28#include "RenderMesh/CMesh.h"
29#include "RenderMesh/CSkinnedMesh.h"
31#include "Importer/CBaseMeshImporter.h"
32#include "RenderMesh/CJointData.h"
42 const int k_positionBuffer = 0;
43 const int k_normalBuffer = 1;
44 const int k_texCoordBuffer = 2;
48 const int k_skinMesh = 1;
54 std::wstring fileName;
56 typedef std::vector<SColladaImage> ArrayImages;
62 std::wstring InitFromTexture;
64 typedef std::vector<SEffectParam> ArrayEffectParams;
72 bool TransparentAddColor;
74 bool HasDiffuseMapping;
76 bool HasSpecularMapping;
78 std::wstring DiffuseRef;
79 std::wstring SpecularRef;
82 ArrayEffectParams EffectParams;
84 inline bool operator< (
const SEffect& other)
const
89 typedef std::vector<SEffect> ArrayEffects;
95 std::wstring InstanceEffect;
98 typedef std::vector<SColladaMaterial> ArrayMaterials;
114 struct SVerticesParam
131 struct STrianglesParam
135 std::wstring Material;
139 int NumElementPerVertex;
152 NumElementPerVertex = 1;
171 std::vector<SWeightParam> Weights;
177 std::wstring ControllerName;
178 std::wstring ListJointName;
180 std::vector<SBufferParam> Buffers;
181 std::vector<SVerticesParam> Vertices;
182 std::vector<STrianglesParam> Triangles;
183 std::vector<SJointParam> Joints;
185 std::vector<s32> JointVertexIndex;
186 std::vector<s32> JointIndex;
191 typedef std::vector<SMeshParam> ArrayMeshParams;
198 std::wstring Instance;
199 std::map<std::wstring, std::wstring> BindMaterial;
203 std::vector<SNodeParam*> Childs;
215 typedef std::vector<SNodeParam*> ArrayNodeParams;
225 if (meshId == another.meshId)
227 if (bufferId == another.bufferId)
229 if (vertexId == another.vertexId)
232 return vertexId < another.vertexId;
235 return bufferId < another.bufferId;
239 return meshId < another.meshId;
253 if (vertexId == another.vertexId)
255 if (normalId == another.normalId)
257 if (texcoordId1 == another.texcoordId1)
259 if (texcoordId2 == another.texcoordId2)
262 return texcoordId2 < another.texcoordId2;
265 return texcoordId1 < another.texcoordId1;
268 return normalId < another.normalId;
272 return vertexId < another.vertexId;
278using namespace Collada;
282 class SKYLICHT_API CColladaLoader :
public CBaseMeshImporter
289 std::string m_meshFile;
290 std::string m_meshName;
301 bool m_loadTexcoord2;
302 bool m_createTangent;
303 bool m_flipNormalMap;
304 bool m_createBatchMesh;
306 bool m_loadNormalMap;
310 std::map<std::string, CJointData*> m_nameToJointData;
311 std::map<std::string, CJointData*> m_sidToJointData;
315 ArrayImages m_listImages;
316 ArrayEffects m_listEffects;
317 ArrayMaterials m_listMaterial;
318 ArrayMeshParams m_listMesh;
319 ArrayNodeParams m_listNode;
324 typedef std::vector<s32> ArrayShort;
325 std::map<SColladaMeshVertexMap, ArrayShort> m_meshVertexIndex;
330 virtual ~CColladaLoader();
332 void setLoadTexCoord2(
bool b)
337 void setCreateBatchMesh(
bool b)
339 m_createBatchMesh = b;
342 void setLoadNormalMap(
bool b,
bool flipNormalMap)
346 m_flipNormalMap = flipNormalMap;
349 void setTextureFolder(std::vector<std::string>& folder)
351 m_textureFolder = folder;
354 virtual bool loadModel(
const char* resource,
CEntityPrefab* output,
bool normalMap =
true,
bool flipNormalMap =
true,
bool texcoord2 =
true,
bool batching =
false);
380 void updateEffectMaterial(
SEffect* effect);
382 void updateJointToMesh(
SMeshParam* mesh,
int numJoints,
float* arrayWeight,
float* arrayTransform, std::vector<s32>& vCountArray, std::vector<s32>& vArray);
388 void loadEffectTexture();
390 ITexture* getTextureResource(std::wstring& refName, ArrayEffectParams& params);
396 void constructSkinMesh(std::list<SNodeParam*>& nodes);
This is the object class that describes an entity.
Definition CEntity.h:58
This object class is created to store data in an array of multiple CEntities.
Definition CEntityPrefab.h:38
Definition CJointData.h:32
Definition CSkinnedMesh.h:36
Struct for holding a mesh with a single material.
Definition IMeshBuffer.h:42
Interface of a Video Driver dependent Texture.
Definition ITexture.h:119
Struct for holding parameters for a material renderer.
Definition SMaterial.h:255
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
CMatrix4< f32 > matrix4
Typedef for f32 matrix.
Definition matrix4.h:2241
IIrrXMLReader< wchar_t, IReferenceCounted > IXMLReader
An xml reader for wide characters, derived from IReferenceCounted.
Definition IXMLReader.h:19
float f32
32 bit floating point variable.
Definition irrTypes.h:104
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
Definition CColladaLoader.h:51
Definition CColladaLoader.h:92
Definition CColladaLoader.h:218
Definition CColladaLoader.h:245
Definition CColladaLoader.h:67
Definition CColladaLoader.h:59
Definition CColladaLoader.h:168
Definition CColladaLoader.h:175
Definition CColladaLoader.h:194
Definition CColladaLoader.h:132
Definition CColladaLoader.h:162