OROCHI
 
Loading...
Searching...
No Matches
GxUnitProjector.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12GX_SHADER_NAMESPACE_BEGIN()
13
14//===========================================================================
16//===========================================================================
18{
19 //-----------------------------------------------------------
21 //-----------------------------------------------------------
23public:
24 GX_RTTI_CLASS_NAME_ICON(GxUnitProjector, GxUnitLocate, "プロジェクタ", GxRtti::ICON_TYPE::MATERIAL)
25 // ClassBaseReference継承クラス用禁止宣言
27
29 enum class DRAW_TYPE
30 {
31 BLEND,
32 ADD,
33 ALPHA_TEST,
34 MAX,
35 };
36#if GX_DEVELOP
38 GX_ENUM_TABLE_MAX(DRAW_TYPE)
39#endif //GX_DEVELOP
40
41private:
43 struct GxVertexData
44 {
45 GxFloat3 _position;
46 GxFloat2 _texCoord;
47 };
48
50 //-----------------------------------------------------------
52 //-----------------------------------------------------------
54
55public:
57 GxUnitProjector(void);
58
60 void cleanup(void) override;
61
63 //-----------------------------------------------------------
65 //-----------------------------------------------------------
67protected:
69 void render(void) override;
70#if GX_DEVELOP
72 void developRender(void) override;
74 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index = 0);
75#endif // GX_DEVELOP
76
77public:
79 void updateWorldMatrix(void) override;
80
82 //-----------------------------------------------------------
84 //-----------------------------------------------------------
86public:
88 constexpr void getPropertyAlphaTestFunction(void* const pValue) { *static_cast<u32*>(pValue) = static_cast<s32>(_alphaTestState._function); }
90 constexpr void setPropertyAlphaTestFunction(const void* const pValue) { _alphaTestState._function = static_cast<RENDER_COMPARISON_FUNCTION>(*static_cast<u32*>(const_cast<void*>(pValue))); }
92 constexpr void getPropertyAlphaTestReference(void* const pValue) { *static_cast<u32*>(pValue) = _alphaTestState._reference; }
94 constexpr void setPropertyAlphaTestReference(const void* const pValue) { _alphaTestState._reference = *static_cast<u32*>(const_cast<void*>(pValue)); }
95
97 constexpr void getPropertyTextureResource(void* const pValue) { *static_cast<GxResTexture**>(pValue) = _pResTexture; }
99 constexpr void setPropertyTextureResource(const void* const pValue) { GX_SET_CLASS_BASE_REFERENCE(_pResTexture, *static_cast<GxResTexture**>(const_cast<void*>(pValue))); }
100
102 constexpr f32 getNear(void) const { return _near; }
104 constexpr void setNear(f32 nearClip) { _near = nearClip; }
105
107 constexpr f32 getFar(void) const { return _far; }
109 constexpr void setFar(f32 farClip) { _far = farClip; }
110
112 GX_FORCE_INLINE GxColorHDR getColor(void) const { return _color; }
114 GX_FORCE_INLINE void setColor(GxColorHDR color) { _color = color; }
115
117 constexpr f32 getFadeDistance(void) const { return _fadeDistance; }
119 constexpr void setFadeDistance(f32 distance) { _fadeDistance = distance; }
120
122 b32 setTextureResource(GxResTexture * pResTexture);
124 constexpr GxResTexture* getTextureResource(void) const { return _pResTexture; }
126 constexpr DRAW_TYPE getDrawType(void) const { return _drawType; }
128 constexpr void setDrawType(DRAW_TYPE type) { _drawType = type; }
130 constexpr s32 getDrawOrder(void) const { return _drawOrder; }
132 constexpr void setDrawOrder(s32 drawOrder) { _drawOrder = drawOrder; }
134 constexpr RENDER_COMPARISON_FUNCTION getAlphaTestFunction(void) const { return _alphaTestState._function; }
136 constexpr void setAlphaTestFunction(RENDER_COMPARISON_FUNCTION function) { _alphaTestState._function = function; }
138 constexpr u32 getAlphaTestReference(void) const { return _alphaTestState._reference; }
140 constexpr void setAlphaTestReference(u32 reference) { _alphaTestState._reference = reference; }
141
142public:
143#if GX_DEVELOP
145 GX_FORCE_INLINE b32 isShowTexture(void) const { return _showTexture; }
147 GX_FORCE_INLINE void setShowTexture(b32 show) { _showTexture = show; }
149 GX_FORCE_INLINE b32 isShowRange(void) const { return _showRange; }
151 GX_FORCE_INLINE void setShowRange(b32 show) { _showRange = show; }
152#endif // GX_DEVLEOP
153
155 //-----------------------------------------------------------
157 //-----------------------------------------------------------
159private:
160 DRAW_TYPE _drawType;
161 GxRenderAlphaTestState _alphaTestState;
162 s32 _drawOrder;
163 GxResTexture* _pResTexture;
164 GxColorHDR _color;
165 f32 _near;
166 f32 _far;
167 GxMatrixAffine _projectorMatrix;
168 GxRenderVertexDeclaration* _pRenderDeclaration;
169 GxRenderVertexBuffer* _pRenderVertexBuffer;
170 GxResShaderPackage* _pShaderPackage;
171 GxShaderPackage::GxShaderCode* _pShaderCode;
172 GX_HANDLE _handleProjectionMatrix2D;
173 GX_HANDLE _handleProjectionToUvMatrix;
174 GX_HANDLE _handleProjectorParameter;
175 GX_HANDLE _handleColor;
176 GX_HANDLE _handleAlphaTest;
177 GX_HANDLE _handleAlphaTestParameter;
178 GX_HANDLE _handleDepthMapSampler;
179 GX_HANDLE _handleProjectionMapSampler;
180 b32 _showTexture;
181 b32 _showRange;
182 f32 _fadeDistance;
183
185};
186
187GX_SHADER_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
#define GX_SET_CLASS_BASE_REFERENCE(__DST__, __SRC__)
オブジェクト設定(参照カウンタを使用する場合)
Definition GxBase.h:318
@ MAX
定義数
void GxTypedObject
その他
Definition GxDefine.h:213
u32 GX_HANDLE
ハンドル
Definition GxDefine.h:214
RENDER_COMPARISON_FUNCTION
描画ステート(比較関数)
Definition GxRender.h:572
@ ADD
加算(src+dst)
プロパティクラス
Definition GxProperty.h:48
頂点バッファを管理する
Definition GxRenderVertexBuffer.h:20
頂点シェーダに渡す頂点の宣言を管理する
Definition GxRenderVertexDeclaration.h:22
シェーダパッケージリソースクラス
Definition GxResShaderPackage.h:19
テクスチャリソース
Definition GxResTexture.h:23
実行時型情報クラス
Definition GxRtti.h:154
@ MATERIAL
マテリアル
座標ユニット基礎クラス
Definition GxUnitLocate.h:23
プロジェクタクラス
Definition GxUnitProjector.h:18
constexpr void setAlphaTestReference(u32 reference)
アルファテストの基準値の設定
Definition GxUnitProjector.h:140
constexpr f32 getFar(void) const
ファークリップ距離の取得
Definition GxUnitProjector.h:107
constexpr DRAW_TYPE getDrawType(void) const
描画タイプの取得
Definition GxUnitProjector.h:126
GX_FORCE_INLINE void setColor(GxColorHDR color)
カラーの設定
Definition GxUnitProjector.h:114
constexpr void setDrawOrder(s32 drawOrder)
描画順の設定
Definition GxUnitProjector.h:132
constexpr GxResTexture * getTextureResource(void) const
テクスチャリソースの取得
Definition GxUnitProjector.h:124
GX_FORCE_INLINE GxColorHDR getColor(void) const
カラーの取得
Definition GxUnitProjector.h:112
constexpr void setDrawType(DRAW_TYPE type)
描画タイプの設定
Definition GxUnitProjector.h:128
constexpr RENDER_COMPARISON_FUNCTION getAlphaTestFunction(void) const
アルファテストの関数の取得
Definition GxUnitProjector.h:134
constexpr void setAlphaTestFunction(RENDER_COMPARISON_FUNCTION function)
アルファテストの関数の設定
Definition GxUnitProjector.h:136
constexpr void setNear(f32 nearClip)
ニアクリップ距離の設定
Definition GxUnitProjector.h:104
constexpr void setPropertyAlphaTestFunction(const void *const pValue)
アルファテスト関数を設定
Definition GxUnitProjector.h:90
constexpr f32 getNear(void) const
ニアクリップ距離の取得
Definition GxUnitProjector.h:102
constexpr void setFar(f32 farClip)
ファークリップ距離の設定
Definition GxUnitProjector.h:109
constexpr void setPropertyAlphaTestReference(const void *const pValue)
アルファテスト参照を設定
Definition GxUnitProjector.h:94
constexpr f32 getFadeDistance(void) const
フェード距離の取得
Definition GxUnitProjector.h:117
constexpr void setFadeDistance(f32 distance)
フェード距離の設定
Definition GxUnitProjector.h:119
constexpr void getPropertyAlphaTestReference(void *const pValue)
アルファテスト参照を取得
Definition GxUnitProjector.h:92
constexpr void getPropertyAlphaTestFunction(void *const pValue)
アルファテスト関数を取得
Definition GxUnitProjector.h:88
constexpr void setPropertyTextureResource(const void *const pValue)
テクスチャリソースの設定
Definition GxUnitProjector.h:99
constexpr void getPropertyTextureResource(void *const pValue)
テクスチャリソースの取得
Definition GxUnitProjector.h:97
constexpr u32 getAlphaTestReference(void) const
アルファテストの基準値の取得
Definition GxUnitProjector.h:138
DRAW_TYPE
描画タイプ
Definition GxUnitProjector.h:30
constexpr s32 getDrawOrder(void) const
描画順の取得
Definition GxUnitProjector.h:130
色(HDR)
Definition GxColor.h:241
2次元浮動小数点数クラス
Definition GxStruct.h:22
3次元浮動小数点数クラス
Definition GxStruct.h:91
アフィン変換行列(行優先)
Definition GxMatrix.h:330
アルファテストステート
Definition GxRender.h:731
シェーダコード
Definition GxShaderPackage.h:52
32bitブーリアン
Definition GxDefine.h:173