Commit c45c8492 authored by D-AIRY's avatar D-AIRY

Transparency rendering

parent 5b1fa258
/*
mtrltp_base.ps
Рендер прозрачной геометрии
*/
#include "../struct.h"
#include "../mtrl.h"
//##########################################################################
SamplerState g_sScene: register(s0);
Texture2D g_txColor: register(t0); // basetexture
Texture2D g_txParameters: register(t10); // basetexture
//##########################################################################
// half4 g_vNearFarLayers;
#include "../const.h"
cbuffer CDataClipPlanes: register(b6)
{
float4 g_vClipPlanes[4];
};
//##########################################################################
float4 main(VSO_SceneCommon IN):COLOR0
{
// ClipFar(IN.vPos.z, g_vNearFarLayers.y);
// IN.vNormal = normalize(IN.vNormal);
float3 vPos = IN.vPos.xyz / IN.vPos.w;
[unroll]for(uint i = 0; i < 4; ++i)
{
float4 vPlane = g_vClipPlanes[i];
clip(dot(vPlane.xyz, vPos) + vPlane.w);
}
return(g_txColor.Sample(g_sScene, IN.vTexUV));
/* return(CreateGbuffer(
float4(g_txColor.Sample(g_sScene, IN.vTexUV).xyz, 0.0f),
IN.vNormal,
g_txParameters.Sample(g_sScene, IN.vTexUV),
IN.vPos,
g_vNearFarLayers
)); */
}
......@@ -6,17 +6,17 @@ CRenderable::CRenderable(ID idPlugin, CSkyBox *pSkyBox):
{
}
X_RENDER_STAGE CRenderable::getStages()
X_RENDER_STAGE XMETHODCALLTYPE CRenderable::getStages()
{
return(XRS_GBUFFER);
}
UINT CRenderable::getPriorityForStage(X_RENDER_STAGE stage)
UINT XMETHODCALLTYPE CRenderable::getPriorityForStage(X_RENDER_STAGE stage)
{
return(50);
}
void CRenderable::renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVisibility)
void XMETHODCALLTYPE CRenderable::renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVisibility)
{
UNREFERENCED_PARAMETER(pVisibility);
......@@ -42,7 +42,7 @@ void CRenderable::renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVis
}
}
void CRenderable::startup(IGXContext *pDevice, IXMaterialSystem *pMaterialSystem)
void XMETHODCALLTYPE CRenderable::startup(IGXContext *pDevice, IXMaterialSystem *pMaterialSystem)
{
m_pDevice = pDevice;
m_pMaterialSystem = pMaterialSystem;
......@@ -50,17 +50,17 @@ void CRenderable::startup(IGXContext *pDevice, IXMaterialSystem *pMaterialSystem
m_pSkyBox->setDevice(pDevice);
m_pSkyBox->setMaterialSystem(pMaterialSystem);
}
void CRenderable::shutdown()
void XMETHODCALLTYPE CRenderable::shutdown()
{
m_pSkyBox->setDevice(NULL);
}
void CRenderable::newVisData(IXRenderableVisibility **ppVisibility)
void XMETHODCALLTYPE CRenderable::newVisData(IXRenderableVisibility **ppVisibility)
{
*ppVisibility = NULL;
}
IXMaterialSystem *CRenderable::getMaterialSystem()
IXMaterialSystem* CRenderable::getMaterialSystem()
{
return(m_pMaterialSystem);
}
......@@ -11,19 +11,30 @@ public:
CRenderable(ID idPlugin, CSkyBox *pSkyBox);
//! Возвращает поддерживаемые стадии рендера
X_RENDER_STAGE getStages() override;
X_RENDER_STAGE XMETHODCALLTYPE getStages() override;
//! Возвращает приоритет рендера внутри стадии. Чем меньше число - тем раньше будет рендер
UINT getPriorityForStage(X_RENDER_STAGE stage) override;
UINT XMETHODCALLTYPE getPriorityForStage(X_RENDER_STAGE stage) override;
//! Выполняет отрисовку согласно заданной стадии с учетом видимости. Если pVisibility == NULL - рисуется все
void renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVisibility) override;
void startup(IGXContext *pDevice, IXMaterialSystem *pMaterialSystem) override;
void shutdown() override;
void XMETHODCALLTYPE renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVisibility) override;
UINT XMETHODCALLTYPE getTransparentCount(IXRenderableVisibility *pVisibility) override
{
return(0);
}
void XMETHODCALLTYPE getTransparentObject(IXRenderableVisibility *pVisibility, UINT uIndex, XTransparentObject *pObject) override
{
}
void XMETHODCALLTYPE renderTransparentObject(IXRenderableVisibility *pVisibility, UINT uIndex, UINT uSplitPlanes) override
{
}
void XMETHODCALLTYPE startup(IGXContext *pDevice, IXMaterialSystem *pMaterialSystem) override;
void XMETHODCALLTYPE shutdown() override;
//! Создает новый объект просчета видимости для системы
void newVisData(IXRenderableVisibility **ppVisibility) override;
void XMETHODCALLTYPE newVisData(IXRenderableVisibility **ppVisibility) override;
IXMaterialSystem *getMaterialSystem();
protected:
......
......@@ -730,7 +730,7 @@ void CAnimatedModel::fillBoneMatrix()
m_isBoneMatrixReFilled = true;
}
void XMETHODCALLTYPE CAnimatedModel::render(UINT uLod)
void XMETHODCALLTYPE CAnimatedModel::render(UINT uLod, bool isTransparent)
{
if(!m_pDevice || !m_isEnabled || !m_pWorldBuffer)
{
......
......@@ -82,7 +82,7 @@ public:
UINT addLayer();
void XMETHODCALLTYPE render(UINT uLod) override;
void XMETHODCALLTYPE render(UINT uLod, bool isTransparent) override;
void sync();
void initGPUresources();
......
......@@ -174,12 +174,12 @@ void CAnimatedModelProvider::render(CRenderableVisibility *pVisibility)
auto pItem = pVisibility->getItem(i);
if(pItem->isVisible)
{
m_apModels[i]->render(pItem->uLod);
m_apModels[i]->render(pItem->uLod, false);
}
}
else
{
m_apModels[i]->render(0);
m_apModels[i]->render(0, false);
}
}
}
......
......@@ -185,7 +185,7 @@ const IXResourceModel * XMETHODCALLTYPE CDynamicModel::getResource(UINT uIndex)
return(m_pShared->getResource());
}
void XMETHODCALLTYPE CDynamicModel::render(UINT uLod)
void XMETHODCALLTYPE CDynamicModel::render(UINT uLod, bool isTransparent)
{
if(!m_pDevice || !m_isEnabled || !m_pWorldBuffer)
{
......@@ -200,10 +200,31 @@ void XMETHODCALLTYPE CDynamicModel::render(UINT uLod)
m_pDevice->setVertexShaderConstant(m_pWorldBuffer, 1 /* SCR_OBJECT */);
m_pShared->render(m_uSkin, uLod, m_vColor);
m_pShared->render(m_uSkin, uLod, m_vColor, isTransparent);
}
CDynamicModelShared* CDynamicModel::getShared()
{
return(m_pShared);
}
UINT CDynamicModel::getPSPcount(UINT uLod) const
{
return(m_pShared->getPSPs(m_uSkin, uLod).size());
}
SMPLANE CDynamicModel::getPSP(UINT uLod, UINT uPlane) const
{
auto &aPlanes = m_pShared->getPSPs(m_uSkin, uLod);
assert(uPlane < aPlanes.size());
SMPLANE plane = aPlanes[uPlane];
plane = SMPlaneTransform(plane, SMMatrixScaling(m_fScale) * m_qRotation.GetMatrix() * SMMatrixTranslation(m_vPosition));
return(plane);
}
bool CDynamicModel::hasTransparentSubsets(UINT uLod) const
{
return(m_pShared->hasTransparentSubsets(m_uSkin, uLod));
}
......@@ -40,11 +40,14 @@ public:
const IModelPhysbox* XMETHODCALLTYPE getPhysBox(UINT id, UINT uPartIndex = 0) const override;
const IXResourceModel* XMETHODCALLTYPE getResource(UINT uIndex = 0) override;
void XMETHODCALLTYPE render(UINT uLod) override;
void XMETHODCALLTYPE render(UINT uLod, bool isTransparent) override;
CDynamicModelShared* getShared();
void initGPUresources();
UINT getPSPcount(UINT uLod) const;
SMPLANE getPSP(UINT uLod, UINT uPlane) const;
bool hasTransparentSubsets(UINT uLod) const;
protected:
CDynamicModelProvider *m_pProvider;
CDynamicModelShared *m_pShared;
......
......@@ -2,13 +2,31 @@
#include <xcommon/IPluginManager.h>
#include <chrono>
CMaterialChangedEventListener::CMaterialChangedEventListener(CDynamicModelProvider *pProvider):
m_pProvider(pProvider)
{
}
void CMaterialChangedEventListener::onEvent(const XEventMaterialChanged *pData)
{
if(pData->type == XEventMaterialChanged::TYPE_TRANSPARENCY)
{
m_pProvider->onMaterialTransparencyChanged(pData->pMaterial);
}
}
//##########################################################################
CDynamicModelProvider::CDynamicModelProvider(IXCore *pCore):
m_pCore(pCore)
{
m_pMaterialChangedEventListener = new CMaterialChangedEventListener(this);
pCore->getEventChannel<XEventMaterialChanged>(EVENT_MATERIAL_CHANGED_GUID)->addListener(m_pMaterialChangedEventListener);
}
CDynamicModelProvider::~CDynamicModelProvider()
{
m_pCore->getEventChannel<XEventMaterialChanged>(EVENT_MATERIAL_CHANGED_GUID)->removeListener(m_pMaterialChangedEventListener);
mem_delete(m_pMaterialChangedEventListener);
mem_release(m_pVertexDeclaration);
}
......@@ -102,7 +120,7 @@ IXMaterialSystem *CDynamicModelProvider::getMaterialSystem()
return((IXMaterialSystem*)m_pCore->getPluginManager()->getInterface(IXMATERIALSYSTEM_GUID));
}
void CDynamicModelProvider::render(CRenderableVisibility *pVisibility)
void CDynamicModelProvider::render(bool isTransparent, CRenderableVisibility *pVisibility)
{
for(UINT i = 0, l = m_apModels.size(); i < l; ++i)
{
......@@ -111,12 +129,16 @@ void CDynamicModelProvider::render(CRenderableVisibility *pVisibility)
auto pItem = pVisibility->getItemDynamic(i);
if(pItem->isVisible)
{
m_apModels[i]->render(pItem->uLod);
if(isTransparent && !pItem->isTransparent)
{
continue;
}
m_apModels[i]->render(pItem->uLod, isTransparent);
}
}
else
{
m_apModels[i]->render(0);
m_apModels[i]->render(0, isTransparent);
}
}
}
......@@ -124,20 +146,40 @@ void CDynamicModelProvider::render(CRenderableVisibility *pVisibility)
void CDynamicModelProvider::computeVisibility(const IFrustum *pFrustum, CRenderableVisibility *pVisibility, CRenderableVisibility *pReference)
{
pVisibility->setItemCountDynamic(m_apModels.size());
pVisibility->resetItemTransparentDynamic();
CDynamicModel *pMdl;
for(UINT i = 0, l = m_apModels.size(); i < l; ++i)
{
pMdl = m_apModels[i];
auto *pItem = pVisibility->getItemDynamic(i);
if(pMdl->isEnabled())
{
float3 vDelta = pMdl->getPosition();
pVisibility->getItemDynamic(i)->isVisible = (pReference ? pReference->getItemDynamic(i)->isVisible : true)
pItem->isVisible = (pReference ? pReference->getItemDynamic(i)->isVisible : true)
&& pFrustum->boxInFrustum(&float3(pMdl->getLocalBoundMin() + vDelta), &float3(pMdl->getLocalBoundMax() + vDelta));
if(pItem->isVisible)
{
pItem->isTransparent = pMdl->hasTransparentSubsets(pItem->uLod);
if(pItem->isTransparent)
{
UINT uPSPcount = pMdl->getPSPcount(pItem->uLod);
if(uPSPcount)
{
pVisibility->addItemTransparentDynamic({pMdl, true, pMdl->getPSP(pItem->uLod, 0)});
}
else
{
pVisibility->addItemTransparentDynamic({pMdl, false});
}
}
}
}
else
{
pVisibility->getItemDynamic(i)->isVisible = false;
pItem->isVisible = false;
}
}
}
......@@ -211,3 +253,34 @@ void CDynamicModelProvider::scheduleModelGPUinit(CDynamicModel *pModel)
pModel->AddRef();
m_queueGPUinitModel.push(pModel);
}
void CDynamicModelProvider::onMaterialTransparencyChanged(const IXMaterial *pMaterial)
{
for(auto i = m_mModels.begin(); i; i++)
{
(*i.second)->onMaterialTransparencyChanged(pMaterial);
}
}
UINT CDynamicModelProvider::getTransparentCount(CRenderableVisibility *pVisibility)
{
return(pVisibility->getItemTransparentDynamicCount());
}
void CDynamicModelProvider::getTransparentObject(CRenderableVisibility *pVisibility, UINT uIndex, XTransparentObject *pObject)
{
CRenderableVisibility::TransparentModel *pMdl = pVisibility->getItemTransparentDynamic(uIndex);
pObject->hasPSP = pMdl->hasPSP;
if(pMdl->hasPSP)
{
pObject->psp = pMdl->psp;
}
//! @fixme use transparent local bound
pObject->vMin = pMdl->pReferenceMdl->getLocalBoundMin() + pMdl->pReferenceMdl->getPosition();
pObject->vMax = pMdl->pReferenceMdl->getLocalBoundMax() + pMdl->pReferenceMdl->getPosition();
}
void CDynamicModelProvider::renderTransparentObject(CRenderableVisibility *pVisibility, UINT uIndex, UINT uSplitPlanes)
{
CRenderableVisibility::TransparentModel *pMdl = pVisibility->getItemTransparentDynamic(uIndex);
pMdl->pReferenceMdl->render(pMdl->uLod, true);
}
......@@ -8,10 +8,24 @@
#include <mtrl/IXMaterialSystem.h>
#include "RenderableVisibility.h"
#include <common/ConcurrentQueue.h>
#include <xcommon/XEvents.h>
class CDynamicModelProvider;
class CMaterialChangedEventListener: public IEventListener<XEventMaterialChanged>
{
public:
CMaterialChangedEventListener(CDynamicModelProvider *pProvider);
void onEvent(const XEventMaterialChanged *pData) override;
protected:
CDynamicModelProvider *m_pProvider;
};
class CDynamicModelProvider: public IXDynamicModelProvider
{
public:
friend class CMaterialChangedEventListener;
CDynamicModelProvider(IXCore *pCore);
~CDynamicModelProvider();
......@@ -25,7 +39,7 @@ public:
void setDevice(IGXContext *pContext);
IGXVertexDeclaration *getVertexDeclaration();
void render(CRenderableVisibility *pVisibility = NULL);
void render(bool isTransparent, CRenderableVisibility *pVisibility = NULL);
void computeVisibility(const IFrustum *pFrustum, CRenderableVisibility *pVisibility, CRenderableVisibility *pReference=NULL);
void getLevelSize(const XEventLevelSize *pData);
......@@ -35,7 +49,16 @@ public:
void scheduleSharedGPUinit(CDynamicModelShared *pShared);
void scheduleModelGPUinit(CDynamicModel *pModel);
UINT getTransparentCount(CRenderableVisibility *pVisibility);
void getTransparentObject(CRenderableVisibility *pVisibility, UINT uIndex, XTransparentObject *pObject);
void renderTransparentObject(CRenderableVisibility *pVisibility, UINT uIndex, UINT uSplitPlanes);
protected:
void onMaterialTransparencyChanged(const IXMaterial *pMaterial);
CMaterialChangedEventListener *m_pMaterialChangedEventListener;
AssotiativeArray<IXResourceModel*, CDynamicModelShared*> m_mModels;
Array<CDynamicModel*> m_apModels;
......
......@@ -23,6 +23,8 @@ CDynamicModelShared::~CDynamicModelShared()
mem_delete_a(m_ppMaterialsBlob);
m_pppMaterials = NULL;
mem_delete_a(m_isTransparent);
if(m_pDevice)
{
for(UINT i = 0, l = m_aLods.size(); i < l; ++i)
......@@ -73,6 +75,8 @@ bool CDynamicModelShared::init(IXResourceModelStatic *pResource)
m_uMaterialCount = pResource->getMaterialCount();
m_uSkinCount = pResource->getSkinCount();
m_isTransparent = new bool[m_uSkinCount];
m_ppMaterialsBlob = new void*[m_uMaterialCount * m_uSkinCount + m_uSkinCount];
m_pppMaterials = (IXMaterial***)m_ppMaterialsBlob;
XSHADER_DEFAULT_DESC shaderDesc;
......@@ -84,6 +88,7 @@ bool CDynamicModelShared::init(IXResourceModelStatic *pResource)
for(UINT i = 0; i < m_uSkinCount; ++i)
{
m_pppMaterials[i] = (IXMaterial**)(m_ppMaterialsBlob + m_uSkinCount + m_uMaterialCount * i);
bool isTransparent = false;
for(UINT j = 0; j < m_uMaterialCount; ++j)
{
......@@ -102,7 +107,14 @@ bool CDynamicModelShared::init(IXResourceModelStatic *pResource)
m_pppMaterials[i][j] = m_pppMaterials[0][j];
m_pppMaterials[i][j]->AddRef();
}
if(m_pppMaterials[i][j] && m_pppMaterials[i][j]->isTransparent())
{
isTransparent = true;
}
}
m_isTransparent[i] = isTransparent;
}
}
......@@ -217,10 +229,44 @@ bool CDynamicModelShared::init(IXResourceModelStatic *pResource)
{
m_apPhysboxes.push_back(pResource->getPhysbox(m));
}
buildPSPs();
return(true);
}
void CDynamicModelShared::onMaterialTransparencyChanged(const IXMaterial *pMaterial)
{
bool isChanged = false;
for(UINT i = 0; i < m_uSkinCount; ++i)
{
bool isTransparent = false;
for(UINT j = 0; j < m_uMaterialCount; ++j)
{
if(m_pppMaterials[i][j])
{
if(m_pppMaterials[i][j]->isTransparent())
{
isTransparent = true;
}
if(m_pppMaterials[i][j] == pMaterial)
{
isChanged = true;
}
}
}
m_isTransparent[i] = isTransparent;
}
if(isChanged)
{
buildPSPs();
}
}
void CDynamicModelShared::initGPUresources()
{
if(!m_ppTempIndices)
......@@ -272,7 +318,7 @@ float3 CDynamicModelShared::getLocalBoundMax() const
return(m_vLocalMax);
}
void CDynamicModelShared::render(UINT uSkin, UINT uLod, const float4_t &vColor)
void CDynamicModelShared::render(UINT uSkin, UINT uLod, const float4_t &vColor, bool isTransparent)
{
if(!m_pDevice)
{
......@@ -284,6 +330,11 @@ void CDynamicModelShared::render(UINT uSkin, UINT uLod, const float4_t &vColor)
uSkin = 0;
}
if(isTransparent && !hasTransparentSubsets(uSkin, uLod))
{
return;
}
if(uLod >= m_aLods.size())
{
return;
......@@ -314,7 +365,7 @@ void CDynamicModelShared::render(UINT uSkin, UINT uLod, const float4_t &vColor)
{
pSubset = &m_aLods[uLod][i];
if(pSubset->uIndexCount != 0)
if(pSubset->uIndexCount != 0 && ((!m_pppMaterials[uSkin][i] && !isTransparent) || m_pppMaterials[uSkin][i]->isTransparent() == isTransparent))
{
m_pMaterialSystem->bindMaterial(m_pppMaterials[uSkin][i]);
......@@ -332,3 +383,100 @@ void CDynamicModelShared::render(UINT uSkin, UINT uLod, const float4_t &vColor)
}
}
}
bool CDynamicModelShared::hasTransparentSubsets(UINT uSkin, UINT uLod)
{
assert(uSkin < m_uSkinCount);
if(uSkin >= m_uSkinCount)
{
return(false);
}
//! @todo add uLod support
return(m_isTransparent[uSkin]);
}
float3 CDynamicModelShared::getTransparentBoundMin(UINT uSkin, UINT uLod) const
{
//! @todo Implement me!
return(m_vLocalMin);
}
float3 CDynamicModelShared::getTransparentBoundMax(UINT uSkin, UINT uLod) const
{
//! @todo Implement me!
return(m_vLocalMax);
}
void CDynamicModelShared::buildPSPs()
{
assert(m_topology == XPT_TRIANGLELIST);
if(m_topology != XPT_TRIANGLELIST)
{
return;
}
const float c_fEpsilon = 0.01f;
m_aPSPs.reserve(m_aLods.size());
for(UINT i = 0, uLodCount = m_aLods.size(); i < uLodCount; ++i)
{
m_aPSPs[i].reserve(m_uSkinCount);
for(UINT j = 0, jl = m_pResource->getSubsetCount(i); j < jl; ++j)
{
auto pSubset = m_pResource->getSubset(i, j);
for(UINT k = 0; k < m_uSkinCount; ++k)
{
if(j == 0)
{
m_aPSPs[i][k].clearFast();
}
IXMaterial *pMaterial = m_pppMaterials[k][pSubset->iMaterialID];
if(pMaterial && pMaterial->isTransparent())
{
// Если сабсет достаточно плоский, он может породить PSP
UINT uTotalFaces = pSubset->iIndexCount / 3;
float3 vFirstNormal, vNormal;
bool isGood = true;
float3 a, b, c;
for(UINT uFace = 0; uFace < uTotalFaces; ++uFace)
{
a = pSubset->pVertices[pSubset->pIndices[uFace * 3]].vPos;
b = pSubset->pVertices[pSubset->pIndices[uFace * 3 + 1]].vPos;
c = pSubset->pVertices[pSubset->pIndices[uFace * 3 + 2]].vPos;
vNormal = SMVector3Normalize(SMVector3Cross(b - a, c - a));
if(uFace == 0)
{
vFirstNormal = vNormal;
}
else
{
if(1.0f - fabsf(SMVector2Dot(vNormal, vFirstNormal)) > c_fEpsilon)
{
isGood = false;
break;
}
}
}
//! @fixme Здесь не учитывается расстояние между полигонами
if(isGood)
{
m_aPSPs[i][k].push_back(SMPLANE(vNormal, a));
}
}
}
}
}
}
const Array<float4_t>& CDynamicModelShared::getPSPs(UINT uSkin, UINT uLod) const
{
assert(uSkin < m_uSkinCount);
assert(uLod < m_aLods.size());
return(m_aPSPs[uLod][uSkin]);
}
......@@ -26,10 +26,21 @@ public:
float3 getLocalBoundMin() const;
float3 getLocalBoundMax() const;
void render(UINT uSkin, UINT uLod, const float4_t &vColor);
void render(UINT uSkin, UINT uLod, const float4_t &vColor, bool isTransparent);
void initGPUresources();
bool hasTransparentSubsets(UINT uSkin, UINT uLod);
void onMaterialTransparencyChanged(const IXMaterial *pMaterial);
float3 getTransparentBoundMin(UINT uSkin, UINT uLod) const;
float3 getTransparentBoundMax(UINT uSkin, UINT uLod) const;
const Array<float4_t>& getPSPs(UINT uSkin, UINT uLod) const;
protected:
void buildPSPs();
protected:
UINT m_uRefCount = 0;
IXResourceModelStatic *m_pResource;
......@@ -50,6 +61,7 @@ protected:
IXMaterial ***m_pppMaterials = NULL;
UINT m_uMaterialCount = 0;
UINT m_uSkinCount = 0;
bool *m_isTransparent = NULL; //!< По количеству скинов, истина если есть прозрачные материалы в любом сабсете
XPT_TOPOLOGY m_topology;
......@@ -72,6 +84,8 @@ protected:
Array<Array<subset_t>, 1> m_aLods;
Array<Array<Array<float4_t>>, 1> m_aPSPs;
Array<const IModelPhysbox*> m_apPhysboxes;
};
......
......@@ -8,17 +8,17 @@ CRenderable::CRenderable(ID idPlugin, CAnimatedModelProvider *pProviderAnimated,
{
}
X_RENDER_STAGE CRenderable::getStages()
X_RENDER_STAGE XMETHODCALLTYPE CRenderable::getStages()
{
return(XRS_GBUFFER | XRS_SHADOWS | XRS_EDITOR_2D);
return(XRS_GBUFFER | XRS_SHADOWS | XRS_EDITOR_2D | XRS_TRANSPARENT);
}
UINT CRenderable::getPriorityForStage(X_RENDER_STAGE stage)
UINT XMETHODCALLTYPE CRenderable::getPriorityForStage(X_RENDER_STAGE stage)
{
return(20);
}
void CRenderable::renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVisibility)
void XMETHODCALLTYPE CRenderable::renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVisibility)
{
CRenderableVisibility *pVis = NULL;
if(pVisibility)
......@@ -34,28 +34,48 @@ void CRenderable::renderStage(X_RENDER_STAGE stage, IXRenderableVisibility *pVis
break;
case XRS_GBUFFER:
m_pAnimatedModelProvider->render(pVis);
m_pDynamicModelProvider->render(pVis);
m_pDynamicModelProvider->render(false, pVis);
break;
case XRS_SHADOWS:
m_pAnimatedModelProvider->render(pVis);
m_pDynamicModelProvider->render(pVis);
m_pDynamicModelProvider->render(false, pVis);
break;
case XRS_GI:
break;
case XRS_POSTPROCESS_MAIN:
break;
case XRS_TRANSPARENT:
//m_pDynamicModelProvider->render(true, pVis);
break;
case XRS_POSTPROCESS_FINAL:
break;
case XRS_EDITOR_2D:
m_pAnimatedModelProvider->render(pVis);
m_pDynamicModelProvider->render(pVis);
m_pDynamicModelProvider->render(false, pVis);
break;
}
}