1 #ifndef __OGRE_VERTEX_ELEMENT_H__ 2 #define __OGRE_VERTEX_ELEMENT_H__ 3 4 #include "DAE2OgrePrerequisites.h" 5 6 namespace Ogre 7 { 8 // Integer formats of fixed bit width 9 typedef unsigned int uint32; 10 typedef unsigned short uint16; 11 typedef unsigned char uint8; 12 typedef uint32 RGBA; 13 typedef uint32 ARGB; 14 typedef uint32 ABGR; 15 typedef uint32 BGRA; 16 17 /// Vertex element semantics, used to identify the meaning of vertex buffer contents 18 enum VertexElementSemantic { 19 /// Position, 3 reals per vertex 20 VES_POSITION = 1, 21 /// Blending weights 22 VES_BLEND_WEIGHTS = 2, 23 /// Blending indices 24 VES_BLEND_INDICES = 3, 25 /// Normal, 3 reals per vertex 26 VES_NORMAL = 4, 27 /// Diffuse colours 28 VES_DIFFUSE = 5, 29 /// Specular colours 30 VES_SPECULAR = 6, 31 /// Texture coordinates 32 VES_TEXTURE_COORDINATES = 7, 33 /// Binormal (Y axis if normal is Z) 34 VES_BINORMAL = 8, 35 /// Tangent (X axis if normal is Z) 36 VES_TANGENT = 9 37 38 }; 39 40 /// Vertex element type, used to identify the base types of the vertex contents 41 enum VertexElementType 42 { 43 VET_FLOAT1 = 0, 44 VET_FLOAT2 = 1, 45 VET_FLOAT3 = 2, 46 VET_FLOAT4 = 3, 47 /// alias to more specific colour type - use the current rendersystem's colour packing 48 VET_COLOUR = 4, 49 VET_SHORT1 = 5, 50 VET_SHORT2 = 6, 51 VET_SHORT3 = 7, 52 VET_SHORT4 = 8, 53 VET_UBYTE4 = 9, 54 /// D3D style compact colour 55 VET_COLOUR_ARGB = 10, 56 /// GL style compact colour 57 VET_COLOUR_ABGR = 11 58 }; 59 60 class VertexElement 61 { 62 63 public: 64 /// The source vertex buffer, as bound to an index using VertexBufferBinding 65 unsigned short mSource; 66 /// The offset in the buffer that this element starts at 67 size_t mOffset; 68 /// The type of element 69 VertexElementType mType; 70 /// The meaning of the element 71 VertexElementSemantic mSemantic; 72 /// Index of the item, only applicable for some elements like texture coords 73 unsigned short mIndex; 74 75 VertexElement(); 76 VertexElement( unsigned short source, size_t offset, VertexElementType type, VertexElementSemantic semantic, unsigned short index ); 77 virtual ~VertexElement(); 78 79 /// Utility method for helping to calculate offsets 80 static size_t getTypeSize( VertexElementType etype ); 81 }; 82 83 enum IndexType { 84 IT_16BIT, 85 IT_32BIT 86 }; 87 88 /// The rendering operation type to perform 89 enum OperationType { 90 /// A list of points, 1 vertex per point 91 OT_POINT_LIST = 1, 92 /// A list of lines, 2 vertices per line 93 OT_LINE_LIST = 2, 94 /// A strip of connected lines, 1 vertex per line plus 1 start vertex 95 OT_LINE_STRIP = 3, 96 /// A list of triangles, 3 vertices per triangle 97 OT_TRIANGLE_LIST = 4, 98 /// A strip of triangles, 3 vertices for the first triangle, and 1 per triangle after that 99 OT_TRIANGLE_STRIP = 5, 100 /// A fan of triangles, 3 vertices for the first triangle, and 1 per triangle after that 101 OT_TRIANGLE_FAN = 6 102 }; 103 104 } 105 106 #endif //__OGRE_VERTEX_ELEMENT_H__ 107