diff --git a/Sources/Engine/Models/EditModel.cpp b/Sources/Engine/Models/EditModel.cpp index ff8724da2..8c112a1e1 100644 --- a/Sources/Engine/Models/EditModel.cpp +++ b/Sources/Engine/Models/EditModel.cpp @@ -1523,10 +1523,8 @@ void CEditModel::AddMipModel( CObject3D *pO3D) */ ULONG trans_vtx_idx = pO3D->ob_aoscSectors[0].osc_aovxVertices[ aesv[ mpvct].esv_MipGlobalIndex].ovx_Tag; - pmp->mp_PolygonVertices[ j].mpv_ptvTransformedVertex = - &edm_md.md_TransformedVertices[ (INDEX) trans_vtx_idx ]; // remapped ptr to transformed vertex - pmp->mp_PolygonVertices[ j].mpv_ptvTextureVertex = - &pmmpi->mmpi_TextureVertices[ aesv[ mpvct].esv_TextureVertexRemap]; // ptr to unique vertex in surface + pmp->mp_PolygonVertices[j].SetTransVertex(&edm_md, trans_vtx_idx); // remapped ptr to transformed vertex + pmp->mp_PolygonVertices[j].SetTexVertex(pmmpi, aesv[mpvct].esv_TextureVertexRemap); // ptr to unique vertex in surface mpvct ++; } } @@ -1943,14 +1941,14 @@ void CEditModel::DrawWireSurface( CDrawPort *pDP, INDEX iCurrentMip, INDEX iCurr struct ModelPolygon *pPoly = &edm_md.md_MipInfos[iCurrentMip].mmpi_Polygons[iPoly]; if( pPoly->mp_Surface == iCurrentSurface) { // readout poly vertices - f3dTr0(1) = (FLOAT)pPoly->mp_PolygonVertices[0].mpv_ptvTextureVertex->mtv_UV(1); - f3dTr0(2) = (FLOAT)pPoly->mp_PolygonVertices[0].mpv_ptvTextureVertex->mtv_UV(2); + f3dTr0(1) = (FLOAT)pPoly->mp_PolygonVertices[0].GetTexVertex()->mtv_UV(1); + f3dTr0(2) = (FLOAT)pPoly->mp_PolygonVertices[0].GetTexVertex()->mtv_UV(2); f3dTr0(3) = 0.0f; - f3dTr1(1) = (FLOAT)pPoly->mp_PolygonVertices[1].mpv_ptvTextureVertex->mtv_UV(1); - f3dTr1(2) = (FLOAT)pPoly->mp_PolygonVertices[1].mpv_ptvTextureVertex->mtv_UV(2); + f3dTr1(1) = (FLOAT)pPoly->mp_PolygonVertices[1].GetTexVertex()->mtv_UV(1); + f3dTr1(2) = (FLOAT)pPoly->mp_PolygonVertices[1].GetTexVertex()->mtv_UV(2); f3dTr1(3) = 0.0f; - f3dTr2(1) = (FLOAT)pPoly->mp_PolygonVertices[2].mpv_ptvTextureVertex->mtv_UV(1); - f3dTr2(2) = (FLOAT)pPoly->mp_PolygonVertices[2].mpv_ptvTextureVertex->mtv_UV(2); + f3dTr2(1) = (FLOAT)pPoly->mp_PolygonVertices[2].GetTexVertex()->mtv_UV(1); + f3dTr2(2) = (FLOAT)pPoly->mp_PolygonVertices[2].GetTexVertex()->mtv_UV(2); f3dTr2(3) = 0.0f; // determine line visibility @@ -1967,8 +1965,8 @@ void CEditModel::DrawWireSurface( CDrawPort *pDP, INDEX iCurrentMip, INDEX iCurr // draw lines PIX pixX0, pixY0, pixX1, pixY1; for( INDEX iVtx=0; iVtxmp_PolygonVertices.Count()-1; iVtx++) { - pVtx0 = pPoly->mp_PolygonVertices[iVtx+0].mpv_ptvTextureVertex; - pVtx1 = pPoly->mp_PolygonVertices[iVtx+1].mpv_ptvTextureVertex; + pVtx0 = pPoly->mp_PolygonVertices[iVtx + 0].GetTexVertex(); + pVtx1 = pPoly->mp_PolygonVertices[iVtx + 1].GetTexVertex(); pixX0 = (PIX)(pVtx0->mtv_UV(1) * fMagnifyFactor) - offx; pixY0 = (PIX)(pVtx0->mtv_UV(2) * fMagnifyFactor) - offy; pixX1 = (PIX)(pVtx1->mtv_UV(1) * fMagnifyFactor) - offx; @@ -1976,7 +1974,7 @@ void CEditModel::DrawWireSurface( CDrawPort *pDP, INDEX iCurrentMip, INDEX iCurr pDP->DrawLine( pixX0, pixY0, pixX1, pixY1, clrWire|CT_OPAQUE, ulLineType); } // draw last line - pVtx0 = pPoly->mp_PolygonVertices[0].mpv_ptvTextureVertex; + pVtx0 = pPoly->mp_PolygonVertices[0].GetTexVertex(); pixX0 = (PIX)(pVtx0->mtv_UV(1) * fMagnifyFactor) - offx; pixY0 = (PIX)(pVtx0->mtv_UV(2) * fMagnifyFactor) - offy; pDP->DrawLine( pixX0, pixY0, pixX1, pixY1, clrWire|CT_OPAQUE, ulLineType); @@ -2001,14 +1999,14 @@ void CEditModel::DrawFilledSurface( CDrawPort *pDP, INDEX iCurrentMip, INDEX iCu struct ModelPolygon *pPoly = &edm_md.md_MipInfos[iCurrentMip].mmpi_Polygons[iPoly]; if( pPoly->mp_Surface == iCurrentSurface) { // readout poly vertices - f3dTr0(1) = (FLOAT)pPoly->mp_PolygonVertices[0].mpv_ptvTextureVertex->mtv_UV(1); - f3dTr0(2) = (FLOAT)pPoly->mp_PolygonVertices[0].mpv_ptvTextureVertex->mtv_UV(2); + f3dTr0(1) = (FLOAT)pPoly->mp_PolygonVertices[0].GetTexVertex()->mtv_UV(1); + f3dTr0(2) = (FLOAT)pPoly->mp_PolygonVertices[0].GetTexVertex()->mtv_UV(2); f3dTr0(3) = 0.0f; - f3dTr1(1) = (FLOAT)pPoly->mp_PolygonVertices[1].mpv_ptvTextureVertex->mtv_UV(1); - f3dTr1(2) = (FLOAT)pPoly->mp_PolygonVertices[1].mpv_ptvTextureVertex->mtv_UV(2); + f3dTr1(1) = (FLOAT)pPoly->mp_PolygonVertices[1].GetTexVertex()->mtv_UV(1); + f3dTr1(2) = (FLOAT)pPoly->mp_PolygonVertices[1].GetTexVertex()->mtv_UV(2); f3dTr1(3) = 0.0f; - f3dTr2(1) = (FLOAT)pPoly->mp_PolygonVertices[2].mpv_ptvTextureVertex->mtv_UV(1); - f3dTr2(2) = (FLOAT)pPoly->mp_PolygonVertices[2].mpv_ptvTextureVertex->mtv_UV(2); + f3dTr2(1) = (FLOAT)pPoly->mp_PolygonVertices[2].GetTexVertex()->mtv_UV(1); + f3dTr2(2) = (FLOAT)pPoly->mp_PolygonVertices[2].GetTexVertex()->mtv_UV(2); f3dTr2(3) = 0.0f; // determine poly visibility @@ -2019,12 +2017,12 @@ void CEditModel::DrawFilledSurface( CDrawPort *pDP, INDEX iCurrentMip, INDEX iCu // draw traingle(s) fan pDP->InitTexture( NULL); - pVtx0 = pPoly->mp_PolygonVertices[0].mpv_ptvTextureVertex; + pVtx0 = pPoly->mp_PolygonVertices[0].GetTexVertex(); PIX pixX0 = (PIX)(pVtx0->mtv_UV(1) * fMagnifyFactor) - offx; PIX pixY0 = (PIX)(pVtx0->mtv_UV(2) * fMagnifyFactor) - offy; for( INDEX iVtx=1; iVtxmp_PolygonVertices.Count()-1; iVtx++) { - pVtx1 = pPoly->mp_PolygonVertices[iVtx+0].mpv_ptvTextureVertex; - pVtx2 = pPoly->mp_PolygonVertices[iVtx+1].mpv_ptvTextureVertex; + pVtx1 = pPoly->mp_PolygonVertices[iVtx + 0].GetTexVertex(); + pVtx2 = pPoly->mp_PolygonVertices[iVtx + 1].GetTexVertex(); PIX pixX1 = (PIX)(pVtx1->mtv_UV(1) * fMagnifyFactor) - offx; PIX pixY1 = (PIX)(pVtx1->mtv_UV(2) * fMagnifyFactor) - offy; PIX pixX2 = (PIX)(pVtx2->mtv_UV(1) * fMagnifyFactor) - offx; @@ -2324,7 +2322,7 @@ void CEditModel::CalculatePatchesPerPolygon(void) MEXaabbox2D boxMapping; for( INDEX iVertex=0; iVertexmp_PolygonVertices.Count(); iVertex++) { - ModelTextureVertex *pMTV = pMP->mp_PolygonVertices[iVertex].mpv_ptvTextureVertex; + ModelTextureVertex *pMTV = pMP->mp_PolygonVertices[iVertex].GetTexVertex(); // calculate bounding box of mapping coordinates boxMapping |= MEXaabbox2D(pMTV->mtv_UV); } diff --git a/Sources/Engine/Models/Model.cpp b/Sources/Engine/Models/Model.cpp index 7a57dbac8..2fbbb5cd9 100644 --- a/Sources/Engine/Models/Model.cpp +++ b/Sources/Engine/Models/Model.cpp @@ -473,19 +473,30 @@ ModelTextureVertex::ModelTextureVertex(void) //------------------------------------------ WRITE void ModelPolygonVertex::Write_t( CTStream *pFile) // throw char * { - (*pFile) << (INDEX) mpv_ptvTransformedVertex; - (*pFile) << (INDEX) mpv_ptvTextureVertex; + // [Cecil] Write indices instead of pointers + *pFile << mpv_iTransformedVertex; + *pFile << mpv_iTextureVertex; } //------------------------------------------ READ void ModelPolygonVertex::Read_t( CTStream *pFile) // throw char * { - INDEX itmp; - - (*pFile) >> itmp; - mpv_ptvTransformedVertex = (struct TransformedVertexData *) itmp; - (*pFile) >> itmp; - mpv_ptvTextureVertex = (ModelTextureVertex *) itmp; + // [Cecil] Read into indices instead of pointers + *pFile >> mpv_iTransformedVertex; + *pFile >> mpv_iTextureVertex; } + +// [Cecil] Set transformed vertex data from a model data array +void ModelPolygonVertex::SetTransVertex(CModelData *md, INDEX iVtx) { + mpv_ptvTransformedVertex = &md->md_TransformedVertices[iVtx]; + mpv_iTransformedVertex = iVtx; +}; + +// [Cecil] Set model texture vertex from a model data array +void ModelPolygonVertex::SetTexVertex(ModelMipInfo *mmpi, INDEX iVtx) { + mpv_ptvTextureVertex = &mmpi->mmpi_TextureVertices[iVtx]; + mpv_iTextureVertex = iVtx; +}; + //-------------------------------------------------------------------------------------------- //------------------------------------------ WRITE void ModelPolygon::Write_t( CTStream *pFile) // throw char * @@ -750,8 +761,8 @@ void CModelData::LinkDataForSurfaces(BOOL bFirstMip) for( INDEX iVertex = 0; iVertexmmpi_Polygons[iPolygon].mp_PolygonVertices.Count(); iVertex++) { ModelPolygonVertex *pmpvPolygonVertex = &pMMI->mmpi_Polygons[iPolygon].mp_PolygonVertices[iVertex]; - INDEX iTransformed = md_TransformedVertices.Index( pmpvPolygonVertex->mpv_ptvTransformedVertex); - pmpvPolygonVertex->mpv_ptvTextureVertex->mtv_iTransformedVertex = iTransformed; + INDEX iTransformed = md_TransformedVertices.Index(pmpvPolygonVertex->GetTransVertex()); + pmpvPolygonVertex->GetTexVertex()->mtv_iTransformedVertex = iTransformed; } }} @@ -813,8 +824,7 @@ void CModelData::LinkDataForSurfaces(BOOL bFirstMip) for( INDEX iVertex=0; iVertexGetHeight(); // project vertices for given mip model ProjectFrameVertices( pProjection, mo_iLastRenderMipLevel); @@ -2261,7 +2271,7 @@ void CModelObject::ColorizeRegion( CDrawPort *pDP, CProjection3D *pProjection, P pPoly = &pMD->md_MipInfos[ mo_iLastRenderMipLevel].mmpi_Polygons[ j]; for( INDEX i=0; imp_PolygonVertices.Count(); i++) { - pTransformedVertice = pPoly->mp_PolygonVertices[ i].mpv_ptvTransformedVertex; + pTransformedVertice = pPoly->mp_PolygonVertices[i].GetTransVertex(); PIXaabbox2D ptBox = PIXaabbox2D( PIX2D( (SWORD) pTransformedVertice->tvd_TransformedPoint(1), pixDPHeight - (SWORD) pTransformedVertice->tvd_TransformedPoint(2))); if( !((box & ptBox).IsEmpty()) ) @@ -2293,7 +2303,7 @@ void CModelObject::ApplySurfaceToPolygonsInRegion( CDrawPort *pDP, CProjection3D ProjectFrameVertices( pProjection, mo_iLastRenderMipLevel); struct ModelPolygon *pPoly; - struct TransformedVertexData *pTransformedVertice; + const TransformedVertexData *pTransformedVertice; CModelData *pMD = (CModelData *) GetData(); PIX pixDPHeight = pDP->GetHeight(); @@ -2302,7 +2312,7 @@ void CModelObject::ApplySurfaceToPolygonsInRegion( CDrawPort *pDP, CProjection3D pPoly = &pMD->md_MipInfos[ mo_iLastRenderMipLevel].mmpi_Polygons[ j]; for( INDEX i=0; imp_PolygonVertices.Count(); i++) { - pTransformedVertice = pPoly->mp_PolygonVertices[ i].mpv_ptvTransformedVertex; + pTransformedVertice = pPoly->mp_PolygonVertices[i].GetTransVertex(); PIXaabbox2D ptBox = PIXaabbox2D( PIX2D( (SWORD) pTransformedVertice->tvd_TransformedPoint(1), pixDPHeight - (SWORD) pTransformedVertice->tvd_TransformedPoint(2))); if( !((box & ptBox).IsEmpty()) ) @@ -2436,16 +2446,16 @@ struct ModelPolygon *CModelObject::PolygonHitModelData(CModelData *pMD, // get next vertex index (first is i) INDEX next = (i+1) % pPoly->mp_PolygonVertices.Count(); // add edge to intersection object - Intersector.AddEdge( pPoly->mp_PolygonVertices[ i].mpv_ptvTransformedVertex->tvd_TransformedPoint(1), - pPoly->mp_PolygonVertices[ i].mpv_ptvTransformedVertex->tvd_TransformedPoint(2), - pPoly->mp_PolygonVertices[ next].mpv_ptvTransformedVertex->tvd_TransformedPoint(1), - pPoly->mp_PolygonVertices[ next].mpv_ptvTransformedVertex->tvd_TransformedPoint(2)); + Intersector.AddEdge(pPoly->mp_PolygonVertices[i].GetTransVertex()->tvd_TransformedPoint(1), + pPoly->mp_PolygonVertices[i].GetTransVertex()->tvd_TransformedPoint(2), + pPoly->mp_PolygonVertices[next].GetTransVertex()->tvd_TransformedPoint(1), + pPoly->mp_PolygonVertices[next].GetTransVertex()->tvd_TransformedPoint(2)); } if( Intersector.IsIntersecting()) { - FLOAT3D f3dTr0 = pPoly->mp_PolygonVertices[ 0].mpv_ptvTransformedVertex->tvd_TransformedPoint; - FLOAT3D f3dTr1 = pPoly->mp_PolygonVertices[ 1].mpv_ptvTransformedVertex->tvd_TransformedPoint; - FLOAT3D f3dTr2 = pPoly->mp_PolygonVertices[ 2].mpv_ptvTransformedVertex->tvd_TransformedPoint; + FLOAT3D f3dTr0 = pPoly->mp_PolygonVertices[0].GetTransVertex()->tvd_TransformedPoint; + FLOAT3D f3dTr1 = pPoly->mp_PolygonVertices[1].GetTransVertex()->tvd_TransformedPoint; + FLOAT3D f3dTr2 = pPoly->mp_PolygonVertices[2].GetTransVertex()->tvd_TransformedPoint; FLOATplane3D fplPlane = FLOATplane3D( f3dTr0, f3dTr1, f3dTr2); FLOAT3D f3dHitted3DPoint = FLOAT3D(0,0,0); diff --git a/Sources/Engine/Models/Model_internal.h b/Sources/Engine/Models/Model_internal.h index 0521b652b..9c04be1ed 100644 --- a/Sources/Engine/Models/Model_internal.h +++ b/Sources/Engine/Models/Model_internal.h @@ -145,12 +145,52 @@ struct ENGINE_API ModelTextureVertex { FLOAT3D mtv_vU, mtv_vV; // bump directions }; +struct ENGINE_API TransformedVertexData { + FLOAT3D tvd_TransformedPoint; // for transformed point vector + PolyVertex2D tvd_pv2; // vertex structure for software + FLOAT tvd_fX, tvd_fY, tvd_fZ; // view space original coords + FLOAT tvd_fU, tvd_fV; // texture mapping temp vars for clipping purposes + BOOL tvd_bClipped; // is clipped to near clip plane or screen boundaries? +}; + struct ENGINE_API ModelPolygonVertex { - struct TransformedVertexData *mpv_ptvTransformedVertex; // buffer where vertices really rotate - struct ModelTextureVertex *mpv_ptvTextureVertex; // needed by modeler to calculate U,V - void Read_t( CTStream *istrFile); // throw char * - void Write_t( CTStream *ostrFile); // throw char * + private: + TransformedVertexData *mpv_ptvTransformedVertex; // buffer where vertices really rotate + INDEX mpv_iTransformedVertex; // [Cecil] Index of the vertex in model data + + ModelTextureVertex *mpv_ptvTextureVertex; // needed by modeler to calculate U,V + INDEX mpv_iTextureVertex; // [Cecil] Index of the texture vertex in model data + + public: + void Read_t( CTStream *istrFile); // throw char * + void Write_t( CTStream *ostrFile); // throw char * + + // [Cecil] Get transformed vertex data + inline TransformedVertexData *GetTransVertex(void) const { + return mpv_ptvTransformedVertex; + }; + + // [Cecil] Get index of transformed vertex data + inline INDEX GetTransIndex(void) const { + return mpv_iTransformedVertex; + }; + + // [Cecil] Set transformed vertex data from model data + void SetTransVertex(class CModelData *md, INDEX iVtx); + + // [Cecil] Get model texture vertex + inline ModelTextureVertex *GetTexVertex(void) const { + return mpv_ptvTextureVertex; + }; + + // [Cecil] Get index of model texture vertex + inline INDEX GetTexIndex(void) const { + return mpv_iTextureVertex; + }; + + // [Cecil] Set model texture vertex from a model mip + void SetTexVertex(struct ModelMipInfo *mmpi, INDEX iVtx); }; #define SC_ALLWAYS_ON (1UL << 30) @@ -160,7 +200,7 @@ struct ENGINE_API ModelPolygon { ModelPolygon(); // constructor ~ModelPolygon(); // destructor - CStaticArray mp_PolygonVertices; // this polygon's vertices + CStaticArray mp_PolygonVertices; // this polygon's vertices ULONG mp_RenderFlags; // flags which define rendering of this polygon ULONG mp_ColorAndAlpha; // color and global alpha for this polygon INDEX mp_Surface; // in which surface this polygon belongs @@ -221,15 +261,6 @@ struct ENGINE_API PolygonsPerPatch inline void Clear() { ppp_iPolygons.Clear();}; }; -/* rcg 10042001 removed anonymous structs, dangerous union. */ -struct ENGINE_API TransformedVertexData { - FLOAT3D tvd_TransformedPoint; // for transformed point vector - PolyVertex2D tvd_pv2; // vertex structure for software - FLOAT tvd_fX, tvd_fY, tvd_fZ; // view space original coords - FLOAT tvd_fU, tvd_fV; // texture mapping temp vars for clipping purposes - BOOL tvd_bClipped; // is clipped to near clip plane or screen boundaries? -}; - class ENGINE_API CModelCollisionBox { public: FLOAT3D mcb_vCollisionBoxMin; // min vector of collision box diff --git a/Sources/Engine/Models/RenderModel_Mask.cpp b/Sources/Engine/Models/RenderModel_Mask.cpp index 0dd7d24d0..9c3b34303 100644 --- a/Sources/Engine/Models/RenderModel_Mask.cpp +++ b/Sources/Engine/Models/RenderModel_Mask.cpp @@ -103,8 +103,8 @@ static void RenderOneSide( CRenderModel &rm, const INDEX iVisibility) INDEX ivx1=0; {for( INDEX ivx=0; ivxtvd_pv2; + PolyVertex2D &pvx0 = mpPolygon.mp_PolygonVertices[0].GetTransVertex()->tvd_pv2; {for( INDEX ivx=1; ivxtvd_pv2; - PolyVertex2D &pvx2 = mpPolygon.mp_PolygonVertices[ivx+1].mpv_ptvTransformedVertex->tvd_pv2; + PolyVertex2D &pvx1 = mpPolygon.mp_PolygonVertices[ivx + 0].GetTransVertex()->tvd_pv2; + PolyVertex2D &pvx2 = mpPolygon.mp_PolygonVertices[ivx + 1].GetTransVertex()->tvd_pv2; DrawTriangle_Mask( _pubMask, _slMaskWidth, _slMaskHeight, &pvx0, &pvx1, &pvx2, bTransparency); }} _pfModelProfile.IncrementCounter(CModelProfile::PCI_MASK_TRIANGLES, mpPolygon.mp_PolygonVertices.Count()-2); @@ -472,9 +472,9 @@ void CModelObject::RenderModel_Mask( CRenderModel &rm) ModelPolygon &mp = *itmp; ulRenderFlags = mmiMip.mmpi_MappingSurfaces[mp.mp_Surface].ms_ulRenderingFlags; // get first three of polygon's transformed vertices - const TransformedVertexData &tvd0 = *mp.mp_PolygonVertices[0].mpv_ptvTransformedVertex; - const TransformedVertexData &tvd1 = *mp.mp_PolygonVertices[1].mpv_ptvTransformedVertex; - const TransformedVertexData &tvd2 = *mp.mp_PolygonVertices[2].mpv_ptvTransformedVertex; + const TransformedVertexData &tvd0 = *mp.mp_PolygonVertices[0].GetTransVertex(); + const TransformedVertexData &tvd1 = *mp.mp_PolygonVertices[1].GetTransVertex(); + const TransformedVertexData &tvd2 = *mp.mp_PolygonVertices[2].GetTransVertex(); // calculate polygon normal with front plane clipping FLOAT fD1X = tvd2.tvd_fX - tvd1.tvd_fX; @@ -519,7 +519,7 @@ void CModelObject::RenderModel_Mask( CRenderModel &rm) if( mp.mp_slVisibility != VISIBLE_NOT) { // for all vertices {for( INDEX ivx=0; ivxmtv_iSurfaceVx; - tri.i1 = mp.mp_PolygonVertices[ivx-1].mpv_ptvTextureVertex->mtv_iSurfaceVx; - tri.i2 = mp.mp_PolygonVertices[ivx-0].mpv_ptvTextureVertex->mtv_iSurfaceVx; + tri.i0 = mp.mp_PolygonVertices[ 0].GetTexVertex()->mtv_iSurfaceVx; + tri.i1 = mp.mp_PolygonVertices[ivx - 1].GetTexVertex()->mtv_iSurfaceVx; + tri.i2 = mp.mp_PolygonVertices[ivx - 0].GetTexVertex()->mtv_iSurfaceVx; }} }} @@ -561,9 +561,9 @@ static void PrepareModelMipForRendering( CModelData &md, INDEX iMip) for( iipo=0; iipomtv_iSurfaceVx; - ppp.ppp_auwElements[iel++] = mp.mp_PolygonVertices[ivx-1].mpv_ptvTextureVertex->mtv_iSurfaceVx; - ppp.ppp_auwElements[iel++] = mp.mp_PolygonVertices[ivx-0].mpv_ptvTextureVertex->mtv_iSurfaceVx; + ppp.ppp_auwElements[iel++] = mp.mp_PolygonVertices[ 0].GetTexVertex()->mtv_iSurfaceVx; + ppp.ppp_auwElements[iel++] = mp.mp_PolygonVertices[ivx - 1].GetTexVertex()->mtv_iSurfaceVx; + ppp.ppp_auwElements[iel++] = mp.mp_PolygonVertices[ivx - 0].GetTexVertex()->mtv_iSurfaceVx; } } }