00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "CaelumPrecompiled.h"
00022 #include "CaelumPrerequisites.h"
00023
00024 #if CAELUM_TYPE_DESCRIPTORS
00025
00026 #include "TypeDescriptor.h"
00027 #include "CaelumSystem.h"
00028 #include "FlatCloudLayer.h"
00029
00030 using namespace Ogre;
00031
00032 namespace Caelum
00033 {
00034 CaelumDefaultTypeDescriptorData::CaelumDefaultTypeDescriptorData ():
00035 CaelumSystemTypeDescriptor(0),
00036 PointStarfieldTypeDescriptor(0),
00037 BaseSkyLightTypeDescriptor(0),
00038 GroundFogTypeDescriptor(0),
00039 PrecipitationTypeDescriptor(0),
00040 DepthComposerTypeDescriptor(0),
00041 FlatCloudLayerTypeDescriptor(0),
00042 SkyDomeTypeDescriptor(0)
00043 {
00044 try {
00045 load ();
00046 } catch (...) {
00047 unload ();
00048 throw;
00049 }
00050 }
00051
00052 CaelumDefaultTypeDescriptorData::~CaelumDefaultTypeDescriptorData ()
00053 {
00054 unload ();
00055 }
00056
00057 template<class T>
00058 inline void delete_zero(T*& member) {
00059
00060 delete member;
00061 member = 0;
00062 }
00063
00064 void CaelumDefaultTypeDescriptorData::unload ()
00065 {
00066 delete_zero(CaelumSystemTypeDescriptor);
00067 delete_zero(PointStarfieldTypeDescriptor);
00068 delete_zero(BaseSkyLightTypeDescriptor);
00069 delete_zero(GroundFogTypeDescriptor);
00070 delete_zero(PrecipitationTypeDescriptor);
00071 delete_zero(DepthComposerTypeDescriptor);
00072 delete_zero(FlatCloudLayerTypeDescriptor);
00073 delete_zero(SkyDomeTypeDescriptor);
00074 }
00075
00076 void CaelumDefaultTypeDescriptorData::load ()
00077 {
00078 if (!CaelumSystemTypeDescriptor)
00079 {
00080 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00081
00082
00083 td->add("time_scale",
00084 new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
00085 &Caelum::CaelumSystem::getTimeScale,
00086 &Caelum::CaelumSystem::setTimeScale));
00087 td->add("julian_day",
00088 new AccesorPropertyDescriptor<Caelum::CaelumSystem, LongReal, LongReal, LongReal>(
00089 &Caelum::CaelumSystem::getJulianDay,
00090 &Caelum::CaelumSystem::setJulianDay));
00091
00092
00093 td->add("latitude",
00094 new AccesorPropertyDescriptor<Caelum::CaelumSystem, Degree, Degree, const Degree>(
00095 &Caelum::CaelumSystem::getObserverLatitude,
00096 &Caelum::CaelumSystem::setObserverLatitude));
00097 td->add("longitude",
00098 new AccesorPropertyDescriptor<Caelum::CaelumSystem, Degree, Degree, const Degree>(
00099 &Caelum::CaelumSystem::getObserverLongitude,
00100 &Caelum::CaelumSystem::setObserverLongitude));
00101
00102
00103 td->add("global_fog_density_multiplier",
00104 new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
00105 &Caelum::CaelumSystem::getGlobalFogDensityMultiplier,
00106 &Caelum::CaelumSystem::setGlobalFogDensityMultiplier));
00107 td->add("global_fog_colour_multiplier",
00108 new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
00109 &Caelum::CaelumSystem::getGlobalFogColourMultiplier,
00110 &Caelum::CaelumSystem::setGlobalFogColourMultiplier));
00111 td->add("manage_scene_fog",
00112 new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
00113 &Caelum::CaelumSystem::getManageSceneFog,
00114 &Caelum::CaelumSystem::setManageSceneFog));
00115 td->add("scene_fog_density_multiplier",
00116 new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
00117 &Caelum::CaelumSystem::getSceneFogDensityMultiplier,
00118 &Caelum::CaelumSystem::setSceneFogDensityMultiplier));
00119 td->add("scene_fog_colour_multiplier",
00120 new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
00121 &Caelum::CaelumSystem::getSceneFogColourMultiplier,
00122 &Caelum::CaelumSystem::setSceneFogColourMultiplier));
00123 td->add("ground_fog_density_multiplier",
00124 new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
00125 &Caelum::CaelumSystem::getGroundFogDensityMultiplier,
00126 &Caelum::CaelumSystem::setGroundFogDensityMultiplier));
00127 td->add("ground_fog_colour_multiplier",
00128 new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
00129 &Caelum::CaelumSystem::getGroundFogColourMultiplier,
00130 &Caelum::CaelumSystem::setGroundFogColourMultiplier));
00131
00132
00133 td->add("manage_ambient_light",
00134 new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
00135 &Caelum::CaelumSystem::getManageAmbientLight,
00136 &Caelum::CaelumSystem::setManageAmbientLight));
00137 td->add("minimum_ambient_light",
00138 new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
00139 &Caelum::CaelumSystem::getMinimumAmbientLight,
00140 &Caelum::CaelumSystem::setMinimumAmbientLight));
00141 td->add("ensure_single_light_source",
00142 new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
00143 &Caelum::CaelumSystem::getEnsureSingleLightSource,
00144 &Caelum::CaelumSystem::setEnsureSingleLightSource));
00145 td->add("ensure_single_shadow_source",
00146 new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
00147 &Caelum::CaelumSystem::getEnsureSingleShadowSource,
00148 &Caelum::CaelumSystem::setEnsureSingleShadowSource));
00149
00150 CaelumSystemTypeDescriptor = td.release ();
00151 }
00152
00153 if (!PointStarfieldTypeDescriptor)
00154 {
00155 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00156 td->add("magnitude_scale",
00157 new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
00158 &Caelum::PointStarfield::getMagnitudeScale,
00159 &Caelum::PointStarfield::setMagnitudeScale));
00160 td->add("mag0_pixel_size",
00161 new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
00162 &Caelum::PointStarfield::getMag0PixelSize,
00163 &Caelum::PointStarfield::setMag0PixelSize));
00164 td->add("min_pixel_size",
00165 new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
00166 &Caelum::PointStarfield::getMinPixelSize,
00167 &Caelum::PointStarfield::setMinPixelSize));
00168 td->add("max_pixel_size",
00169 new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
00170 &Caelum::PointStarfield::getMaxPixelSize,
00171 &Caelum::PointStarfield::setMaxPixelSize));
00172 td->add("latitude",
00173 new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(
00174 &Caelum::PointStarfield::getObserverLatitude,
00175 &Caelum::PointStarfield::setObserverLatitude));
00176 td->add("longitude",
00177 new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(
00178 &Caelum::PointStarfield::getObserverLongitude,
00179 &Caelum::PointStarfield::setObserverLongitude));
00180 td->add("observer_position_rebuild_delta",
00181 new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(
00182 &Caelum::PointStarfield::getObserverPositionRebuildDelta,
00183 &Caelum::PointStarfield::setObserverPositionRebuildDelta));
00184 PointStarfieldTypeDescriptor = td.release ();
00185 }
00186
00187 if (!BaseSkyLightTypeDescriptor)
00188 {
00189 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00190 td->add("ambient_multiplier",
00191 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
00192 &Caelum::BaseSkyLight::getAmbientMultiplier,
00193 &Caelum::BaseSkyLight::setAmbientMultiplier));
00194 td->add("specular_multiplier",
00195 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
00196 &Caelum::BaseSkyLight::getSpecularMultiplier,
00197 &Caelum::BaseSkyLight::setSpecularMultiplier));
00198 td->add("diffuse_multiplier",
00199 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
00200 &Caelum::BaseSkyLight::getDiffuseMultiplier,
00201 &Caelum::BaseSkyLight::setDiffuseMultiplier));
00202 td->add("light_colour",
00203 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
00204 &Caelum::BaseSkyLight::getLightColour,
00205 &Caelum::BaseSkyLight::setLightColour));
00206 td->add("body_colour",
00207 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
00208 &Caelum::BaseSkyLight::getBodyColour,
00209 &Caelum::BaseSkyLight::setBodyColour));
00210 td->add("auto_disable_threshold",
00211 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, Real, Real, Real>(
00212 &Caelum::BaseSkyLight::getAutoDisableThreshold,
00213 &Caelum::BaseSkyLight::setAutoDisableThreshold));
00214 td->add("auto_disable",
00215 new AccesorPropertyDescriptor<Caelum::BaseSkyLight, bool, bool, bool>(
00216 &Caelum::BaseSkyLight::getAutoDisable,
00217 &Caelum::BaseSkyLight::setAutoDisable));
00218 BaseSkyLightTypeDescriptor = td.release ();
00219 }
00220
00221 if (!GroundFogTypeDescriptor)
00222 {
00223 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00224 td->add("density",
00225 new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(
00226 &Caelum::GroundFog::getDensity,
00227 &Caelum::GroundFog::setDensity));
00228 td->add("vertical_decay",
00229 new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(
00230 &Caelum::GroundFog::getVerticalDecay,
00231 &Caelum::GroundFog::setVerticalDecay));
00232 td->add("ground_level",
00233 new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(
00234 &Caelum::GroundFog::getGroundLevel,
00235 &Caelum::GroundFog::setGroundLevel));
00236 td->add("colour",
00237 new AccesorPropertyDescriptor<Caelum::GroundFog, ColourValue>(
00238 &Caelum::GroundFog::getColour,
00239 &Caelum::GroundFog::setColour));
00240 GroundFogTypeDescriptor = td.release ();
00241 }
00242
00243 if (!DepthComposerTypeDescriptor)
00244 {
00245 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00246 td->add("debug_depth_render",
00247 new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(
00248 &Caelum::DepthComposer::getDebugDepthRender,
00249 &Caelum::DepthComposer::setDebugDepthRender));
00250
00251
00252 td->add("haze_enabled",
00253 new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(
00254 &Caelum::DepthComposer::getSkyDomeHazeEnabled,
00255 &Caelum::DepthComposer::setSkyDomeHazeEnabled));
00256 td->add("haze_colour",
00257 new AccesorPropertyDescriptor<Caelum::DepthComposer, ColourValue>(
00258 &Caelum::DepthComposer::getHazeColour,
00259 &Caelum::DepthComposer::setHazeColour));
00260 td->add("haze_sun_direction",
00261 new AccesorPropertyDescriptor<Caelum::DepthComposer, Vector3>(
00262 &Caelum::DepthComposer::getSunDirection,
00263 &Caelum::DepthComposer::setSunDirection));
00264
00265
00266 td->add("ground_fog_enabled",
00267 new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(
00268 &Caelum::DepthComposer::getGroundFogEnabled,
00269 &Caelum::DepthComposer::setGroundFogEnabled));
00270 td->add("ground_fog_density",
00271 new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(
00272 &Caelum::DepthComposer::getGroundFogDensity,
00273 &Caelum::DepthComposer::setGroundFogDensity));
00274 td->add("ground_fog_vertical_decay",
00275 new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(
00276 &Caelum::DepthComposer::getGroundFogVerticalDecay,
00277 &Caelum::DepthComposer::setGroundFogVerticalDecay));
00278 td->add("ground_fog_base_level",
00279 new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(
00280 &Caelum::DepthComposer::getGroundFogBaseLevel,
00281 &Caelum::DepthComposer::setGroundFogBaseLevel));
00282 td->add("ground_fog_colour",
00283 new AccesorPropertyDescriptor<Caelum::DepthComposer, ColourValue>(
00284 &Caelum::DepthComposer::getGroundFogColour,
00285 &Caelum::DepthComposer::setGroundFogColour));
00286
00287 DepthComposerTypeDescriptor = td.release ();
00288 }
00289
00290 if (!PrecipitationTypeDescriptor)
00291 {
00292 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00293
00294 td->add("texture",
00295 new AccesorPropertyDescriptor<Caelum::PrecipitationController, String>(
00296 &Caelum::PrecipitationController::getTextureName,
00297 &Caelum::PrecipitationController::setTextureName));
00298 td->add("precipitation_colour",
00299 new AccesorPropertyDescriptor<Caelum::PrecipitationController, ColourValue>(
00300 &Caelum::PrecipitationController::getColour,
00301 &Caelum::PrecipitationController::setColour));
00302 td->add("falling_speed",
00303 new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(
00304 &Caelum::PrecipitationController::getSpeed,
00305 &Caelum::PrecipitationController::setSpeed));
00306 td->add("wind_speed",
00307 new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(
00308 &Caelum::PrecipitationController::getWindSpeed,
00309 &Caelum::PrecipitationController::setWindSpeed));
00310 td->add("camera_speed_scale",
00311 new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(
00312 &Caelum::PrecipitationController::getCameraSpeedScale,
00313 &Caelum::PrecipitationController::setCameraSpeedScale));
00314 td->add("intensity",
00315 new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(
00316 &Caelum::PrecipitationController::getIntensity,
00317 &Caelum::PrecipitationController::setIntensity));
00318 td->add("auto_disable_intensity",
00319 new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(
00320 &Caelum::PrecipitationController::getAutoDisableThreshold,
00321 &Caelum::PrecipitationController::setAutoDisableThreshold));
00322 td->add("falling_direction",
00323 new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(
00324 &Caelum::PrecipitationController::getFallingDirection,
00325 &Caelum::PrecipitationController::setFallingDirection));
00326
00327 PrecipitationTypeDescriptor = td.release ();
00328 }
00329
00330 if (!FlatCloudLayerTypeDescriptor)
00331 {
00332 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00333
00334
00335 td->add("height",
00336 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00337 &Caelum::FlatCloudLayer::getHeight,
00338 &Caelum::FlatCloudLayer::setHeight));
00339
00340
00341 td->add("coverage",
00342 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00343 &Caelum::FlatCloudLayer::getCloudCover,
00344 &Caelum::FlatCloudLayer::setCloudCover));
00345 td->add("cloud_cover_visibility_threshold",
00346 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00347 &Caelum::FlatCloudLayer::getCloudCoverVisibilityThreshold,
00348 &Caelum::FlatCloudLayer::setCloudCoverVisibilityThreshold));
00349 td->add("cloud_cover_lookup",
00350 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, String>(
00351 &Caelum::FlatCloudLayer::getCloudCoverLookupFileName,
00352 &Caelum::FlatCloudLayer::setCloudCoverLookup));
00353
00354
00355 td->add("sun_direction",
00356 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector3>(
00357 &Caelum::FlatCloudLayer::getSunDirection,
00358 &Caelum::FlatCloudLayer::setSunDirection));
00359 td->add("sun_light_colour",
00360 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, ColourValue>(
00361 &Caelum::FlatCloudLayer::getSunLightColour,
00362 &Caelum::FlatCloudLayer::setSunLightColour));
00363 td->add("sun_sphere_colour",
00364 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, ColourValue>(
00365 &Caelum::FlatCloudLayer::getSunSphereColour,
00366 &Caelum::FlatCloudLayer::setSunSphereColour));
00367 td->add("fog_colour",
00368 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, ColourValue>(
00369 &Caelum::FlatCloudLayer::getFogColour,
00370 &Caelum::FlatCloudLayer::setFogColour));
00371
00372
00373 td->add("cloud_speed",
00374 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector2>(
00375 &Caelum::FlatCloudLayer::getCloudSpeed,
00376 &Caelum::FlatCloudLayer::setCloudSpeed));
00377
00378
00379 td->add("blend_time",
00380 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00381 &Caelum::FlatCloudLayer::getCloudBlendTime,
00382 &Caelum::FlatCloudLayer::setCloudBlendTime));
00383
00384
00385 td->add("mesh_width",
00386 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00387 &Caelum::FlatCloudLayer::getMeshWidth,
00388 &Caelum::FlatCloudLayer::setMeshWidth));
00389 td->add("mesh_height",
00390 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00391 &Caelum::FlatCloudLayer::getMeshHeight,
00392 &Caelum::FlatCloudLayer::setMeshHeight));
00393 td->add("mesh_width_segments",
00394 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, int, int, int>(
00395 &Caelum::FlatCloudLayer::getMeshWidthSegments,
00396 &Caelum::FlatCloudLayer::setMeshWidthSegments));
00397 td->add("mesh_height_segments",
00398 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, int, int, int>(
00399 &Caelum::FlatCloudLayer::getMeshHeightSegments,
00400 &Caelum::FlatCloudLayer::setMeshHeightSegments));
00401
00402
00403 td->add("cloud_uv_factor",
00404 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00405 &Caelum::FlatCloudLayer::getCloudUVFactor,
00406 &Caelum::FlatCloudLayer::setCloudUVFactor));
00407 td->add("height_red_factor",
00408 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00409 &Caelum::FlatCloudLayer::getHeightRedFactor,
00410 &Caelum::FlatCloudLayer::setHeightRedFactor));
00411
00412
00413 td->add("near_fade_dist",
00414 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00415 &Caelum::FlatCloudLayer::getNearFadeDist,
00416 &Caelum::FlatCloudLayer::setNearFadeDist));
00417 td->add("far_fade_dist",
00418 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
00419 &Caelum::FlatCloudLayer::getFarFadeDist,
00420 &Caelum::FlatCloudLayer::setFarFadeDist));
00421 td->add("fade_dist_measurement_vector",
00422 new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector3>(
00423 &Caelum::FlatCloudLayer::getFadeDistMeasurementVector,
00424 &Caelum::FlatCloudLayer::setFadeDistMeasurementVector));
00425
00426 FlatCloudLayerTypeDescriptor = td.release ();
00427 }
00428
00429 if (!SkyDomeTypeDescriptor)
00430 {
00431 std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
00432
00433
00434
00435
00436 td->add("sun_direction",
00437 new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::Vector3>(
00438 0, &Caelum::SkyDome::setSunDirection));
00439 td->add("haze_colour",
00440 new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::ColourValue>(
00441 0, &Caelum::SkyDome::setHazeColour));
00442
00443
00444 td->add("sky_gradients_image",
00445 new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::String>(
00446 0, &Caelum::SkyDome::setSkyGradientsImage));
00447 td->add("atmosphere_depth_image",
00448 new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::String>(
00449 0, &Caelum::SkyDome::setAtmosphereDepthImage));
00450
00451
00452 td->add("haze_enabled",
00453 new AccesorPropertyDescriptor<Caelum::SkyDome, bool, bool, bool>(
00454 &Caelum::SkyDome::getHazeEnabled,
00455 &Caelum::SkyDome::setHazeEnabled));
00456
00457 SkyDomeTypeDescriptor = td.release ();
00458 }
00459 }
00460 }
00461
00462 #endif // CAELUM_TYPE_DESCRIPTORS