mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
set convexshape to use a standard vertex type
we were seeing vert type vs shadergen mismatches. this is a route to conform the former to the latter, which avoids generating a unique shader/processedmaterial combo
This commit is contained in:
parent
67771cad5b
commit
dd920bb537
2 changed files with 16 additions and 13 deletions
|
|
@ -1205,11 +1205,15 @@ void ConvexShape::_updateMaterial()
|
||||||
//update our custom surface materials
|
//update our custom surface materials
|
||||||
for (U32 i = 0; i<mSurfaceTextures.size(); i++)
|
for (U32 i = 0; i<mSurfaceTextures.size(); i++)
|
||||||
{
|
{
|
||||||
|
mSurfaceTextures[i]._setMaterial(mSurfaceTextures[i].getMaterial());
|
||||||
//If we already have the material inst and it hasn't changed, skip
|
//If we already have the material inst and it hasn't changed, skip
|
||||||
if (mSurfaceTextures[i].materialInst &&
|
if (mSurfaceTextures[i].materialInst &&
|
||||||
mSurfaceTextures[i].getMaterialAsset()->getMaterialDefinitionName() == mSurfaceTextures[i].materialInst->getMaterial()->getName())
|
mSurfaceTextures[i].getMaterialAsset()->getMaterialDefinitionName() == mSurfaceTextures[i].materialInst->getMaterial()->getName() &&
|
||||||
|
mSurfaceTextures[i].materialInst->getVertexFormat() == getGFXVertexFormat<VertexType>())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
SAFE_DELETE(mSurfaceTextures[i].materialInst);
|
||||||
|
|
||||||
Material* material = mSurfaceTextures[i].getMaterialResource();
|
Material* material = mSurfaceTextures[i].getMaterialResource();
|
||||||
|
|
||||||
if (material == nullptr)
|
if (material == nullptr)
|
||||||
|
|
@ -1227,8 +1231,10 @@ void ConvexShape::_updateMaterial()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setMaterial(getMaterial());
|
||||||
// If the material name matches then don't bother updating it.
|
// 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<VertexType>())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SAFE_DELETE( mMaterialInst );
|
SAFE_DELETE( mMaterialInst );
|
||||||
|
|
@ -1240,12 +1246,6 @@ void ConvexShape::_updateMaterial()
|
||||||
|
|
||||||
mMaterialInst = material->createMatInstance();
|
mMaterialInst = material->createMatInstance();
|
||||||
|
|
||||||
//GFXStateBlockDesc desc;
|
|
||||||
//desc.setCullMode( GFXCullNone );
|
|
||||||
//desc.setBlend( false );
|
|
||||||
|
|
||||||
//mMaterialInst->addStateBlockDesc( desc );
|
|
||||||
|
|
||||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||||
//features.addFeature( MFT_DiffuseVertColor );
|
//features.addFeature( MFT_DiffuseVertColor );
|
||||||
|
|
||||||
|
|
@ -1436,10 +1436,12 @@ void ConvexShape::_updateGeometry( bool updateCollision )
|
||||||
for (S32 k = 0; k < 3; k++)
|
for (S32 k = 0; k < 3; k++)
|
||||||
{
|
{
|
||||||
pVert->normal = face.normal;
|
pVert->normal = face.normal;
|
||||||
pVert->tangent = face.tangent;
|
pVert->T = face.tangent;
|
||||||
pVert->color = faceColor;
|
pVert->B = mCross(face.normal,face.tangent);
|
||||||
|
//pVert->color = faceColor;
|
||||||
pVert->point = pointList[facePntMap[triangles[j][k]]];
|
pVert->point = pointList[facePntMap[triangles[j][k]]];
|
||||||
pVert->texCoord = face.texcoords[triangles[j][k]];
|
pVert->texCoord = face.texcoords[triangles[j][k]];
|
||||||
|
pVert->texCoord2 = pVert->texCoord;
|
||||||
|
|
||||||
pVert++;
|
pVert++;
|
||||||
vc++;
|
vc++;
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,6 @@ GFXDeclareVertexFormat( ConvexVert )
|
||||||
|
|
||||||
class PhysicsBody;
|
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
|
class ConvexShape : public SceneObject
|
||||||
{
|
{
|
||||||
|
|
@ -100,6 +97,10 @@ public:
|
||||||
// the otherwise excessively deep scoping we had.
|
// the otherwise excessively deep scoping we had.
|
||||||
// eg. ConvexShape::Face::Triangle ...
|
// 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
|
struct Edge
|
||||||
{
|
{
|
||||||
U32 p0;
|
U32 p0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue