1#ifndef ULT_BOX_SHAPE_H_INCLUDED
2#define ULT_BOX_SHAPE_H_INCLUDED
8#define ULT_UNIT_BOX_VERTEX_TOTAL 24
9#define ULT_UNIT_BOX_INDEX_TOTAL 36
10#define ULT_UNIT_BOX_STRIDE sizeof(Ult::stUnitBoxVertex)
31static inline bool CreateCubeMesh(
34 std::vector<Plane>* planes
37 if (!model) {
return false; }
40 {-1*size, -1*size, -1*size, 1,0, 0,0,1 },
41 {+1*size, -1*size, -1*size, 0,0, 0,0,1 },
42 {+1*size, +1*size, -1*size, 0,1, 0,0,1 },
43 {-1*size, +1*size, -1*size, 1,1, 0,0,1 },
45 {+1*size, -1*size, +1*size, 1,0, 0,0,-1 },
46 {-1*size, -1*size, +1*size, 0,0, 0,0,-1 },
47 {-1*size, +1*size, +1*size, 0,1, 0,0,-1 },
48 {+1*size, +1*size, +1*size, 1,1, 0,0,-1 },
50 {-1*size, -1*size, -1*size, 0,0, 1,0,0 },
51 {-1*size, +1*size, -1*size, 0,1, 1,0,0 },
52 {-1*size, +1*size, +1*size, 1,1, 1,0,0 },
53 {-1*size, -1*size, +1*size, 1,0, 1,0,0 },
55 {+1*size, -1*size, +1*size, 0,0, -1,0,0 },
56 {+1*size, +1*size, +1*size, 0,1, -1,0,0 },
57 {+1*size, +1*size, -1*size, 1,1, -1,0,0 },
58 {+1*size, -1*size, -1*size, 1,0, -1,0,0 },
60 {-1*size, +1*size, +1*size, 0,0, 0,-1,0 },
61 {-1*size, +1*size, -1*size, 0,1, 0,-1,0 },
62 {+1*size, +1*size, -1*size, 1,1, 0,-1,0 },
63 {+1*size, +1*size, +1*size, 1,0, 0,-1,0 },
65 {+1*size, -1*size, +1*size, 0,0, 0,1,0 },
66 {+1*size, -1*size, -1*size, 0,1, 0,1,0 },
67 {-1*size, -1*size, -1*size, 1,1, 0,1,0 },
68 {-1*size, -1*size, +1*size, 1,0, 0,1,0 }
73 planes->push_back(
Plane(0,0,1,size));
74 planes->push_back(
Plane(0,0,-1,size));
75 planes->push_back(
Plane(1,0,0,size));
76 planes->push_back(
Plane(-1,0,0,size));
77 planes->push_back(
Plane(0,-1,0,size));
78 planes->push_back(
Plane(0,1,0,size));
99 (
char*)UnitBoxData)) {
112static inline bool CreateCubeMesh(
const float size,
ModelData* model)
114 return CreateCubeMesh(size, model,
nullptr);
121static inline bool CreateUnitCubeMesh(
ModelData* model)
123 return CreateCubeMesh(1, model,
nullptr);
#define ULT_UNIT_BOX_STRIDE
Definition BoxShape.h:10
#define ULT_UNIT_BOX_VERTEX_TOTAL
Definition BoxShape.h:8
#define ULT_UNIT_BOX_INDEX_TOTAL
Definition BoxShape.h:9
Definition ModelData.h:26
void Clear()
Definition ModelData.cpp:21
bool SetIndices(int totalIndices, unsigned int *indices)
Definition ModelData.cpp:36
bool AddDescriptorElement(ElementType type)
Definition ModelData.h:49
bool SetVertices(PrimitiveType type, int totalVertices, int stride, char *vertices)
Definition ModelData.cpp:53
@ ULT_TRI_LIST
Definition PrimitiveType.h:12
@ ULT_VERTEX_3F
Definition ElementType.h:13
@ ULT_TEX1_2F
Definition ElementType.h:16
@ ULT_NORMAL_3F
Definition ElementType.h:14
float nx
Definition BoxShape.h:23
float tu1
Definition BoxShape.h:22
float x
Definition BoxShape.h:21
float ny
Definition BoxShape.h:23
float tv1
Definition BoxShape.h:22
float y
Definition BoxShape.h:21
float z
Definition BoxShape.h:21
float nz
Definition BoxShape.h:23