Skip to content

Commit

Permalink
GRAPHICS: Fix NWN2 model textures
Browse files Browse the repository at this point in the history
Regression introduced in ca05ff3.
  • Loading branch information
DrMcCoy committed Jan 25, 2013
1 parent 4c01e34 commit ecdb308
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/graphics/aurora/model_nwn2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,13 @@ bool ModelNode_NWN2::loadRigid(Model_NWN2::ParserContext &ctx) {
std::vector<Common::UString> textures;
textures.push_back(diffuseMap);

loadTextures(textures);

// Read vertices (interleaved)

GLsizei vpsize = 3;
GLsizei vnsize = 3;
GLsizei vtsize = 2;
GLsizei vtsize = 3;
uint32 vertexSize = (vpsize + vnsize + vtsize) * sizeof(float);
_vertexBuffer.setSize(vertexCount, vertexSize);

Expand Down Expand Up @@ -236,7 +237,7 @@ bool ModelNode_NWN2::loadRigid(Model_NWN2::ParserContext &ctx) {
vt.size = vtsize;
vt.type = GL_FLOAT;
vt.stride = vertexSize;
vt.pointer = vertexData + vpsize + vnsize + vtsize;
vt.pointer = vertexData + vpsize + vnsize;
vertexDecl.push_back(vt);

_vertexBuffer.setVertexDecl(vertexDecl);
Expand All @@ -259,8 +260,7 @@ bool ModelNode_NWN2::loadRigid(Model_NWN2::ParserContext &ctx) {
// Texture Coords
*v++ = ctx.mdb->readIEEEFloatLE();
*v++ = ctx.mdb->readIEEEFloatLE();
//*v++ = ctx.mdb->readIEEEFloatLE();
ctx.mdb->skip(4); // Third tcoord component
*v++ = ctx.mdb->readIEEEFloatLE();
}


Expand Down Expand Up @@ -320,12 +320,13 @@ bool ModelNode_NWN2::loadSkin(Model_NWN2::ParserContext &ctx) {
std::vector<Common::UString> textures;
textures.push_back(diffuseMap);

loadTextures(textures);

// Read vertices (interleaved)

GLsizei vpsize = 3;
GLsizei vnsize = 3;
GLsizei vtsize = 2;
GLsizei vtsize = 3;
uint32 vertexSize = (vpsize + vnsize + vtsize) * sizeof(float);
_vertexBuffer.setSize(vertexCount, vertexSize);

Expand Down Expand Up @@ -353,7 +354,7 @@ bool ModelNode_NWN2::loadSkin(Model_NWN2::ParserContext &ctx) {
vt.size = vtsize;
vt.type = GL_FLOAT;
vt.stride = vertexSize;
vt.pointer = vertexData + vpsize + vnsize + vtsize;
vt.pointer = vertexData + vpsize + vnsize;
vertexDecl.push_back(vt);

float *v = vertexData;
Expand All @@ -376,8 +377,7 @@ bool ModelNode_NWN2::loadSkin(Model_NWN2::ParserContext &ctx) {
// TexCoords
*v++ = ctx.mdb->readIEEEFloatLE();
*v++ = ctx.mdb->readIEEEFloatLE();
//*v++ = ctx.mdb->readIEEEFloatLE();
ctx.mdb->skip(4); // Third tcoord component
*v++ = ctx.mdb->readIEEEFloatLE();

ctx.mdb->skip(4); // Bone count
}
Expand Down

0 comments on commit ecdb308

Please sign in to comment.