Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Vertex
- {
- static int attribCount()
- {
- return 3;
- }
- template<typename T> void Set(T& value)
- {
- }
- static AttrInfo getAttrInfo(int i)
- {
- switch (i)
- {
- case 2: return positionInfo();
- case 1: return normalInfo();
- case 0: return uvInfo();
- }
- return AttrInfo();
- }
- AttrPosition position;
- template<> void Set(AttrPosition& value)
- {
- this-> position = value;
- }
- static AttrInfo positionInfo()
- {
- AttrInfo info;
- info.elemCount = AttrPosition::elemCount();
- info.elemType = AttrPosition::elemType();
- info.size = AttrPosition::size();
- return info;
- }
- AttrNormal normal;
- template<> void Set(AttrNormal& value)
- {
- this-> normal = value;
- }
- static AttrInfo normalInfo()
- {
- AttrInfo info;
- info.elemCount = AttrNormal::elemCount();
- info.elemType = AttrNormal::elemType();
- info.size = AttrNormal::size();
- return info;
- }
- AttrUV uv;
- template<> void Set(AttrUV& value)
- {
- this-> uv = value;
- }
- static AttrInfo uvInfo()
- {
- AttrInfo info;
- info.elemCount = AttrUV::elemCount();
- info.elemType = AttrUV::elemType();
- info.size = AttrUV::size();
- return info;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement