OROCHI
 
Loading...
Searching...
No Matches
GxUnitLight.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13GX_SHADER_NAMESPACE_BEGIN()
14
15//===========================================================================
17//===========================================================================
19{
20 //-----------------------------------------------------------
22 //-----------------------------------------------------------
24public:
25 GX_RTTI_CLASS_NAME(GxUnitLightShadow, GxUnitLightDirectionalBase, "シャドウライト")
26 // ClassBaseReference継承クラス用禁止宣言
28
29
30 //-----------------------------------------------------------
32 //-----------------------------------------------------------
34protected:
37public:
39 void cleanup(void) override;
40
42 //-----------------------------------------------------------
44 //-----------------------------------------------------------
46protected:
48 b32 setup(void) override;
50 void forceAsyncUpdate(void) override;
51
52#if GX_DEVELOP
53public:
55 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index);
56#endif //GX_DEVELOP
57
59 //-----------------------------------------------------------
61 //-----------------------------------------------------------
63public:
65 GX_FORCE_INLINE const GxColorHDR& getAmbientColor(void) const { return _ambientColor; }
67 GX_FORCE_INLINE void setAmbientColor(const GxColorHDR& color) { _ambientColor = color; }
68
70 GX_FORCE_INLINE b32 isShadowEnable(void) const { return _shadowEnable; }
72 GX_FORCE_INLINE void setShadowEnable(b32 enable) { _shadowEnable = enable; }
73
75 constexpr f32 getShadowNearZ(void) const { return _shadowNearZ; }
77 constexpr void setShadowNearZ(f32 nearZ) { _shadowNearZ = nearZ; }
79 constexpr f32 getShadowFarZ(void) const { return _shadowFarZ; }
81 constexpr void setShadowFarZ(f32 farZ) { _shadowFarZ = farZ; }
83 constexpr f32 getShadowNearFade(void) const { return _shadowNearFade; }
85 constexpr void setShadowNearFade(f32 nearFade) { _shadowNearFade = nearFade; }
87 constexpr f32 getShadowFarFade(void) const { return _shadowFarFade; }
89 constexpr void setShadowFarFade(f32 farFade) { _shadowFarFade = farFade; }
91 constexpr f32 getShadowSplitParam(void) const { return _shadowSplitParam; }
93 constexpr void setShadowSplitParam(f32 splitParam) { _shadowSplitParam = splitParam; }
95 constexpr f32 getShadowFirstFarZ(void) const { return _shadowFirstFarZ; }
97 constexpr void setShadowFirstFarZ(f32 farZ) { _shadowFirstFarZ = farZ; }
98
100 constexpr f32 getShadowWorldYMax(void) const { return _shadowWorldYMax; }
102 constexpr void setShadowWorldYMax(f32 worldYMax) { _shadowWorldYMax = worldYMax; }
104 constexpr f32 getShadowWorldYMin(void) const { return _shadowWorldYMin; }
106 constexpr void setShadowWorldYMin(f32 worldYMin) { _shadowWorldYMin = worldYMin; }
107
109 constexpr f32 getShadowOffset(void) const { return _shadowOffset; }
111 constexpr void setShadowOffset(f32 offset) { _shadowOffset = offset; }
112
114 GX_FORCE_INLINE b32 isProjectionMapEnable(void) const { return _projectionMapEnable; }
116 GX_FORCE_INLINE void setProjectionMapEnable(b32 enable) { _projectionMapEnable = enable; }
118 constexpr GxResTexture* getResProjectionMap(u32 index) const { return _pResProjectionMap[index]; }
120 constexpr void setResProjectionMap(u32 index, GxResTexture* resTexture) { _pResProjectionMap[index] = resTexture; }
122 constexpr f32 getProjectionMapScaling(void) const { return _projectionMapScaling; }
124 constexpr void setProjectionMapScaling(f32 scaling) { _projectionMapScaling = scaling; }
126 GX_FORCE_INLINE GxVector2 getProjectionMapUVVelocity(u32 index) const { return _projectionMapUVVelocity[index]; }
128 GX_FORCE_INLINE void setProjectionMapUVVelocity(u32 index, const GxVector2& velocity) { _projectionMapUVVelocity[index] = velocity; }
130 constexpr f32 getProjectionMapIntensityMax(void) const { return _projectionMapIntensityMax; }
132 constexpr void setProjectionMapIntensityMax(f32 intensity) { _projectionMapIntensityMax = intensity; }
134 constexpr f32 getProjectionMapIntensityMin(void) const { return _projectionMapIntensityMin; }
136 constexpr void setProjectionMapIntensityMin(f32 intensity) { _projectionMapIntensityMin = intensity; }
138 GX_FORCE_INLINE GxVector3 getProjectionMapUVOrigin(void) const { return _projectionMapUVOrigin; }
140 GX_FORCE_INLINE void setProjectionMapUVOrigin(const GxVector3& origin) { _projectionMapUVOrigin = origin; }
142 GxMatrix44 calculateProjectionMapMatrix(const GxMatrix44& inverseCameraView) const;
144 GX_FORCE_INLINE GxVector2 getProjectionMapUVOffset(u32 index) const { return _projectionMapUVOffset[index]; }
146 GX_FORCE_INLINE GxVector4 getProjectionMapParam(void) const { return GxVector4((_projectionMapIntensityMax - _projectionMapIntensityMin) / 2, _projectionMapIntensityMin, 0, 0); }
147
148private:
150 void getPropertyProjectionMap(void* const pValue, u32 index);
152 void setPropertyProjectionMap(const void* const pValue, u32 index);
154 constexpr u32 getPropertyProjectionMapCount(void) const { return 2; }
156 constexpr void setPropertyProjectionMapCount(u32){}
157
159 //-----------------------------------------------------------
161 //-----------------------------------------------------------
163private:
164 GxColorHDR _ambientColor;
165 b32 _shadowEnable;
166 f32 _shadowNearZ;
167 f32 _shadowFarZ;
168 f32 _shadowNearFade;
169 f32 _shadowFarFade;
170 f32 _shadowSplitParam;
171 b32 _autoShadowSplitParam;
172 f32 _shadowFirstFarZ;
173 f32 _shadowWorldYMax;
174 f32 _shadowWorldYMin;
175 f32 _shadowOffset;
176 b32 _projectionMapEnable;
177 GxResTexture* _pResProjectionMap[2];
178 f32 _projectionMapScaling;
179 GxVector2 _projectionMapUVVelocity[2];
180 GxVector2 _projectionMapUVOffset[2];
181 f32 _projectionMapIntensityMax;
182 f32 _projectionMapIntensityMin;
183 u32 _projectionMapWavingCycle;
184 f32 _projectionMapWavingPhase[2];
185 GxVector3 _projectionMapUVOrigin;
186#if GX_DEVELOP
187 GxString _dialogPath;
188#endif //GX_DEVELOP
189
191};
192
193//===========================================================================
195//===========================================================================
197{
198 //-----------------------------------------------------------
200 //-----------------------------------------------------------
202public:
203 GX_RTTI_CLASS_NAME(GxUnitLightPoint, GxUnitLightPointBase, "ポイントライト")
204 // ClassBaseReference継承クラス用禁止宣言
206
207
208 //-----------------------------------------------------------
210 //-----------------------------------------------------------
212protected:
214 GxUnitLightPoint(void);
215
217 //-----------------------------------------------------------
219 //-----------------------------------------------------------
221public:
223 void forceAsyncUpdate(void) override;
224
226 //-----------------------------------------------------------
228 //-----------------------------------------------------------
230public:
232 constexpr void getPropertyAttenuation(void* const pValue) { *static_cast<f32*>(pValue) = getAttenuation(); }
234 constexpr void setPropertyAttenuation(const void* const pValue) { setAttenuation(*static_cast<f32*>(const_cast<void*>(pValue))); }
236 constexpr void getPropertyConstantAttenuation(void* const pValue) { *static_cast<f32*>(pValue) = getConstantAttenuation(); }
238 constexpr void setPropertyConstantAttenuation(const void* const pValue) { setConstantAttenuation(*static_cast<f32*>(const_cast<void*>(pValue))); }
239
241 GX_FORCE_INLINE const GxVector4& getParam(void) const { return _param; }
242
244 constexpr f32 getAttenuation(void) const { return _param._y; }
246 constexpr void setAttenuation(f32 attenuation) { _param._y = attenuation; }
247
249 GX_FORCE_INLINE b32 isShadowEnable(void) const { return _shadowEnable; }
251 GX_FORCE_INLINE void setShadowEnable(b32 enable) { _shadowEnable = enable; }
253 constexpr f32 getConstantAttenuation(void) const { return _param._x; }
255 constexpr void setConstantAttenuation(f32 attenuation) { _param._x = attenuation; }
256
258 constexpr f32 getShadowOffset(void) const { return _shadowOffset; }
260 constexpr void setShadowOffset(f32 offset) { _shadowOffset = offset; }
261
263 //-----------------------------------------------------------
265 //-----------------------------------------------------------
267private:
268 GxVector4 _param;
269 b32 _shadowEnable;
270 f32 _shadowOffset;
271#if GX_DEVELOP
272 GxString _dialogPath;
273#endif //GX_DEVELOP
274
276};
277
278//===========================================================================
280//===========================================================================
282{
283 //-----------------------------------------------------------
285 //-----------------------------------------------------------
287public:
288 GX_RTTI_CLASS_NAME(GxUnitLightSpot, GxUnitLightSpotBase, "スポットライト")
289 // ClassBaseReference継承クラス用禁止宣言
291
292
293 //-----------------------------------------------------------
295 //-----------------------------------------------------------
297protected:
299 GxUnitLightSpot(void);
300
302 //-----------------------------------------------------------
304 //-----------------------------------------------------------
306public:
308 void forceAsyncUpdate(void) override;
309
311 //-----------------------------------------------------------
313 //-----------------------------------------------------------
315public:
317 constexpr void getPropertyAttenuation(void* const pValue) { *static_cast<f32*>(pValue) = getAttenuation(); }
319 constexpr void setPropertyAttenuation(const void* const pValue) { setAttenuation(*static_cast<f32*>(const_cast<void*>(pValue))); }
321 constexpr void getPropertyConstantAttenuation(void* const pValue) { *static_cast<f32*>(pValue) = getConstantAttenuation(); }
323 constexpr void setPropertyConstantAttenuation(const void* const pValue) { setConstantAttenuation(*static_cast<f32*>(const_cast<void*>(pValue))); }
324
326 GX_FORCE_INLINE const GxVector4& getParam(void) const { return _param; }
327
329 constexpr f32 getAttenuation(void) const { return _param._y; }
331 constexpr void setAttenuation(f32 attenuation) { _param._y = attenuation; }
333 constexpr f32 getConstantAttenuation(void) const { return _param._x; }
335 constexpr void setConstantAttenuation(f32 attenuation) { _param._x = attenuation; }
336
338 GX_FORCE_INLINE b32 isShadowEnable(void) const { return _shadowEnable; }
340 GX_FORCE_INLINE void setShadowEnable(b32 enable) { _shadowEnable = enable; }
341
343 constexpr f32 getShadowOffset(void) const { return _shadowOffset; }
345 constexpr void setShadowOffset(f32 offset) { _shadowOffset = offset; }
346
348 GxVector4 getSpotParam(void) const;
349
351 //-----------------------------------------------------------
353 //-----------------------------------------------------------
355private:
356 GxVector4 _param;
357 b32 _shadowEnable;
358 f32 _shadowOffset;
359#if GX_DEVELOP
360 GxString _dialogPath;
361#endif //GX_DEVELOP
362
364};
365
366GX_SHADER_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
void GxTypedObject
その他
Definition GxDefine.h:213
プロパティクラス
Definition GxProperty.h:48
テクスチャリソース
Definition GxResTexture.h:23
実行時型情報クラス
Definition GxRtti.h:154
ディレクショナルライト基礎クラス
Definition GxUnitLightBase.h:154
ポイントライト基礎クラス
Definition GxUnitLightBase.h:214
ポイントライトクラス
Definition GxUnitLight.h:197
constexpr f32 getConstantAttenuation(void) const
固定減衰率を取得
Definition GxUnitLight.h:253
constexpr void setPropertyConstantAttenuation(const void *const pValue)
減衰率定数を設定
Definition GxUnitLight.h:238
GX_FORCE_INLINE void setShadowEnable(b32 enable)
シャドウ有効/無効を設定
Definition GxUnitLight.h:251
constexpr void setAttenuation(f32 attenuation)
減衰率を設定
Definition GxUnitLight.h:246
constexpr f32 getAttenuation(void) const
減衰率を取得
Definition GxUnitLight.h:244
constexpr void setShadowOffset(f32 offset)
シャドウのオフセットを設定
Definition GxUnitLight.h:260
void forceAsyncUpdate(void) override
強制並列更新(pause中も実行)
Definition GxUnitLight.cpp:259
constexpr void getPropertyConstantAttenuation(void *const pValue)
減衰率定数を取得
Definition GxUnitLight.h:236
GX_FORCE_INLINE const GxVector4 & getParam(void) const
パラメータを取得
Definition GxUnitLight.h:241
constexpr void setPropertyAttenuation(const void *const pValue)
減衰率を設定
Definition GxUnitLight.h:234
constexpr f32 getShadowOffset(void) const
シャドウのオフセットを取得
Definition GxUnitLight.h:258
GX_FORCE_INLINE b32 isShadowEnable(void) const
シャドウ有効/無効を取得
Definition GxUnitLight.h:249
GxUnitLightPoint(void)
デフォルトコンストラクタ
Definition GxUnitLight.cpp:246
constexpr void getPropertyAttenuation(void *const pValue)
減衰率を取得
Definition GxUnitLight.h:232
constexpr void setConstantAttenuation(f32 attenuation)
固定減衰率を設定
Definition GxUnitLight.h:255
シャドウライトクラス
Definition GxUnitLight.h:19
GX_FORCE_INLINE GxVector2 getProjectionMapUVOffset(u32 index) const
投影マップのUVオフセットを取得
Definition GxUnitLight.h:144
constexpr void setShadowNearFade(f32 nearFade)
シャドウのニアのフェード幅
Definition GxUnitLight.h:85
GX_FORCE_INLINE void setShadowEnable(b32 enable)
シャドウ有効/無効を設定
Definition GxUnitLight.h:72
GX_FORCE_INLINE void setProjectionMapUVVelocity(u32 index, const GxVector2 &velocity)
投影マップのUVスクロール速度を設定
Definition GxUnitLight.h:128
constexpr void setShadowWorldYMin(f32 worldYMin)
シャドウを落とすY下限を設定
Definition GxUnitLight.h:106
constexpr void setShadowFarZ(f32 farZ)
シャドウのファー
Definition GxUnitLight.h:81
constexpr f32 getShadowFarZ(void) const
シャドウのファー
Definition GxUnitLight.h:79
GX_FORCE_INLINE const GxColorHDR & getAmbientColor(void) const
アンビエントカラーを取得
Definition GxUnitLight.h:65
GX_FORCE_INLINE void setProjectionMapUVOrigin(const GxVector3 &origin)
投影マップのUV原点を設定
Definition GxUnitLight.h:140
constexpr f32 getShadowOffset(void) const
シャドウのオフセットを取得
Definition GxUnitLight.h:109
constexpr void setShadowWorldYMax(f32 worldYMax)
シャドウを落とすY上限を設定
Definition GxUnitLight.h:102
constexpr void setShadowFarFade(f32 farFade)
シャドウのファーのフェード幅
Definition GxUnitLight.h:89
constexpr void setProjectionMapIntensityMax(f32 intensity)
投影マップの最大輝度を設定
Definition GxUnitLight.h:132
constexpr f32 getProjectionMapIntensityMin(void) const
投影マップの最小輝度を取得
Definition GxUnitLight.h:134
constexpr void setShadowSplitParam(f32 splitParam)
シャドウのカスケード分割パラメータ
Definition GxUnitLight.h:93
constexpr void setShadowFirstFarZ(f32 farZ)
シャドウマップの一段目のファー
Definition GxUnitLight.h:97
constexpr f32 getProjectionMapIntensityMax(void) const
投影マップの最大輝度を取得
Definition GxUnitLight.h:130
constexpr void setProjectionMapScaling(f32 scaling)
投影マップのスケーリングを設定
Definition GxUnitLight.h:124
constexpr f32 getShadowWorldYMax(void) const
シャドウを落とすY上限を取得
Definition GxUnitLight.h:100
constexpr void setShadowOffset(f32 offset)
シャドウのオフセットを設定
Definition GxUnitLight.h:111
GX_FORCE_INLINE b32 isProjectionMapEnable(void) const
投影マップ有効/無効を取得
Definition GxUnitLight.h:114
constexpr GxResTexture * getResProjectionMap(u32 index) const
投影マップを取得
Definition GxUnitLight.h:118
constexpr f32 getShadowWorldYMin(void) const
シャドウを落とすY下限を取得
Definition GxUnitLight.h:104
GX_FORCE_INLINE void setProjectionMapEnable(b32 enable)
投影マップ有効/無効を設定
Definition GxUnitLight.h:116
constexpr void setProjectionMapIntensityMin(f32 intensity)
投影マップの最小輝度を設定
Definition GxUnitLight.h:136
constexpr f32 getShadowSplitParam(void) const
シャドウのカスケード分割パラメータ
Definition GxUnitLight.h:91
constexpr f32 getShadowNearZ(void) const
シャドウのニア
Definition GxUnitLight.h:75
constexpr f32 getShadowFarFade(void) const
シャドウのファーのフェード幅
Definition GxUnitLight.h:87
GX_FORCE_INLINE GxVector3 getProjectionMapUVOrigin(void) const
投影マップのUV原点を取得
Definition GxUnitLight.h:138
GX_FORCE_INLINE GxVector4 getProjectionMapParam(void) const
投影マップのパラメータを取得
Definition GxUnitLight.h:146
constexpr void setResProjectionMap(u32 index, GxResTexture *resTexture)
投影マップを設定
Definition GxUnitLight.h:120
GX_FORCE_INLINE void setAmbientColor(const GxColorHDR &color)
アンビエントカラーを設定
Definition GxUnitLight.h:67
GX_FORCE_INLINE b32 isShadowEnable(void) const
シャドウ有効/無効を取得
Definition GxUnitLight.h:70
constexpr f32 getProjectionMapScaling(void) const
投影マップのスケーリングを取得
Definition GxUnitLight.h:122
constexpr void setShadowNearZ(f32 nearZ)
シャドウのニア
Definition GxUnitLight.h:77
GX_FORCE_INLINE GxVector2 getProjectionMapUVVelocity(u32 index) const
投影マップのUVスクロール速度を取得
Definition GxUnitLight.h:126
constexpr f32 getShadowFirstFarZ(void) const
シャドウマップの一段目のファー
Definition GxUnitLight.h:95
constexpr f32 getShadowNearFade(void) const
シャドウのニアのフェード幅
Definition GxUnitLight.h:83
スポットライト基礎クラス
Definition GxUnitLightBase.h:252
スポットライトクラス
Definition GxUnitLight.h:282
constexpr f32 getAttenuation(void) const
減衰率を取得
Definition GxUnitLight.h:329
GX_FORCE_INLINE b32 isShadowEnable(void) const
シャドウ有効/無効を取得
Definition GxUnitLight.h:338
void forceAsyncUpdate(void) override
強制並列更新(pause中も実行)
Definition GxUnitLight.cpp:306
constexpr void setAttenuation(f32 attenuation)
減衰率を設定
Definition GxUnitLight.h:331
GxVector4 getSpotParam(void) const
スポット減衰パラメータを取得
Definition GxUnitLight.cpp:328
GxUnitLightSpot(void)
デフォルトコンストラクタ
Definition GxUnitLight.cpp:293
constexpr void getPropertyConstantAttenuation(void *const pValue)
減衰率定数を取得
Definition GxUnitLight.h:321
constexpr f32 getConstantAttenuation(void) const
固定減衰率を取得
Definition GxUnitLight.h:333
constexpr void setPropertyAttenuation(const void *const pValue)
減衰率を設定
Definition GxUnitLight.h:319
constexpr void setPropertyConstantAttenuation(const void *const pValue)
減衰率定数を設定
Definition GxUnitLight.h:323
constexpr void setConstantAttenuation(f32 attenuation)
固定減衰率を設定
Definition GxUnitLight.h:335
constexpr void setShadowOffset(f32 offset)
シャドウのオフセットを設定
Definition GxUnitLight.h:345
GX_FORCE_INLINE const GxVector4 & getParam(void) const
パラメータを取得
Definition GxUnitLight.h:326
GX_FORCE_INLINE void setShadowEnable(b32 enable)
シャドウ有効/無効を設定
Definition GxUnitLight.h:340
constexpr void getPropertyAttenuation(void *const pValue)
減衰率を取得
Definition GxUnitLight.h:317
constexpr f32 getShadowOffset(void) const
シャドウのオフセットを取得
Definition GxUnitLight.h:343
色(HDR)
Definition GxColor.h:241
4×4行列(行優先)
Definition GxMatrix.h:607
文字列型クラス
Definition GxString.h:18
2次元ベクトル
Definition GxVector.h:34
3次元ベクトル
Definition GxVector.h:245
4次元ベクトル
Definition GxVector.h:582
f32 _x
X値
Definition GxVector.h:793
f32 _y
Y値
Definition GxVector.h:794
32bitブーリアン
Definition GxDefine.h:173