add example program LoadStaticMesh
This commit is contained in:
66
inc/hgl/graph/data/MeshData.h
Normal file
66
inc/hgl/graph/data/MeshData.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef HGL_GRAPH_MESH_DATA_INCLUDE
|
||||
#define HGL_GRAPH_MESH_DATA_INCLUDE
|
||||
|
||||
#include<hgl/type/DataType.h>
|
||||
#include<hgl/math/Math.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
struct MeshData
|
||||
{
|
||||
int index;
|
||||
uint32 vertex_count; ///<顶点数量
|
||||
|
||||
uint8 ntb;
|
||||
|
||||
float *position;
|
||||
float *normal;
|
||||
float *tangent;
|
||||
|
||||
union
|
||||
{
|
||||
float *bitangent;
|
||||
float *binormal;
|
||||
};
|
||||
|
||||
uint32 color_count;
|
||||
uint8 **colors;
|
||||
|
||||
uint32 uv_count;
|
||||
const uint8 *uv_component;
|
||||
float **uv;
|
||||
|
||||
uint32 indices_count;
|
||||
|
||||
union
|
||||
{
|
||||
void *indices;
|
||||
uint16 *indices16;
|
||||
uint32 *indices32;
|
||||
};
|
||||
|
||||
AABB bounding_box;
|
||||
|
||||
public:
|
||||
|
||||
MeshData()
|
||||
{
|
||||
hgl_zero(this,sizeof(MeshData));
|
||||
|
||||
index=-1;
|
||||
}
|
||||
|
||||
~MeshData()
|
||||
{
|
||||
if(colors)
|
||||
delete[] colors;
|
||||
|
||||
if(uv)
|
||||
delete[] uv;
|
||||
}
|
||||
};//struct MeshData
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_MESH_DATA_INCLUDE
|
45
inc/hgl/graph/data/SceneNodeData.h
Normal file
45
inc/hgl/graph/data/SceneNodeData.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef HGL_GRAPH_SCENE_NODE_DATA_INCLUDE
|
||||
#define HGL_GRAPH_SCENE_NODE_DATA_INCLUDE
|
||||
|
||||
#include<hgl/graph/data/MeshData.h>
|
||||
#include<hgl/type/StringList.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
struct SceneNodeData
|
||||
{
|
||||
UTF8String name;
|
||||
|
||||
Matrix4f local_matrix;
|
||||
|
||||
List<uint32> mesh_index;
|
||||
|
||||
ObjectList<SceneNodeData> sub_nodes;
|
||||
};//struct SceneNodeData
|
||||
|
||||
struct ModelData
|
||||
{
|
||||
uint8 *source_filedata=nullptr;
|
||||
|
||||
uint8 version=0;
|
||||
|
||||
UTF8StringList mesh_name;
|
||||
ObjectList<MeshData> mesh_list;
|
||||
|
||||
SceneNodeData *root_node=nullptr;
|
||||
|
||||
AABB bounding_box;
|
||||
|
||||
public:
|
||||
|
||||
~ModelData()
|
||||
{
|
||||
SAFE_CLEAR(root_node);
|
||||
delete[] source_filedata;
|
||||
}
|
||||
};//struct ModelData
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_SCENE_NODE_DATA_INCLUDE
|
Reference in New Issue
Block a user