Skip to content

Commit

Permalink
use nicemetal materials
Browse files Browse the repository at this point in the history
  • Loading branch information
tritonas00 committed May 29, 2022
1 parent 6590779 commit bf00c2e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 66 deletions.
1 change: 0 additions & 1 deletion source/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ CVar* gfx_speedo_imperial;
CVar* gfx_flexbody_cache;
CVar* gfx_reduce_shadows;
CVar* gfx_enable_rtshaders;
CVar* gfx_classic_shaders;

// Instance management
void SetSimTerrain (TerrainManager* obj) { g_sim_terrain = obj;}
Expand Down
1 change: 0 additions & 1 deletion source/main/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ extern CVar* gfx_speedo_imperial;
extern CVar* gfx_flexbody_cache;
extern CVar* gfx_reduce_shadows;
extern CVar* gfx_enable_rtshaders;
extern CVar* gfx_classic_shaders;

// ------------------------------------------------------------------------------------------------
// Global objects
Expand Down
1 change: 0 additions & 1 deletion source/main/gui/panels/GUI_GameSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ void GameSettings::DrawGraphicsSettings()
DrawGCheckbox(App::gfx_declutter_map, _LC("GameSettings", "Declutter overview map"));
}
DrawGCheckbox(App::gfx_water_waves, _LC("GameSettings", "Waves on water"));
DrawGCheckbox(App::gfx_classic_shaders, _LC("GameSettings", "Classic material shaders (experimental)"));

DrawGCombo(App::gfx_extcam_mode, "Exterior camera mode",
"None\0"
Expand Down
77 changes: 15 additions & 62 deletions source/main/physics/ActorSpawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2250,31 +2250,17 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def)
if (def.specular_map != "")
{
/* FLEXMESH, damage, specular */
if (App::gfx_classic_shaders->getBool())
{
material = this->InstantiateManagedMaterial(mat_name_base + "/speculardamage_nicemetal", custom_name);
}
else
{
material = this->InstantiateManagedMaterial(mat_name_base + "/speculardamage", custom_name);
}

if (material.isNull())
{
return;
}
if(App::gfx_classic_shaders->getBool())
{

material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Dmg_Diffuse_Map")->setTextureName(def.damaged_diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
material->getTechnique("BaseTechnique")->getPass("Specular")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
}
else
{
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Dmg_Diffuse_Map")->setTextureName(def.damaged_diffuse_map);
material->getTechnique("BaseTechnique")->getPass("SpecularMapping1")->getTextureUnitState("SpecularMapping1_Tex")->setTextureName(def.specular_map);
}
}
else
{
Expand All @@ -2293,29 +2279,16 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def)
if (def.specular_map != "")
{
/* FLEXMESH, no_damage, specular */
if (App::gfx_classic_shaders->getBool())
{
material = this->InstantiateManagedMaterial(mat_name_base + "/specularonly_nicemetal", custom_name);
}
else
{
material = this->InstantiateManagedMaterial(mat_name_base + "/specularonly", custom_name);
}
material = this->InstantiateManagedMaterial(mat_name_base + "/specularonly_nicemetal", custom_name);

if (material.isNull())
{
return;
}
if (App::gfx_classic_shaders->getBool())
{
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
material->getTechnique("BaseTechnique")->getPass("Specular")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
}
else
{
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("SpecularMapping1")->getTextureUnitState("SpecularMapping1_Tex")->setTextureName(def.specular_map);
}

material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
material->getTechnique("BaseTechnique")->getPass("Specular")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
}
else
{
Expand All @@ -2339,29 +2312,16 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def)
if (def.specular_map != "")
{
/* MESH, specular */
if (App::gfx_classic_shaders->getBool())
{
material = this->InstantiateManagedMaterial(mat_name_base + "/specular_nicemetal", custom_name);
}
else
{
material = this->InstantiateManagedMaterial(mat_name_base + "/specular", custom_name);
}
material = this->InstantiateManagedMaterial(mat_name_base + "/specular_nicemetal", custom_name);

if (material.isNull())
{
return;
}
if (App::gfx_classic_shaders->getBool())
{
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
material->getTechnique("BaseTechnique")->getPass("Specular")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
}
else
{
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("SpecularMapping1")->getTextureUnitState("SpecularMapping1_Tex")->setTextureName(def.specular_map);
}

material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map);
material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
material->getTechnique("BaseTechnique")->getPass("Specular")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map);
}
else
{
Expand All @@ -2383,14 +2343,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def)
material->getTechnique("BaseTechnique")->getPass("BaseRender")->setCullingMode(Ogre::CULL_NONE);
if (def.specular_map != "")
{
if (App::gfx_classic_shaders->getBool())
{
material->getTechnique("BaseTechnique")->getPass("Specular")->setCullingMode(Ogre::CULL_NONE);
}
else
{
material->getTechnique("BaseTechnique")->getPass("SpecularMapping1")->setCullingMode(Ogre::CULL_NONE);
}
material->getTechnique("BaseTechnique")->getPass("Specular")->setCullingMode(Ogre::CULL_NONE);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion source/main/system/CVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ void Console::cVarSetupBuiltins()
App::gfx_flexbody_cache = this->cVarCreate("gfx_flexbody_cache", "Flexbody_UseCache", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false");
App::gfx_reduce_shadows = this->cVarCreate("gfx_reduce_shadows", "Shadow optimizations", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true");
App::gfx_enable_rtshaders = this->cVarCreate("gfx_enable_rtshaders", "Use RTShader System", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false");
App::gfx_classic_shaders = this->cVarCreate("gfx_classic_shaders", "Classic material shaders", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false");
}

CVar* Console::cVarCreate(std::string const& name, std::string const& long_name,
Expand Down

0 comments on commit bf00c2e

Please # to comment.