-
Notifications
You must be signed in to change notification settings - Fork 70
/
EC_Sky.h
89 lines (72 loc) · 2.83 KB
/
EC_Sky.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// For conditions of distribution and use, see copyright notice in LICENSE
#pragma once
#include "OgreModuleApi.h"
#include "IComponent.h"
#include "IAttribute.h"
#include "Math/Quat.h"
#include "AssetReference.h"
#include "OgreModuleFwd.h"
#include "AssetRefListener.h"
/// Makes the entity a sky.
/** <table class="header">
<tr>
<td>
<h2>Sky</h2>
Makes the entity a sky.
Registered by OgreRenderingModule.
<b>Attributes</b>:
<ul>
<li>AssetReference: materialRef
<div> @copydoc materialRef </div>
<li>Quat: orientation
<div> @copydoc orientation </div>
<li>float: distance
<div> @copydoc distance </div>
<li>bool : drawFirst
<div> @copydoc drawFirst </div>
</ul>
</table> */
class OGRE_MODULE_API EC_Sky : public IComponent
{
Q_OBJECT
COMPONENT_NAME("Sky", 10)
public:
/// @cond PRIVATE
/// Do not directly allocate new components using operator new, but use the factory-based SceneAPI::CreateComponent functions instead.
explicit EC_Sky(Scene* scene);
/// @endcond
virtual ~EC_Sky();
/// Sky material reference.
/** Material defines how the sky looks. Dy default and typically a material with cubic texture is used,
but also f.ex. a simpler material can be used to paint the sky with solid color. */
Q_PROPERTY(AssetReference materialRef READ getmaterialRef WRITE setmaterialRef);
DEFINE_QPROPERTY_ATTRIBUTE(AssetReference, materialRef);
/// Sky texture references.
/** @deprecated Use materialRef to set the appearance of the sky.
@todo Remove. */
Q_PROPERTY(AssetReferenceList textureRefs READ gettextureRefs WRITE settextureRefs);
DEFINE_QPROPERTY_ATTRIBUTE(AssetReferenceList, textureRefs);
/// Distance in world coordinates from the camera to each plane of the box.
Q_PROPERTY(float distance READ getdistance WRITE setdistance);
DEFINE_QPROPERTY_ATTRIBUTE(float, distance);
/// Optional parameter to specify the orientation of the box.
Q_PROPERTY(Quat orientation READ getorientation WRITE setorientation);
DEFINE_QPROPERTY_ATTRIBUTE(Quat, orientation);
/// Defines is sky drawn first.
Q_PROPERTY(bool drawFirst READ getdrawFirst WRITE setdrawFirst);
DEFINE_QPROPERTY_ATTRIBUTE(bool, drawFirst);
/// Is the sky enabled.
Q_PROPERTY(bool enabled READ getenabled WRITE setenabled);
DEFINE_QPROPERTY_ATTRIBUTE(bool, enabled);
private:
void AttributesChanged();
void Update();
AssetRefListenerPtr materialAsset;
std::vector<AssetRefListenerPtr> textureAssets;
QString currentMaterial; ///< Ogre resource name for the currently used material.
OgreWorldWeakPtr world_;
private slots:
void OnMaterialAssetLoaded(AssetPtr mat);
/// @deprecated This will be removed when textureRefs attribute is removed.
void OnTextureAssetLoaded(AssetPtr tex);
};