- Removed OsgShadowVolume (deprecated on OSG 3.6)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6536 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 421508d050df4666568d3d32eb4284fe175f2874
Former-commit-id: db47902a82d56d42a0b95dc67bf1f71aeb3482f4
This commit is contained in:
torcs-ng 2018-05-27 15:26:51 +00:00
parent 912f56f2eb
commit 0157e79761
3 changed files with 121 additions and 135 deletions

View file

@ -16,8 +16,8 @@
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _GRAPHV1_H_
#define _GRAPHV1_H_
@ -81,7 +81,6 @@
#define GR_ATT_SHADOW_SSM "soft shadowmap"
#define GR_ATT_SHADOW_PSSM "paralele shadowmap"
#define GR_ATT_SHADOW_LSPM "light shadowmap"
#define GR_ATT_SHADOW_VOLUME "shadow volume"
#define GR_ATT_SHADOW_VDSM "view dependent shadowmap"
#define GR_ATT_SHADOW_SIZE "texture shadow size"
@ -116,7 +115,7 @@
#define GR_ATT_REAR_LEVEL2 "Rear Level Group 2"
#define GR_ATT_REAR_LEVEL1 "Rear Level Group 1"
#define GR_ATT_FRONT_MAP1 "Front Level Map 1"
#define GR_ATT_FRONT_MAP1 "Front Level Map 1"
#define GR_ATT_FRONT_MAP2 "Front Level Map 2"
#define GR_ATT_FRONT_MAP3 "Front Level Map 3"
#define GR_ATT_REAR_MAP1 "Rear Level Map 1"

View file

@ -61,7 +61,7 @@
#define SCARCE_CLOUD 5
#define COVERAGE_CLOUD 8
static const char* ShadowValues[] = { GR_ATT_SHADOW_NONE, GR_ATT_SHADOW_SM, GR_ATT_SHADOW_SSM, GR_ATT_SHADOW_PSSM, GR_ATT_SHADOW_LSPM, GR_ATT_SHADOW_VOLUME, GR_ATT_SHADOW_VDSM};
static const char* ShadowValues[] = { GR_ATT_SHADOW_NONE, GR_ATT_SHADOW_SM, GR_ATT_SHADOW_SSM, GR_ATT_SHADOW_PSSM, GR_ATT_SHADOW_LSPM, GR_ATT_SHADOW_VDSM};
static const int NbShadowValues = sizeof(ShadowValues) / sizeof(ShadowValues[0]);
static const char* TexSizeValues[] = { GR_ATT_SHADOW_512, GR_ATT_SHADOW_1024, GR_ATT_SHADOW_2048, GR_ATT_SHADOW_4096, GR_ATT_SHADOW_8192 };
static const int NbTexSizeValues = sizeof(TexSizeValues) / sizeof(TexSizeValues[0]);
@ -546,19 +546,6 @@ void SDRender::ShadowedScene()
shadowRoot->setShadowTechnique((lspsm.get()));
}
else if (ShadowIndex == 5)
{
osg::DisplaySettings::instance()->setMinimumNumStencilBits(8);
osg::ref_ptr<osgShadow::ShadowVolume> sv = new osgShadow::ShadowVolume;
sv->setDynamicShadowVolumes(1);
sv->setDrawMode(osgShadow::ShadowVolumeGeometry::GEOMETRY);
shadowRoot = new osgShadow::ShadowedScene;
shadowRoot->setReceivesShadowTraversalMask(rcvShadowMask);
shadowRoot->setCastsShadowTraversalMask(castShadowMask);
shadowRoot->setShadowTechnique((sv.get()));
}
else if (ShadowIndex == 6)
{
osg::ref_ptr<osgShadow::ShadowSettings> shadowSettings = new osgShadow::ShadowSettings;
shadowSettings->setTextureSize(osg::Vec2s(ShadowTexSize, ShadowTexSize));

View file

@ -17,8 +17,8 @@
* *
***************************************************************************/
/** @file
/** @file
@author <a href=mailto:bertauxx@yahoo.fr>Xavier Bertaux</a>
@version $Id: advancedgraphconfig.cpp 4542 2012-05-13 17:24:29Z torcs-ng $
*/
@ -37,7 +37,7 @@ static const char* BackgroundTypeValues[] = { GR_ATT_BGSKY_RING, GR_ATT_BGSKY_LA
static const int NbBackgroundTypeValues = sizeof(BackgroundTypeValues) / sizeof(BackgroundTypeValues[0]);
//static const char* SpectatorValues[] = { GR_ATT_AGR_NULL, GR_ATT_AGR_LITTLE, GR_ATT_AGR_MEDIUM, GR_ATT_AGR_FULL, GR_ATT_AGR_HIGH };
//static const int NbSpectatorValues = sizeof(SpectatorValues) / sizeof(SpectatorValues[0]);
static const char* ShadowValues[] = { GR_ATT_SHADOW_NONE, GR_ATT_SHADOW_SM, GR_ATT_SHADOW_SSM, GR_ATT_SHADOW_PSSM, GR_ATT_SHADOW_LSPM, GR_ATT_SHADOW_VOLUME, GR_ATT_SHADOW_VDSM};
static const char* ShadowValues[] = { GR_ATT_SHADOW_NONE, GR_ATT_SHADOW_SM, GR_ATT_SHADOW_SSM, GR_ATT_SHADOW_PSSM, GR_ATT_SHADOW_LSPM, GR_ATT_SHADOW_VDSM};
static const int NbShadowValues = sizeof(ShadowValues) / sizeof(ShadowValues[0]);
static const char* TexSizeValues[] = { GR_ATT_SHADOW_512, GR_ATT_SHADOW_1024, GR_ATT_SHADOW_2048, GR_ATT_SHADOW_4096, GR_ATT_SHADOW_8192 };
static const int NbTexSizeValues = sizeof(TexSizeValues) / sizeof(TexSizeValues[0]);
@ -86,53 +86,53 @@ loadOptions()
snprintf(buf, sizeof(buf), "%s%s", GfLocalDir(), GR_PARAM_FILE);
void* grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
BackgroundTypeIndex = 0; // Default value index, in case file value not found in list.
const char* pszBackgroundType =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_BGSKYTYPE, GR_ATT_BGSKY_RING);
for (int i = 0; i < NbBackgroundTypeValues; i++)
{
if (!strcmp(pszBackgroundType, BackgroundTypeValues[i]))
{
BackgroundTypeIndex = i;
break;
}
}
BackgroundTypeIndex = 0; // Default value index, in case file value not found in list.
const char* pszBackgroundType =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_BGSKYTYPE, GR_ATT_BGSKY_RING);
for (int i = 0; i < NbBackgroundTypeValues; i++)
{
if (!strcmp(pszBackgroundType, BackgroundTypeValues[i]))
{
BackgroundTypeIndex = i;
break;
}
}
ShadowIndex = 0; // Default value index, in case file value not found in list.
const char* pszShadow =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SHADOW_TYPE, GR_ATT_SHADOW_NONE);
for (int i = 0; i < NbShadowValues; i++)
{
{
if (!strcmp(pszShadow, ShadowValues[i]))
{
{
ShadowIndex = i;
break;
}
}
break;
}
}
TexSizeIndex = 0; // Default value index, in case file value not found in list.
const char* pszTexSize =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SHADOW_SIZE, GR_ATT_SHADOW_1024);
for (int i = 0; i < NbTexSizeValues; i++)
{
{
if (!strcmp(pszTexSize, TexSizeValues[i]))
{
{
TexSizeIndex = i;
break;
}
}
break;
}
}
QualityIndex = 0; // Default value index, in case file value not found in list.
const char* pszQuality =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_AGR_QUALITY, GR_ATT_AGR_NULL);
for (int i = 0; i < NbQualityValues; i++)
{
{
if (!strcmp(pszQuality, QualityValues[i]))
{
{
QualityIndex = i;
break;
}
}
break;
}
}
ShadersIndex = 0; // Default value index, in case file value not found in list.
const char* pszShaders =
@ -146,62 +146,62 @@ loadOptions()
}
}
SpansplitIndex = 0; // Default value index, in case file value not found in list.
const char* pszSpansplit =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SPANSPLIT, GR_VAL_NO);
for (int i = 0; i < NbSpansplitValues; i++)
{
if (!strcmp(pszSpansplit, SpansplitValues[i]))
{
SpansplitIndex = i;
break;
}
}
SpansplitIndex = 0; // Default value index, in case file value not found in list.
const char* pszSpansplit =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SPANSPLIT, GR_VAL_NO);
for (int i = 0; i < NbSpansplitValues; i++)
{
if (!strcmp(pszSpansplit, SpansplitValues[i]))
{
SpansplitIndex = i;
break;
}
}
BezelComp = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_BEZELCOMP, "%", 110.0f);
if (BezelComp > 150.0f) {
BezelComp = 150.0f;
}
else if (BezelComp < 50.0f) {
BezelComp = 50.0f;
}
BezelComp = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_BEZELCOMP, "%", 110.0f);
if (BezelComp > 150.0f) {
BezelComp = 150.0f;
}
else if (BezelComp < 50.0f) {
BezelComp = 50.0f;
}
sprintf(buf, "%g", BezelComp);
GfuiEditboxSetString(ScrHandle, BezelCompId, buf);
sprintf(buf, "%g", BezelComp);
GfuiEditboxSetString(ScrHandle, BezelCompId, buf);
ScreenDist = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SCREENDIST, NULL, 1.0f);
if (ScreenDist > 5.0f) {
ScreenDist = 5.0f;
}
else if (ScreenDist < 0.0f) {
ScreenDist = 0.0f;
}
ScreenDist = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SCREENDIST, NULL, 1.0f);
if (ScreenDist > 5.0f) {
ScreenDist = 5.0f;
}
else if (ScreenDist < 0.0f) {
ScreenDist = 0.0f;
}
sprintf(buf, "%g", ScreenDist);
GfuiEditboxSetString(ScrHandle, ScreenDistId, buf);
sprintf(buf, "%g", ScreenDist);
GfuiEditboxSetString(ScrHandle, ScreenDistId, buf);
ArcRatio = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_ARCRATIO, NULL, 1.0f);
if (ArcRatio > 2.0f) {
ArcRatio = 2.0f;
}
else if (ArcRatio < 0.0f) {
ArcRatio = 0.0f;
}
ArcRatio = GfParmGetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_ARCRATIO, NULL, 1.0f);
if (ArcRatio > 2.0f) {
ArcRatio = 2.0f;
}
else if (ArcRatio < 0.0f) {
ArcRatio = 0.0f;
}
sprintf(buf, "%g", ArcRatio);
GfuiEditboxSetString(ScrHandle, ArcRatioId, buf);
sprintf(buf, "%g", ArcRatio);
GfuiEditboxSetString(ScrHandle, ArcRatioId, buf);
MonitorIndex = 0; // Default value index, in case file value not found in list.
const char* pszMonitor =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_MONITOR, GR_VAL_MONITOR_16BY9);
for (int i = 0; i < NbMonitorValues; i++)
{
if (!strcmp(pszMonitor, MonitorValues[i]))
{
MonitorIndex = i;
break;
}
}
MonitorIndex = 0; // Default value index, in case file value not found in list.
const char* pszMonitor =
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_MONITOR, GR_VAL_MONITOR_16BY9);
for (int i = 0; i < NbMonitorValues; i++)
{
if (!strcmp(pszMonitor, MonitorValues[i]))
{
MonitorIndex = i;
break;
}
}
GfParmReleaseHandle(grHandle);
}
@ -214,20 +214,20 @@ saveOptions()
snprintf(buf, sizeof(buf), "%s%s", GfLocalDir(), GR_PARAM_FILE);
void* grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_BGSKYTYPE, BackgroundTypeValues[BackgroundTypeIndex]);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SHADOW_TYPE, ShadowValues[ShadowIndex]);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SHADOW_SIZE, TexSizeValues[TexSizeIndex]);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_AGR_QUALITY, QualityValues[QualityIndex]);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SHADERS, ShadersValues[ShadersIndex]);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SPANSPLIT, SpansplitValues[SpansplitIndex]);
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_BEZELCOMP, "%", BezelComp);
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SCREENDIST, NULL, ScreenDist);
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_ARCRATIO, NULL, ArcRatio);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_MONITOR, MonitorValues[MonitorIndex]);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SPANSPLIT, SpansplitValues[SpansplitIndex]);
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_BEZELCOMP, "%", BezelComp);
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_SCREENDIST, NULL, ScreenDist);
GfParmSetNum(grHandle, GR_SCT_GRAPHIC, GR_ATT_ARCRATIO, NULL, ArcRatio);
GfParmSetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_MONITOR, MonitorValues[MonitorIndex]);
GfParmWriteFile(NULL, grHandle, "graph");
GfParmReleaseHandle(grHandle);
}
@ -263,7 +263,7 @@ onChangeQuality(void* vp)
const long delta = (long)vp;
QualityIndex = (QualityIndex + NbQualityValues + delta) % NbQualityValues;
GfuiLabelSetText(ScrHandle, QualityLabelId, QualityValues[QualityIndex]);
}
}
static void
onChangeShaders(void* vp)
@ -283,7 +283,7 @@ onChangeSpansplit(void* vp)
GfuiEnable(ScrHandle, BezelCompId, SpansplitIndex ? GFUI_ENABLE : GFUI_DISABLE);
GfuiEnable(ScrHandle, ScreenDistId, SpansplitIndex ? GFUI_ENABLE : GFUI_DISABLE);
GfuiEnable(ScrHandle, ArcRatioId, SpansplitIndex ? GFUI_ENABLE : GFUI_DISABLE);
}
}
static void
onChangeBezelComp(void * )
@ -291,10 +291,10 @@ onChangeBezelComp(void * )
char* val = GfuiEditboxGetString(ScrHandle, BezelCompId);
sscanf(val, "%g", &BezelComp);
if (BezelComp > 150.0f)
BezelComp = 150.0f;
BezelComp = 150.0f;
else if (BezelComp < 50.0f)
BezelComp = 50.0f;
BezelComp = 50.0f;
char buf[32];
sprintf(buf, "%g", BezelComp);
GfuiEditboxSetString(ScrHandle, BezelCompId, buf);
@ -306,10 +306,10 @@ onChangeScreenDist(void * )
char* val = GfuiEditboxGetString(ScrHandle, ScreenDistId);
sscanf(val, "%g", &ScreenDist);
if (ScreenDist > 25.0f)
ScreenDist = 25.0f;
ScreenDist = 25.0f;
else if (ScreenDist < 0.1f)
ScreenDist = 0.1f;
ScreenDist = 0.1f;
char buf[32];
sprintf(buf, "%g", ScreenDist);
GfuiEditboxSetString(ScrHandle, ScreenDistId, buf);
@ -321,10 +321,10 @@ onChangeArcRatio(void * )
char* val = GfuiEditboxGetString(ScrHandle, ArcRatioId);
sscanf(val, "%g", &ArcRatio);
if (ArcRatio > 2.0f)
ArcRatio = 2.0f;
ArcRatio = 2.0f;
else if (ArcRatio < 0.0f)
ArcRatio = 0.0f;
ArcRatio = 0.0f;
char buf[32];
sprintf(buf, "%g", ArcRatio);
GfuiEditboxSetString(ScrHandle, ArcRatioId, buf);
@ -336,31 +336,31 @@ onChangeMonitor(void* vp)
const long delta = (long)vp;
MonitorIndex = (MonitorIndex + NbMonitorValues + delta) % NbMonitorValues;
GfuiLabelSetText(ScrHandle, MonitorLabelId, MonitorValues[MonitorIndex]);
}
}
static void
onActivate(void* /* dummy */)
{
loadOptions();
// Load GUI control values.
// Load GUI control values.
onChangeBackgroundType(0);
onChangeShadow(0);
onChangeTexSize(0);
onChangeQuality(0);
onChangeShaders(0);
onChangeSpansplit(0);
onChangeBezelComp(0);
onChangeScreenDist(0);
onChangeArcRatio(0);
onChangeMonitor(0);
onChangeSpansplit(0);
onChangeBezelComp(0);
onChangeScreenDist(0);
onChangeArcRatio(0);
onChangeMonitor(0);
}
static void
onAccept(void* tgtScrHdle)
{
saveOptions();
GfuiScreenActivate(tgtScrHdle);
}
@ -378,7 +378,7 @@ AdvancedGraphMenuInit(void* prevMenu)
{
// Don't do it twice.
if (ScrHandle)
return ScrHandle;
return ScrHandle;
ScrHandle = GfuiScreenCreate((float*)NULL, NULL, onActivate, NULL, (tfuiCallback)NULL, 1);
@ -386,10 +386,10 @@ AdvancedGraphMenuInit(void* prevMenu)
GfuiMenuCreateStaticControls(ScrHandle, param);
BackgroundTypeLeftButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "bgskyleftarrow", (void*)-1, onChangeBackgroundType);
BackgroundTypeLeftButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "bgskyleftarrow", (void*)-1, onChangeBackgroundType);
BackgroundTypeRightButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "bgskyrightarrow", (void*)1, onChangeBackgroundType);
GfuiMenuCreateButtonControl(ScrHandle, param, "bgskyrightarrow", (void*)1, onChangeBackgroundType);
BackgroundTypeLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "bgskydomelabel");
ShadowLeftButtonId =
@ -416,10 +416,10 @@ AdvancedGraphMenuInit(void* prevMenu)
GfuiMenuCreateButtonControl(ScrHandle, param, "carrightarrow", (void*)1, onChangeShaders);
ShadersLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "carlabel");
SpansplitLeftButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "spansplitleftarrow", (void*)-1, onChangeSpansplit);
SpansplitLeftButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "spansplitleftarrow", (void*)-1, onChangeSpansplit);
SpansplitRightButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "spansplitrightarrow", (void*)1, onChangeSpansplit);
GfuiMenuCreateButtonControl(ScrHandle, param, "spansplitrightarrow", (void*)1, onChangeSpansplit);
SpansplitLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "spansplitlabel");
BezelCompId = GfuiMenuCreateEditControl(ScrHandle, param, "bezelcompedit", NULL, NULL, onChangeBezelComp);
@ -428,17 +428,17 @@ AdvancedGraphMenuInit(void* prevMenu)
ArcRatioId = GfuiMenuCreateEditControl(ScrHandle, param, "arcratioedit", NULL, NULL, onChangeArcRatio);
MonitorLeftButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "monitorleftarrow", (void*)-1, onChangeMonitor);
MonitorLeftButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "monitorleftarrow", (void*)-1, onChangeMonitor);
MonitorRightButtonId =
GfuiMenuCreateButtonControl(ScrHandle, param, "monitorrightarrow", (void*)1, onChangeMonitor);
GfuiMenuCreateButtonControl(ScrHandle, param, "monitorrightarrow", (void*)1, onChangeMonitor);
MonitorLabelId = GfuiMenuCreateLabelControl(ScrHandle, param, "monitorlabel");
GfuiMenuCreateButtonControl(ScrHandle, param, "ApplyButton", prevMenu, onAccept);
GfuiMenuCreateButtonControl(ScrHandle, param, "CancelButton", prevMenu, onCancel);
GfParmReleaseHandle(param);
GfuiAddKey(ScrHandle, GFUIK_RETURN, "Apply", prevMenu, onAccept, NULL);
GfuiAddKey(ScrHandle, GFUIK_ESCAPE, "Cancel", prevMenu, onCancel, NULL);
GfuiAddKey(ScrHandle, GFUIK_F1, "Help", ScrHandle, GfuiHelpScreen, NULL);