Selection Highlighting

This commit is contained in:
Marc Chapman 2017-07-26 23:48:29 +01:00
parent fec893cd8b
commit 9106eef98b
7 changed files with 52 additions and 0 deletions

View file

@ -5013,3 +5013,22 @@ DefineEngineMethod( ShapeBase, getModelFile, const char *, (),,
const char *fieldName = StringTable->insert( String("shapeFile") );
return datablock->getDataField( fieldName, NULL );
}
void ShapeBase::setSelectionFlags(U8 flags)
{
Parent::setSelectionFlags(flags);
if (!mShapeInstance || !isClientObject())
return;
if (!mShapeInstance->ownMaterialList())
return;
TSMaterialList* pMatList = mShapeInstance->getMaterialList();
for (S32 j = 0; j < pMatList->size(); j++)
{
BaseMatInstance * bmi = pMatList->getMaterialInst(j);
bmi->setSelectionHighlighting(needsSelectionHighlighting());
}
}

View file

@ -1852,6 +1852,8 @@ public:
protected:
DECLARE_CALLBACK( F32, validateCameraFov, (F32 fov) );
virtual void setSelectionFlags(U8 flags);
};

View file

@ -375,6 +375,8 @@ bool TSStatic::_createShape()
mShapeInstance = new TSShapeInstance( mShape, isClientObject() );
if (isClientObject())
mShapeInstance->cloneMaterialList();
if( isGhost() )
{
// Reapply the current skin
@ -1405,3 +1407,22 @@ void TSStatic::onStaticModified(const char* slotName, const char*newValue)
set_special_typing();
}
void TSStatic::setSelectionFlags(U8 flags)
{
Parent::setSelectionFlags(flags);
if (!mShapeInstance || !isClientObject())
return;
if (!mShapeInstance->ownMaterialList())
return;
TSMaterialList* pMatList = mShapeInstance->getMaterialList();
for (S32 j = 0; j < pMatList->size(); j++)
{
BaseMatInstance * bmi = pMatList->getMaterialInst(j);
bmi->setSelectionHighlighting(needsSelectionHighlighting());
}
}

View file

@ -254,6 +254,7 @@ public:
Point2F mGradientRange;
private:
void set_special_typing();
virtual void setSelectionFlags(U8 flags);
};
typedef TSStatic::MeshType TSMeshType;

View file

@ -252,6 +252,11 @@ public:
virtual const GFXStateBlockDesc &getUserStateBlock() const = 0;
protected:
bool needsHighlighting;
public:
bool needsSelectionHighlighting() { return needsHighlighting; };
void setSelectionHighlighting(bool flag) { needsHighlighting = flag; };
};
#endif /// _BASEMATINSTANCE_H_

View file

@ -253,6 +253,7 @@ void MatInstance::construct()
mIsForwardLit = false;
mIsValid = false;
mIsHardwareSkinned = false;
needsHighlighting = false;
MATMGR->_track(this);
}

View file

@ -52,6 +52,9 @@ struct SceneData
/// The deferred render bin.
/// @RenderDeferredMgr
DeferredBin,
/// The selection-highlight render bin.
/// @afxRenderHighlightMgr
HighlightBin,
};
/// This defines when we're rendering a special bin