Skylicht Engine
Loading...
Searching...
No Matches
CColladaLoaderFunc.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 "pch.h"
28#include "CColladaLoader.h"
29
30namespace Collada
31{
32 void uriToId(std::wstring& str);
33 std::wstring readId(io::IXMLReader* xmlRead);
34 std::wstring readName(io::IXMLReader* xmlRead);
35 void findNextNoneWhiteSpace(const c8** start);
36 inline f32 readFloat(const c8** p);
37
38 void readIntsInsideElement(io::IXMLReader* reader, s32* ints, u32 count);
39 void readIntsInsideElement(io::IXMLReader* reader, std::vector<s32>& arrayInt);
40 void readFloatsInsideElement(io::IXMLReader* reader, f32* floats, u32 count);
41 void readStringInsideElement(io::IXMLReader* reader, std::wstring& string);
42
43 int calcNumTriangleFromPolygon(const s32* vCount, int numPolygon);
44 int convertPolygonToTriangle(const s32* sourcePolygon, int offset, s32* targetTriangle, int& targetID, int numVertex, int numElementPerVertex);
45
46 SColorf readColorNode(io::IXMLReader* reader);
47 f32 readFloatNode(io::IXMLReader* reader);
48 core::matrix4 readTranslateNode(io::IXMLReader* reader, bool flip);
49 core::matrix4 readRotateNode(io::IXMLReader* reader, bool flip);
50 core::matrix4 readScaleNode(io::IXMLReader* reader, bool flip);
51 core::matrix4 readMatrixNode(io::IXMLReader* reader, bool flip);
52
53 ITexture* getTextureFromImage(std::wstring& uri, ArrayEffectParams& listEffectParam, ArrayImages& listImages, std::vector<std::string>& textureFolder);
54 ITexture* getTextureFromImage(std::wstring& id, const ArrayImages& listImages, std::vector<std::string>& textureFolder);
55 std::wstring getImageWithId(const std::wstring& id, const ArrayImages& listImages);
56 ITexture* loadDaeTexture(const std::wstring& path, std::vector<std::string>& textureFolder);
57
58 int getBufferWithUri(std::wstring& uri, SMeshParam* mesh);
59 int getVerticesWithUri(std::wstring& uri, SMeshParam* mesh);
60 int getEffectWithUri(std::wstring& uri, ArrayEffects& listEffectParam);
61 int getEffectWithUri(std::wstring& uri, ArrayEffects& listEffectParam, ArrayMaterials& listMaterial);
62 int getMeshWithUri(std::wstring& uri, ArrayMeshParams& listMeshParam);
63 int getMeshWithControllerName(std::wstring& controllerName, ArrayMeshParams& listMeshParam);
64}
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
char c8
8 bit character variable.
Definition irrTypes.h:31
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
Definition CColladaLoader.h:175