From da08ee36b479a42531df2a0bafdf03f475e30d8b Mon Sep 17 00:00:00 2001 From: torcs-ng Date: Fri, 3 Apr 2020 23:56:05 +0000 Subject: [PATCH] - Update OsgCar for shaders git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6889 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: f293d68004f66ea1754250be943408b40123d165 Former-commit-id: 64fabb71b5d5ac68df20f830dc01c3a8f01680ba --- src/interfaces/graphic.h | 1 + src/modules/graphic/osggraph/Car/OsgCar.cpp | 4 +++- src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp | 1 + src/modules/graphic/osggraph/Render/OsgRender.cpp | 3 ++- .../legacymenu/confscreens/advancedgraphconfig.cpp | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/interfaces/graphic.h b/src/interfaces/graphic.h index 506040e6a..c8d1e9b96 100644 --- a/src/interfaces/graphic.h +++ b/src/interfaces/graphic.h @@ -98,6 +98,7 @@ #define GR_ATT_AGR_MEDIUM "medium" #define GR_ATT_AGR_FULL "full" #define GR_ATT_AGR_HIGH "high" +#define GR_ATT_AGR_ULTRA "ultra" #define GR_ATT_ENV_SIZE "environment size" #define GR_ATT_NB_SCREENS "number of screens" diff --git a/src/modules/graphic/osggraph/Car/OsgCar.cpp b/src/modules/graphic/osggraph/Car/OsgCar.cpp index 58fe39203..0108115fa 100644 --- a/src/modules/graphic/osggraph/Car/OsgCar.cpp +++ b/src/modules/graphic/osggraph/Car/OsgCar.cpp @@ -108,6 +108,7 @@ osg::ref_ptr SDCar::loadCar(tCarElt *Car, bool tracktype, bool subcat int nranges = 0; _carShader = carshader; + GfLogInfo("Graphic options car shader = %u\n", _carShader); #if 1 osgLoader loader; @@ -869,11 +870,12 @@ void SDCar::updateCar() else pLightBrake->setSingleChildOn(1); } + wheels.updateWheels(); this->car_branch->setMatrix(mat); - if(_carShader == 2) + if(_carShader > 2) reflectionMapping->update(); this->setReflectionMap(reflectionMapping->getReflectionMap()); diff --git a/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp b/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp index b4bb0dd25..ee2dc10f5 100644 --- a/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp +++ b/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp @@ -102,6 +102,7 @@ SDReflectionMapping::SDReflectionMapping(SDCar *c): { SDScreens * screens = (SDScreens*)getScreens(); screens->registerViewDependantPreRenderNode(this->getCamerasRoot()); + GfLogInfo("Graphic options : reflectionShader = %u\n", reflectionShader); cameras[4]->setNodeMask(NODE_MASK_ALL); } diff --git a/src/modules/graphic/osggraph/Render/OsgRender.cpp b/src/modules/graphic/osggraph/Render/OsgRender.cpp index 9539565a8..8cdca0144 100644 --- a/src/modules/graphic/osggraph/Render/OsgRender.cpp +++ b/src/modules/graphic/osggraph/Render/OsgRender.cpp @@ -67,7 +67,7 @@ static const char* TexSizeValues[] = { GR_ATT_SHADOW_512, GR_ATT_SHADOW_1024, GR static const int NbTexSizeValues = sizeof(TexSizeValues) / sizeof(TexSizeValues[0]); static const char* QualityValues[] = { GR_ATT_AGR_LITTLE, GR_ATT_AGR_MEDIUM, GR_ATT_AGR_FULL }; static const int NbQualityValues = sizeof(QualityValues) / sizeof(QualityValues[0]); -static const char* ShadersValues[] = { GR_ATT_AGR_NULL, GR_ATT_AGR_LITTLE, GR_ATT_AGR_FULL }; +static const char* ShadersValues[] = { GR_ATT_AGR_NULL, GR_ATT_AGR_LITTLE, GR_ATT_AGR_MEDIUM, GR_ATT_AGR_FULL, GR_ATT_AGR_HIGH, GR_ATT_AGR_ULTRA }; static const int NbShadersValues = sizeof(ShadersValues) / sizeof(ShadersValues[0]); static const int CloudsTextureIndices[TR_CLOUDS_FULL+1] = {1, 3, 5, 7, 8}; static const int NCloudsTextureIndices = sizeof(CloudsTextureIndices) / sizeof(int); @@ -258,6 +258,7 @@ void SDRender::Init(tTrack *track) GfLogInfo("Graphic options : Shadow Type : %u\n", ShadowIndex); GfLogInfo("Graphic options : Shadow Texture Size : %u\n", ShadowTexSize); GfLogInfo("Graphic options : Shadow Quality : %u\n", QualityIndex); + GfLogInfo("Graphic options : Shader Quality : %u\n", carsShader); NStars = NMaxStars; if (AStarsData) diff --git a/src/modules/userinterface/legacymenu/confscreens/advancedgraphconfig.cpp b/src/modules/userinterface/legacymenu/confscreens/advancedgraphconfig.cpp index a58b7c369..b292ce6e0 100644 --- a/src/modules/userinterface/legacymenu/confscreens/advancedgraphconfig.cpp +++ b/src/modules/userinterface/legacymenu/confscreens/advancedgraphconfig.cpp @@ -43,7 +43,7 @@ static const char* TexSizeValues[] = { GR_ATT_SHADOW_512, GR_ATT_SHADOW_1024, GR static const int NbTexSizeValues = sizeof(TexSizeValues) / sizeof(TexSizeValues[0]); static const char* QualityValues[] = { GR_ATT_AGR_LITTLE, GR_ATT_AGR_MEDIUM, GR_ATT_AGR_FULL }; static const int NbQualityValues = sizeof(QualityValues) / sizeof(QualityValues[0]); -static const char* ShadersValues[] = { GR_ATT_AGR_NULL, GR_ATT_AGR_LITTLE, GR_ATT_AGR_FULL }; +static const char* ShadersValues[] = { GR_ATT_AGR_NULL, GR_ATT_AGR_LITTLE, GR_ATT_AGR_MEDIUM, GR_ATT_AGR_FULL, GR_ATT_AGR_HIGH, GR_ATT_AGR_ULTRA }; static const int NbShadersValues = sizeof(ShadersValues) / sizeof(ShadersValues[0]); static const char* SpansplitValues[] = { GR_VAL_NO, GR_VAL_YES }; static const int NbSpansplitValues = sizeof(SpansplitValues) / sizeof(SpansplitValues[0]);