Skylicht Engine
Loading...
Searching...
No Matches
CRenderMeshData.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "Entity/IEntityData.h"
28#include "Material/CMaterial.h"
29#include "Instancing/SMeshInstancing.h"
30#include "CMesh.h"
31#include "CSkinnedMesh.h"
32
33namespace Skylicht
34{
35 class CEntityPrefab;
36
37 class SKYLICHT_API CRenderMeshData : public IEntityData
38 {
39 public:
40 static void setImportTextureFolder(std::vector<std::string>& folders);
41
42 protected:
43 CMesh* RenderMesh;
44 CMesh* SoftwareSkinnedMesh;
45 CMesh* SoftwareBlendShapeMesh;
46
47 bool IsSkinnedMesh;
48 bool IsSoftwareSkinning;
49 bool IsSoftwareBlendShape;
50 bool IsInstancing;
51 bool IsSkinnedInstancing;
52
53 SMeshInstancing* MeshInstancing;
54
55 bool Visible;
56
57 u32 LightLayers;
58
59 public:
60
61 CRenderMeshData();
62
63 virtual ~CRenderMeshData();
64
65 inline CMesh* getMesh()
66 {
67 return RenderMesh;
68 }
69
70 inline CMesh* getSoftwareSkinnedMesh()
71 {
72 return SoftwareSkinnedMesh;
73 }
74
75 inline CMesh* getSoftwareBlendShapeMesh()
76 {
77 return SoftwareBlendShapeMesh;
78 }
79
80 inline SMeshInstancing* getMeshInstancing()
81 {
82 return MeshInstancing;
83 }
84
85 void setMesh(CMesh* mesh);
86
87 void setShareMesh(CMesh* mesh);
88
89 void initSoftwareBlendShape();
90
91 void initSoftwareSkinning();
92
93 void releaseSoftwareSkinning();
94
95 inline bool isSoftwareSkinning()
96 {
97 return IsSoftwareSkinning;
98 }
99
100 inline bool isInstancing()
101 {
102 return IsInstancing;
103 }
104
105 inline bool isSkinnedInstancing()
106 {
107 return IsSkinnedInstancing;
108 }
109
110 void setSoftwareSkinning(bool b)
111 {
112 IsSoftwareSkinning = b;
113 }
114
115 inline bool isSoftwareBlendShape()
116 {
117 return IsSoftwareBlendShape;
118 }
119
120 inline bool isSkinnedMesh()
121 {
122 return IsSkinnedMesh;
123 }
124
125 inline void setSkinnedMesh(bool b)
126 {
127 IsSkinnedMesh = b;
128 }
129
130 inline void setVisible(bool b)
131 {
132 Visible = b;
133 }
134
135 inline bool isVisible()
136 {
137 return Visible;
138 }
139
140 inline bool isSortingLights()
141 {
142 return LightLayers != 1;
143 }
144
145 inline void setLightLayers(u32 layers)
146 {
147 LightLayers = layers;
148 }
149
150 inline u32 getLightLayers()
151 {
152 return LightLayers;
153 }
154
155 void setInstancing(bool b);
156
157 void setSkinnedInstancing(bool b);
158
159 void setSkinnedInstancing(bool b, IShaderInstancing* instancingShader);
160
161 bool setMaterial(CMaterial* material);
162
163 ArrayMaterial& getMaterials();
164
165 bool unusedMaterial(CMaterial* material);
166
167 virtual bool serializable(CMemoryStream* stream);
168
169 virtual bool deserializable(CMemoryStream* stream, int version);
170
171 DECLARE_GETTYPENAME(CRenderMeshData)
172 };
173
174 DECLARE_PUBLIC_DATA_TYPE_INDEX(CRenderMeshData);
175}
This object class is created to store data in an array of multiple CEntities.
Definition CEntityPrefab.h:38
The object class describes material information such as which shader it's associated with,...
Definition CMaterial.h:84
In-memory byte stream for binary serialization and deserialization.
Definition CMemoryStream.h:37
Definition CMesh.h:75
Definition CRenderMeshData.h:38
Abstract base class for GPU instancing logic in Skylicht-Engine.
Definition IShaderInstancing.h:45
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
Definition SMeshInstancing.h:39