Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
AxisPlaneShapes.h
Go to the documentation of this file.
1#ifndef ULT_AXIS_PLANE_SHAPES_INCLUDED
2#define ULT_AXIS_PLANE_SHAPES_INCLUDED
3
4#include "../ModelData.h"
5
6#define UNIT_AXIS_PLANE_VERTEX_TOTAL 4
7#define UNIT_AXIS_PLANE_INDEX_TOTAL 6
8#define UNIT_AXIS_PLANE_STRIDE sizeof(Ult::stAxisPlaneVertex)
9
10namespace Ult
11{
12
16
18{
19 float x,y,z;
20 float tu1,tv1;
21 float nx,ny,nz;
22};
23
29inline bool CreateXZPlaneMesh(float size, ModelData* model)
30{
31 if (!model) { return false; }
32
34 {+1*size, 0, -1*size, 1,0, 0,1,0},
35 {-1*size, 0, -1*size, 0,0, 0,1,0},
36 {-1*size, 0, +1*size, 0,1, 0,1,0},
37 {+1*size, 0, +1*size, 1,1, 0,1,0}
38 };
39 unsigned int PlaneIndices[UNIT_AXIS_PLANE_INDEX_TOTAL] = {
40 0,1,2,
41 2,3,0
42 };
43
44 model->Clear();
48
49 if (!model->SetVertices(
53 (char*)PlaneData)) {
54 return false;
55 }
56 if (!model->SetIndices(
58 PlaneIndices)) {
59 return false;
60 }
61 return true;
62}
63
64} // namespace Ult
65
66#endif // ULT_AXIS_PLANE_SHAPES_INCLUDED
67
#define UNIT_AXIS_PLANE_VERTEX_TOTAL
Definition AxisPlaneShapes.h:6
#define UNIT_AXIS_PLANE_STRIDE
Definition AxisPlaneShapes.h:8
#define UNIT_AXIS_PLANE_INDEX_TOTAL
Definition AxisPlaneShapes.h:7
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
bool CreateXZPlaneMesh(float size, ModelData *model)
Definition AxisPlaneShapes.h:29
Definition Archive.h:13
Definition AxisPlaneShapes.h:18
float x
Definition AxisPlaneShapes.h:19
float ny
Definition AxisPlaneShapes.h:21
float y
Definition AxisPlaneShapes.h:19
float nz
Definition AxisPlaneShapes.h:21
float nx
Definition AxisPlaneShapes.h:21
float z
Definition AxisPlaneShapes.h:19
float tv1
Definition AxisPlaneShapes.h:20
float tu1
Definition AxisPlaneShapes.h:20