mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 06:49:19 +02:00
build 190322. support for vehicle load visualization model override, skydome brightness tweaks
This commit is contained in:
25
DynObj.cpp
25
DynObj.cpp
@@ -4332,6 +4332,20 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
mdLowPolyInt = TModelsManager::GetModel(asModel, true);
|
||||
}
|
||||
|
||||
else if(token == "loads:") {
|
||||
// default load visualization models overrides
|
||||
// content provided as "key: value" pairs together enclosed in "{}"
|
||||
// value can be optionally set of values enclosed in "[]" in which case one value will be picked randomly
|
||||
while( ( ( token = parser.getToken<std::string>() ) != "" )
|
||||
&& ( token != "}" ) ) {
|
||||
if( token[ token.size() - 1 ] == ':' ) {
|
||||
auto loadmodel { deserialize_random_set( parser ) };
|
||||
replace_slashes( loadmodel );
|
||||
LoadModelOverrides.emplace( token.erase( token.size() - 1 ), loadmodel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if( token == "brakemode:" ) {
|
||||
// Ra 15-01: gałka nastawy hamulca
|
||||
parser.getTokens();
|
||||
@@ -5644,8 +5658,17 @@ TDynamicObject::LoadMMediaFile_mdload( std::string const &Name ) const {
|
||||
|
||||
if( Name.empty() ) { return nullptr; }
|
||||
|
||||
// try first specialized version of the load model, vehiclename_loadname
|
||||
TModel3d *loadmodel { nullptr };
|
||||
|
||||
// check if we don't have model override for this load type
|
||||
auto const lookup { LoadModelOverrides.find( Name ) };
|
||||
if( lookup != LoadModelOverrides.end() ) {
|
||||
loadmodel = TModelsManager::GetModel( asBaseDir + lookup->second, true );
|
||||
// if the override was succesfully loaded call it a day
|
||||
if( loadmodel != nullptr ) { return loadmodel; }
|
||||
}
|
||||
// regular routine if there's no override or it couldn't be loaded
|
||||
// try first specialized version of the load model, vehiclename_loadname
|
||||
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
||||
if( ( true == FileExists( specializedloadfilename + ".e3d" ) )
|
||||
|| ( true == FileExists( specializedloadfilename + ".t3d" ) ) ) {
|
||||
|
||||
1
DynObj.h
1
DynObj.h
@@ -202,6 +202,7 @@ public:
|
||||
bool JointCabs{ false }; // flag for vehicles with multiple virtual 'cabs' sharing location and 3d model(s)
|
||||
float fShade; // zacienienie: 0:normalnie, -1:w ciemności, +1:dodatkowe światło (brak koloru?)
|
||||
float LoadOffset { 0.f };
|
||||
std::unordered_map<std::string, std::string> LoadModelOverrides; // potential overrides of default load visualization models
|
||||
glm::vec3 InteriorLight { 0.9f * 255.f / 255.f, 0.9f * 216.f / 255.f, 0.9f * 176.f / 255.f }; // tungsten light. TODO: allow definition of light type?
|
||||
float InteriorLightLevel { 0.0f }; // current level of interior lighting
|
||||
struct vehicle_section {
|
||||
|
||||
@@ -118,6 +118,11 @@ world_environment::update() {
|
||||
duskfactor );
|
||||
}
|
||||
// ...update skydome to match the current sun position as well...
|
||||
// turbidity varies from 2-3 during the day based on overcast, 3-4 after sunset to deal with sunlight bleeding too much into the sky from below horizon
|
||||
m_skydome.SetTurbidity(
|
||||
2.f
|
||||
+ clamp( Global.Overcast, 0.f, 1.f )
|
||||
+ interpolate( 0.f, 1.f, clamp( twilightfactor * 1.5f, 0.f, 1.f ) ) );
|
||||
m_skydome.SetOvercastFactor( Global.Overcast );
|
||||
m_skydome.Update( m_sun.getDirection() );
|
||||
// ...retrieve current sky colour and brightness...
|
||||
|
||||
@@ -169,7 +169,7 @@ bool CSkyDome::SetSunPosition( glm::vec3 const &Direction ) {
|
||||
|
||||
void CSkyDome::SetTurbidity( float const Turbidity ) {
|
||||
|
||||
m_turbidity = clamp( Turbidity, 1.0f, 512.0f );
|
||||
m_turbidity = clamp( Turbidity, 1.f, 4.f );
|
||||
}
|
||||
|
||||
void CSkyDome::SetExposure( bool const Linearexposure, float const Expfactor ) {
|
||||
|
||||
Reference in New Issue
Block a user