OROCHI
 
Loading...
Searching...
No Matches
GxRenderMaterial.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12GX_CORE_NAMESPACE_BEGIN()
13
14//===========================================================================
16//===========================================================================
18{
19 //-----------------------------------------------------------
21 //-----------------------------------------------------------
23public:
24 GX_RTTI_CLASS(GxRenderMaterial, GxClassBase)
25
26
28 {
30 u16 _offset;
32#if defined(_WINDOWS) || defined(_PS4) || defined(_PS5) || defined(_XBOX_XS)
33 GX_HANDLE _samplerStateHandle;
34#endif // _WINDOWS || _PS4 || _PS5 || _XBOX_XS
35 };
36
38 enum class PASS
39 {
40 MODEL,
41 HUD,
42 POST_EFFECT,
43 MAX,
44 };
45#if GX_DEVELOP
47 GX_ENUM_TABLE_MAX(PASS)
48#endif //GX_DEVELOP
49 // 描画パスのシェーダーパッケージのパス
50 static GX_CSTR SHADER_PACKAGE_PATH[static_cast<u32>(PASS::MAX)];
51
53 enum class TYPE
54 {
55 OPACITY,
56 ALPHA_TEST,
57 BLEND,
58 ADD,
59 SUB,
60 BLEND2PASS,
61 DITHER,
62 ALPHA_TO_COVERAGE,
63 BLEND_ALPHA_TEST,
64 ADD_ALPHA_TEST,
65 SUB_ALPHA_TEST,
66 MAX,
67 };
68#if GX_DEVELOP
70 GX_ENUM_TABLE_MAX(TYPE)
71#endif //GX_DEVELOP
72
74 enum class ATTRIBUTE
75 {
76 BACK_FACE_CULLING_ENABLE,
77 RENDER_TO_VIEWPORT,
78 RENDER_TO_SHADOW_MAP,
79 SHADOW_RECIVE_DISABLE,
81 OVERPAINT,
82 RENDER_TO_DEPTH_BUFFER,
83 NPR,
84 NPR_DRAW_POLYGON_LINE,
85 TESSELLATION,
86 MAX,
87 };
88#if GX_DEVELOP
90 GX_FLAG_TABLE_MAX(ATTRIBUTE)
91#endif //GX_DEVELOP
92
95 {
96 //-----------------------------------------------------------
98 //-----------------------------------------------------------
100 public:
101 // RTTI定義
102 GX_RTTI_CLASS(GxShaderInfo, GxClassBase)
103 // ClassBase継承クラス用禁止宣言
105
106
107 //-----------------------------------------------------------
109 //-----------------------------------------------------------
111
114 : _pShaderPackage(nullptr)
115 , _pShaderCode(nullptr)
116 , _functionsCount(0)
117 , _parameterCount(0)
118 , _pData(nullptr)
119 , _dataSize(0)
120 , _pParameterInfo(nullptr)
121 {}
122
124 //-----------------------------------------------------------
126 //-----------------------------------------------------------
128
130 void releaseTexture(void);
131
133 //-----------------------------------------------------------
135 //-----------------------------------------------------------
137
139 GX_FORCE_INLINE void getPropertyShaderPackageResource(void* const pValue) { *static_cast<GxResShaderPackage**>(pValue) = _pShaderPackage; }
141 GX_FORCE_INLINE void setPropertyShaderPackageResource(const void* const pValue) { setShaderPackageResource(*static_cast<GxResShaderPackage**>(const_cast<void*>(pValue))); }
143 void setShaderPackageResource(GxResShaderPackage* pResource);
144
146 //-----------------------------------------------------------
148 //-----------------------------------------------------------
150 public:
155 void* _pData;
158
160 };
161
163 //-----------------------------------------------------------
165 //-----------------------------------------------------------
167public:
169 GxRenderMaterial(void);
171 ~GxRenderMaterial(void) override;
172
174 //-----------------------------------------------------------
176 //-----------------------------------------------------------
178public:
180 static void copy(GxRenderMaterial* pDst, const GxRenderMaterial* pSrc, b32 isCopyParent = true);
182 void terminate(void);
183
184#if GX_DEVELOP
186 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index = 0);
188 static void createPropertyTableParameter(GxPropertyTable& propertyTable, GxRenderMaterial* pMaterial);
189#endif // GX_DEVELOP
190
192 //-------------------------------------------------------------
194 //-------------------------------------------------------------
196public:
198 const GxTypedObject* getDefaultObject(void) override;
200 GX_FORCE_INLINE void getPropertyAlphaTestFunction(void* const pValue) { *static_cast<u32*>(pValue) = static_cast<s32>(_alphaTestState._function); }
202 GX_FORCE_INLINE void setPropertyAlphaTestFunction(const void* const pValue) { _alphaTestState._function = static_cast<RENDER_COMPARISON_FUNCTION>(*static_cast<u32*>(const_cast<void*>(pValue))); }
204 GX_FORCE_INLINE void getPropertyAlphaTestReference(void* const pValue) { *static_cast<u32*>(pValue) = _alphaTestState._reference; }
206 GX_FORCE_INLINE void setPropertyAlphaTestReference(const void* const pValue) { _alphaTestState._reference = *static_cast<u32*>(const_cast<void*>(pValue)); }
207
209 constexpr TYPE getType(void) const { return _type; }
211 constexpr void setType(TYPE type) { _type = type; }
213 GX_FORCE_INLINE GxRenderAlphaTestState getAlphaTestState(void) const { return _alphaTestState; }
215 GX_FORCE_INLINE void setAlphaTestState(GxRenderAlphaTestState state) { _alphaTestState = state; }
217 GX_FORCE_INLINE b32 isAttribute(ATTRIBUTE attribute) const { return _attribute.isFlag(attribute); }
219 GX_FORCE_INLINE void setAttribute(ATTRIBUTE attribute, b32 enable) { _attribute.setFlag(attribute, enable); }
221 GX_FORCE_INLINE RENDER_FACE_CULLING_MODE getCullingMode(void) const { return _cullingMode; }
223 GX_FORCE_INLINE void setCullingMode(RENDER_FACE_CULLING_MODE cullingmode) { if (cullingmode != RENDER_FACE_CULLING_MODE::NONE) _cullingMode = cullingmode; }
225 GX_FORCE_INLINE GxResShaderPackage* getShaderPackage(void) const { return _drawShaderInfo._pShaderPackage; }
227 constexpr u32 getFunctionsCount(void) const { return _drawShaderInfo._functionsCount; }
229 constexpr u32 getParameterCount(void) const { return _drawShaderInfo._parameterCount; }
230
232 GX_FORCE_INLINE GX_HANDLE getFunctionsHandleByName(GX_CSTR name) const
233 {
234 if (!_drawShaderInfo._pShaderPackage)
235 {
236 return GX_INVALID_HANDLE;
237 }
238 else
239 {
240 return _drawShaderInfo._pShaderPackage->getMaterialFunctionsHandleByName(name);
241 }
242 }
243
245 GX_FORCE_INLINE GX_HANDLE getFunctionsHandleByVirtualName(GX_CSTR name) const
246 {
247 if (!_drawShaderInfo._pShaderPackage)
248 {
249 return GX_INVALID_HANDLE;
250 }
251 else
252 {
253 return _drawShaderInfo._pShaderPackage->getMaterialFunctionsHandleByVirtualName(name);
254 }
255 }
256
258 GX_FORCE_INLINE GX_HANDLE getParameterHandleByName(GX_CSTR name) const
259 {
260 if (!_drawShaderInfo._pShaderPackage)
261 {
262 return GX_INVALID_HANDLE;
263 }
264 else
265 {
266 return _drawShaderInfo._pShaderPackage->getMaterialParameterHandleByName(name);
267 }
268 }
269
271 GX_FORCE_INLINE GX_HANDLE getParameterHandleByVirtualName(GX_CSTR name) const
272 {
273 if (!_drawShaderInfo._pShaderPackage)
274 {
275 return GX_INVALID_HANDLE;
276 }
277 else
278 {
279 return _drawShaderInfo._pShaderPackage->getMaterialParameterHandleByVirtualName(name);
280 }
281 }
282
284 GX_FORCE_INLINE void setFunctions(GX_HANDLE handle, u32 value)
285 {
286 if (_drawShaderInfo._functionsCount <= handle)
287 {
288 GX_ERROR(false, "指定されたハンドルが無効です");
289 return;
290 }
291 else if (!_drawShaderInfo._pShaderCode)
292 {
293 GX_ERROR(false, "シェーダコードが無効です");
294 return;
295 }
296 _drawShaderInfo._pShaderCode->setMaterialFunctions(handle, value);
297 }
298
300 GX_FORCE_INLINE u32 getFunctions(GX_HANDLE handle)
301 {
302 if (_drawShaderInfo._functionsCount <= handle)
303 {
304 GX_ERROR(false, "指定されたハンドルが無効です");
305 return 0;
306 }
307 else if (!_drawShaderInfo._pShaderCode)
308 {
309 GX_ERROR(false, "シェーダコードが無効です");
310 return 0;
311 }
312 return _drawShaderInfo._pShaderCode->getMaterialFunctions(handle);
313 }
314
316 GX_FORCE_INLINE void setParameterVector(GX_HANDLE handle, const GxVector4& vector)
317 {
318 if (_drawShaderInfo._parameterCount > handle)
319 {
320 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
322 {
323 auto* pVector = reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, pInfo->_offset));
324 *pVector = vector;
325 }
326 else
327 {
328 GX_ERROR(false, "マテリアルに設定しようとした型が違います");
329 }
330 }
331 else
332 {
333 GX_ERROR(false, "指定されたハンドルが無効です");
334 }
335 }
336
338 GX_FORCE_INLINE const GxVector4& getParameterVector(GX_HANDLE handle) const
339 {
340 if (_drawShaderInfo._parameterCount > handle)
341 {
342 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
344 {
345 return *reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, pInfo->_offset));
346
347 }
348 else
349 {
350 GX_ERROR(false, "マテリアルから取得しようとした型が違います");
351 }
352 }
353 else
354 {
355 GX_ERROR(false, "指定されたハンドルが無効です");
356 }
357 return GxVector4::ZERO;
358 }
359
361 GX_FORCE_INLINE void setParameterTexture(GX_HANDLE handle, GxResTexture* pTexture)
362 {
363 if (_drawShaderInfo._parameterCount > handle)
364 {
365 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
367 {
368 auto** ppTexture = reinterpret_cast<GxResTexture**>(GX_POINTER_ADD(_drawShaderInfo._pData, pInfo->_offset));
369 GX_SAFE_RELEASE(*ppTexture);
370 GX_SET_CLASS_BASE_REFERENCE(*ppTexture, pTexture);
371 }
372 else
373 {
374 GX_ERROR(false, "マテリアルに設定しようとした型が違います");
375 }
376 }
377 else
378 {
379 GX_ERROR(false, "指定されたハンドルが無効です");
380 }
381 }
382
385 {
386 if (_drawShaderInfo._parameterCount > handle)
387 {
388 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
390 {
391 return *reinterpret_cast<GxResTexture**>(GX_POINTER_ADD(_drawShaderInfo._pData, pInfo->_offset));
392 }
393 else
394 {
395 GX_ERROR(false, "マテリアルから取得しようとした型が違います");
396 }
397 }
398 else
399 {
400 GX_ERROR(false, "指定されたハンドルが無効です");
401 }
402 return nullptr;
403 }
404
407 {
408 if (_drawShaderInfo._parameterCount <= handle)
409 {
410 GX_ERROR(false, "指定されたハンドルが無効です");
412 }
413 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
414 return pInfo->_type;
415 }
416
418 GX_FORCE_INLINE void setParameterSamplerState(GX_HANDLE handle, GxRenderSamplerState samplerState)
419 {
420 if (_drawShaderInfo._parameterCount > handle)
421 {
422 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
424 {
425 auto* state = reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, pInfo->_offset + sizeof(GxResTexture*)));
426 *state = samplerState;
427 }
428 else
429 {
430 GX_ERROR(false, "マテリアルに設定しようとした型が違います");
431 }
432 }
433 else
434 {
435 GX_ERROR(false, "指定されたハンドルが無効です");
436 }
437 }
438
440 GX_FORCE_INLINE GxRenderSamplerState getParameterSamplerState(GX_HANDLE handle) { return *getParameterSamplerStateAddress(handle); }
443 {
444 if (_drawShaderInfo._parameterCount > handle)
445 {
446 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
448 {
449 return reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, pInfo->_offset + sizeof(GxResTexture*)));
450 }
451 else
452 {
453 GX_ERROR(false, "マテリアルから取得しようとした型が違います");
454 }
455 }
456 else
457 {
458 GX_ERROR(false, "指定されたハンドルが無効です");
459 }
460 return nullptr;
461 }
462
464 GX_FORCE_INLINE void setParameterInvalid(GX_HANDLE handle)
465 {
466 if (_drawShaderInfo._parameterCount <= handle)
467 {
468 GX_ERROR(false, "指定されたハンドルが無効です");
469 return;
470 }
471 auto* pInfo = &_drawShaderInfo._pParameterInfo[handle];
472 pInfo->_handle = GX_INVALID_HANDLE;
473 }
474#if GX_DEVELOP
476 GX_FORCE_INLINE void getPropertyFunction(void* pValue, u32 index) { *static_cast<u8*>(pValue) = _drawShaderInfo._pShaderCode ? _drawShaderInfo._pShaderCode->_header._pMaterialFunctions[index] : 0; }
478 GX_FORCE_INLINE void setPropertyFunction(const void* pValue, u32 index) { _drawShaderInfo._pShaderCode->_header._pMaterialFunctions[index] = *static_cast<u8*>(const_cast<void*>(pValue)); }
480 GX_FORCE_INLINE void getPropertyParameterX(void* pValue, u32 index) { *static_cast<f32*>(pValue) = _drawShaderInfo._pShaderCode ? reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_x : 0; }
482 GX_FORCE_INLINE void setPropertyParameterX(const void* pValue, u32 index) { reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_x = *static_cast<f32*>(const_cast<void*>(pValue)); }
484 GX_FORCE_INLINE void getPropertyParameterY(void* pValue, u32 index) { *static_cast<f32*>(pValue) = _drawShaderInfo._pShaderCode ? reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_y : 0; }
486 GX_FORCE_INLINE void setPropertyParameterY(const void* pValue, u32 index) { reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_y = *static_cast<f32*>(const_cast<void*>(pValue)); }
488 GX_FORCE_INLINE void getPropertyParameterZ(void* pValue, u32 index) { *static_cast<f32*>(pValue) = _drawShaderInfo._pShaderCode ? reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_z : 0; }
490 GX_FORCE_INLINE void setPropertyParameterZ(const void* pValue, u32 index) { reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_z = *static_cast<f32*>(const_cast<void*>(pValue)); }
492 GX_FORCE_INLINE void getPropertyParameterW(void* pValue, u32 index) { *static_cast<f32*>(pValue) = _drawShaderInfo._pShaderCode ? reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_w : 0; }
494 GX_FORCE_INLINE void setPropertyParameterW(const void* pValue, u32 index) { reinterpret_cast<GxVector4*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset))->_w = *static_cast<f32*>(const_cast<void*>(pValue)); }
496 GX_FORCE_INLINE void getPropertyParameterTexture(void* pValue, u32 index) { *static_cast<GxResTexture**>(pValue) = _drawShaderInfo._pShaderCode ? *reinterpret_cast<GxResTexture**>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset)) : nullptr; }
498 GX_FORCE_INLINE void setPropertyParameterTexture(const void* pValue, u32 index)
499 {
500 void* pDst = GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset);
501 GX_MEMCPY(pDst, pValue, sizeof(GxResTexture*));
502 (*static_cast<GxResTexture**>(const_cast<void*>(pValue)))->addReference();
503 }
505 GX_FORCE_INLINE void getPropertyParameterSamplerStateAddressU(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_addressU : 0; }
507 GX_FORCE_INLINE void setPropertyParameterSamplerStateAddressU(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_addressU = static_cast<RENDER_SAMPLER_ADDRESS_MODE>(*static_cast<u32*>(const_cast<void*>(pValue))); }
509 GX_FORCE_INLINE void getPropertyParameterSamplerStateAddressV(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_addressV : 0; }
511 GX_FORCE_INLINE void setPropertyParameterSamplerStateAddressV(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_addressV = static_cast<RENDER_SAMPLER_ADDRESS_MODE>(*static_cast<u32*>(const_cast<void*>(pValue))); }
513 GX_FORCE_INLINE void getPropertyParameterSamplerStateAddressW(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_addressW : 0; }
515 GX_FORCE_INLINE void setPropertyParameterSamplerStateAddressW(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_addressW = static_cast<RENDER_SAMPLER_ADDRESS_MODE>(*static_cast<u32*>(const_cast<void*>(pValue))); }
517 GX_FORCE_INLINE void getPropertyParameterSamplerStateBorderColor(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_borderColor : 0; }
519 GX_FORCE_INLINE void setPropertyParameterSamplerStateBorderColor(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_borderColor = static_cast<RENDER_SAMPLER_BORDER_COLOR>(*static_cast<u32*>(const_cast<void*>(pValue))); }
521 GX_FORCE_INLINE void getPropertyParameterSamplerStateMagFilter(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_magFilter : 0; }
523 GX_FORCE_INLINE void setPropertyParameterSamplerStateMagFilter(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_magFilter = static_cast<RENDER_SAMPLER_FILTER>(*static_cast<u32*>(const_cast<void*>(pValue))); }
525 GX_FORCE_INLINE void getPropertyParameterSamplerStateMinFilter(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_minFilter : 0; }
527 GX_FORCE_INLINE void setPropertyParameterSamplerStateMinFilter(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_minFilter = static_cast<RENDER_SAMPLER_FILTER>(*static_cast<u32*>(const_cast<void*>(pValue))); }
529 GX_FORCE_INLINE void getPropertyParameterSamplerStateMipmapFilter(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_mipmapFilter : 0; }
531 GX_FORCE_INLINE void setPropertyParameterSamplerStateMipmapFilter(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_mipmapFilter = static_cast<RENDER_SAMPLER_FILTER>(*static_cast<u32*>(const_cast<void*>(pValue))); }
533 GX_FORCE_INLINE void getPropertyParameterSamplerStateMipmapLodBias(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_mipmapLodBias : 0; }
535 GX_FORCE_INLINE void setPropertyParameterSamplerStateMipmapLodBias(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_mipmapLodBias = static_cast<s32>(*static_cast<u32*>(const_cast<void*>(pValue))); }
537 GX_FORCE_INLINE void getPropertyParameterSamplerStateMipmapLevelMax(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_mipmapLevelMax : 0; }
539 GX_FORCE_INLINE void setPropertyParameterSamplerStateMipmapLevelMax(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_mipmapLevelMax = static_cast<u32>(*static_cast<u32*>(const_cast<void*>(pValue))); }
541 GX_FORCE_INLINE void getPropertyParameterSamplerStateAnisotropyMax(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_anisotropyMax : 0; }
543 GX_FORCE_INLINE void setPropertyParameterSamplerStateAnisotropyMax(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_anisotropyMax = static_cast<RENDER_SAMPLER_ANISOTROPY_MAX>(*static_cast<u32*>(const_cast<void*>(pValue))); }
545 GX_FORCE_INLINE void getPropertyParameterSamplerStateComparison(void* const pValue, u32 index) { *static_cast<u32*>(pValue) = _drawShaderInfo._pShaderCode ? (s32)reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_comparison : 0; }
547 GX_FORCE_INLINE void setPropertyParameterSamplerStateComparison(const void* const pValue, u32 index) { reinterpret_cast<GxRenderSamplerState*>(GX_POINTER_ADD(_drawShaderInfo._pData, _drawShaderInfo._pParameterInfo[index]._offset + sizeof(GxResTexture*)))->_comparison = static_cast<RENDER_SAMPLER_COMPARISON>(*static_cast<u32*>(const_cast<void*>(pValue))); }
548#endif //GX_DEVELOP
549
551 GX_FORCE_INLINE b32 hasAlphaTest(void)
552 {
553 b32 result;
554 switch (_type)
555 {
556 case TYPE::ALPHA_TEST:
557 case TYPE::BLEND_ALPHA_TEST:
558 case TYPE::ADD_ALPHA_TEST:
559 case TYPE::SUB_ALPHA_TEST:
560 result = true;
561 break;
562 default:
563 result = false;
564 break;
565 }
566 return result;
567 }
568
569private:
571 void getPropertyMaterialResource(void* const pValue);
573 void setPropertyMaterialResource(const void* const pValue);
574
576 //-----------------------------------------------------------
578 //-----------------------------------------------------------
580public:
588#if GX_DEVELOP
590 GxString* _pParameterUiLabelFull[GxShaderLanguage::PARAMETER_COUNT_MAX];
591#endif // GX_DEVELOP
592
594
596};
597
598GX_CORE_NAMESPACE_END()
#define GX_SAFE_RELEASE(__POINTER__)
解放(参照カウンタを使用する場合)
Definition GxBase.h:316
#define GX_SET_CLASS_BASE_REFERENCE(__DST__, __SRC__)
オブジェクト設定(参照カウンタを使用する場合)
Definition GxBase.h:318
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
@ MAX
定義数
void GxTypedObject
その他
Definition GxDefine.h:213
u32 GX_HANDLE
ハンドル
Definition GxDefine.h:214
RENDER_SAMPLER_FILTER
サンプラステート(フィルタ)
Definition GxRender.h:992
RENDER_FACE_CULLING_MODE
描画ステート(フェースカリングモード)
Definition GxRender.h:929
@ NONE
カリングしない
RENDER_SAMPLER_BORDER_COLOR
サンプラステート(ボーダーカラー)
Definition GxRender.h:977
RENDER_COMPARISON_FUNCTION
描画ステート(比較関数)
Definition GxRender.h:572
@ ADD
加算(src+dst)
RENDER_SAMPLER_ADDRESS_MODE
サンプラステート(アドレッシングモード)
Definition GxRender.h:958
@ OVERPAINT_PRE
重ね描きパス1
@ OVERPAINT
重ね描きパス2
@ OPACITY
不透明パス
RENDER_SAMPLER_COMPARISON
サンプラステート(Comparisonフィルタ、現在の所DX11のみ)
Definition GxRender.h:1037
RENDER_SAMPLER_ANISOTROPY_MAX
サンプラステート(異方性フィルタ)
Definition GxRender.h:1010
オブジェクト基底クラス
Definition GxBase.h:88
プロパティクラス
Definition GxProperty.h:48
プロパティテーブルクラス
Definition GxProperty.h:1641
シェーダ情報
Definition GxRenderMaterial.h:95
GX_FORCE_INLINE void getPropertyShaderPackageResource(void *const pValue)
シェーダーパッケージリソースを取得(プロパティ用)
Definition GxRenderMaterial.h:139
GxShaderPackage::GxShaderCode * _pShaderCode
シェーダコード
Definition GxRenderMaterial.h:152
u16 _parameterCount
パラメータ数
Definition GxRenderMaterial.h:154
u32 _dataSize
データサイズ
Definition GxRenderMaterial.h:156
void * _pData
データ
Definition GxRenderMaterial.h:155
GxParameterInfo * _pParameterInfo
パラメータ情報
Definition GxRenderMaterial.h:157
u16 _functionsCount
関数数
Definition GxRenderMaterial.h:153
GxResShaderPackage * _pShaderPackage
シェーダパッケージ
Definition GxRenderMaterial.h:151
GX_FORCE_INLINE void setPropertyShaderPackageResource(const void *const pValue)
シェーダーパッケージリソースを設定(プロパティ用)
Definition GxRenderMaterial.h:141
マテリアル構造体
Definition GxRenderMaterial.h:18
ATTRIBUTE
属性定義
Definition GxRenderMaterial.h:75
GX_FORCE_INLINE void setAttribute(ATTRIBUTE attribute, b32 enable)
属性の設定
Definition GxRenderMaterial.h:219
GX_FORCE_INLINE void getPropertyAlphaTestFunction(void *const pValue)
アルファテスト関数取得
Definition GxRenderMaterial.h:200
PASS
描画パス定義
Definition GxRenderMaterial.h:39
constexpr u32 getParameterCount(void) const
パラメータの数
Definition GxRenderMaterial.h:229
GX_FORCE_INLINE void setParameterSamplerState(GX_HANDLE handle, GxRenderSamplerState samplerState)
パラメータの設定(SamplerState)
Definition GxRenderMaterial.h:418
GX_FORCE_INLINE GxRenderSamplerState * getParameterSamplerStateAddress(GX_HANDLE handle)
パラメータの取得(SamplerState)
Definition GxRenderMaterial.h:442
TYPE _type
タイプ
Definition GxRenderMaterial.h:583
GX_FORCE_INLINE b32 isAttribute(ATTRIBUTE attribute) const
属性の取得
Definition GxRenderMaterial.h:217
GX_FORCE_INLINE void setPropertyAlphaTestFunction(const void *const pValue)
アルファテスト関数設定
Definition GxRenderMaterial.h:202
GX_FORCE_INLINE RENDER_FACE_CULLING_MODE getCullingMode(void) const
カリングモードを取得
Definition GxRenderMaterial.h:221
constexpr TYPE getType(void) const
タイプの取得
Definition GxRenderMaterial.h:209
GxShaderInfo _drawShaderInfo
描画シェーダ情報
Definition GxRenderMaterial.h:587
GX_FORCE_INLINE u32 getFunctions(GX_HANDLE handle)
関数の取得
Definition GxRenderMaterial.h:300
GX_FORCE_INLINE GxResShaderPackage * getShaderPackage(void) const
シェーダパッケージの取得
Definition GxRenderMaterial.h:225
GX_FORCE_INLINE GX_HANDLE getParameterHandleByVirtualName(GX_CSTR name) const
パラメータのハンドルを仮想名から取得
Definition GxRenderMaterial.h:271
GX_FORCE_INLINE void getPropertyAlphaTestReference(void *const pValue)
アルファテスト参照取得
Definition GxRenderMaterial.h:204
RENDER_FACE_CULLING_MODE _cullingMode
カリング情報
Definition GxRenderMaterial.h:593
GX_FORCE_INLINE GxRenderAlphaTestState getAlphaTestState(void) const
アルファテストステートの取得
Definition GxRenderMaterial.h:213
GX_FORCE_INLINE void setParameterTexture(GX_HANDLE handle, GxResTexture *pTexture)
パラメータの設定(Texture)
Definition GxRenderMaterial.h:361
PASS _pass
描画パス
Definition GxRenderMaterial.h:582
constexpr u32 getFunctionsCount(void) const
関数の数
Definition GxRenderMaterial.h:227
TYPE
描画方法定義
Definition GxRenderMaterial.h:54
GX_FORCE_INLINE GX_HANDLE getParameterHandleByName(GX_CSTR name) const
パラメータのハンドルを名前から取得
Definition GxRenderMaterial.h:258
GX_FORCE_INLINE b32 hasAlphaTest(void)
マテリアルがアルファテストを持っているか判定
Definition GxRenderMaterial.h:551
GX_FORCE_INLINE GxResTexture * getParameterTexture(GX_HANDLE handle)
パラメータの取得(Texture)
Definition GxRenderMaterial.h:384
GX_FORCE_INLINE void setAlphaTestState(GxRenderAlphaTestState state)
アルファテストステートの設定
Definition GxRenderMaterial.h:215
GX_FORCE_INLINE void setCullingMode(RENDER_FACE_CULLING_MODE cullingmode)
カリングモードを設定
Definition GxRenderMaterial.h:223
GxResMaterial * _pResMaterial
親リソース
Definition GxRenderMaterial.h:581
GxFlag32Index< ATTRIBUTE > _attribute
属性
Definition GxRenderMaterial.h:586
GX_FORCE_INLINE const GxVector4 & getParameterVector(GX_HANDLE handle) const
パラメータの取得(Vector)
Definition GxRenderMaterial.h:338
GX_FORCE_INLINE GX_HANDLE getFunctionsHandleByName(GX_CSTR name) const
関数のハンドルを名前から取得
Definition GxRenderMaterial.h:232
GX_FORCE_INLINE void setFunctions(GX_HANDLE handle, u32 value)
関数の設定
Definition GxRenderMaterial.h:284
GX_FORCE_INLINE GxShaderLanguage::PARAMETER_TYPE getParameterInfoType(GX_HANDLE handle)
パラメータのタイプを取得
Definition GxRenderMaterial.h:406
constexpr void setType(TYPE type)
タイプの設定
Definition GxRenderMaterial.h:211
GX_FORCE_INLINE void setParameterInvalid(GX_HANDLE handle)
パラメータをINVALIDに変更
Definition GxRenderMaterial.h:464
GX_FORCE_INLINE void setParameterVector(GX_HANDLE handle, const GxVector4 &vector)
パラメータの設定(Vector)
Definition GxRenderMaterial.h:316
GX_FORCE_INLINE GxRenderSamplerState getParameterSamplerState(GX_HANDLE handle)
パラメータの取得(SamplerState)
Definition GxRenderMaterial.h:440
GX_FORCE_INLINE GX_HANDLE getFunctionsHandleByVirtualName(GX_CSTR name) const
関数のハンドルを仮想名から取得
Definition GxRenderMaterial.h:245
s32 _drawOrder
描画順
Definition GxRenderMaterial.h:584
GxRenderAlphaTestState _alphaTestState
アルファテストステート
Definition GxRenderMaterial.h:585
GX_FORCE_INLINE void setPropertyAlphaTestReference(const void *const pValue)
アルファテスト参照設定
Definition GxRenderMaterial.h:206
マテリアルリソース
Definition GxResMaterial.h:18
シェーダパッケージリソースクラス
Definition GxResShaderPackage.h:19
テクスチャリソース
Definition GxResTexture.h:23
実行時型情報クラス
Definition GxRtti.h:154
PARAMETER_TYPE
パラメータの種類
Definition GxShaderLanguage.h:35
@ FLOAT4
浮動小数点型(float4)
static constexpr u32 PARAMETER_COUNT_MAX
最大パラメータ数
Definition GxShaderLanguage.h:29
インデックス指定型フラグ
Definition GxStruct.h:1294
アルファテストステート
Definition GxRender.h:731
パラメータ情報
Definition GxRenderMaterial.h:28
u16 _offset
オフセット
Definition GxRenderMaterial.h:30
GX_HANDLE _handle
ハンドル
Definition GxRenderMaterial.h:31
GxShaderLanguage::PARAMETER_TYPE _type
パラメータタイプ
Definition GxRenderMaterial.h:29
サンプラステート
Definition GxRender.h:1046
シェーダコード
Definition GxShaderPackage.h:52
文字列型クラス
Definition GxString.h:18
4次元ベクトル
Definition GxVector.h:582
f32 _x
X値
Definition GxVector.h:793
f32 _w
W値
Definition GxVector.h:796
static const GxVector4 ZERO
(0, 0, 0, 0)
Definition GxVector.h:593
f32 _y
Y値
Definition GxVector.h:794
f32 _z
Z値
Definition GxVector.h:795
32bitブーリアン
Definition GxDefine.h:173