JunkBox_Lib++ (for Windows) 1.10.1
Loading...
Searching...
No Matches
ColladaTool.h
Go to the documentation of this file.
1#ifndef __JBXL_CPP_COLLADA_TOOL_H_
2#define __JBXL_CPP_COLLADA_TOOL_H_
3
4#include "tools++.h"
5#include "txml.h"
6
7#include "TriBrep.h"
8#include "Rotation.h"
9#include "ContourBaseData.h"
10#include "MaterialParam.h"
11#include "MeshObjectData.h"
12
13
14namespace jbxl {
15
16
17#define COLLADA_STR_AUTHOR "JBXL Collada Tool Library (C) 2014-2024 by Fumi.Iseki and Austin Tate"
18#define COLLADA_STR_XMLNS "http://www.collada.org/2005/11/COLLADASchema"
19#define COLLADA_STR_TOOL "JunkBox_Lib++ (https://github.com/JunkBox-Library)"
20#define COLLADA_STR_VER "1.6.0"
21
22//
23#define COLLADA_X_UP 0
24#define COLLADA_Y_UP 1
25#define COLLADA_Z_UP 2
26
27
29// ColladaXML. XML for Collada Data
30//
31
36{
37public:
38 ColladaXML(double meter=1.0, int axis=COLLADA_Z_UP, const char* ver=NULL) { init(meter, axis, ver);}
39 ColladaXML(float meter, int axis=COLLADA_Z_UP, const char* ver=NULL) { init(meter, axis, ver);}
40 virtual ~ColladaXML(void);
41
42public:
43 void init (double meter=1.0, int axis=COLLADA_Z_UP, const char* ver=NULL);
44 void init (float meter, int axis=COLLADA_Z_UP, const char* ver=NULL) { init((double)meter, axis, ver); }
45 void clear(double meter=1.0, int axis=COLLADA_Z_UP, const char* ver=NULL);
46 void clear(float meter, int axis=COLLADA_Z_UP, const char* ver=NULL) { clear((double)meter, axis, ver); }
47 void free (void);
48
49 void outputFile(const char* fn, const char* path=NULL, int mode=XML_SPACE_FORMAT);
50 void output_dae (FILE* fp, int mode=XML_SPACE_FORMAT) { print_xml(fp, xml_tag, mode);}
51 void output_tree(FILE* fp) { print_xml_tree(fp, xml_tag, " ");}
52
53public:
54 void initCollada(double meter, int axis, const char* ver);
55 void initCollada(float meter, int axis, const char* ver) { initCollada((double)meter, axis, ver); }
56 void addShell(MeshObjectData* shelldata, bool collider, SkinJointData* skin_joint=NULL, tXML* joints_template=NULL);
57
58 char* addGeometry(MeshObjectData* shelldata);
59 char* addController(const char* geometry_id, MeshObjectData* shelldata, SkinJointData* skin_joint);
60 void addScene(const char* geometry_id, char* controll_id, MeshObjectData* shelldata, bool collider, SkinJointData* skin_joint);
61
62 char* addVertexSource(tXML* tag, MeshObjectData* shelldata);
63 char* addNormalSource(tXML* tag, MeshObjectData* shelldata);
64 char* addTexcrdSource(tXML* tag, MeshObjectData* shelldata);
65 char* addWeightSource(tXML* tag, MeshObjectData* shelldata, Vector<int>* weight_index, int num_joints);
66
67 char* addVerticesPos (tXML* mesh_tag, const char* position_id);
68
69 void addSimpleTechniqueAccessor(tXML* source_tag, const char* source_array_id, int count, int stride, const char* name, const char* type);
70 void addPosTechniqueAccessor(tXML* source_tag, const char* source_array_id, int count);
71 void addMapTechniqueAccessor(tXML* source_tag, const char* source_array_id, int count);
72
73 void addPolylists(tXML* mesh_tag, MeshObjectData* shelldata, const char* vertex_id, const char* normal_id=NULL, const char* texcrd_id=NULL);
74 char* addImage(const char* filename);
75 char* addMaterial(const char* material);
76 tXML* addEffect(const char* material_url, const char* file_id, MaterialParam param);
77 void addExtraBumpmap(tXML* effect_tag, const char* bump_id);
78
79 void closeSolid(void);
80 void deleteJoint(tXML* delete_tag);
81
82 bool existSameID(tXML* top, const char* tag, const char* id);
83
84 void setBlankTexture(const char* name) { if(name!=NULL) blank_texture = make_Buffer_bystr(name);}
85 bool isBlankTexture (const char* name);
86
87 void setJointLocationMatrix(void);
88 void deleteNousedJoints(tXML* delete_tag);
89 void deleteListJoints(tXML* top_tag, tList* joints_name);
90
91private:
92
93public:
95 //
105
114
116
120
124
125public:
128
135
136// for Unity
137public:
140 void addCenterObject(void);
141 void addCenterScene(void);
142};
143
144
145inline void freeColladaXML(ColladaXML*& dae) { if(dae!=NULL) { dae->free(); delete dae; dae=NULL;} }
146
147
148} // namespace
149
150#endif
151
#define COLLADA_Z_UP
Definition ColladaTool.h:25
回転・クォータニオン ライブラリ ヘッダ
三角Contour(Facet)用ライブラリ ヘッダ for BREP
#define make_Buffer_bystr(str)
set_Buffer()
Definition buffer.h:57
tXML * instance_physics_model_tag
char * addImage(const char *filename)
char * addVertexSource(tXML *tag, MeshObjectData *shelldata)
char * addWeightSource(tXML *tag, MeshObjectData *shelldata, Vector< int > *weight_index, int num_joints)
ColladaXML(double meter=1.0, int axis=COLLADA_Z_UP, const char *ver=NULL)
Definition ColladaTool.h:38
tXML * library_visual_scenes_tag
tXML * physics_scene_tag
void addCenterScene(void)
void addExtraBumpmap(tXML *effect_tag, const char *bump_id)
tXML * physics_model_tag
void deleteJoint(tXML *delete_tag)
void initCollada(float meter, int axis, const char *ver)
Definition ColladaTool.h:55
char * addMaterial(const char *material)
char * addController(const char *geometry_id, MeshObjectData *shelldata, SkinJointData *skin_joint)
void addMapTechniqueAccessor(tXML *source_tag, const char *source_array_id, int count)
void init(double meter=1.0, int axis=COLLADA_Z_UP, const char *ver=NULL)
void output_dae(FILE *fp, int mode=XML_SPACE_FORMAT)
Definition ColladaTool.h:50
tXML * visual_scene_tag
void initCollada(double meter, int axis, const char *ver)
AffineTrans< double > * affineTrans
char * addGeometry(MeshObjectData *shelldata)
void clear(float meter, int axis=COLLADA_Z_UP, const char *ver=NULL)
Definition ColladaTool.h:46
tXML * authoring_tool_tag
void setBlankTexture(const char *name)
Definition ColladaTool.h:84
void closeSolid(void)
void init(float meter, int axis=COLLADA_Z_UP, const char *ver=NULL)
Definition ColladaTool.h:44
void outputFile(const char *fn, const char *path=NULL, int mode=XML_SPACE_FORMAT)
void addShell(MeshObjectData *shelldata, bool collider, SkinJointData *skin_joint=NULL, tXML *joints_template=NULL)
char * addVerticesPos(tXML *mesh_tag, const char *position_id)
tXML * joints_template_tag
void deleteNousedJoints(tXML *delete_tag)
tXML * library_physics_models_tag
char * addNormalSource(tXML *tag, MeshObjectData *shelldata)
void addPolylists(tXML *mesh_tag, MeshObjectData *shelldata, const char *vertex_id, const char *normal_id=NULL, const char *texcrd_id=NULL)
void addCenterObject(void)
tXML * library_images_tag
void deleteListJoints(tXML *top_tag, tList *joints_name)
void output_tree(FILE *fp)
Definition ColladaTool.h:51
void addSimpleTechniqueAccessor(tXML *source_tag, const char *source_array_id, int count, int stride, const char *name, const char *type)
AffineTrans< double > affineSkeleton
bool isBlankTexture(const char *name)
tXML * addEffect(const char *material_url, const char *file_id, MaterialParam param)
tXML * contributor_tag
Definition ColladaTool.h:98
tXML * library_materials_tag
virtual ~ColladaXML(void)
tXML * instance_physics_scene_tag
tXML * instance_visual_scene_tag
ColladaXML(float meter, int axis=COLLADA_Z_UP, const char *ver=NULL)
Definition ColladaTool.h:39
tXML * library_geometries_tag
void addScene(const char *geometry_id, char *controll_id, MeshObjectData *shelldata, bool collider, SkinJointData *skin_joint)
void setJointLocationMatrix(void)
bool existSameID(tXML *top, const char *tag, const char *id)
void addPosTechniqueAccessor(tXML *source_tag, const char *source_array_id, int count)
tXML * library_physics_scenes_tag
tXML * library_controllers_tag
tXML * library_effects_tag
void clear(double meter=1.0, int axis=COLLADA_Z_UP, const char *ver=NULL)
char * addTexcrdSource(tXML *tag, MeshObjectData *shelldata)
Definition Brep.h:29
void freeColladaXML(ColladaXML *&dae)
ツールライブラリ ヘッダ for C++
void print_xml_tree(FILE *fp, tXML *pp, const char *space)
XMLツリーをそのままツリー表示する.デバッグ用.
Definition txml.cpp:1759
void print_xml(FILE *fp, tXML *pp, int mode)
XMLの表示(出力).
Definition txml.cpp:1691
Tiny XML ライブラリヘッダ
#define XML_SPACE_FORMAT
先頭に空白2つ " " をつけ,ノードごとに改行する.
Definition txml.h:119