Added offset enum.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 0dcb470a19
commit 7384cdd10a

@ -27,6 +27,27 @@ namespace
else else
return false; return false;
} }
enum AttribOffset
{
Position,
Weight,
Normal,
PrimaryColor,
SecondaryColor,
Fog,
PaletteSkin,
Empty,
TexCoord0,
TexCoord1,
TexCoord2,
TexCoord3,
TexCoord4,
TexCoord5,
TexCoord6,
TexCoord7,
NumOffsets
};
} }
namespace NL3D namespace NL3D
@ -96,7 +117,7 @@ namespace NL3D
ss << "uniform mat4 mvpMatrix;" << std::endl; ss << "uniform mat4 mvpMatrix;" << std::endl;
ss << std::endl; ss << std::endl;
for( int i = 0; i < CVertexBuffer::NumValue; i++ ) for( int i = Position; i < NumOffsets; i++ )
{ {
if( hasFlag( vbFormat, vertexFlags[ i ] ) ) if( hasFlag( vbFormat, vertexFlags[ i ] ) )
{ {
@ -111,7 +132,7 @@ namespace NL3D
} }
ss << std::endl; ss << std::endl;
for( int i = 1; i < CVertexBuffer::NumValue; i++ ) for( int i = Weight; i < NumOffsets; i++ )
{ {
if( hasFlag( vbFormat, vertexFlags[ i ] ) ) if( hasFlag( vbFormat, vertexFlags[ i ] ) )
{ {
@ -125,7 +146,7 @@ namespace NL3D
ss << "{" << std::endl; ss << "{" << std::endl;
ss << "gl_Position = mvpMatrix * " << "v" << attribNames[ 0 ] << ";" << std::endl; ss << "gl_Position = mvpMatrix * " << "v" << attribNames[ 0 ] << ";" << std::endl;
for( int i = 1; i < CVertexBuffer::NumValue; i++ ) for( int i = Weight; i < NumOffsets; i++ )
{ {
if( hasFlag( vbFormat, vertexFlags[ i ] ) ) if( hasFlag( vbFormat, vertexFlags[ i ] ) )
{ {
@ -149,7 +170,7 @@ namespace NL3D
ss << "out vec4 fragColor;" << std::endl; ss << "out vec4 fragColor;" << std::endl;
for( int i = 1; i < CVertexBuffer::NumValue; i++ ) for( int i = Weight; i < NumOffsets; i++ )
{ {
if( hasFlag( vbFormat, vertexFlags[ i ] ) ) if( hasFlag( vbFormat, vertexFlags[ i ] ) )
{ {

Loading…
Cancel
Save