2 #include "IAttributeFields.h" 3 #include "light_scattering_data.h" 4 #include "LightParam.h" 41 ATTRIBUTE_METHOD1(
CSunLight, GetTimeOfDay_s,
float*) {*p1 = cls->GetTimeOfDay();
return S_OK;}
42 ATTRIBUTE_METHOD1(
CSunLight, SetTimeOfDay_s,
float) {cls->SetTimeOfDay(p1);
return S_OK;}
44 ATTRIBUTE_METHOD1(
CSunLight, GetTimeOfDaySTD_s,
float*) {*p1 = cls->GetTimeOfDaySTD();
return S_OK;}
45 ATTRIBUTE_METHOD1(
CSunLight, SetTimeOfDaySTD_s,
float) {cls->SetTimeOfDaySTD(p1);
return S_OK;}
47 ATTRIBUTE_METHOD1(
CSunLight, GetMaximumAngle_s,
float*) {*p1 = cls->GetMaximumAngle();
return S_OK;}
48 ATTRIBUTE_METHOD1(
CSunLight, SetMaximumAngle_s,
float) {cls->SetMaximumAngle(p1);
return S_OK;}
50 ATTRIBUTE_METHOD1(
CSunLight, GetSunDiffuse_s,
Vector3*) { *p1 = cls->GetSunDiffuse().ToVector3();
return S_OK; }
53 ATTRIBUTE_METHOD1(
CSunLight, GetSunAmbient_s,
Vector3*) { *p1 = cls->GetSunAmbient().ToVector3();
return S_OK; }
56 ATTRIBUTE_METHOD1(
CSunLight, IsAutoSunColorEnable_s,
bool*) {*p1 = cls->IsAutoSunColorEnable();
return S_OK;}
57 ATTRIBUTE_METHOD1(
CSunLight, EnableAutoSunColor_s,
bool) {cls->EnableAutoSunColor(p1);
return S_OK;}
59 ATTRIBUTE_METHOD1(
CSunLight, GetDayLength_s,
float*) {*p1 = cls->GetDayLength();
return S_OK;}
60 ATTRIBUTE_METHOD1(
CSunLight, SetDayLength_s,
float) {cls->SetDayLength(p1);
return S_OK;}
62 ATTRIBUTE_METHOD1(
CSunLight, GetSunAngle_s,
float*) {*p1 = cls->GetSunAngle();
return S_OK;}
63 ATTRIBUTE_METHOD1(
CSunLight, SetSunAngle_s,
float) {cls->SetSunAngle(p1);
return S_OK;}
66 ATTRIBUTE_METHOD1(
CSunLight, GetShadowFactor_s,
float*) {*p1 = cls->GetShadowFactor();
return S_OK;}
67 ATTRIBUTE_METHOD1(
CSunLight, SetShadowFactor_s,
float) {cls->SetShadowFactor(p1);
return S_OK;}
177 float GetShadowFactor();
179 void SetShadowFactor(
float shadowFactor);
181 bool HasNightHours()
const;
182 void SetHasNightHours(
bool val);
188 float m_fYaxisRotation;
193 float m_fCurrentAngle;
203 bool m_bAutoSunColor;
205 bool m_bHasNightHours;
207 float m_shadowFactor;
214 void UpdateSunParameters();
217 void SetPosition(
const Vector3& newpos);
void SetSunAngle(float fSunAngle)
set the sun angle.
Definition: SunLight.cpp:119
float GetTimeOfDay()
get the current time in seconds
Definition: SunLight.cpp:54
CLightScatteringData * GetLightScatteringData()
get light Scattering Data object.
Definition: SunLight.cpp:125
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
void SetSunAmbient(const LinearColor &ambient)
Set the ambient sun color.
Definition: SunLight.cpp:75
Vector3 GetSunDirection()
get the normalized sun direction vector, please note the vector always points from the sun position t...
Definition: SunLight.cpp:104
float GetMaximumAngle()
get the maximum sun angle with the Y axis.
Definition: SunLight.cpp:135
float CalculateCelestialAngle(float curTime, float relativeTime=0.f)
in seconds
Definition: SunLight.cpp:262
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: SunLight.h:37
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: light_scattering_data.h:26
LinearColor GetSunAmbient()
get the ambient sun color.
Definition: SunLight.cpp:70
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: SunLight.cpp:244
Modeling the global sun and its directional light, including sun position, direction, color, time of day, etc.
Definition: SunLight.h:26
float GetSunAngle()
Get the sun angle, where angle 0 means the noon.
Definition: SunLight.cpp:114
void SetTimeOfDay(float time)
set time of day in seconds.
Definition: SunLight.cpp:161
void SetTimeOfDaySTD(float time)
set standard time.
Definition: SunLight.cpp:174
the sky object in the scene.
Definition: SkyMesh.h:13
float GetCelestialAngle()
angle between [0, 1].
Definition: SunLight.cpp:278
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
float GetDayLength()
return how many minutes are there in a day in minutes
Definition: SunLight.cpp:150
void EnableAutoSunColor(bool bEnable)
set whether we will automatically adjust sun diffuse and ambient colors according to time of day...
Definition: SunLight.cpp:81
bool IsAutoSunColorEnable()
get whether we will automatically adjust sun diffuse and ambient colors according to time of day...
Definition: SunLight.cpp:93
LinearColor GetSunColor()
get the ambient sun color.
Definition: SunLight.cpp:99
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: SunLight.h:35
void SetMaximumAngle(float fMaxAngle)
set the maximum sun angle with the Y axis.
Definition: SunLight.cpp:130
void SetDayLength(float fMinutes)
set how many minutes are there in a day, this is used in time simulation.
Definition: SunLight.cpp:155
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
The top level scene management class.
Definition: SceneObject.h:58
CSunLight()
Definition: SunLight.cpp:20
void SetSunDiffuse(const LinearColor &diffuse)
Set the ambient sun color.
Definition: SunLight.cpp:64
LinearColor * CalcSunriseSunsetColors(float fCelestialAngle)
return NULL if no sun set colors.
Definition: SunLight.cpp:293
a single light in ParaEngine.
Definition: LightParam.h:6
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: SunLight.h:33
Definition: RenderCore.h:34
float GetTimeOfDaySTD()
get standard time.
Definition: SunLight.cpp:167
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
float AdvanceTimeOfDay(float timeDelta)
advance time is in seconds, this will also change the light direction, sun color and sun ambient colo...
Definition: SunLight.cpp:180
LinearColor GetSunAmbientHue()
get the Ambient color of the sun.
Definition: SunLight.cpp:109
LinearColor GetSunDiffuse()
get the ambient sun color.
Definition: SunLight.cpp:59
Para3DLight * GetD3DLight()
get the equivalent light in d3d format
Definition: SunLight.cpp:49
LinearColor ComputeFogColor()
compute and return the fog color
Definition: SunLight.cpp:230
float GetCelestialAngleRadian()
(GetCelestialAngle() * 2 * PI)
Definition: SunLight.cpp:288