2 #include "TileObject.h" 19 virtual CBaseObject::_SceneObjectType GetType(){
return CBaseObject::SkyMesh; };
39 ATTRIBUTE_SUPPORT_CREATE_FACTORY(
CSkyMesh);
40 ATTRIBUTE_METHOD1(
CSkyMesh, GetSkyColorFactor_s,
Vector3*) { (*p1).x = cls->GetSkyColorFactor().r; (*p1).y = cls->GetSkyColorFactor().g; (*p1).z = cls->GetSkyColorFactor().b;
return S_OK; }
41 ATTRIBUTE_METHOD1(
CSkyMesh, SetSkyColorFactor_s,
Vector3) {
LinearColor c(p1.x, p1.y, p1.z, 1); cls->SetSkyColorFactor(c);
return S_OK; }
42 ATTRIBUTE_METHOD1(
CSkyMesh, GetSkyMeshFile_s,
const char**) { *p1 = cls->GetSkyMeshFile();
return S_OK; }
43 ATTRIBUTE_METHOD1(
CSkyMesh, SetSkyMeshFile_s,
const char*) { cls->SetSkyMeshFile(p1);
return S_OK; }
44 ATTRIBUTE_METHOD1(
CSkyMesh, GetSkyMeshTexture_s,
const char**) { *p1 = cls->GetSkyMeshTexture();
return S_OK; }
45 ATTRIBUTE_METHOD1(
CSkyMesh, SetSkyMeshTexture_s,
const char*) { cls->SetSkyMeshTexture(p1);
return S_OK; }
47 ATTRIBUTE_METHOD1(
CSkyMesh, GetFogBlendAngleFrom_s,
float*) { *p1 = cls->GetFogBlendAngleFrom();
return S_OK; }
48 ATTRIBUTE_METHOD1(
CSkyMesh, SetFogBlendAngleFrom_s,
float) { cls->SetFogBlendAngleFrom(p1);
return S_OK; }
49 ATTRIBUTE_METHOD1(
CSkyMesh, GetFogBlendAngleTo_s,
float*) { *p1 = cls->GetFogBlendAngleTo();
return S_OK; }
50 ATTRIBUTE_METHOD1(
CSkyMesh, SetFogBlendAngleTo_s,
float) { cls->SetFogBlendAngleTo(p1);
return S_OK; }
52 ATTRIBUTE_METHOD1(
CSkyMesh, IsSimulatedSkyEnabled_s,
bool*) { *p1 = cls->IsSimulatedSkyEnabled();
return S_OK; }
53 ATTRIBUTE_METHOD1(
CSkyMesh, EnableSimulatedSky_s,
bool) { cls->EnableSimulatedSky(p1);
return S_OK; }
55 ATTRIBUTE_METHOD1(
CSkyMesh, GetIsAutoDayTime_s,
bool*) { *p1 = cls->GetIsAutoDayTime();
return S_OK; }
56 ATTRIBUTE_METHOD1(
CSkyMesh, SetIsAutoDayTime_s,
bool) { cls->SetIsAutoDayTime(p1);
return S_OK; }
58 ATTRIBUTE_METHOD1(
CSkyMesh, GetSunGlowTexture_s,
const char**) { *p1 = cls->GetSunGlowTexture();
return S_OK; }
59 ATTRIBUTE_METHOD1(
CSkyMesh, SetSunGlowTexture_s,
const char*) { cls->SetSunGlowTexture(p1);
return S_OK; }
61 ATTRIBUTE_METHOD1(
CSkyMesh, GetCloudTexture_s,
const char**) { *p1 = cls->GetCloudTexture();
return S_OK; }
62 ATTRIBUTE_METHOD1(
CSkyMesh, SetCloudTexture_s,
const char*) { cls->SetCloudTexture(p1);
return S_OK; }
64 ATTRIBUTE_METHOD1(
CSkyMesh, GetSunColor_s,
Vector3*) { (*p1) = cls->GetSunColor();
return S_OK; }
65 ATTRIBUTE_METHOD1(
CSkyMesh, SetSunColor_s,
Vector3) { cls->SetSunColor(p1);
return S_OK; }
67 ATTRIBUTE_METHOD1(
CSkyMesh, GetLightSkyColor_s,
Vector3*) { (*p1) = cls->GetLightSkyColor();
return S_OK; }
68 ATTRIBUTE_METHOD1(
CSkyMesh, SetLightSkyColor_s,
Vector3) { cls->SetLightSkyColor(p1);
return S_OK; }
70 ATTRIBUTE_METHOD1(
CSkyMesh, GetDarkSkyColor_s,
Vector3*) { (*p1) = cls->GetDarkSkyColor();
return S_OK; }
71 ATTRIBUTE_METHOD1(
CSkyMesh, SetDarkSkyColor_s,
Vector3) { cls->SetDarkSkyColor(p1);
return S_OK; }
73 ATTRIBUTE_METHOD1(
CSkyMesh, GetSunIntensity_s,
Vector2*) { (*p1) = cls->GetSunIntensity();
return S_OK; }
74 ATTRIBUTE_METHOD1(
CSkyMesh, SetSunIntensity_s,
Vector2) { cls->SetSunIntensity(p1);
return S_OK; }
76 ATTRIBUTE_METHOD1(
CSkyMesh, GetCloudColor_s,
Vector3*) { (*p1) = cls->GetCloudColor();
return S_OK; }
77 ATTRIBUTE_METHOD1(
CSkyMesh, SetCloudColor_s,
Vector3) { cls->SetCloudColor(p1);
return S_OK; }
79 ATTRIBUTE_METHOD1(
CSkyMesh, GetCloudVelocity_s,
Vector2*) { (*p1) = cls->GetCloudVelocity();
return S_OK; }
80 ATTRIBUTE_METHOD1(
CSkyMesh, SetCloudVelocity_s,
Vector2) { cls->SetCloudVelocity(p1);
return S_OK; }
82 ATTRIBUTE_METHOD1(
CSkyMesh, GetCloudOffset_s,
Vector2*) { (*p1) = cls->GetCloudOffset();
return S_OK; }
83 ATTRIBUTE_METHOD1(
CSkyMesh, SetCloudOffset_s,
Vector2) { cls->SetCloudOffset(p1);
return S_OK; }
85 ATTRIBUTE_METHOD1(
CSkyMesh, GetCloudThickness_s,
float*) { *p1 = cls->GetCloudThickness();
return S_OK; }
86 ATTRIBUTE_METHOD1(
CSkyMesh, SetCloudThickness_s,
float) { cls->SetCloudThickness(p1);
return S_OK; }
88 ATTRIBUTE_METHOD1(
CSkyMesh, GetSunSize_s,
Vector2*) { (*p1) = cls->GetSunSize();
return S_OK; }
89 ATTRIBUTE_METHOD1(
CSkyMesh, SetSunSize_s,
Vector2) { cls->SetSunSize(p1);
return S_OK; }
91 ATTRIBUTE_METHOD1(
CSkyMesh, GetMoonSize_s,
Vector2*) { (*p1) = cls->GetMoonSize();
return S_OK; }
92 ATTRIBUTE_METHOD1(
CSkyMesh, SetMoonSize_s,
Vector2) { cls->SetMoonSize(p1);
return S_OK; }
94 ATTRIBUTE_METHOD1(
CSkyMesh, GetFogColor_s,
Vector3*) { (*p1) = cls->GetFogColor();
return S_OK; }
95 ATTRIBUTE_METHOD1(
CSkyMesh, SetFogColor_s,
Vector3) { cls->SetFogColor(p1);
return S_OK; }
125 void DrawStaticMeshSkyInner(
SceneState * sceneState);
127 virtual HRESULT RendererRecreated();
129 void CreateSkyVertexColorSimple();
142 void CreateSkyStaticMesh(
const string& strObjectName,
AssetEntity& MeshAsset, FLOAT fScaleX, FLOAT fScaleY, FLOAT fScaleZ, FLOAT fHeightOffset = 0);
153 float GetFogBlendAngleFrom(){
return m_fFogBlendAngleFrom; };
161 float GetFogBlendAngleTo(){
return m_fFogBlendAngleTo; };
186 static float m_fFogBlendAngleFrom;
187 static float m_fFogBlendAngleTo;
191 void SetSkyMesh(
AssetEntity& MeshAsset,
float fHeightOffset = 0);
198 bool m_bSimsky_BufferInited;
200 bool m_bSimsky_AutoDayTime;
202 bool GetIsAutoDayTime() {
return m_bSimsky_AutoDayTime; }
203 void SetIsAutoDayTime(
bool bValue) { m_bSimsky_AutoDayTime = bValue; }
207 int m_nSimsky_vertexCount;
208 int m_nSimsky_indexCount;
209 int m_nSimsky_primitiveCount;
210 float m_fSimsky_verticalRadius;
211 float m_fSimsky_horizonRadius;
212 int m_nSimsky_verticalSampleCount;
213 int m_nSimsky_horizonSampleCount;
214 Vector3 m_vSimsky_sunDirection;
220 asset_ptr<TextureEntity> m_texSimsky_sunsetGlowTexture;
221 const char* GetSunGlowTexture();
222 void SetSunGlowTexture(
const char* sValue);
226 asset_ptr<TextureEntity> m_texSimsky_cloudTexture;
227 const char* GetCloudTexture();
228 void SetCloudTexture(
const char* sValue);
231 Vector3 GetSunColor() {
return m_vSimsky_sunColor; }
232 void SetSunColor(
const Vector3 & vValue) { m_vSimsky_sunColor = vValue; }
234 Vector3 m_vSimsky_lightSkyColor;
236 Vector3 GetLightSkyColor() {
return m_vSimsky_lightSkyColor; }
237 void SetLightSkyColor(
const Vector3 & vValue) { m_vSimsky_lightSkyColor = vValue; }
239 Vector3 m_vSimsky_darkSkyColor;
240 Vector3 GetDarkSkyColor() {
return m_vSimsky_darkSkyColor; }
241 void SetDarkSkyColor(
const Vector3 & vValue) { m_vSimsky_darkSkyColor = vValue; }
243 Vector2 m_vSimsky_sunIntensity;
244 Vector2 GetSunIntensity() {
return m_vSimsky_sunIntensity; }
245 void SetSunIntensity(
const Vector2 & vValue) { m_vSimsky_sunIntensity = vValue; }
248 Vector3 GetCloudColor() {
return m_vSimsky_cloudColor; }
249 void SetCloudColor(
const Vector3 & vValue) { m_vSimsky_cloudColor = vValue; }
251 Vector2 m_vSimsky_cloudDirection;
252 Vector2 GetCloudDirection() {
return m_vSimsky_cloudDirection; }
253 void SetCloudDirection(
const Vector2 & vValue) { m_vSimsky_cloudDirection = vValue; }
255 Vector2 m_vSimsky_cloudVelocity;
256 Vector2 GetCloudVelocity() {
return m_vSimsky_cloudVelocity; }
257 void SetCloudVelocity(
const Vector2 & vValue) { m_vSimsky_cloudVelocity = vValue; }
260 Vector2 GetCloudOffset() {
return m_vSimsky_cloudOffset; }
261 void SetCloudOffset(
const Vector2 & vValue) { m_vSimsky_cloudOffset = vValue; }
264 Vector2 GetSunSize() {
return m_vSimsky_sunSize; }
270 void SetSunSize(
const Vector2 & vValue) { m_vSimsky_sunSize = vValue; }
273 Vector3 GetFogColor()
const {
return m_vSimsky_fogColor; }
274 void SetFogColor(
Vector3 val) { m_vSimsky_fogColor = val; }
277 Vector2 GetMoonSize()
const {
return m_vSimsky_moonSize; }
278 void SetMoonSize(
Vector2 val) { m_vSimsky_moonSize = val; }
280 float m_fSimsky_cloudThickness;
281 float GetCloudThickness()
const {
return m_fSimsky_cloudThickness; }
282 void SetCloudThickness(
float val) { m_fSimsky_cloudThickness = val; }
285 void UpdateSimSky(
float fTime);
286 bool m_bSimsky_isDaytime;
291 void CreateSkySimulated(
int verticalSampleCount,
int horizonSampleCount,
float verticalRadius,
float horizonRadius);
void SetSkyMeshFile(const char *filename)
change the sky mesh model
Definition: SkyMesh.cpp:208
void DrawSimulatedSky(EffectManager *pEffectManager, SceneState *sceneState, CSunLight &sunlight, RenderDevicePtr pd3dDevice, Vector3 &vPos)
Definition: SkyMesh.cpp:657
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual HRESULT DeleteDeviceObjects()
delete device objects
Definition: SkyMesh.cpp:335
void EnableSimulatedSky(bool bEnable)
set whether we render the sky as simulated mesh
Definition: SkyMesh.cpp:239
SkyType
Definition: SkyMesh.h:21
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
different physics engine has different winding order.
Definition: EventBinding.h:32
the mesh is just a static mesh object.
Definition: SkyMesh.h:24
virtual HRESULT InitDeviceObjects()
init device objects.
Definition: SkyMesh.cpp:253
Modeling the global sun and its directional light, including sun position, direction, color, time of day, etc.
Definition: SunLight.h:26
virtual void SetPosition(const DVector3 &v)
always bottom center of the bounding shape
Definition: SkyMesh.h:145
a very thin wrapper to DirectX device with a portable version of openGL implementation.
Definition: RenderDeviceDirectX.h:10
a simulated sky
Definition: SkyMesh.h:26
void DrawStaticMeshSky(EffectManager *pEffectManager, SceneState *sceneState, RenderDevicePtr pd3dDevice, CSunLight &sunlight, Vector3 vPos)
Definition: SkyMesh.cpp:430
the sky object in the scene.
Definition: SkyMesh.h:13
cross platform vertex/index buffer.
Definition: ParaVertexBuffer.h:18
const char * GetSkyMeshFile()
get the sky mesh model file name.
Definition: SkyMesh.cpp:228
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
void SetSkyMeshTexture(const char *filename, int nTexIndex=2)
change the sky mesh model
Definition: SkyMesh.cpp:401
void SetFogBlendAngleTo(float fValue)
to which angle the sky fog ends, in most cases.
Definition: SkyMesh.h:160
The ref_ptr class template stores a pointer to a dynamically allocated (AssetEntity|CRefCounted|BaseA...
Definition: PERefPtr.h:13
in OpenGL, there is no different between vertex and index buffer.
Definition: ParaVertexBuffer.h:78
virtual DVector3 GetPosition()
always bottom center of the bounding shape
Definition: SkyMesh.h:144
bool IsSimulatedSkyEnabled()
get whether we render the sky as simulated mesh
Definition: SkyMesh.h:166
virtual HRESULT Draw(SceneState *sceneState)
render the sky
Definition: SkyMesh.cpp:68
Tile Object have position and bounding rect and can usually be attached to quad-tree terrain tile...
Definition: TileObject.h:10
void SetFogBlendAngleFrom(float fValue)
from which angle the sky fog begins, in most cases.
Definition: SkyMesh.h:152
manager all effects file used by the game engine.
Definition: EffectManager.h:16
void SetSkyColorFactor(const LinearColor &color)
a color to be multiplied to the sky, giving it a special color hue
Definition: SkyMesh.h:116
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: SkyMesh.h:35
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: SkyMesh.cpp:830
const LinearColor & GetSkyColorFactor()
a color to be multiplied to the sky, giving it a special color hue
Definition: SkyMesh.h:111
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: SkyMesh.h:33
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: SkyMesh.h:31
const char * GetSkyMeshTexture(int nTexIndex=2)
get the sky mesh model file name.
Definition: SkyMesh.cpp:409
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
void CreateSkyStaticMesh(const string &strObjectName, AssetEntity &MeshAsset, FLOAT fScaleX, FLOAT fScaleY, FLOAT fScaleZ, FLOAT fHeightOffset=0)
Create the sky mesh as a static mesh object.
Definition: SkyMesh.cpp:159