first version of new renderer
This commit is contained in:
parent
042e21115e
commit
e6ef2f12de
@ -252,6 +252,7 @@ enum Config {
|
|||||||
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||||
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||||
#define SCREEN_DROPLETS // neo water droplets
|
#define SCREEN_DROPLETS // neo water droplets
|
||||||
|
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EXTENDED_COLOURFILTER
|
#ifndef EXTENDED_COLOURFILTER
|
||||||
|
@ -121,6 +121,13 @@ bool gbPrintMemoryUsage;
|
|||||||
#define FOUND_GAME_TO_LOAD b_FoundRecentSavedGameWantToLoad
|
#define FOUND_GAME_TO_LOAD b_FoundRecentSavedGameWantToLoad
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
bool gbNewRenderer;
|
||||||
|
#define CLEARMODE (rwCAMERACLEARZ | rwCAMERACLEARSTENCIL)
|
||||||
|
#else
|
||||||
|
#define CLEARMODE (rwCAMERACLEARZ)
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
ValidateVersion()
|
ValidateVersion()
|
||||||
{
|
{
|
||||||
@ -168,7 +175,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &TopColor.rwRGBA, CLEARMODE);
|
||||||
|
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return false;
|
return false;
|
||||||
@ -190,7 +197,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
|
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return false;
|
return false;
|
||||||
@ -1160,9 +1167,126 @@ DisplayGameDebugText()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
bool gbRenderRoads = true;
|
||||||
|
bool gbRenderEverythingBarRoads = true;
|
||||||
|
//bool gbRenderFadingInUnderwaterEntities = true;
|
||||||
|
bool gbRenderFadingInEntities = true;
|
||||||
|
bool gbRenderWater = true;
|
||||||
|
bool gbRenderBoats = true;
|
||||||
|
bool gbRenderVehicles = true;
|
||||||
|
bool gbRenderWorld0 = true;
|
||||||
|
bool gbRenderWorld1 = true;
|
||||||
|
bool gbRenderWorld2 = true;
|
||||||
|
|
||||||
|
void
|
||||||
|
MattRenderScene(void)
|
||||||
|
{
|
||||||
|
// this calls CMattRenderer::Render
|
||||||
|
/// CWorld::AdvanceCurrentScanCode();
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
/// CRenderer::ClearForFrame(); // before ConstructRenderList
|
||||||
|
// CClock::CalcEnvMapTimeMultiplicator
|
||||||
|
if(gbRenderWater)
|
||||||
|
CRenderer::RenderWater(); // actually CMattRenderer::RenderWater
|
||||||
|
// CClock::ms_EnvMapTimeMultiplicator = 1.0f;
|
||||||
|
// cWorldStream::ClearDynamics
|
||||||
|
/// CRenderer::ConstructRenderList(); // before PreRender
|
||||||
|
if(gbRenderWorld0)
|
||||||
|
CRenderer::RenderWorld(0); // roads
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
/// CRenderer::PreRender(); // has to be called before BeginUpdate because of cutscene shadows
|
||||||
|
CCoronas::RenderReflections();
|
||||||
|
if(gbRenderWorld1)
|
||||||
|
CRenderer::RenderWorld(1); // opaque
|
||||||
|
if(gbRenderRoads)
|
||||||
|
CRenderer::RenderRoads();
|
||||||
|
|
||||||
|
CRenderer::RenderPeds();
|
||||||
|
|
||||||
|
if(gbRenderBoats)
|
||||||
|
CRenderer::RenderBoats();
|
||||||
|
//if(gbRenderFadingInUnderwaterEntities)
|
||||||
|
// CRenderer::RenderFadingInUnderwaterEntities();
|
||||||
|
|
||||||
|
if(gbRenderEverythingBarRoads)
|
||||||
|
CRenderer::RenderEverythingBarRoads();
|
||||||
|
// get env map here?
|
||||||
|
// moved this:
|
||||||
|
// CRenderer::RenderFadingInEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RenderScene_new(void)
|
||||||
|
{
|
||||||
|
CClouds::Render();
|
||||||
|
DoRWRenderHorizon();
|
||||||
|
|
||||||
|
MattRenderScene();
|
||||||
|
DefinedState();
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
// moved CRenderer::RenderBoats to before transparent water
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
bool FredIsInFirstPersonCam(void) { return false; }
|
||||||
|
void
|
||||||
|
RenderEffects_new(void)
|
||||||
|
{
|
||||||
|
CShadows::RenderStaticShadows();
|
||||||
|
// CRenderer::GenerateEnvironmentMap
|
||||||
|
CShadows::RenderStoredShadows();
|
||||||
|
CSkidmarks::Render();
|
||||||
|
CRubbish::Render();
|
||||||
|
|
||||||
|
// these aren't really effects
|
||||||
|
DefinedState();
|
||||||
|
if(FredIsInFirstPersonCam()){
|
||||||
|
DefinedState();
|
||||||
|
C3dMarkers::Render(); // normally rendered in CSpecialFX::Render()
|
||||||
|
if(gbRenderWorld2)
|
||||||
|
CRenderer::RenderWorld(2); // transparent
|
||||||
|
if(gbRenderVehicles)
|
||||||
|
CRenderer::RenderVehicles();
|
||||||
|
}else{
|
||||||
|
// flipped these two, seems to give the best result
|
||||||
|
if(gbRenderWorld2)
|
||||||
|
CRenderer::RenderWorld(2); // transparent
|
||||||
|
if(gbRenderVehicles)
|
||||||
|
CRenderer::RenderVehicles();
|
||||||
|
}
|
||||||
|
// better render these after transparent world
|
||||||
|
if(gbRenderFadingInEntities)
|
||||||
|
CRenderer::RenderFadingInEntities();
|
||||||
|
|
||||||
|
// actual effects here
|
||||||
|
CGlass::Render();
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
DefinedState();
|
||||||
|
CWeather::RenderRainStreaks();
|
||||||
|
// CWeather::AddSnow
|
||||||
|
CWaterCannons::Render();
|
||||||
|
CAntennas::Render();
|
||||||
|
CSpecialFX::Render();
|
||||||
|
CCoronas::Render();
|
||||||
|
CParticle::Render();
|
||||||
|
CPacManPickups::Render();
|
||||||
|
CWeaponEffects::Render();
|
||||||
|
CPointLights::RenderFogEffect();
|
||||||
|
CMovingThings::Render();
|
||||||
|
CRenderer::RenderFirstPersonVehicle();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
RenderScene(void)
|
RenderScene(void)
|
||||||
{
|
{
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
RenderScene_new();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CClouds::Render();
|
CClouds::Render();
|
||||||
DoRWRenderHorizon();
|
DoRWRenderHorizon();
|
||||||
CRenderer::RenderRoads();
|
CRenderer::RenderRoads();
|
||||||
@ -1195,6 +1319,12 @@ RenderDebugShit(void)
|
|||||||
void
|
void
|
||||||
RenderEffects(void)
|
RenderEffects(void)
|
||||||
{
|
{
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
RenderEffects_new();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CGlass::Render();
|
CGlass::Render();
|
||||||
CWaterCannons::Render();
|
CWaterCannons::Render();
|
||||||
CSpecialFX::Render();
|
CSpecialFX::Render();
|
||||||
@ -1390,6 +1520,12 @@ Idle(void *arg)
|
|||||||
|
|
||||||
PUSH_MEMID(MEMID_RENDERLIST);
|
PUSH_MEMID(MEMID_RENDERLIST);
|
||||||
tbStartTimer(0, "CnstrRenderList");
|
tbStartTimer(0, "CnstrRenderList");
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
CWorld::AdvanceCurrentScanCode(); // don't think this is even necessary
|
||||||
|
CRenderer::ClearForFrame();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CRenderer::ConstructRenderList();
|
CRenderer::ConstructRenderList();
|
||||||
tbEndTimer("CnstrRenderList");
|
tbEndTimer("CnstrRenderList");
|
||||||
|
|
||||||
@ -1457,7 +1593,7 @@ Idle(void *arg)
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
goto popret;
|
goto popret;
|
||||||
}
|
}
|
||||||
@ -1523,7 +1659,7 @@ FrontendIdle(void)
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1780,7 +1916,7 @@ void TheGame(void)
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
RsCameraBeginUpdate(Scene.camera);
|
RsCameraBeginUpdate(Scene.camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,3 +48,8 @@ void TheModelViewer(void);
|
|||||||
void LoadINISettings();
|
void LoadINISettings();
|
||||||
void SaveINISettings();
|
void SaveINISettings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
extern bool gbNewRenderer;
|
||||||
|
bool FredIsInFirstPersonCam(void);
|
||||||
|
#endif
|
||||||
|
@ -558,6 +558,30 @@ DebugMenuPopulate(void)
|
|||||||
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
||||||
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
||||||
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
DebugMenuAddVarBool8("Render", "new renderer", &gbNewRenderer, nil);
|
||||||
|
extern bool gbRenderRoads;
|
||||||
|
extern bool gbRenderEverythingBarRoads;
|
||||||
|
//extern bool gbRenderFadingInUnderwaterEntities;
|
||||||
|
extern bool gbRenderFadingInEntities;
|
||||||
|
extern bool gbRenderWater;
|
||||||
|
extern bool gbRenderBoats;
|
||||||
|
extern bool gbRenderVehicles;
|
||||||
|
extern bool gbRenderWorld0;
|
||||||
|
extern bool gbRenderWorld1;
|
||||||
|
extern bool gbRenderWorld2;
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderRoads", &gbRenderRoads, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderEverythingBarRoads", &gbRenderEverythingBarRoads, nil);
|
||||||
|
// DebugMenuAddVarBool8("Render", "gbRenderFadingInUnderwaterEntities", &gbRenderFadingInUnderwaterEntities, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderFadingInEntities", &gbRenderFadingInEntities, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWater", &gbRenderWater, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderBoats", &gbRenderBoats, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderVehicles", &gbRenderVehicles, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWorld0", &gbRenderWorld0, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWorld1", &gbRenderWorld1, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWorld2", &gbRenderWorld2, nil);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXTENDED_COLOURFILTER
|
#ifdef EXTENDED_COLOURFILTER
|
||||||
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
||||||
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
|
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#define WITH_D3D
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@ -6,6 +7,7 @@
|
|||||||
#include "Treadable.h"
|
#include "Treadable.h"
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
#include "Boat.h"
|
||||||
#include "Heli.h"
|
#include "Heli.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
@ -68,6 +70,12 @@ int32 CRenderer::ms_nNoOfVisibleEntities;
|
|||||||
CEntity *CRenderer::ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
|
CEntity *CRenderer::ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
|
||||||
CEntity *CRenderer::ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
|
CEntity *CRenderer::ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
|
||||||
int32 CRenderer::ms_nNoOfInVisibleEntities;
|
int32 CRenderer::ms_nNoOfInVisibleEntities;
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
int32 CRenderer::ms_nNoOfVisibleVehicles;
|
||||||
|
CEntity *CRenderer::ms_aVisibleVehiclePtrs[NUMVISIBLEENTITIES];
|
||||||
|
int32 CRenderer::ms_nNoOfVisibleBuildings;
|
||||||
|
CEntity *CRenderer::ms_aVisibleBuildingPtrs[NUMVISIBLEENTITIES];
|
||||||
|
#endif
|
||||||
|
|
||||||
CVector CRenderer::ms_vecCameraPosition;
|
CVector CRenderer::ms_vecCameraPosition;
|
||||||
CVehicle *CRenderer::m_pFirstPersonVehicle;
|
CVehicle *CRenderer::m_pFirstPersonVehicle;
|
||||||
@ -109,6 +117,20 @@ CRenderer::PreRender(void)
|
|||||||
for(i = 0; i < ms_nNoOfVisibleEntities; i++)
|
for(i = 0; i < ms_nNoOfVisibleEntities; i++)
|
||||||
ms_aVisibleEntityPtrs[i]->PreRender();
|
ms_aVisibleEntityPtrs[i]->PreRender();
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleVehicles; i++)
|
||||||
|
ms_aVisibleVehiclePtrs[i]->PreRender();
|
||||||
|
// How is this done with cWorldStream?
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleBuildings; i++)
|
||||||
|
ms_aVisibleBuildingPtrs[i]->PreRender();
|
||||||
|
for(node = CVisibilityPlugins::m_alphaBuildingList.head.next;
|
||||||
|
node != &CVisibilityPlugins::m_alphaBuildingList.tail;
|
||||||
|
node = node->next)
|
||||||
|
((CEntity*)node->item.entity)->PreRender();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < ms_nNoOfInVisibleEntities; i++) {
|
for (i = 0; i < ms_nNoOfInVisibleEntities; i++) {
|
||||||
#ifdef SQUEEZE_PERFORMANCE
|
#ifdef SQUEEZE_PERFORMANCE
|
||||||
if (ms_aInVisibleEntityPtrs[i]->IsVehicle() && ((CVehicle*)ms_aInVisibleEntityPtrs[i])->IsHeli())
|
if (ms_aInVisibleEntityPtrs[i]->IsVehicle() && ((CVehicle*)ms_aInVisibleEntityPtrs[i])->IsHeli())
|
||||||
@ -241,6 +263,8 @@ CRenderer::RenderFirstPersonVehicle(void)
|
|||||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IsRoad(CEntity *e) { return e->IsBuilding() && ((CBuilding*)e)->GetIsATreadable(); }
|
||||||
|
|
||||||
void
|
void
|
||||||
CRenderer::RenderRoads(void)
|
CRenderer::RenderRoads(void)
|
||||||
{
|
{
|
||||||
@ -254,7 +278,7 @@ CRenderer::RenderRoads(void)
|
|||||||
|
|
||||||
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
|
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
|
||||||
t = (CTreadable*)ms_aVisibleEntityPtrs[i];
|
t = (CTreadable*)ms_aVisibleEntityPtrs[i];
|
||||||
if(t->IsBuilding() && t->GetIsATreadable()){
|
if(IsRoad(t)){
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
if(gbShowCarRoadGroups || gbShowPedRoadGroups){
|
if(gbShowCarRoadGroups || gbShowPedRoadGroups){
|
||||||
int ind = 0;
|
int ind = 0;
|
||||||
@ -288,7 +312,7 @@ CRenderer::RenderEverythingBarRoads(void)
|
|||||||
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
|
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
|
||||||
e = ms_aVisibleEntityPtrs[i];
|
e = ms_aVisibleEntityPtrs[i];
|
||||||
|
|
||||||
if(e->IsBuilding() && ((CBuilding*)e)->GetIsATreadable())
|
if(IsRoad(e))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
@ -349,6 +373,556 @@ CRenderer::RenderBoats(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
#ifndef LIBRW
|
||||||
|
#error "Need librw for EXTENDED_PIPELINES"
|
||||||
|
#endif
|
||||||
|
#include "WaterLevel.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
// blend passes
|
||||||
|
PASS_NOZ, // no z-write
|
||||||
|
PASS_ADD, // additive
|
||||||
|
PASS_BLEND // normal blend
|
||||||
|
};
|
||||||
|
|
||||||
|
static RwRGBAReal black;
|
||||||
|
|
||||||
|
static void
|
||||||
|
SetStencilState(int state)
|
||||||
|
{
|
||||||
|
switch(state){
|
||||||
|
// disable stencil
|
||||||
|
case 0:
|
||||||
|
rw::SetRenderState(rw::STENCILENABLE, FALSE);
|
||||||
|
break;
|
||||||
|
// test against stencil
|
||||||
|
case 1:
|
||||||
|
rw::SetRenderState(rw::STENCILENABLE, TRUE);
|
||||||
|
rw::SetRenderState(rw::STENCILFUNCTION, rw::STENCILNOTEQUAL);
|
||||||
|
rw::SetRenderState(rw::STENCILPASS, rw::STENCILKEEP);
|
||||||
|
rw::SetRenderState(rw::STENCILFAIL, rw::STENCILKEEP);
|
||||||
|
rw::SetRenderState(rw::STENCILZFAIL, rw::STENCILKEEP);
|
||||||
|
rw::SetRenderState(rw::STENCILFUNCTIONMASK, 0xFF);
|
||||||
|
rw::SetRenderState(rw::STENCILFUNCTIONREF, 0xFF);
|
||||||
|
break;
|
||||||
|
// write to stencil
|
||||||
|
case 2:
|
||||||
|
rw::SetRenderState(rw::STENCILENABLE, TRUE);
|
||||||
|
rw::SetRenderState(rw::STENCILFUNCTION, rw::STENCILALWAYS);
|
||||||
|
rw::SetRenderState(rw::STENCILPASS, rw::STENCILREPLACE);
|
||||||
|
rw::SetRenderState(rw::STENCILFUNCTIONREF, 0xFF);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef RW_D3D9
|
||||||
|
struct BuildingInst
|
||||||
|
{
|
||||||
|
rw::RawMatrix combinedMat;
|
||||||
|
rw::d3d9::InstanceDataHeader *instHeader;
|
||||||
|
uint8 fadeAlpha;
|
||||||
|
bool lighting;
|
||||||
|
};
|
||||||
|
static BuildingInst blendInsts[3][2000];
|
||||||
|
static int numBlendInsts[3];
|
||||||
|
|
||||||
|
static void
|
||||||
|
SetMatrix(BuildingInst *building, rw::Matrix *worldMat)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
RawMatrix world, worldview;
|
||||||
|
Camera *cam = engine->currentCamera;
|
||||||
|
convMatrix(&world, worldMat);
|
||||||
|
RawMatrix::mult(&worldview, &world, &cam->devView);
|
||||||
|
RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsTextureTransparent(RwTexture *tex)
|
||||||
|
{
|
||||||
|
if(tex == nil || tex->raster == nil)
|
||||||
|
return false;
|
||||||
|
return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all opaque meshes and put atomics that needs blending
|
||||||
|
// into the deferred list.
|
||||||
|
static void
|
||||||
|
AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||||
|
building->fadeAlpha = 255;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
|
||||||
|
bool setupDone = false;
|
||||||
|
bool defer = false;
|
||||||
|
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
if(inst->vertexAlpha || m->color.alpha != 255 ||
|
||||||
|
IsTextureTransparent(m->texture)){
|
||||||
|
defer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// alright we're rendering this atomic
|
||||||
|
if(!setupDone){
|
||||||
|
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||||
|
setIndices(building->instHeader->indexBuffer);
|
||||||
|
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||||
|
setVertexShader(default_amb_VS);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
|
||||||
|
if(building->lighting)
|
||||||
|
setAmbient(pAmbient->color);
|
||||||
|
else
|
||||||
|
setAmbient(black);
|
||||||
|
setupDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
if(m->texture){
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
setPixelShader(default_tex_PS);
|
||||||
|
}else
|
||||||
|
setPixelShader(default_PS);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
if(defer)
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||||
|
building->fadeAlpha = fadeAlpha;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
RenderBlendPass(int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
setVertexShader(default_amb_VS);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
|
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||||
|
setIndices(building->instHeader->indexBuffer);
|
||||||
|
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
|
||||||
|
if(building->lighting)
|
||||||
|
setAmbient(pAmbient->color);
|
||||||
|
else
|
||||||
|
setAmbient(black);
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255)
|
||||||
|
continue; // already done this one
|
||||||
|
|
||||||
|
rw::RGBA color = m->color;
|
||||||
|
color.alpha = (color.alpha * building->fadeAlpha)/255;
|
||||||
|
setMaterial(color, m->surfaceProps);
|
||||||
|
|
||||||
|
if(m->texture){
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
setPixelShader(default_tex_PS);
|
||||||
|
}else
|
||||||
|
setPixelShader(default_PS);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef RW_GL3
|
||||||
|
struct BuildingInst
|
||||||
|
{
|
||||||
|
rw::Matrix matrix;
|
||||||
|
rw::gl3::InstanceDataHeader *instHeader;
|
||||||
|
uint8 fadeAlpha;
|
||||||
|
bool lighting;
|
||||||
|
};
|
||||||
|
static BuildingInst blendInsts[3][2000];
|
||||||
|
static int numBlendInsts[3];
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsTextureTransparent(RwTexture *tex)
|
||||||
|
{
|
||||||
|
if(tex == nil || tex->raster == nil)
|
||||||
|
return false;
|
||||||
|
return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all opaque meshes and put atomics that needs blending
|
||||||
|
// into the deferred list.
|
||||||
|
static void
|
||||||
|
AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||||
|
building->fadeAlpha = 255;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
|
||||||
|
WorldLights lights;
|
||||||
|
lights.numAmbients = 1;
|
||||||
|
lights.numDirectionals = 0;
|
||||||
|
lights.numLocals = 0;
|
||||||
|
if(building->lighting)
|
||||||
|
lights.ambient = pAmbient->color;
|
||||||
|
else
|
||||||
|
lights.ambient = black;
|
||||||
|
|
||||||
|
bool setupDone = false;
|
||||||
|
bool defer = false;
|
||||||
|
building->matrix = *atomic->getFrame()->getLTM();
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
if(inst->vertexAlpha || m->color.alpha != 255 ||
|
||||||
|
IsTextureTransparent(m->texture)){
|
||||||
|
defer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// alright we're rendering this atomic
|
||||||
|
if(!setupDone){
|
||||||
|
defaultShader->use();
|
||||||
|
setWorldMatrix(&building->matrix);
|
||||||
|
#ifdef RW_GL_USE_VAOS
|
||||||
|
glBindVertexArray(building->instHeader->vao);
|
||||||
|
#else
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
|
||||||
|
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
setLights(&lights);
|
||||||
|
setupDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
#ifndef RW_GL_USE_VAOS
|
||||||
|
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
if(defer)
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||||
|
building->fadeAlpha = fadeAlpha;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
building->matrix = *atomic->getFrame()->getLTM();
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
RenderBlendPass(int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
defaultShader->use();
|
||||||
|
WorldLights lights;
|
||||||
|
lights.numAmbients = 1;
|
||||||
|
lights.numDirectionals = 0;
|
||||||
|
lights.numLocals = 0;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
|
#ifdef RW_GL_USE_VAOS
|
||||||
|
glBindVertexArray(building->instHeader->vao);
|
||||||
|
#else
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
|
||||||
|
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
setWorldMatrix(&building->matrix);
|
||||||
|
if(building->lighting)
|
||||||
|
lights.ambient = pAmbient->color;
|
||||||
|
else
|
||||||
|
lights.ambient = black;
|
||||||
|
setLights(&lights);
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255)
|
||||||
|
continue; // already done this one
|
||||||
|
|
||||||
|
rw::RGBA color = m->color;
|
||||||
|
color.alpha = (color.alpha * building->fadeAlpha)/255;
|
||||||
|
setMaterial(color, m->surfaceProps);
|
||||||
|
|
||||||
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
#ifndef RW_GL_USE_VAOS
|
||||||
|
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
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());
|
||||||
|
|
||||||
|
int pass = PASS_BLEND;
|
||||||
|
if(mi->m_additive) // very questionable
|
||||||
|
pass = PASS_ADD;
|
||||||
|
if(mi->m_noZwrite)
|
||||||
|
pass = PASS_NOZ;
|
||||||
|
|
||||||
|
if(ent->bDistanceFade){
|
||||||
|
RpAtomic *lodatm;
|
||||||
|
float fadefactor;
|
||||||
|
uint32 alpha;
|
||||||
|
|
||||||
|
lodatm = mi->GetAtomicFromDistance(camdist - FADE_DISTANCE);
|
||||||
|
fadefactor = (mi->GetLargestLodDistance() - (camdist - FADE_DISTANCE))/FADE_DISTANCE;
|
||||||
|
if(fadefactor > 1.0f)
|
||||||
|
fadefactor = 1.0f;
|
||||||
|
alpha = mi->m_alpha * fadefactor;
|
||||||
|
|
||||||
|
if(alpha == 255)
|
||||||
|
AtomicFirstPass(atomic, pass);
|
||||||
|
else{
|
||||||
|
// not quite sure what this is about, do we have to do that?
|
||||||
|
RpGeometry *geo = RpAtomicGetGeometry(lodatm);
|
||||||
|
if(geo != RpAtomicGetGeometry(atomic))
|
||||||
|
RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE);
|
||||||
|
AtomicFullyTransparent(atomic, pass, alpha);
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
AtomicFirstPass(atomic, pass);
|
||||||
|
|
||||||
|
ent->bImBeingRendered = false; // TODO: this seems wrong, but do we even need it?
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CRenderer::RenderWorld(int pass)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CEntity *e;
|
||||||
|
CLink<CVisibilityPlugins::AlphaObjectInfo> *node;
|
||||||
|
|
||||||
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||||
|
DeActivateDirectional();
|
||||||
|
SetAmbientColours();
|
||||||
|
|
||||||
|
// Temporary...have to figure out sorting better
|
||||||
|
switch(pass){
|
||||||
|
case 0:
|
||||||
|
// Roads
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleBuildings; i++){
|
||||||
|
e = ms_aVisibleBuildingPtrs[i];
|
||||||
|
if(e->bIsBIGBuilding || IsRoad(e))
|
||||||
|
RenderOneBuilding(e);
|
||||||
|
}
|
||||||
|
for(node = CVisibilityPlugins::m_alphaBuildingList.tail.prev;
|
||||||
|
node != &CVisibilityPlugins::m_alphaBuildingList.head;
|
||||||
|
node = node->prev){
|
||||||
|
e = node->item.entity;
|
||||||
|
if(e->bIsBIGBuilding || IsRoad(e))
|
||||||
|
RenderOneBuilding(e, node->item.sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
// KLUDGE for road puddles which have to be rendered at road-time
|
||||||
|
// only very temporary, there are more rendering issues
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
|
RenderBlendPass(PASS_BLEND);
|
||||||
|
numBlendInsts[PASS_BLEND] = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// Opaque
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleBuildings; i++){
|
||||||
|
e = ms_aVisibleBuildingPtrs[i];
|
||||||
|
if(!(e->bIsBIGBuilding || IsRoad(e)))
|
||||||
|
RenderOneBuilding(e);
|
||||||
|
}
|
||||||
|
for(node = CVisibilityPlugins::m_alphaBuildingList.tail.prev;
|
||||||
|
node != &CVisibilityPlugins::m_alphaBuildingList.head;
|
||||||
|
node = node->prev){
|
||||||
|
e = node->item.entity;
|
||||||
|
if(!(e->bIsBIGBuilding || IsRoad(e)))
|
||||||
|
RenderOneBuilding(e, node->item.sort);
|
||||||
|
}
|
||||||
|
// Now we have iterated through all visible buildings (unsorted and sorted)
|
||||||
|
// and the transparency list is done.
|
||||||
|
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
|
||||||
|
RenderBlendPass(PASS_NOZ);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// Transparent
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||||
|
RenderBlendPass(PASS_ADD);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
|
RenderBlendPass(PASS_BLEND);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CRenderer::RenderPeds(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CEntity *e;
|
||||||
|
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
|
||||||
|
e = ms_aVisibleVehiclePtrs[i];
|
||||||
|
if(e->IsPed())
|
||||||
|
RenderOneNonRoad(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CRenderer::RenderVehicles(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CEntity *e;
|
||||||
|
EntityInfo ei;
|
||||||
|
CLink<EntityInfo> *node;
|
||||||
|
|
||||||
|
// not the real thing
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
|
||||||
|
e = ms_aVisibleVehiclePtrs[i];
|
||||||
|
if(!e->IsVehicle())
|
||||||
|
continue;
|
||||||
|
// if(PutIntoSortedVehicleList((CVehicle*)e))
|
||||||
|
// continue; // boats handled elsewhere
|
||||||
|
ei.ent = e;
|
||||||
|
ei.sort = (ms_vecCameraPosition - e->GetPosition()).MagnitudeSqr();
|
||||||
|
gSortedVehiclesAndPeds.InsertSorted(ei);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(node = gSortedVehiclesAndPeds.tail.prev;
|
||||||
|
node != &gSortedVehiclesAndPeds.head;
|
||||||
|
node = node->prev)
|
||||||
|
RenderOneNonRoad(node->item.ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CRenderer::RenderWater(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CEntity *e;
|
||||||
|
|
||||||
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||||
|
SetStencilState(2);
|
||||||
|
|
||||||
|
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
|
||||||
|
e = ms_aVisibleVehiclePtrs[i];
|
||||||
|
if(e->IsVehicle() && ((CVehicle*)e)->IsBoat())
|
||||||
|
((CBoat*)e)->RenderWaterOutPolys();
|
||||||
|
}
|
||||||
|
|
||||||
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||||
|
SetStencilState(1);
|
||||||
|
|
||||||
|
CWaterLevel::RenderWater();
|
||||||
|
|
||||||
|
SetStencilState(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CRenderer::ClearForFrame(void)
|
||||||
|
{
|
||||||
|
ms_nNoOfVisibleEntities = 0;
|
||||||
|
ms_nNoOfVisibleVehicles = 0;
|
||||||
|
ms_nNoOfVisibleBuildings = 0;
|
||||||
|
ms_nNoOfInVisibleEntities = 0;
|
||||||
|
gSortedVehiclesAndPeds.Clear();
|
||||||
|
|
||||||
|
numBlendInsts[PASS_NOZ] = 0;
|
||||||
|
numBlendInsts[PASS_ADD] = 0;
|
||||||
|
numBlendInsts[PASS_BLEND] = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
CRenderer::RenderFadingInEntities(void)
|
CRenderer::RenderFadingInEntities(void)
|
||||||
{
|
{
|
||||||
@ -634,9 +1208,14 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
|
|||||||
|
|
||||||
void
|
void
|
||||||
CRenderer::ConstructRenderList(void)
|
CRenderer::ConstructRenderList(void)
|
||||||
|
{
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(!gbNewRenderer)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
ms_nNoOfVisibleEntities = 0;
|
ms_nNoOfVisibleEntities = 0;
|
||||||
ms_nNoOfInVisibleEntities = 0;
|
ms_nNoOfInVisibleEntities = 0;
|
||||||
|
}
|
||||||
ms_vecCameraPosition = TheCamera.GetPosition();
|
ms_vecCameraPosition = TheCamera.GetPosition();
|
||||||
|
|
||||||
// unused
|
// unused
|
||||||
@ -1122,6 +1701,20 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CRenderer::InsertEntityIntoList(CEntity *ent)
|
||||||
|
{
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
// TODO: there are more flags being checked here
|
||||||
|
if(gbNewRenderer && (ent->IsVehicle() || ent->IsPed()))
|
||||||
|
ms_aVisibleVehiclePtrs[ms_nNoOfVisibleVehicles++] = ent;
|
||||||
|
else if(gbNewRenderer && ent->IsBuilding())
|
||||||
|
ms_aVisibleBuildingPtrs[ms_nNoOfVisibleBuildings++] = ent;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CRenderer::ScanBigBuildingList(CPtrList &list)
|
CRenderer::ScanBigBuildingList(CPtrList &list)
|
||||||
{
|
{
|
||||||
@ -1136,7 +1729,7 @@ CRenderer::ScanBigBuildingList(CPtrList &list)
|
|||||||
#endif
|
#endif
|
||||||
if(!ent->bZoneCulled){
|
if(!ent->bZoneCulled){
|
||||||
if(SetupBigBuildingVisibility(ent) == VIS_VISIBLE)
|
if(SetupBigBuildingVisibility(ent) == VIS_VISIBLE)
|
||||||
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
InsertEntityIntoList(ent);
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
EntitiesRendered++;
|
EntitiesRendered++;
|
||||||
RenderedBigBuildings++;
|
RenderedBigBuildings++;
|
||||||
@ -1167,7 +1760,7 @@ CRenderer::ScanSectorList(CPtrList *lists)
|
|||||||
if(IsEntityCullZoneVisible(ent)){
|
if(IsEntityCullZoneVisible(ent)){
|
||||||
switch(SetupEntityVisibility(ent)){
|
switch(SetupEntityVisibility(ent)){
|
||||||
case VIS_VISIBLE:
|
case VIS_VISIBLE:
|
||||||
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
InsertEntityIntoList(ent);
|
||||||
break;
|
break;
|
||||||
case VIS_INVISIBLE:
|
case VIS_INVISIBLE:
|
||||||
if(!IsGlass(ent->GetModelIndex()))
|
if(!IsGlass(ent->GetModelIndex()))
|
||||||
@ -1210,7 +1803,7 @@ CRenderer::ScanSectorList(CPtrList *lists)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable() && !CStreaming::ms_disableStreaming){
|
}else if(IsRoad(ent) && !CStreaming::ms_disableStreaming){
|
||||||
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
||||||
if(!m_loadingPriority || CStreaming::ms_numModelsRequested < 10)
|
if(!m_loadingPriority || CStreaming::ms_numModelsRequested < 10)
|
||||||
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
||||||
@ -1243,7 +1836,7 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
|
|||||||
if(IsEntityCullZoneVisible(ent)){
|
if(IsEntityCullZoneVisible(ent)){
|
||||||
switch(SetupEntityVisibility(ent)){
|
switch(SetupEntityVisibility(ent)){
|
||||||
case VIS_VISIBLE:
|
case VIS_VISIBLE:
|
||||||
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
InsertEntityIntoList(ent);
|
||||||
break;
|
break;
|
||||||
case VIS_INVISIBLE:
|
case VIS_INVISIBLE:
|
||||||
if(!IsGlass(ent->GetModelIndex()))
|
if(!IsGlass(ent->GetModelIndex()))
|
||||||
@ -1289,7 +1882,7 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable() && !CStreaming::ms_disableStreaming){
|
}else if(IsRoad(ent) && !CStreaming::ms_disableStreaming){
|
||||||
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
||||||
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
||||||
}else{
|
}else{
|
||||||
@ -1320,7 +1913,7 @@ CRenderer::ScanSectorList_Subway(CPtrList *lists)
|
|||||||
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
||||||
switch(SetupEntityVisibility(ent)){
|
switch(SetupEntityVisibility(ent)){
|
||||||
case VIS_VISIBLE:
|
case VIS_VISIBLE:
|
||||||
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
InsertEntityIntoList(ent);
|
||||||
break;
|
break;
|
||||||
case VIS_OFFSCREEN:
|
case VIS_OFFSCREEN:
|
||||||
dx = ms_vecCameraPosition.x - ent->GetPosition().x;
|
dx = ms_vecCameraPosition.x - ent->GetPosition().x;
|
||||||
|
@ -40,6 +40,13 @@ class CRenderer
|
|||||||
static CEntity *ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
|
static CEntity *ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
|
||||||
static int32 ms_nNoOfInVisibleEntities;
|
static int32 ms_nNoOfInVisibleEntities;
|
||||||
static CEntity *ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
|
static CEntity *ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
static int32 ms_nNoOfVisibleVehicles;
|
||||||
|
static CEntity *ms_aVisibleVehiclePtrs[NUMVISIBLEENTITIES];
|
||||||
|
// for cWorldStream emulation
|
||||||
|
static int32 ms_nNoOfVisibleBuildings;
|
||||||
|
static CEntity *ms_aVisibleBuildingPtrs[NUMVISIBLEENTITIES];
|
||||||
|
#endif
|
||||||
|
|
||||||
static CVector ms_vecCameraPosition;
|
static CVector ms_vecCameraPosition;
|
||||||
static CVehicle *m_pFirstPersonVehicle;
|
static CVehicle *m_pFirstPersonVehicle;
|
||||||
@ -90,4 +97,15 @@ public:
|
|||||||
static bool IsVehicleCullZoneVisible(CEntity *ent);
|
static bool IsVehicleCullZoneVisible(CEntity *ent);
|
||||||
|
|
||||||
static void RemoveVehiclePedLights(CEntity *ent, bool reset);
|
static void RemoveVehiclePedLights(CEntity *ent, bool reset);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
static void ClearForFrame(void);
|
||||||
|
static void RenderPeds(void);
|
||||||
|
static void RenderVehicles(void); // also renders peds in LCS
|
||||||
|
static void RenderOneBuilding(CEntity *ent, float camdist = 0.0f);
|
||||||
|
static void RenderWorld(int pass); // like cWorldStream::Render(int)
|
||||||
|
static void RenderWater(void); // keep-out polys and water
|
||||||
|
#endif
|
||||||
|
static void InsertEntityIntoList(CEntity *ent);
|
||||||
};
|
};
|
||||||
|
@ -141,6 +141,9 @@ CSpecialFX::Render(void)
|
|||||||
CBrightLights::Render();
|
CBrightLights::Render();
|
||||||
CShinyTexts::Render();
|
CShinyTexts::Render();
|
||||||
CMoneyMessages::Render();
|
CMoneyMessages::Render();
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(!(gbNewRenderer && FredIsInFirstPersonCam()))
|
||||||
|
#endif
|
||||||
C3dMarkers::Render();
|
C3dMarkers::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
|
#include "main.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "Lights.h"
|
#include "Lights.h"
|
||||||
@ -14,6 +15,9 @@
|
|||||||
|
|
||||||
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaList;
|
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaList;
|
||||||
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaEntityList;
|
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaEntityList;
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaBuildingList;
|
||||||
|
#endif
|
||||||
|
|
||||||
int32 CVisibilityPlugins::ms_atomicPluginOffset = -1;
|
int32 CVisibilityPlugins::ms_atomicPluginOffset = -1;
|
||||||
int32 CVisibilityPlugins::ms_framePluginOffset = -1;
|
int32 CVisibilityPlugins::ms_framePluginOffset = -1;
|
||||||
@ -158,6 +162,12 @@ CVisibilityPlugins::Initialise(void)
|
|||||||
#endif // ASPECT_RATIO_SCALE
|
#endif // ASPECT_RATIO_SCALE
|
||||||
m_alphaEntityList.head.item.sort = 0.0f;
|
m_alphaEntityList.head.item.sort = 0.0f;
|
||||||
m_alphaEntityList.tail.item.sort = 100000000.0f;
|
m_alphaEntityList.tail.item.sort = 100000000.0f;
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
m_alphaBuildingList.Init(NUMALPHAENTITYLIST);
|
||||||
|
m_alphaBuildingList.head.item.sort = 0.0f;
|
||||||
|
m_alphaBuildingList.tail.item.sort = 100000000.0f;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -165,12 +175,18 @@ CVisibilityPlugins::Shutdown(void)
|
|||||||
{
|
{
|
||||||
m_alphaList.Shutdown();
|
m_alphaList.Shutdown();
|
||||||
m_alphaEntityList.Shutdown();
|
m_alphaEntityList.Shutdown();
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
m_alphaBuildingList.Shutdown();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CVisibilityPlugins::InitAlphaEntityList(void)
|
CVisibilityPlugins::InitAlphaEntityList(void)
|
||||||
{
|
{
|
||||||
m_alphaEntityList.Clear();
|
m_alphaEntityList.Clear();
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
m_alphaBuildingList.Clear();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -179,6 +195,10 @@ CVisibilityPlugins::InsertEntityIntoSortedList(CEntity *e, float dist)
|
|||||||
AlphaObjectInfo item;
|
AlphaObjectInfo item;
|
||||||
item.entity = e;
|
item.entity = e;
|
||||||
item.sort = dist;
|
item.sort = dist;
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer && e->IsBuilding())
|
||||||
|
return !!m_alphaBuildingList.InsertSorted(item);
|
||||||
|
#endif
|
||||||
bool ret = !!m_alphaEntityList.InsertSorted(item);
|
bool ret = !!m_alphaEntityList.InsertSorted(item);
|
||||||
// if(!ret)
|
// if(!ret)
|
||||||
// printf("list full %d\n", m_alphaEntityList.Count());
|
// printf("list full %d\n", m_alphaEntityList.Count());
|
||||||
|
@ -22,6 +22,9 @@ public:
|
|||||||
|
|
||||||
static CLinkList<AlphaObjectInfo> m_alphaList;
|
static CLinkList<AlphaObjectInfo> m_alphaList;
|
||||||
static CLinkList<AlphaObjectInfo> m_alphaEntityList;
|
static CLinkList<AlphaObjectInfo> m_alphaEntityList;
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
static CLinkList<AlphaObjectInfo> m_alphaBuildingList;
|
||||||
|
#endif
|
||||||
static RwCamera *ms_pCamera;
|
static RwCamera *ms_pCamera;
|
||||||
static RwV3d *ms_pCameraPosn;
|
static RwV3d *ms_pCameraPosn;
|
||||||
static float ms_cullCompsDist;
|
static float ms_cullCompsDist;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
@ -719,6 +720,15 @@ CBoat::Render()
|
|||||||
((CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()))->SetVehicleColour(m_currentColour1, m_currentColour2);
|
((CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()))->SetVehicleColour(m_currentColour1, m_currentColour2);
|
||||||
if (!CVehicle::bWheelsOnlyCheat)
|
if (!CVehicle::bWheelsOnlyCheat)
|
||||||
CEntity::Render();
|
CEntity::Render();
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(!gbNewRenderer)
|
||||||
|
#endif
|
||||||
|
RenderWaterOutPolys(); // not separate function in III
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CBoat::RenderWaterOutPolys(void)
|
||||||
|
{
|
||||||
KeepWaterOutIndices[0] = 0;
|
KeepWaterOutIndices[0] = 0;
|
||||||
KeepWaterOutIndices[1] = 2;
|
KeepWaterOutIndices[1] = 2;
|
||||||
KeepWaterOutIndices[2] = 1;
|
KeepWaterOutIndices[2] = 1;
|
||||||
@ -758,19 +768,29 @@ CBoat::Render()
|
|||||||
KeepWaterOutVertices[2].v = 1.0f;
|
KeepWaterOutVertices[2].v = 1.0f;
|
||||||
KeepWaterOutVertices[3].u = 1.0f;
|
KeepWaterOutVertices[3].u = 1.0f;
|
||||||
KeepWaterOutVertices[3].v = 1.0f;
|
KeepWaterOutVertices[3].v = 1.0f;
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(!gbNewRenderer)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpWaterRaster);
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpWaterRaster);
|
||||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
|
||||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||||
|
}
|
||||||
if (!CVehicle::bWheelsOnlyCheat && RwIm3DTransform(KeepWaterOutVertices, 4, GetMatrix().m_attachment, rwIM3D_VERTEXUV)) {
|
if (!CVehicle::bWheelsOnlyCheat && RwIm3DTransform(KeepWaterOutVertices, 4, GetMatrix().m_attachment, rwIM3D_VERTEXUV)) {
|
||||||
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, KeepWaterOutIndices, 6);
|
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, KeepWaterOutIndices, 6);
|
||||||
RwIm3DEnd();
|
RwIm3DEnd();
|
||||||
}
|
}
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(!gbNewRenderer)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CBoat::Teleport(CVector v)
|
CBoat::Teleport(CVector v)
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
virtual bool IsComponentPresent(int32 component) { return true; }
|
virtual bool IsComponentPresent(int32 component) { return true; }
|
||||||
virtual void BlowUpCar(CEntity *ent);
|
virtual void BlowUpCar(CEntity *ent);
|
||||||
|
|
||||||
|
void RenderWaterOutPolys(void);
|
||||||
void ApplyWaterResistance(void);
|
void ApplyWaterResistance(void);
|
||||||
void SetupModelNodes();
|
void SetupModelNodes();
|
||||||
void PruneWakeTrail(void);
|
void PruneWakeTrail(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user