port from perforce
This commit is contained in:
170
aiwaz/Aiwaz/Interfaces/IGeometryBuffer.h
Normal file
170
aiwaz/Aiwaz/Interfaces/IGeometryBuffer.h
Normal file
@@ -0,0 +1,170 @@
|
||||
#pragma once
|
||||
#include "Resource.h"
|
||||
|
||||
struct PrimitiveTopology
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
Undefined = 0,
|
||||
PointList = 1,
|
||||
LineList = 2,
|
||||
LineStrip = 3,
|
||||
TriangleList = 4,
|
||||
TriangleStrip = 5,
|
||||
|
||||
LineListAdjacency = 10,
|
||||
LineStripAdjacency = 11,
|
||||
TriangleListAdjacency = 12,
|
||||
TriangleStripAdjacency = 13
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct VertexElement
|
||||
{
|
||||
enum Enumeration
|
||||
{
|
||||
Position,
|
||||
PositionT,
|
||||
Normal,
|
||||
Binormal,
|
||||
Tangent,
|
||||
Color,
|
||||
BlendWeight,
|
||||
BlendIndices,
|
||||
Texture2D,
|
||||
Texture3D,
|
||||
Texture4D,
|
||||
PointSize
|
||||
};
|
||||
|
||||
VertexElement(Enumeration argElement, uint32 argNameIndex = 0)
|
||||
: m_NameIndex(argNameIndex)
|
||||
, m_WellKnownFormat(argElement)
|
||||
{
|
||||
switch (argElement)
|
||||
{
|
||||
case PositionT:
|
||||
{
|
||||
m_SemanticName = "POSITIONT";
|
||||
m_ElementFormat = DataFormat::R32G32B32A32_Float;
|
||||
m_Size = 4 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Normal:
|
||||
{
|
||||
m_SemanticName = "NORMAL";
|
||||
m_ElementFormat = DataFormat::R32G32B32_Float;
|
||||
m_Size = 3 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Binormal:
|
||||
{
|
||||
m_SemanticName = "BINORMAL";
|
||||
m_ElementFormat = DataFormat::R32G32B32_Float;
|
||||
m_Size = 3 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Tangent:
|
||||
{
|
||||
m_SemanticName = "TANGENT";
|
||||
m_ElementFormat = DataFormat::R32G32B32_Float;
|
||||
m_Size = 3 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Color:
|
||||
{
|
||||
m_SemanticName = "COLOR";
|
||||
m_ElementFormat = DataFormat::R8G8B8A8_UnsignedNormalized;
|
||||
m_Size = 4 * sizeof(unsigned char);
|
||||
break;
|
||||
}
|
||||
case BlendWeight:
|
||||
{
|
||||
m_SemanticName = "BLENDWEIGHT";
|
||||
m_ElementFormat = DataFormat::R32G32B32A32_Float;
|
||||
m_Size = 4 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case BlendIndices:
|
||||
{
|
||||
m_SemanticName = "BLENDINDICES";
|
||||
m_ElementFormat = DataFormat::R32G32B32A32_SignedInteger;
|
||||
m_Size = 4 * sizeof(int);
|
||||
break;
|
||||
}
|
||||
case Texture2D:
|
||||
{
|
||||
m_SemanticName = "TEXCOORD";
|
||||
m_ElementFormat = DataFormat::R32G32_Float;
|
||||
m_Size = 2 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Texture3D:
|
||||
{
|
||||
m_SemanticName = "TEXCOORD";
|
||||
m_ElementFormat = DataFormat::R32G32B32_Float;
|
||||
m_Size = 3 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Texture4D:
|
||||
{
|
||||
m_SemanticName = "TEXCOORD";
|
||||
m_ElementFormat = DataFormat::R32G32B32A32_Float;
|
||||
m_Size = 4 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case PointSize:
|
||||
{
|
||||
m_SemanticName = "PSIZE";
|
||||
m_ElementFormat = DataFormat::R32_Float;
|
||||
m_Size = 1 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
case Position:
|
||||
default:
|
||||
{
|
||||
m_SemanticName = "POSITION";
|
||||
m_ElementFormat = DataFormat::R32G32B32_Float;
|
||||
m_Size = 3 * sizeof(float);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string8 m_SemanticName;
|
||||
DataFormat::Enumeration m_ElementFormat;
|
||||
Enumeration m_WellKnownFormat;
|
||||
uint32 m_NameIndex;
|
||||
uint32 m_Size;
|
||||
};
|
||||
|
||||
|
||||
struct __declspec(novtable) IGeometryBuffer
|
||||
{
|
||||
virtual ~IGeometryBuffer() {}
|
||||
virtual void SetVertexData(uint32 argVertexCount, uint32 argVertexElementSize, void* a_VertexData_, const std::vector<VertexElement>& argVertexElements, bool argNeedsDynamicAccess) = 0;
|
||||
virtual void DeleteVertexData() = 0;
|
||||
virtual void SetIndexData(uint32 argIndexCount, uint32* aui_IndexData_, bool argNeedsDynamicAccess) = 0;
|
||||
virtual void DeleteIndexData() = 0;
|
||||
|
||||
virtual void* MapVertexBuffer(DataAccessMode::Enumeration argAccessMode) = 0;
|
||||
virtual void UnmapVertexBuffer() = 0;
|
||||
|
||||
virtual uint32* MapIndexBuffer(DataAccessMode::Enumeration argAccessMode) = 0;
|
||||
virtual void UnmapIndexBuffer() = 0;
|
||||
|
||||
virtual uint32 get_IndexBufferOffset() const = 0;
|
||||
virtual void set_IndexBufferOffset(uint32 argValue) = 0;
|
||||
virtual uint32 get_IndexBufferUsableLength() const = 0;
|
||||
virtual void set_IndexBufferUsableLength(uint32 argValue) = 0;
|
||||
|
||||
virtual uint32 get_IndexBufferLength() const = 0;
|
||||
virtual uint32 get_VertexBufferLength() const = 0;
|
||||
|
||||
//virtual ICollisionHull get_CollisionHull() const = 0;
|
||||
virtual PrimitiveTopology::Enumeration get_PrimitiveTopology() const = 0;
|
||||
virtual void set_PrimitiveTopology(PrimitiveTopology::Enumeration argValue) = 0;
|
||||
|
||||
virtual void ConvertToAdjacency() = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user