Skip to content

Commit

Permalink
Fix "out of memory" error by removing tangent and bi-normal vectors f…
Browse files Browse the repository at this point in the history
…rom vertex
  • Loading branch information
bibendovsky committed Mar 10, 2014
1 parent ce05bc2 commit ec5f0e2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Engine/runtime/render_a/src/sys/d3d/d3d_renderblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ ILTStream &operator>>(ILTStream &stream, SRBVertex &sVert)
stream >> sVert.m_fV1;
stream >> sVert.m_nColor;
stream >> sVert.m_vNormal;

// BBi
#ifdef LTJS_USE_TANGENT_AND_BINORMAL
stream >> sVert.m_vTangent;
stream >> sVert.m_vBinormal;
#endif // LTJS_USE_TANGENT_AND_BINORMAL

return stream;
}

Expand Down Expand Up @@ -543,7 +548,7 @@ bool CD3D_RenderBlock::Load(ILTStream *pStream)
}

// Get the vertex data
*pStream >> (uint32)m_nVertexCount;
*pStream >> m_nVertexCount;
if (m_nVertexCount)
{
LT_MEM_TRACK_ALLOC(m_aVertices = new SRBVertex[m_nVertexCount],LT_MEM_TYPE_RENDER_WORLD);
Expand All @@ -562,7 +567,7 @@ bool CD3D_RenderBlock::Load(ILTStream *pStream)
}

// Get the triangle count
*pStream >> (uint32)m_nTriCount;
*pStream >> m_nTriCount;
if (m_nTriCount)
{
LT_MEM_TRACK_ALLOC(m_aIndices = new uint16[m_nTriCount * 3],LT_MEM_TYPE_RENDER_WORLD);
Expand Down
4 changes: 4 additions & 0 deletions Engine/runtime/render_a/src/sys/d3d/d3d_renderblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ struct SRBVertex
float m_fU1, m_fV1;
uint32 m_nColor;
LTVector m_vNormal;

// BBi
#ifdef LTJS_USE_TANGENT_AND_BINORMAL
LTVector m_vTangent;
LTVector m_vBinormal;
#endif // LTJS_USE_TANGENT_AND_BINORMAL
};

// Geometry-only n-gon w/ a pre-stored plane and bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2954,8 +2954,13 @@ void CRenderShader_Gouraud_Effect::TranslateVertices(SVertex_Gouraud_Effect *pOu
pCurOut->m_vPos = pCurIn->m_vPos;
pCurOut->m_nColor = pCurIn->m_nColor;
pCurOut->m_vNormal = pCurIn->m_vNormal;

// BBi
#ifdef LTJS_USE_TANGENT_AND_BINORMAL
pCurOut->m_vTangent = pCurIn->m_vTangent;
pCurOut->m_vBinormal = pCurIn->m_vBinormal;
#endif // LTJS_USE_TANGENT_AND_BINORMAL

pCurOut->m_fU = pCurIn->m_fU0;
pCurOut->m_fV = pCurIn->m_fV0;
pCurOut->m_fW = 1.0f;
Expand Down

0 comments on commit ec5f0e2

Please sign in to comment.