Logo
ModelData.h
1#pragma once
2
3#include "Types.h"
4
5#include "gfx/mdl/ModelData.h"
6#include "gfx/Material.h"
7#include "Physics/Physics.h"
8#include "MaterialInfo.h"
9
10namespace XXSharpKmyGfx
11{
12 ref class Render;
13 ref class Material;
14 ref class MaterialInstance;
15
16 private ref class ModelData
17 {
18 public:
19 kmyGfx::ModelData *obj;
20 bool own = false;
21
22 ModelData(System::String^ path, System::Guid guid, bool vtxCompress);
23 ModelData(System::String^ path);
24
25 //Unused.
26 ModelData(kmyGfx::ModelData *o)
27 {
28 obj = o;
29 }
30
31 ~ModelData();
32
33 void load();
34 void unload();
35 MaterialInfo^ getMaterialInfo(int index);
36
37 void ReleaseForToolWithSync();
38
39 void initializeByDef(System::String ^path);
40 void renamePath(System::String^ path);
41
42 XXSharpKmyMath::Vector3 getSize();
43 XXSharpKmyMath::Vector3 getCenter();
44 static XXSharpKmyMath::Vector3 getCenterImpl(kmyGfx::ModelData *obj);
45
46 void setBlendType(System::String ^mtlname, int type);
47 int getMaterialIndex(System::String ^name);
48 int getMeshClusterMaterialIndex(int index);
49 size_t getIndexCount(int index);
50 int getBoneCount(int index);
51 Material^ getMaterial(u32 index);
52 bool isOverInfluenceCount(int index);
53 array<System::String^> ^getTextureNameList();
54 System::Collections::Generic::List<System::String^>^ getMotionNameList();
55 System::Collections::Generic::Dictionary<System::String^, XXSharpKmyMath::Vector2>^ getMotion();
56 System::String^ getPath();
57 void saveDefFile(System::String^ path);
58 bool isModified();
59 void reconstruct();
60 void constructPBRMaterial();
61 bool evalMaterialCount() { return obj ? obj->evalMaterialCount() : true; }
62 void validateVertexDesc() { if (obj)obj->validateVertexDesc(); }
63 void clearMaterialGUID() { if (obj)obj->clearMaterialGUID(); }
64 void setMaterialGUID(int index, System::Guid id);
65 void setVertexCompressMode(bool compress);
66 bool getVertexCompressMode();
67 void setVrmSpringBoneLimit(float limit);
68 float getStartTime();
69 float getEndTime();
70 XXSharpKmyMath::Vector3 getPreviewOffset();
71 XXSharpKmyMath::Vector3 getPreviewAngle();
72 array<XXSharpKmyMath::Vector3> ^getMeshCollisionVertices();
73 array<System::String^> ^getNodeNameList();
74
75 bool hasUnTriangulateMesh();
76 void setSkinnedBoundSphereRadiusScale(float v) {
77 if (obj)obj->setSkinnedBoundSphereRadiusScale(v);
78 }
79 float getSkinnedBoundSphereRadiusScale() {
80 return obj ? obj->getSkinnedBoundSphereRadiusScale() : 1.0f;
81 }
82
83 private:
84
85#ifdef KMY_USE_VRM
86 public:
87 enum class VrmLookAtType : int
88 {
89 None = -1,
90 Bone,
91 BlendShape,
92 Texture,
93 };
94 public:
95 ModelExporter::ModelDataWrap^ GetModelData();
96 bool isVrm();
97 int vrmGetTextureNum();
98 System::String^ vrmGetTextureName(int index);
99 void vrmStoreTextureToFile(int index, System::String^ path);
100 array<Byte>^ vrmGetImageArray(int index);
101
102 System::String^ vrmGetMaterialDef(int index);
103 VrmLookAtType vrmGetLookAtType();
104#endif
105 };
106}