All pastes #790368 Raw Edit

Something

public text v1 · immutable
·published 2007-11-20 09:54 UTC
rendered paste body
as per-
http://msdn.microsoft.com/archive/en-us/dx8_c/directx_cpp/images/fvfmem.gif


struct SVertexFormatOffsets
{
    u32 Size;

    bool HasTcoord0;
    u32 TCOORD0Offset;
    bool HasTcoord1;
    u32 TCOORD1Offset;
    bool HasTcoord2;
    u32 TCOORD2Offset;
    bool HasTcoord3;
    u32 TCOORD3Offset;
    bool HasTcoord4;
    u32 TCOORD4Offset;

    bool HasPosition;
    u32 PositionOffset;
    bool HasNormal;
    u32 NormalOffset;
    bool HasSpecular;
    u32 ColorOffset;

 // etc

}

class CVertexList, public IVertexList
{
    vector3df& getNormal(u32 idx) { return *((vector3df*)((format.size*idx) + offsets.Normal)); }
}


// BlindSides idea:

enum E_VERTEX_PARAM_TYPE
{
TCOORDS1,
TCOORDS2,
TCOORDS3,
TCOORDS4,
NORMAL,
POSITION,
COLOR,

EVRT_COUNT
};

struct VertexParam
{
  E_VERTEX_PARAM_TYPE type;
  u32 offset;
};

struct VertexType
{
  array<VertexParam> params;
};

struct DerivedVertexType : public VertexType
{
DerivedVertexType()
{
   VertexParam tcoords1 = {TCOORDS1,12};
   params.push_back(tcoords1);
}
};