Shadow intensity can be set in video options.
Tilesets can set their own default shadow intensity with <shadow-intensity value="0.3"/>. ShadowAlpha is beeing removed form ini files
This commit is contained in:
parent
836e61d5d6
commit
416ccaae4b
|
@ -69,7 +69,6 @@ RefreshFrequency=75
|
||||||
ScreenHeight=600
|
ScreenHeight=600
|
||||||
ScreenWidth=800
|
ScreenWidth=800
|
||||||
ServerIp=192.168.0.107
|
ServerIp=192.168.0.107
|
||||||
ShadowAlpha=0.2
|
|
||||||
ShadowFrameSkip=2
|
ShadowFrameSkip=2
|
||||||
ShadowTextureSize=512
|
ShadowTextureSize=512
|
||||||
Shadows=Projected
|
Shadows=Projected
|
||||||
|
|
|
@ -168,7 +168,7 @@ Renderer::Renderer() : BaseRenderer() {
|
||||||
//assert(0==1);
|
//assert(0==1);
|
||||||
|
|
||||||
Renderer::rendererEnded = false;
|
Renderer::rendererEnded = false;
|
||||||
shadowAlpha = 0;
|
shadowIntensity = 0;
|
||||||
shadowFrameSkip = 0;
|
shadowFrameSkip = 0;
|
||||||
triangleCount = 0;
|
triangleCount = 0;
|
||||||
smoothedRenderFps = 0;
|
smoothedRenderFps = 0;
|
||||||
|
@ -6957,7 +6957,11 @@ void Renderer::renderShadowsToTexture(const int renderFps){
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float color= 1.0f-shadowAlpha;
|
float shadowIntensityToSet=shadowIntensity*game->getWorld()->getTileset()->getShadowIntense();
|
||||||
|
if(shadowIntensityToSet > 1.0f){
|
||||||
|
shadowIntensityToSet=1.0f;
|
||||||
|
}
|
||||||
|
float color= 1.0f-shadowIntensityToSet;
|
||||||
glColor3f(color, color, color);
|
glColor3f(color, color, color);
|
||||||
glClearColor(1.f, 1.f, 1.f, 1.f);
|
glClearColor(1.f, 1.f, 1.f, 1.f);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
@ -7256,7 +7260,7 @@ void Renderer::loadConfig() {
|
||||||
if(shadows==sProjected || shadows==sShadowMapping){
|
if(shadows==sProjected || shadows==sShadowMapping){
|
||||||
shadowTextureSize= config.getInt("ShadowTextureSize");
|
shadowTextureSize= config.getInt("ShadowTextureSize");
|
||||||
shadowFrameSkip= config.getInt("ShadowFrameSkip");
|
shadowFrameSkip= config.getInt("ShadowFrameSkip");
|
||||||
shadowAlpha= config.getFloat("ShadowAlpha");
|
shadowIntensity= config.getFloat("ShadowIntensity","1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
//load filter settings
|
//load filter settings
|
||||||
|
|
|
@ -248,7 +248,7 @@ private:
|
||||||
bool photoMode;
|
bool photoMode;
|
||||||
int shadowTextureSize;
|
int shadowTextureSize;
|
||||||
int shadowFrameSkip;
|
int shadowFrameSkip;
|
||||||
float shadowAlpha;
|
float shadowIntensity;
|
||||||
bool focusArrows;
|
bool focusArrows;
|
||||||
bool textures3D;
|
bool textures3D;
|
||||||
Shadows shadows;
|
Shadows shadows;
|
||||||
|
|
|
@ -151,7 +151,7 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
||||||
}
|
}
|
||||||
float gammaValue=config.getFloat("GammaValue","1.0");
|
float gammaValue=config.getFloat("GammaValue","1.0");
|
||||||
if(gammaValue==0.0f) gammaValue=1.0f;
|
if(gammaValue==0.0f) gammaValue=1.0f;
|
||||||
listBoxGammaCorrection.setSelectedItem(floatToStr(gammaValue));
|
listBoxGammaCorrection.setSelectedItem(floatToStr(gammaValue),false);
|
||||||
|
|
||||||
currentLine-=lineOffset;
|
currentLine-=lineOffset;
|
||||||
|
|
||||||
|
@ -215,6 +215,22 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
||||||
listBoxShadowTextureSize.setSelectedItem(intToStr(config.getInt("ShadowTextureSize","512")),false);
|
listBoxShadowTextureSize.setSelectedItem(intToStr(config.getInt("ShadowTextureSize","512")),false);
|
||||||
currentLine-=lineOffset;
|
currentLine-=lineOffset;
|
||||||
|
|
||||||
|
//shadows
|
||||||
|
labelShadowIntensity.registerGraphicComponent(containerName,"labelShadowIntensity");
|
||||||
|
labelShadowIntensity.init(currentLabelStart, currentLine);
|
||||||
|
labelShadowIntensity.setText(lang.get("ShadowIntensity"));
|
||||||
|
|
||||||
|
listBoxShadowIntensity.registerGraphicComponent(containerName,"listBoxShadowIntensity");
|
||||||
|
listBoxShadowIntensity.init(currentColumnStart, currentLine, 200);
|
||||||
|
for (float f=0.5f;f<3.0f;f=f+0.1f) {
|
||||||
|
listBoxShadowIntensity.pushBackItem(floatToStr(f));
|
||||||
|
}
|
||||||
|
float shadowIntensity=config.getFloat("ShadowIntensity","1.0");
|
||||||
|
if(shadowIntensity<=0.0f) shadowIntensity=1.0f;
|
||||||
|
listBoxShadowIntensity.setSelectedItem(floatToStr(shadowIntensity),false);
|
||||||
|
|
||||||
|
currentLine-=lineOffset;
|
||||||
|
|
||||||
//textures 3d
|
//textures 3d
|
||||||
labelTextures3D.registerGraphicComponent(containerName,"labelTextures3D");
|
labelTextures3D.registerGraphicComponent(containerName,"labelTextures3D");
|
||||||
labelTextures3D.init(currentLabelStart, currentLine);
|
labelTextures3D.init(currentLabelStart, currentLine);
|
||||||
|
@ -399,6 +415,13 @@ void MenuStateOptionsGraphics::reloadUI() {
|
||||||
listBoxGammaCorrection.setItems(listboxData);
|
listBoxGammaCorrection.setItems(listboxData);
|
||||||
|
|
||||||
|
|
||||||
|
listboxData.clear();
|
||||||
|
for (float f=0.5;f<3.0f;f=f+0.1f) {
|
||||||
|
listboxData.push_back(floatToStr(f));
|
||||||
|
}
|
||||||
|
listBoxShadowIntensity.setItems(listboxData);
|
||||||
|
|
||||||
|
|
||||||
labelShadows.setText(lang.get("Shadows"));
|
labelShadows.setText(lang.get("Shadows"));
|
||||||
labelShadowTextureSize.setText(lang.get("ShadowTextureSize"));
|
labelShadowTextureSize.setText(lang.get("ShadowTextureSize"));
|
||||||
|
|
||||||
|
@ -661,6 +684,7 @@ void MenuStateOptionsGraphics::mouseClick(int x, int y, MouseButton mouseButton)
|
||||||
listBoxShadows.mouseClick(x, y);
|
listBoxShadows.mouseClick(x, y);
|
||||||
listBoxAnimatedTilesetObjects.mouseClick(x, y);
|
listBoxAnimatedTilesetObjects.mouseClick(x, y);
|
||||||
listBoxShadowTextureSize.mouseClick(x, y);
|
listBoxShadowTextureSize.mouseClick(x, y);
|
||||||
|
listBoxShadowIntensity.mouseClick(x, y);
|
||||||
listBoxFilter.mouseClick(x, y);
|
listBoxFilter.mouseClick(x, y);
|
||||||
if(listBoxGammaCorrection.mouseClick(x, y)){
|
if(listBoxGammaCorrection.mouseClick(x, y)){
|
||||||
float gammaValue=strToFloat(listBoxGammaCorrection.getSelectedItem());
|
float gammaValue=strToFloat(listBoxGammaCorrection.getSelectedItem());
|
||||||
|
@ -700,6 +724,7 @@ void MenuStateOptionsGraphics::mouseMove(int x, int y, const MouseState *ms){
|
||||||
buttonVideoInfo.mouseMove(x, y);
|
buttonVideoInfo.mouseMove(x, y);
|
||||||
listBoxFilter.mouseMove(x, y);
|
listBoxFilter.mouseMove(x, y);
|
||||||
listBoxGammaCorrection.mouseMove(x, y);
|
listBoxGammaCorrection.mouseMove(x, y);
|
||||||
|
listBoxShadowIntensity.mouseMove(x, y);
|
||||||
listBoxSelectionType.mouseMove(x, y);
|
listBoxSelectionType.mouseMove(x, y);
|
||||||
listBoxShadows.mouseMove(x, y);
|
listBoxShadows.mouseMove(x, y);
|
||||||
checkBoxTextures3D.mouseMove(x, y);
|
checkBoxTextures3D.mouseMove(x, y);
|
||||||
|
@ -775,6 +800,7 @@ void MenuStateOptionsGraphics::render(){
|
||||||
renderer.renderListBox(&listBoxLights);
|
renderer.renderListBox(&listBoxLights);
|
||||||
renderer.renderListBox(&listBoxFilter);
|
renderer.renderListBox(&listBoxFilter);
|
||||||
renderer.renderListBox(&listBoxGammaCorrection);
|
renderer.renderListBox(&listBoxGammaCorrection);
|
||||||
|
renderer.renderListBox(&listBoxShadowIntensity);
|
||||||
renderer.renderLabel(&labelShadows);
|
renderer.renderLabel(&labelShadows);
|
||||||
renderer.renderLabel(&labelTextures3D);
|
renderer.renderLabel(&labelTextures3D);
|
||||||
renderer.renderLabel(&labelUnitParticles);
|
renderer.renderLabel(&labelUnitParticles);
|
||||||
|
@ -785,6 +811,7 @@ void MenuStateOptionsGraphics::render(){
|
||||||
renderer.renderLabel(&labelLights);
|
renderer.renderLabel(&labelLights);
|
||||||
renderer.renderLabel(&labelFilter);
|
renderer.renderLabel(&labelFilter);
|
||||||
renderer.renderLabel(&labelGammaCorrection);
|
renderer.renderLabel(&labelGammaCorrection);
|
||||||
|
renderer.renderLabel(&labelShadowIntensity);
|
||||||
renderer.renderLabel(&labelScreenModes);
|
renderer.renderLabel(&labelScreenModes);
|
||||||
renderer.renderListBox(&listBoxScreenModes);
|
renderer.renderListBox(&listBoxScreenModes);
|
||||||
renderer.renderLabel(&labelFullscreenWindowed);
|
renderer.renderLabel(&labelFullscreenWindowed);
|
||||||
|
@ -837,6 +864,7 @@ void MenuStateOptionsGraphics::saveConfig(){
|
||||||
config.setBool("Windowed", checkBoxFullscreenWindowed.getValue());
|
config.setBool("Windowed", checkBoxFullscreenWindowed.getValue());
|
||||||
config.setString("Filter", listBoxFilter.getSelectedItem());
|
config.setString("Filter", listBoxFilter.getSelectedItem());
|
||||||
config.setFloat("GammaValue", strToFloat(listBoxGammaCorrection.getSelectedItem()));
|
config.setFloat("GammaValue", strToFloat(listBoxGammaCorrection.getSelectedItem()));
|
||||||
|
config.setFloat("ShadowIntensity", strToFloat(listBoxShadowIntensity.getSelectedItem()));
|
||||||
config.setBool("Textures3D", checkBoxTextures3D.getValue());
|
config.setBool("Textures3D", checkBoxTextures3D.getValue());
|
||||||
config.setBool("UnitParticles", (checkBoxUnitParticles.getValue()));
|
config.setBool("UnitParticles", (checkBoxUnitParticles.getValue()));
|
||||||
config.setBool("TilesetParticles", (checkBoxTilesetParticles.getValue()));
|
config.setBool("TilesetParticles", (checkBoxTilesetParticles.getValue()));
|
||||||
|
|
|
@ -77,6 +77,9 @@ private:
|
||||||
GraphicLabel labelGammaCorrection;
|
GraphicLabel labelGammaCorrection;
|
||||||
GraphicListBox listBoxGammaCorrection;
|
GraphicListBox listBoxGammaCorrection;
|
||||||
|
|
||||||
|
GraphicLabel labelShadowIntensity;
|
||||||
|
GraphicListBox listBoxShadowIntensity;
|
||||||
|
|
||||||
GraphicLabel labelShadowTextureSize;
|
GraphicLabel labelShadowTextureSize;
|
||||||
GraphicListBox listBoxShadowTextureSize;
|
GraphicListBox listBoxShadowTextureSize;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ using namespace Shared::Graphics;
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const float Tileset::standardAirHeight= 5.0f;
|
const float Tileset::standardAirHeight= 5.0f;
|
||||||
|
const float Tileset::standardShadowIntensity= 0.2f;
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class AmbientSounds
|
// class AmbientSounds
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -421,6 +422,13 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
||||||
moonLightColor.y= moonLightColorNode->getAttribute("green")->getFloatValue();
|
moonLightColor.y= moonLightColorNode->getAttribute("green")->getFloatValue();
|
||||||
moonLightColor.z= moonLightColorNode->getAttribute("blue")->getFloatValue();
|
moonLightColor.z= moonLightColorNode->getAttribute("blue")->getFloatValue();
|
||||||
|
|
||||||
|
if(parametersNode->hasChild("shadow-intensity")) {
|
||||||
|
const XmlNode *shadowIntenseNode= parametersNode->getChild("shadow-intensity");
|
||||||
|
shadowIntensity= shadowIntenseNode->getAttribute("value")->getFloatValue();
|
||||||
|
} else {
|
||||||
|
shadowIntensity=standardShadowIntensity;
|
||||||
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
//weather
|
//weather
|
||||||
|
|
|
@ -121,6 +121,7 @@ public:
|
||||||
static const int objCount= 10;
|
static const int objCount= 10;
|
||||||
static const int transitionVars= 2; //number or different transition textures
|
static const int transitionVars= 2; //number or different transition textures
|
||||||
static const float standardAirHeight;
|
static const float standardAirHeight;
|
||||||
|
static const float standardShadowIntensity;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef vector<float> SurfProbs;
|
typedef vector<float> SurfProbs;
|
||||||
|
@ -145,6 +146,7 @@ private:
|
||||||
Vec3f fogColor;
|
Vec3f fogColor;
|
||||||
Vec3f sunLightColor;
|
Vec3f sunLightColor;
|
||||||
Vec3f moonLightColor;
|
Vec3f moonLightColor;
|
||||||
|
float shadowIntensity;
|
||||||
Weather weather;
|
Weather weather;
|
||||||
float airHeight;
|
float airHeight;
|
||||||
|
|
||||||
|
@ -162,6 +164,7 @@ public:
|
||||||
fogDensity = 0.0f;
|
fogDensity = 0.0f;
|
||||||
weather= wSunny;
|
weather= wSunny;
|
||||||
airHeight= standardAirHeight;
|
airHeight= standardAirHeight;
|
||||||
|
shadowIntensity= standardShadowIntensity;
|
||||||
|
|
||||||
for(int index = 0; index < surfCount; ++index) {
|
for(int index = 0; index < surfCount; ++index) {
|
||||||
partsArray[index] = 0;
|
partsArray[index] = 0;
|
||||||
|
@ -187,6 +190,7 @@ public:
|
||||||
const Vec3f &getFogColor() const {return fogColor;}
|
const Vec3f &getFogColor() const {return fogColor;}
|
||||||
const Vec3f &getSunLightColor() const {return sunLightColor;}
|
const Vec3f &getSunLightColor() const {return sunLightColor;}
|
||||||
const Vec3f &getMoonLightColor() const {return moonLightColor;}
|
const Vec3f &getMoonLightColor() const {return moonLightColor;}
|
||||||
|
float getShadowIntense()const {return shadowIntensity;}
|
||||||
Weather getWeather() const {return weather;}
|
Weather getWeather() const {return weather;}
|
||||||
void setWeather(Weather value) { weather = value; }
|
void setWeather(Weather value) { weather = value; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user