Added support for editing and resaving EGMC files + improved its preview rendering

This commit is contained in:
parax0
2016-01-16 01:13:27 -07:00
parent c0b74c9883
commit 5c3a37ca4a
20 changed files with 605 additions and 134 deletions

View File

@@ -10,6 +10,7 @@ CModelNode::CModelNode(CScene *pScene, CSceneNode *pParent, CModel *pModel) : CS
mScale = CVector3f(1.f);
mLightingEnabled = true;
mForceAlphaOn = false;
mEnableScanOverlay = false;
mTintColor = CColor::skWhite;
}
@@ -59,6 +60,18 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInf
mpModel->Draw(Options, mActiveMatSet);
else
mpModel->DrawSurface(Options, ComponentIndex, mActiveMatSet);
if (mEnableScanOverlay)
{
CDrawUtil::UseColorShader(mScanOverlayColor);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ZERO);
Options |= eNoMaterialSetup;
if (ComponentIndex < 0)
mpModel->Draw(Options, 0);
else
mpModel->DrawSurface(Options, ComponentIndex, mActiveMatSet);
}
}
void CModelNode::DrawSelection()

View File

@@ -11,6 +11,8 @@ class CModelNode : public CSceneNode
bool mLightingEnabled;
bool mForceAlphaOn;
CColor mTintColor;
bool mEnableScanOverlay;
CColor mScanOverlayColor;
public:
explicit CModelNode(CScene *pScene, CSceneNode *pParent = 0, CModel *pModel = 0);
@@ -26,15 +28,17 @@ public:
// Setters
void SetModel(CModel *pModel);
inline void SetMatSet(u32 MatSet) { mActiveMatSet = MatSet; }
inline void SetDynamicLighting(bool Enable) { mLightingEnabled = Enable; }
inline void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
inline CModel* Model() const { return mpModel; }
inline u32 MatSet() const { return mActiveMatSet; }
inline bool IsDynamicLightingEnabled() const { return mLightingEnabled; }
inline u32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
inline void SetMatSet(u32 MatSet) { mActiveMatSet = MatSet; }
inline void SetDynamicLighting(bool Enable) { mLightingEnabled = Enable; }
inline void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
inline void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; }
inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
inline CModel* Model() const { return mpModel; }
inline u32 MatSet() const { return mActiveMatSet; }
inline bool IsDynamicLightingEnabled() const { return mLightingEnabled; }
inline u32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
};
#endif // CMODELNODE_H