ezEngine  Milestone 9
RenderData_inl.h
1 #include <Core/World/GameObject.h>
2 
3 EZ_ALWAYS_INLINE ezRenderData::Category::Category()
4  : m_uiValue(0xFFFF)
5 {
6 }
7 
8 EZ_ALWAYS_INLINE ezRenderData::Category::Category(ezUInt16 uiValue)
9  : m_uiValue(uiValue)
10 {
11 }
12 
13 EZ_ALWAYS_INLINE bool ezRenderData::Category::operator==(const Category& other) const
14 {
15  return m_uiValue == other.m_uiValue;
16 }
17 
18 EZ_ALWAYS_INLINE bool ezRenderData::Category::operator!=(const Category& other) const
19 {
20  return m_uiValue != other.m_uiValue;
21 }
22 
24 
25 //static
26 EZ_FORCE_INLINE const char* ezRenderData::GetCategoryName(Category category)
27 {
28  return s_CategoryData[category.m_uiValue].m_sName.GetString();
29 }
30 
31 EZ_FORCE_INLINE ezUInt64 ezRenderData::GetCategorySortingKey(Category category, ezUInt32 uiRenderDataSortingKey, const ezCamera& camera) const
32 {
33  return s_CategoryData[category.m_uiValue].m_sortingKeyFunc(this, uiRenderDataSortingKey, camera);
34 }
35 
37 
38 template <typename T>
39 static T* ezCreateRenderDataForThisFrame(const ezGameObject* pOwner, ezUInt32 uiBatchId)
40 {
41  EZ_CHECK_AT_COMPILETIME(EZ_IS_DERIVED_FROM_STATIC(ezRenderData, T));
42 
43  T* pRenderData = EZ_NEW(ezFrameAllocator::GetCurrentAllocator(), T);
44  //ezMemoryUtils::ZeroFill(pRenderData);
45 
46  pRenderData->m_uiBatchId = uiBatchId;
47 
48  if (pOwner != nullptr)
49  {
50  pRenderData->m_hOwner = pOwner->GetHandle();
51  }
52 
53 #if EZ_ENABLED(EZ_COMPILE_FOR_DEVELOPMENT)
54  pRenderData->m_pOwner = pOwner;
55 #endif
56 
57  return pRenderData;
58 }
59 
A camera class that stores the orientation and some basic camera settings.
Definition: Camera.h:37
Base class for all render data. Render data must contain all information that is needed to render the...
Definition: RenderData.h:11
#define EZ_IS_DERIVED_FROM_STATIC(BaseClass, DerivedClass)
Checks inheritance at compile time.
Definition: TypeTraits.h:177
ezUInt64 GetCategorySortingKey(Category category, ezUInt32 uiRenderDataSortingKey, const ezCamera &camera) const
Returns the sorting key for this render data by using the sorting key function for the given category...
Definition: RenderData_inl.h:31
ezGameObjectHandle GetHandle() const
Returns a handle to this object.
Definition: GameObject_inl.h:79
This class represents an object inside the world.
Definition: GameObject.h:20
#define EZ_NEW(allocator, type,...)
creates a new instance of type using the given allocator
Definition: AllocatorBase.h:54
Definition: RenderData.h:17