diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index 8cb8ae39f..5a6ceb4df 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -1205,11 +1205,15 @@ void ConvexShape::_updateMaterial() //update our custom surface materials for (U32 i = 0; igetMaterialDefinitionName() == mSurfaceTextures[i].materialInst->getMaterial()->getName()) + mSurfaceTextures[i].getMaterialAsset()->getMaterialDefinitionName() == mSurfaceTextures[i].materialInst->getMaterial()->getName() && + mSurfaceTextures[i].materialInst->getVertexFormat() == getGFXVertexFormat()) continue; + SAFE_DELETE(mSurfaceTextures[i].materialInst); + Material* material = mSurfaceTextures[i].getMaterialResource(); if (material == nullptr) @@ -1227,8 +1231,10 @@ void ConvexShape::_updateMaterial() } } + _setMaterial(getMaterial()); // If the material name matches then don't bother updating it. - if (mMaterialInst && getMaterialAsset()->getMaterialDefinitionName() == mMaterialInst->getMaterial()->getName()) + if (mMaterialInst && getMaterialAsset()->getMaterialDefinitionName() == mMaterialInst->getMaterial()->getName() && + mMaterialInst->getVertexFormat() == getGFXVertexFormat()) return; SAFE_DELETE( mMaterialInst ); @@ -1240,12 +1246,6 @@ void ConvexShape::_updateMaterial() mMaterialInst = material->createMatInstance(); - //GFXStateBlockDesc desc; - //desc.setCullMode( GFXCullNone ); - //desc.setBlend( false ); - - //mMaterialInst->addStateBlockDesc( desc ); - FeatureSet features = MATMGR->getDefaultFeatures(); //features.addFeature( MFT_DiffuseVertColor ); @@ -1436,10 +1436,12 @@ void ConvexShape::_updateGeometry( bool updateCollision ) for (S32 k = 0; k < 3; k++) { pVert->normal = face.normal; - pVert->tangent = face.tangent; - pVert->color = faceColor; + pVert->T = face.tangent; + pVert->B = mCross(face.normal,face.tangent); + //pVert->color = faceColor; pVert->point = pointList[facePntMap[triangles[j][k]]]; pVert->texCoord = face.texcoords[triangles[j][k]]; + pVert->texCoord2 = pVert->texCoord; pVert++; vc++; diff --git a/Engine/source/T3D/convexShape.h b/Engine/source/T3D/convexShape.h index c6d74fe17..cf02165b6 100644 --- a/Engine/source/T3D/convexShape.h +++ b/Engine/source/T3D/convexShape.h @@ -77,9 +77,6 @@ GFXDeclareVertexFormat( ConvexVert ) class PhysicsBody; -// Define our vertex format here so we don't have to -// change it in multiple spots later -typedef ConvexVert VertexType; class ConvexShape : public SceneObject { @@ -100,6 +97,10 @@ public: // the otherwise excessively deep scoping we had. // eg. ConvexShape::Face::Triangle ... + // Define our vertex format here so we don't have to + // change it in multiple spots later + typedef GFXVertexPNTTB VertexType; + struct Edge { U32 p0;