mirror of
https://github.com/halpz/re3.git
synced 2024-12-22 17:35:29 +00:00
fix new renderer
This commit is contained in:
parent
77ca9c593f
commit
c58d98a39e
|
@ -670,6 +670,7 @@ char *DoubleSidedNames[] = {
|
|||
"sbwy_tunl_cstm3",
|
||||
"sbwy_tunl_cstm2",
|
||||
"sbwy_tunl_cstm1",
|
||||
"tenmnt6ad",
|
||||
""
|
||||
|
||||
};
|
||||
|
|
|
@ -1333,11 +1333,13 @@ void
|
|||
RenderEffects_new(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("RenderEffects_new");
|
||||
/* // stupid to do this before the whole world is drawn!
|
||||
CShadows::RenderStaticShadows();
|
||||
// CRenderer::GenerateEnvironmentMap
|
||||
CShadows::RenderStoredShadows();
|
||||
CSkidmarks::Render();
|
||||
CRubbish::Render();
|
||||
*/
|
||||
|
||||
// these aren't really effects
|
||||
DefinedState();
|
||||
|
@ -1360,6 +1362,13 @@ if(gbRenderFadingInEntities)
|
|||
CRenderer::RenderFadingInEntities();
|
||||
|
||||
// actual effects here
|
||||
|
||||
// from above
|
||||
CShadows::RenderStaticShadows();
|
||||
CShadows::RenderStoredShadows();
|
||||
CSkidmarks::Render();
|
||||
CRubbish::Render();
|
||||
|
||||
CGlass::Render();
|
||||
// CMattRenderer::ResetRenderStates
|
||||
DefinedState();
|
||||
|
|
|
@ -568,6 +568,7 @@ struct BuildingInst
|
|||
{
|
||||
rw::RawMatrix combinedMat;
|
||||
rw::d3d9::InstanceDataHeader *instHeader;
|
||||
uint32 cullMode;
|
||||
uint8 fadeAlpha;
|
||||
bool lighting;
|
||||
};
|
||||
|
@ -612,6 +613,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
|
|||
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||
building->fadeAlpha = 255;
|
||||
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||
building->cullMode = rw::GetRenderState(rw::CULLMODE);
|
||||
rw::uint32 flags = atomic->geometry->flags;
|
||||
|
||||
bool setupDone = false;
|
||||
|
@ -630,6 +632,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
|
|||
|
||||
// alright we're rendering this atomic
|
||||
if(!setupDone){
|
||||
rw::SetRenderState(rw::CULLMODE, building->cullMode);
|
||||
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||
setIndices(building->instHeader->indexBuffer);
|
||||
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||
|
@ -671,6 +674,7 @@ AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
|||
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||
building->fadeAlpha = fadeAlpha;
|
||||
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||
building->cullMode = rw::GetRenderState(rw::CULLMODE);
|
||||
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||
numBlendInsts[pass]++;
|
||||
}
|
||||
|
@ -688,6 +692,7 @@ RenderBlendPass(int pass)
|
|||
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||
BuildingInst *building = &blendInsts[pass][i];
|
||||
|
||||
rw::SetRenderState(rw::CULLMODE, building->cullMode);
|
||||
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||
setIndices(building->instHeader->indexBuffer);
|
||||
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||
|
|
|
@ -595,6 +595,7 @@ struct BuildingInst
|
|||
{
|
||||
rw::Matrix matrix;
|
||||
rw::gl3::InstanceDataHeader *instHeader;
|
||||
uint32 cullMode;
|
||||
uint8 fadeAlpha;
|
||||
bool lighting;
|
||||
};
|
||||
|
@ -627,6 +628,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
|
|||
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||
building->fadeAlpha = 255;
|
||||
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||
building->cullMode = rw::GetRenderState(rw::CULLMODE);
|
||||
rw::uint32 flags = atomic->geometry->flags;
|
||||
|
||||
WorldLights lights;
|
||||
|
@ -654,6 +656,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
|
|||
|
||||
// alright we're rendering this atomic
|
||||
if(!setupDone){
|
||||
rw::SetRenderState(rw::CULLMODE, building->cullMode);
|
||||
defaultShader->use();
|
||||
setWorldMatrix(&building->matrix);
|
||||
setupVertexInput(building->instHeader);
|
||||
|
@ -686,6 +689,7 @@ AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
|||
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||
building->fadeAlpha = fadeAlpha;
|
||||
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||
building->cullMode = rw::GetRenderState(rw::CULLMODE);
|
||||
building->matrix = *atomic->getFrame()->getLTM();
|
||||
numBlendInsts[pass]++;
|
||||
}
|
||||
|
@ -706,6 +710,7 @@ RenderBlendPass(int pass)
|
|||
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||
BuildingInst *building = &blendInsts[pass][i];
|
||||
|
||||
rw::SetRenderState(rw::CULLMODE, building->cullMode);
|
||||
setupVertexInput(building->instHeader);
|
||||
setWorldMatrix(&building->matrix);
|
||||
if(building->lighting)
|
||||
|
|
|
@ -82,14 +82,6 @@ CVehicle *CRenderer::m_pFirstPersonVehicle;
|
|||
bool CRenderer::m_loadingPriority;
|
||||
float CRenderer::ms_lodDistScale = 1.2f;
|
||||
|
||||
#ifdef EXTRA_MODEL_FLAGS
|
||||
#define BACKFACE_CULLING_ON SetCullMode(rwCULLMODECULLBACK)
|
||||
#define BACKFACE_CULLING_OFF SetCullMode(rwCULLMODECULLNONE)
|
||||
#else
|
||||
#define BACKFACE_CULLING_ON
|
||||
#define BACKFACE_CULLING_OFF
|
||||
#endif
|
||||
|
||||
// unused
|
||||
BlockedRange CRenderer::aBlockedRanges[16];
|
||||
BlockedRange *CRenderer::pFullBlockedRanges;
|
||||
|
@ -442,6 +434,14 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist)
|
|||
RpAtomic *atomic = (RpAtomic*)ent->m_rwObject;
|
||||
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->GetModelIndex());
|
||||
|
||||
#ifdef EXTRA_MODEL_FLAGS
|
||||
bool resetCull = false;
|
||||
if(!ent->IsBuilding() || mi->RenderDoubleSided()){
|
||||
resetCull = true;
|
||||
BACKFACE_CULLING_OFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
int pass = PASS_BLEND;
|
||||
if(mi->m_additive) // very questionable
|
||||
pass = PASS_ADD;
|
||||
|
@ -471,6 +471,11 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist)
|
|||
}else
|
||||
WorldRender::AtomicFirstPass(atomic, pass);
|
||||
|
||||
#ifdef EXTRA_MODEL_FLAGS
|
||||
if(resetCull)
|
||||
BACKFACE_CULLING_ON;
|
||||
#endif
|
||||
|
||||
ent->bImBeingRendered = false; // TODO: this seems wrong, but do we even need it?
|
||||
}
|
||||
|
||||
|
@ -482,6 +487,7 @@ CRenderer::RenderWorld(int pass)
|
|||
CLink<CVisibilityPlugins::AlphaObjectInfo> *node;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||
BACKFACE_CULLING_ON;
|
||||
DeActivateDirectional();
|
||||
SetAmbientColours();
|
||||
|
||||
|
|
|
@ -10,6 +10,14 @@ class CEntity;
|
|||
#define FADE_DISTANCE 20.0f
|
||||
#define STREAM_DISTANCE 30.0f
|
||||
|
||||
#ifdef EXTRA_MODEL_FLAGS
|
||||
#define BACKFACE_CULLING_ON SetCullMode(rwCULLMODECULLBACK)
|
||||
#define BACKFACE_CULLING_OFF SetCullMode(rwCULLMODECULLNONE)
|
||||
#else
|
||||
#define BACKFACE_CULLING_ON
|
||||
#define BACKFACE_CULLING_OFF
|
||||
#endif
|
||||
|
||||
extern bool gbShowPedRoadGroups;
|
||||
extern bool gbShowCarRoadGroups;
|
||||
extern bool gbShowCollisionPolys;
|
||||
|
|
|
@ -303,6 +303,8 @@ CVisibilityPlugins::RenderFadingEntities(void)
|
|||
#ifdef EXTRA_MODEL_FLAGS
|
||||
else if(mi->m_bIsTree)
|
||||
SetAlphaRef(128);
|
||||
if(!e->IsBuilding() || mi->RenderDoubleSided())
|
||||
BACKFACE_CULLING_OFF;
|
||||
#endif
|
||||
|
||||
if(e->bDistanceFade){
|
||||
|
@ -319,6 +321,7 @@ CVisibilityPlugins::RenderFadingEntities(void)
|
|||
#ifdef EXTRA_MODEL_FLAGS
|
||||
if(mi->m_bIsTree)
|
||||
SetAlphaRef(2);
|
||||
BACKFACE_CULLING_ON;
|
||||
#endif
|
||||
#ifdef FIX_BUGS
|
||||
if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite)
|
||||
|
|
Loading…
Reference in a new issue