////////////////////////////////////////////////////////////////////////// // environment CEnvironment::CEnvironment () { bWFX = false; Current[0] = 0; Current[1] = 0; CurrentWeather = 0; CurrentWeatherName = 0; eff_Rain = 0; eff_LensFlare = 0; eff_Thunderbolt = 0; OnDeviceCreate (); #ifdef _EDITOR ed_from_time = 0.f; ed_to_time = DAY_LENGTH; #endif fGameTime = 0.f; fTimeFactor = 12.f; wind_strength_factor = 0.f; wind_gust_factor = 0.f; // fill clouds hemi verts & faces const Fvector* verts; CloudsVerts.resize (xrHemisphereVertices(2,verts)); CopyMemory (&CloudsVerts.front(),verts,CloudsVerts.size()*sizeof(Fvector)); const u16* indices; CloudsIndices.resize (xrHemisphereIndices(2,indices)); CopyMemory (&CloudsIndices.front(),indices,CloudsIndices.size()*sizeof(u16)); // perlin noise PerlinNoise1D = xr_new<CPerlinNoise1D>(Random.randI(0,0xFFFF)); PerlinNoise1D->SetOctaves(2); PerlinNoise1D->SetAmplitude(0.66666f); tsky0 = Device.Resources->_CreateTexture("$user$sky0"); tsky1 = Device.Resources->_CreateTexture("$user$sky1"); }
////////////////////////////////////////////////////////////////////////// // environment CEnvironment::CEnvironment () : CurrentEnv (0), m_ambients_config (0) { bNeed_re_create_env = FALSE; bWFX = false; Current[0] = 0; Current[1] = 0; CurrentWeather = 0; CurrentWeatherName = 0; eff_Rain = 0; eff_LensFlare = 0; eff_Thunderbolt = 0; OnDeviceCreate (); #ifdef _EDITOR ed_from_time = 0.f; ed_to_time = DAY_LENGTH; #endif #ifndef _EDITOR m_paused = false; #endif fGameTime = 0.f; fTimeFactor = 12.f; wind_strength_factor = 0.f; wind_gust_factor = 0.f; wind_blast_strength = 0.f; wind_blast_direction.set(1.f,0.f,0.f); wind_blast_strength_start_value = 0.f; wind_blast_strength_stop_value = 0.f; // fill clouds hemi verts & faces const Fvector* verts; CloudsVerts.resize (xrHemisphereVertices(2,verts)); CopyMemory (&CloudsVerts.front(),verts,CloudsVerts.size()*sizeof(Fvector)); const u16* indices; CloudsIndices.resize (xrHemisphereIndices(2,indices)); CopyMemory (&CloudsIndices.front(),indices,CloudsIndices.size()*sizeof(u16)); // perlin noise PerlinNoise1D = xr_new<CPerlinNoise1D>(Random.randI(0,0xFFFF)); PerlinNoise1D->SetOctaves(2); PerlinNoise1D->SetAmplitude(0.66666f); // tsky0 = Device.Resources->_CreateTexture("$user$sky0"); // tsky1 = Device.Resources->_CreateTexture("$user$sky1"); string_path file_name; m_ambients_config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\ambients.ltx" ), TRUE, TRUE, FALSE ); m_sound_channels_config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\sound_channels.ltx" ), TRUE, TRUE, FALSE ); m_effects_config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\effects.ltx" ), TRUE, TRUE, FALSE ); m_suns_config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\suns.ltx" ), TRUE, TRUE, FALSE ); m_thunderbolt_collections_config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\thunderbolt_collections.ltx" ), TRUE, TRUE, FALSE ); m_thunderbolts_config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\thunderbolts.ltx" ), TRUE, TRUE, FALSE ); CInifile* config = xr_new<CInifile>( FS.update_path( file_name, "$game_config$", "environment\\environment.ltx" ), TRUE, TRUE, FALSE ); // params p_var_alt = deg2rad(config->r_float ( "environment","altitude" )); p_var_long = deg2rad (config->r_float ( "environment","delta_longitude" )); p_min_dist = _min (.95f,config->r_float ( "environment","min_dist_factor" )); p_tilt = deg2rad (config->r_float ( "environment","tilt" )); p_second_prop = config->r_float ( "environment","second_propability" ); clamp (p_second_prop,0.f,1.f); p_sky_color = config->r_float ( "environment","sky_color" ); p_sun_color = config->r_float ( "environment","sun_color" ); p_fog_color = config->r_float ( "environment","fog_color" ); xr_delete (config); }