mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-23 17:49:16 +01:00
some rendering things
This commit is contained in:
parent
b3f97cdce4
commit
35cac6b93b
@ -191,7 +191,7 @@ CGame::InitialiseRenderWare(void)
|
||||
CVisibilityPlugins::Initialise();
|
||||
|
||||
/* Create camera */
|
||||
Scene.camera = CameraCreate(RsGlobal.width, RsGlobal.height, TRUE);
|
||||
Scene.camera = CameraCreate(SCREEN_WIDTH, SCREEN_HEIGHT, TRUE);
|
||||
ASSERT(Scene.camera != nil);
|
||||
if (!Scene.camera)
|
||||
{
|
||||
|
@ -890,18 +890,18 @@ void
|
||||
MattRenderScene(void)
|
||||
{
|
||||
// this calls CMattRenderer::Render
|
||||
CWorld::AdvanceCurrentScanCode();
|
||||
/// CWorld::AdvanceCurrentScanCode();
|
||||
// CMattRenderer::ResetRenderStates
|
||||
CRenderer::ClearForFrame();
|
||||
/// CRenderer::ClearForFrame(); // before ConstructRenderList
|
||||
// CClock::CalcEnvMapTimeMultiplicator
|
||||
CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
|
||||
// CClock::ms_EnvMapTimeMultiplicator = 1.0f;
|
||||
// cWorldStream::ClearDynamics
|
||||
CRenderer::ConstructRenderList();
|
||||
/// CRenderer::ConstructRenderList(); // before PreRender
|
||||
if(gbRenderWorld0)
|
||||
CRenderer::RenderWorld(0); // roads
|
||||
// CMattRenderer::ResetRenderStates
|
||||
CRenderer::PreRender();
|
||||
/// CRenderer::PreRender(); // has to be called before BeginUpdate because of cutscene shadows
|
||||
CCoronas::RenderReflections();
|
||||
if(gbRenderWorld1)
|
||||
CRenderer::RenderWorld(1); // opaque
|
||||
@ -1213,13 +1213,16 @@ Idle(void *arg)
|
||||
pos.y = SCREEN_HEIGHT / 2.0f;
|
||||
RsMouseSetPos(&pos);
|
||||
#endif
|
||||
#ifdef NEW_RENDERER
|
||||
if(!gbNewRenderer)
|
||||
#endif
|
||||
{
|
||||
|
||||
tbStartTimer(0, "CnstrRenderList");
|
||||
#ifdef PC_WATER
|
||||
CWaterLevel::PreCalcWaterGeometry();
|
||||
#endif
|
||||
#ifdef NEW_RENDERER
|
||||
if(gbNewRenderer){
|
||||
CWorld::AdvanceCurrentScanCode(); // don't think this is even necessary
|
||||
CRenderer::ClearForFrame();
|
||||
}
|
||||
#endif
|
||||
CRenderer::ConstructRenderList();
|
||||
tbEndTimer("CnstrRenderList");
|
||||
@ -1227,7 +1230,6 @@ Idle(void *arg)
|
||||
tbStartTimer(0, "PreRender");
|
||||
CRenderer::PreRender();
|
||||
tbEndTimer("PreRender");
|
||||
}
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); // TODO: temp? this fixes OpenGL render but there should be a better place for this
|
||||
|
@ -61,14 +61,6 @@ CVehicle *CRenderer::m_pFirstPersonVehicle;
|
||||
bool CRenderer::m_loadingPriority;
|
||||
float CRenderer::ms_lodDistScale = 1.2f;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
#define LOD_DISTANCE (300.0f*TheCamera.LODDistMultiplier)
|
||||
#else
|
||||
#define LOD_DISTANCE 300.0f
|
||||
#endif
|
||||
#define FADE_DISTANCE 20.0f
|
||||
#define STREAM_DISTANCE 30.0f
|
||||
|
||||
|
||||
void
|
||||
CRenderer::Init(void)
|
||||
@ -711,12 +703,13 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist)
|
||||
{
|
||||
if(ent->m_rwObject == nil)
|
||||
return;
|
||||
|
||||
ent->bImBeingRendered = true; // TODO: this seems wrong, but do we even need it?
|
||||
|
||||
assert(RwObjectGetType(ent->m_rwObject) == rpATOMIC);
|
||||
RpAtomic *atomic = (RpAtomic*)ent->m_rwObject;
|
||||
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->GetModelIndex());
|
||||
|
||||
ent->bImBeingRendered = true; // TODO: this seems wrong, but do we even need it?
|
||||
|
||||
int pass = PASS_BLEND;
|
||||
if(mi->m_additive) // very questionable
|
||||
pass = PASS_ADD;
|
||||
|
@ -2,6 +2,14 @@
|
||||
|
||||
class CEntity;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
#define LOD_DISTANCE (300.0f*TheCamera.LODDistMultiplier)
|
||||
#else
|
||||
#define LOD_DISTANCE 300.0f
|
||||
#endif
|
||||
#define FADE_DISTANCE 20.0f
|
||||
#define STREAM_DISTANCE 30.0f
|
||||
|
||||
extern bool gbShowCollisionPolys;
|
||||
extern bool gbShowCollisionLines;
|
||||
extern bool gbBigWhiteDebugLightSwitchedOn;
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
#define FADE_DISTANCE 20.0f
|
||||
|
||||
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaList;
|
||||
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaBoatAtomicList;
|
||||
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaEntityList;
|
||||
@ -39,6 +37,8 @@ float CVisibilityPlugins::ms_bigVehicleLod1Dist;
|
||||
float CVisibilityPlugins::ms_pedLod1Dist;
|
||||
float CVisibilityPlugins::ms_pedFadeDist;
|
||||
|
||||
#define RENDERCALLBACK AtomicDefaultRenderCallBack
|
||||
|
||||
void
|
||||
CVisibilityPlugins::Initialise(void)
|
||||
{
|
||||
@ -132,6 +132,10 @@ CVisibilityPlugins::InsertAtomicIntoBoatSortedList(RpAtomic *a, float dist)
|
||||
return !!m_alphaBoatAtomicList.InsertSorted(item);
|
||||
}
|
||||
|
||||
// can't increase this yet unfortunately...
|
||||
// probably have to fix fading for this so material alpha isn't overwritten
|
||||
#define VEHICLE_LODDIST_MULTIPLIER (TheCamera.GenerationDistMultiplier)
|
||||
|
||||
void
|
||||
CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera)
|
||||
{
|
||||
@ -144,11 +148,11 @@ CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera)
|
||||
else
|
||||
ms_cullCompsDist = sq(TheCamera.LODDistMultiplier * 20.0f);
|
||||
|
||||
ms_vehicleLod0Dist = sq(70.0f * TheCamera.GenerationDistMultiplier);
|
||||
ms_vehicleLod1Dist = sq(90.0f * TheCamera.GenerationDistMultiplier);
|
||||
ms_vehicleFadeDist = sq(100.0f * TheCamera.GenerationDistMultiplier);
|
||||
ms_bigVehicleLod0Dist = sq(60.0f * TheCamera.GenerationDistMultiplier);
|
||||
ms_bigVehicleLod1Dist = sq(150.0f * TheCamera.GenerationDistMultiplier);
|
||||
ms_vehicleLod0Dist = sq(70.0f * VEHICLE_LODDIST_MULTIPLIER);
|
||||
ms_vehicleLod1Dist = sq(90.0f * VEHICLE_LODDIST_MULTIPLIER);
|
||||
ms_vehicleFadeDist = sq(100.0f * VEHICLE_LODDIST_MULTIPLIER);
|
||||
ms_bigVehicleLod0Dist = sq(60.0f * VEHICLE_LODDIST_MULTIPLIER);
|
||||
ms_bigVehicleLod1Dist = sq(150.0f * VEHICLE_LODDIST_MULTIPLIER);
|
||||
ms_pedLod1Dist = sq(60.0f * TheCamera.LODDistMultiplier);
|
||||
ms_pedFadeDist = sq(70.0f * TheCamera.LODDistMultiplier);
|
||||
}
|
||||
@ -187,7 +191,7 @@ CVisibilityPlugins::RenderAtomicList(CLinkList<AlphaObjectInfo> &list)
|
||||
{
|
||||
CLink<AlphaObjectInfo> *node;
|
||||
for(node = list.tail.prev; node != &list.head; node = node->prev)
|
||||
AtomicDefaultRenderCallBack(node->item.atomic);
|
||||
RENDERCALLBACK(node->item.atomic);
|
||||
}
|
||||
|
||||
void
|
||||
@ -257,11 +261,11 @@ CVisibilityPlugins::RenderWheelAtomicCB(RpAtomic *atomic)
|
||||
|
||||
mi = GetAtomicModelInfo(atomic);
|
||||
len = Sqrt(DistToCameraSq);
|
||||
lodatm = mi->GetAtomicFromDistance(len * TheCamera.LODDistMultiplier / TheCamera.GenerationDistMultiplier);
|
||||
lodatm = mi->GetAtomicFromDistance(len * TheCamera.LODDistMultiplier / VEHICLE_LODDIST_MULTIPLIER);
|
||||
if(lodatm){
|
||||
if(RpAtomicGetGeometry(lodatm) != RpAtomicGetGeometry(atomic))
|
||||
RpAtomicSetGeometry(atomic, RpAtomicGetGeometry(lodatm), rpATOMICSAMEBOUNDINGSPHERE);
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -278,7 +282,7 @@ CVisibilityPlugins::RenderObjNormalAtomic(RpAtomic *atomic)
|
||||
len = RwV3dLength(&view);
|
||||
if(RwV3dDotProduct(&view, RwMatrixGetUp(m)) < -0.3f*len && len > 8.0f)
|
||||
return atomic;
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
return atomic;
|
||||
}
|
||||
|
||||
@ -292,7 +296,7 @@ CVisibilityPlugins::RenderAlphaAtomic(RpAtomic *atomic, int alpha)
|
||||
flags = RpGeometryGetFlags(geo);
|
||||
RpGeometrySetFlags(geo, flags | rpGEOMETRYMODULATEMATERIALCOLOR);
|
||||
RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)alpha);
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)255);
|
||||
RpGeometrySetFlags(geo, flags);
|
||||
return atomic;
|
||||
@ -312,7 +316,7 @@ CVisibilityPlugins::RenderWeaponCB(RpAtomic *atomic)
|
||||
maxdist = mi->GetLodDistance(0);
|
||||
distsq = RwV3dDotProduct(&view, &view);
|
||||
if(distsq < maxdist*maxdist)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
return atomic;
|
||||
}
|
||||
|
||||
@ -334,7 +338,7 @@ CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist)
|
||||
fadefactor = 1.0f;
|
||||
alpha = mi->m_alpha * fadefactor;
|
||||
if(alpha == 255)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
else{
|
||||
RpGeometry *geo = RpAtomicGetGeometry(lodatm);
|
||||
uint32 flags = RpGeometryGetFlags(geo);
|
||||
@ -342,7 +346,7 @@ CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist)
|
||||
RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)alpha);
|
||||
if(geo != RpAtomicGetGeometry(atomic))
|
||||
RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)255);
|
||||
RpGeometrySetFlags(geo, flags);
|
||||
}
|
||||
@ -371,7 +375,7 @@ CVisibilityPlugins::RenderVehicleHiDetailCB(RpAtomic *atomic)
|
||||
if(dot > 0.0f && ((flags & ATOMIC_FLAG_ANGLECULL) || 0.1f*DistToCameraSq < dot*dot))
|
||||
return atomic;
|
||||
}
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -395,10 +399,10 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB(RpAtomic *atomic)
|
||||
if(flags & ATOMIC_FLAG_DRAWLAST){
|
||||
// sort before clump
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq - 0.0001f))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}else{
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq + dot))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
}
|
||||
return atomic;
|
||||
@ -420,7 +424,7 @@ CVisibilityPlugins::RenderVehicleHiDetailCB_BigVehicle(RpAtomic *atomic)
|
||||
if(dot > 0.0f)
|
||||
return atomic;
|
||||
}
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -442,7 +446,7 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic)
|
||||
return atomic;
|
||||
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq + dot))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -451,7 +455,7 @@ RpAtomic*
|
||||
CVisibilityPlugins::RenderVehicleHiDetailCB_Boat(RpAtomic *atomic)
|
||||
{
|
||||
if(DistToCameraSq < ms_bigVehicleLod1Dist)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
return atomic;
|
||||
}
|
||||
|
||||
@ -461,9 +465,9 @@ CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic)
|
||||
if(DistToCameraSq < ms_vehicleLod0Dist){
|
||||
if(GetAtomicId(atomic) & ATOMIC_FLAG_DRAWLAST){
|
||||
if(!InsertAtomicIntoBoatSortedList(atomic, DistToCameraSq))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}else
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -485,7 +489,7 @@ CVisibilityPlugins::RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic)
|
||||
if(dot > 0.0f)
|
||||
return atomic;
|
||||
}
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -508,7 +512,7 @@ CVisibilityPlugins::RenderVehicleLowDetailAlphaCB_BigVehicle(RpAtomic *atomic)
|
||||
return atomic;
|
||||
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq + dot))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -523,7 +527,7 @@ CVisibilityPlugins::RenderVehicleReallyLowDetailCB(RpAtomic *atomic)
|
||||
if(DistToCameraSq >= ms_vehicleLod0Dist){
|
||||
alpha = GetClumpAlpha(clump);
|
||||
if(alpha == 255)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
else
|
||||
RenderAlphaAtomic(atomic, alpha);
|
||||
}
|
||||
@ -535,7 +539,7 @@ RpAtomic*
|
||||
CVisibilityPlugins::RenderVehicleReallyLowDetailCB_BigVehicle(RpAtomic *atomic)
|
||||
{
|
||||
if(DistToCameraSq >= ms_bigVehicleLod1Dist)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
return atomic;
|
||||
}
|
||||
|
||||
@ -555,7 +559,7 @@ CVisibilityPlugins::RenderTrainHiDetailCB(RpAtomic *atomic)
|
||||
if(dot > 0.0f && ((flags & ATOMIC_FLAG_ANGLECULL) || 0.1f*DistToCameraSq < dot*dot))
|
||||
return atomic;
|
||||
}
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -579,10 +583,10 @@ CVisibilityPlugins::RenderTrainHiDetailAlphaCB(RpAtomic *atomic)
|
||||
if(flags & ATOMIC_FLAG_DRAWLAST){
|
||||
// sort before clump
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq - 0.0001f))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}else{
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq + dot))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
}
|
||||
return atomic;
|
||||
@ -600,7 +604,7 @@ CVisibilityPlugins::RenderVehicleRotorAlphaCB(RpAtomic *atomic)
|
||||
RwV3dSub(&cam2atm, &RwFrameGetLTM(RpAtomicGetFrame(atomic))->pos, ms_pCameraPosn);
|
||||
dot = RwV3dDotProduct(&cam2atm, &RwFrameGetLTM(clumpframe)->at);
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq + dot*20.0f))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -618,7 +622,7 @@ CVisibilityPlugins::RenderVehicleTailRotorAlphaCB(RpAtomic *atomic)
|
||||
RwV3dSub(&cam2atm, &atmMat->pos, ms_pCameraPosn);
|
||||
dot = RwV3dDotProduct(&cam2atm, &clumpMat->up) + RwV3dDotProduct(&cam2atm, &clumpMat->right);
|
||||
if(!InsertAtomicIntoSortedList(atomic, DistToCameraSq - dot))
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
@ -628,7 +632,7 @@ CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic)
|
||||
{
|
||||
if(CWorld::Players[0].m_pSkinTexture)
|
||||
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture);
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
return atomic;
|
||||
}
|
||||
|
||||
@ -642,7 +646,7 @@ CVisibilityPlugins::RenderPedCB(RpAtomic *atomic)
|
||||
if(RwV3dDotProduct(&cam2atm, &cam2atm) < ms_pedLod1Dist){
|
||||
alpha = GetClumpAlpha(RpAtomicGetClump(atomic));
|
||||
if(alpha == 255)
|
||||
AtomicDefaultRenderCallBack(atomic);
|
||||
RENDERCALLBACK(atomic);
|
||||
else
|
||||
RenderAlphaAtomic(atomic, alpha);
|
||||
}
|
||||
@ -838,7 +842,7 @@ void
|
||||
CVisibilityPlugins::SetAtomicRenderCallback(RpAtomic *atomic, RpAtomicCallBackRender cb)
|
||||
{
|
||||
if(cb == nil)
|
||||
cb = AtomicDefaultRenderCallBack; // not necessary
|
||||
cb = RENDERCALLBACK; // not necessary
|
||||
RpAtomicSetRenderCallBack(atomic, cb);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user