Example #1
0
VEnvironmentObject::VEnvironmentObject()
	: VSceneObject()
	, mSceneMgr(VNULL)
	, mViewport(VNULL)
	, mWeatherParticleSystemName("")
	, mAmbientLight(Ogre::ColourValue::Black)
	, mBackgroundColor(Ogre::ColourValue::Black)
	, mFogColor(Ogre::ColourValue::White)
	, mFogMode(Ogre::FOG_NONE)
	, mFogExpDensity(0.001f)
	, mFogLinearStart(0.0f)
	, mFogLinearEnd(1.0f)
	, mRenderWeather(VFALSE)
{
	typedef VEnvColorRGBMemberCommand<&VEnvironmentObject::mAmbientLight> VAmbientLightCmd;
	typedef VEnvColorRGBMemberCommand<&VEnvironmentObject::mBackgroundColor> VBackgroundColorCmd;
	typedef VEnvColorRGBMemberCommand<&VEnvironmentObject::mFogColor> VFogColorCmd;

	typedef VObjectMemberPropertyCommand<VEnvironmentObject,Ogre::Real,&VEnvironmentObject::mFogExpDensity> VFogExpDensityCmd;    
	typedef VObjectMemberPropertyCommand<VEnvironmentObject,Ogre::Real,&VEnvironmentObject::mFogLinearStart> VFogLinearStartCmd;
	typedef VObjectMemberPropertyCommand<VEnvironmentObject,Ogre::Real,&VEnvironmentObject::mFogLinearEnd> VFogLinearEndCmd;

	typedef VObjectMemberPropertyCommand<VEnvironmentObject,VString,&VEnvironmentObject::mWeatherParticleSystemName> VWeatherParticleSystemNameCmd;

	if (createPropertyDictionary("Environment"))
	{
		static VAmbientLightCmd ambientColorCmd;
		defineProperty(
			"ambient",
			"The ambient light level to be used for the scene",
			"ColorRGB",
			&ambientColorCmd,
			0);

		static VBackgroundColorCmd backgroundColorCmd;
		defineProperty(
			"background",
			"The background color of the scene",
			"ColorRGB",
			&backgroundColorCmd,
			0);

		static VFogModeCmd fogModeCmd;
		defineProperty(
			"fog.mode",
			"The fog mode",
			getEnumTypeString("FogMode", gsFogModeConstants),
			&fogModeCmd,
			0);

		static VFogColorCmd fogColorCmd;
		defineProperty(
			"fog.colour",
			"The color of the fog.",
			"ColorRGB",
			&fogColorCmd,
			0);     

		static VFogExpDensityCmd expDensityCmd;
		defineProperty(
			"fog.exp density",
			"The density of the fog in exp or exp2 mode.",
			"Real",
			&expDensityCmd,
			0);    

		static VFogLinearStartCmd linearStartCmd;
		defineProperty(
			"fog.linear start",
			"Distance in world units at which linear fog starts to encroach.",
			"Real",
			&linearStartCmd,
			0);    

		static VFogLinearEndCmd linearEndCmd;
		defineProperty(
			"fog.linear end",
			"Distance in world units at which linear fog becomes completely opaque.",
			"Real",
			&linearEndCmd,
			0);    

		static VRenderWeatherCmd renderWeatherCmd;
		defineProperty(
			"weather.render weather",
			"if this option is true, the weather particle system will be rendered.",
			"Bool",
			&renderWeatherCmd,
			0);

		static VWeatherParticleSystemNameCmd weatherCmd;
		defineProperty(
			"weather.particle system name",
			"The name of the particle system that used for scene weather.",
			"String",
			&weatherCmd,
			0);
	}
}
    EnviromentObject::EnviromentObject(void)
        : Object()
        , mSceneManager(NULL)
        , mViewport(NULL)
        , mFogMode(Ogre::FOG_NONE)
        , mFogExpDensity(0.001f)
        , mFogLinearStart(0.0f)
        , mFogLinearEnd(1.0f)
        , mAmbientLight(Ogre::ColourValue::Black)
        , mBackgroundColour(Ogre::ColourValue::Black)
        , mFogColour(Ogre::ColourValue::White)
		, mWeatherParticleSystemName("")
		, mWeatherParticleSystem(NULL)
		, mWeatherParticleSystemNode(NULL)
		, mRenderWeather(true)
    {
        if (createPropertyDictionary("Enviroment"))
        {
            static AmbientLightCmd ambientColourCmd;
            defineProperty(
                "ambient",
                "The ambient light level to be used for the scene.",
                "ColourRGB",
                &ambientColourCmd,
                0);     

            static BackgroundColourCmd backgroundCmd;
            defineProperty(
                "background",
                "The background colour of the scene.",
                "ColourRGB",
                &backgroundCmd,
                0);     

            static FogModeCmd fogModeCmd;
            defineProperty(
                "fog.mode",
                "The fog mode",
                getEnumTypeString("FogMode", gsFogModeConstants),
                &fogModeCmd,
                0);

            static FogColourCmd fogColourCmd;
            defineProperty(
                "fog.colour",
                "The colour of the fog.",
                "ColourRGB",
                &fogColourCmd,
                0);     

            static FogExpDensityCmd expDensityCmd;
            defineProperty(
                "fog.exp density",
                "The density of the fog in exp or exp2 mode.",
                "Real",
                &expDensityCmd,
                0);    

            static FogLinearStartCmd linearStartCmd;
            defineProperty(
                "fog.linear start",
                "Distance in world units at which linear fog starts to encroach.",
                "Real",
                &linearStartCmd,
                0);    

            static FogLinearEndCmd linearEndCmd;
            defineProperty(
                "fog.linear end",
                "Distance in world units at which linear fog becomes completely opaque.",
                "Real",
                &linearEndCmd,
                0);    

			static RenderWeatherCmd renderWeatherCmd;
			defineProperty(
				"weather.render weather",
				"if this option is true, the weather particle system will be rendered.",
				"Bool",
				&renderWeatherCmd
				);

			static WeatherParticleSystemNameCmd weatherCmd;
			defineProperty(
				"weather.particle system name",
				"The name of the particle system that used for scene weather.",
				"String",
				&weatherCmd
				);
        }
    }
Example #3
0
    LightObject::LightObject(void)
        : Object()
        , mBaseSceneNode(NULL)
        , mSceneNode(NULL)
        , mLight(NULL)
        , mLightType(Ogre::Light::LT_POINT)
        , mDiffuse(Ogre::ColourValue::White)
        , mSpecular(Ogre::ColourValue::Black)
        , mPosition(Ogre::Vector3::ZERO)
        , mDirection(Ogre::Vector3::UNIT_Z)
        , mRange(100000.0f)
        , mAttenuationConstant(1.0f)
        , mAttenuationLinear(0.0f)
        , mAttenuationQuadric(0.0f)
        , mSpotOuterAngle(40.0f)
        , mSpotInnerAngle(30.0f)
        , mSpotFalloff(1.0f)
        , mCastShadows(false)
        , mStaticLight(false)
    {
        if (createPropertyDictionary("Light"))
        {
            static LightTypeCmd lightTypeCmd;
            defineProperty(
                "type",
                "The type of light.",
                getEnumTypeString("LightType", gsLightTypeConstants),
                &lightTypeCmd,
                0);

            static DiffuseCmd diffuseCmd;
            defineProperty(
                "diffuse",
                "The colour of the diffuse light given off by this light.",
                "ColourRGB",
                &diffuseCmd,
                0);

            static SpecularCmd specularCmd;
            defineProperty(
                "specular",
                "The colour of the specular light given off by this light.",
                "ColourRGB",
                &specularCmd,
                0);

            static PositionCmd positionCmd;
            defineProperty(
                "position",
                "The position of the light.\n"
                "Applicable to point lights and spotlights only.",
                "Position",
                &positionCmd,
                0);

            static DirectionCmd directionCmd;
            defineProperty(
                "direction",
                "The direction of the light.\n"
                "Applicable to directional lights and spotlights only.",
                "Direction",
                &directionCmd,
                0);

            static RangeCmd rangeCmd;
            defineProperty(
                "range",
                "The absolute upper range of the light.\n"
                "Applicable to point lights and spotlights only.",
                "Real",
                &rangeCmd,
                0);

            static AttenuationConstantCmd attenuationConstantCmd;
            defineProperty(
                "attenuation.constant",
                "The constant factor in the attenuation formula.\n"
                "Applicable to point lights and spotlights only.",
                "Real",
                &attenuationConstantCmd,
                0);

            static AttenuationLinearCmd attenuationLinearCmd;
            defineProperty(
                "attenuation.linear",
                "The linear factor in the attenuation formula.\n"
                "Applicable to point lights and spotlights only.",
                "Real",
                &attenuationLinearCmd,
                0);

            static AttenuationQuadricCmd attenuationQuadricCmd;
            defineProperty(
                "attenuation.quadric",
                "The quadric factor in the attenuation formula.\n"
                "Applicable to point lights and spotlights only.",
                "Real",
                &attenuationQuadricCmd,
                0);

            static SpotOuterAngleCmd spotOuterAngleCmd;
            defineProperty(
                "spotlight.outer",
                "The angle covered by the spotlights outer cone.\n"
                "Applicable to spotlights only.",
                "Real",
                &spotOuterAngleCmd,
                0);

            static SpotInnerAngleCmd spotInnerAngleCmd;
            defineProperty(
                "spotlight.inner",
                "The angle covered by the spotlights inner cone.\n"
                "Applicable to spotlights only.",
                "Real",
                &spotInnerAngleCmd,
                0);

            static SpotFalloffCmd spotFalloffCmd;
            defineProperty(
                "spotlight.falloff",
                "The falloff between the inner and outer cones of the spotlight.\n"
                "Applicable to spotlights only.",
                "Real",
                &spotFalloffCmd,
                0);

            static CastShadowsCmd castShadowsCmd;
            defineProperty(
                "cast shadows",
                "Does this light cast shadows?",
                "Bool",
                &castShadowsCmd,
                0);

            static StaticLightCmd staticLightCmd;
            defineProperty(
                "static light",
                "This light is use as static, which will be use for calculate lightmap only.",
                "Bool",
                &staticLightCmd,
                0);
        }
    }