4 #ifndef _3ESSIMPLEMESH_H_ 5 #define _3ESSIMPLEMESH_H_ 10 #include "3esmeshresource.h" 11 #include "3esmeshmessages.h" 39 SimpleMesh(uint32_t
id,
unsigned vertexCount = 0,
unsigned indexCount = 0,
DrawType drawType = DtTriangles,
40 unsigned components = Vertex | Index);
55 virtual void clearData();
58 virtual uint32_t id()
const override;
61 virtual Matrix4f transform()
const override;
69 void setTransform(
const Matrix4f &transform);
72 virtual uint32_t tint()
const override;
76 void setTint(uint32_t tint);
84 virtual uint8_t drawType(
int stream)
const override;
94 unsigned components()
const;
98 void setComponents(
unsigned components);
102 void addComponents(
unsigned components);
104 unsigned vertexCount()
const;
105 virtual unsigned vertexCount(
int stream)
const override;
106 void setVertexCount(
unsigned count);
107 void reserveVertexCount(
unsigned count);
109 inline unsigned addVertex(
const Vector3f &v) {
return addVertices(&v, 1u); }
110 unsigned addVertices(
const Vector3f *v,
unsigned count);
111 inline bool setVertex(
unsigned at,
const Vector3f &v) {
return setVertices(at, &v, 1u) == 1u; }
112 unsigned setVertices(
unsigned at,
const Vector3f *v,
const unsigned count);
114 virtual const float *vertices(
unsigned &stride,
int stream = 0)
const override;
116 unsigned indexCount()
const;
117 virtual unsigned indexCount(
int stream)
const override;
118 void setIndexCount(
unsigned count);
119 void reserveIndexCount(
unsigned count);
121 inline void addIndex(uint32_t i) {
return addIndices(&i, 1u); }
122 void addIndices(
const uint32_t *idx,
unsigned count);
123 inline bool setIndex(
unsigned at, uint32_t i) {
return setIndices(at, &i, 1u) == 1u; }
124 unsigned setIndices(
unsigned at,
const uint32_t *idx,
unsigned count);
125 const uint32_t *indices()
const;
126 virtual const uint8_t *indices(
unsigned &stride,
unsigned &width,
int stream = 0)
const override;
128 inline bool setNormal(
unsigned at,
const Vector3f &n) {
return setNormals(at, &n, 1u) == 1u; }
129 unsigned setNormals(
unsigned at,
const Vector3f *n,
const unsigned count);
131 virtual const float *normals(
unsigned &stride,
int stream)
const override;
133 inline bool setColour(
unsigned at, uint32_t c) {
return setColours(at, &c, 1u) == 1u; }
134 unsigned setColours(
unsigned at,
const uint32_t *c,
unsigned count);
135 const uint32_t *colours()
const;
136 virtual const uint32_t *colours(
unsigned &stride,
int stream)
const override;
138 inline bool setUv(
unsigned at,
float u,
float v) {
const float uv[2] = { u, v };
return setUvs(at, uv, 1u) == 1u; }
139 unsigned setUvs(
unsigned at,
const float *uvs,
const unsigned count);
140 const float *uvs()
const;
141 virtual const float *uvs(
unsigned &stride,
int stream)
const override;
152 setComponents(this->components() | components);
156 #endif // _3ESSIMPLEMESH_H_ A 32-bit integer colour class.
Definition: 3escolour.h:19
A row major 4x4 transformation matrix.
Definition: 3esmatrix4.h:27
DrawType
Defines the primitives for a mesh.
Definition: 3esmeshmessages.h:135
Definition: 3esbounds.h:13
An encapsulated definition of a mesh. It manages all its own vertices, indices, etc.
Definition: 3essimplemesh.h:18
Represents a mesh part or object.
Definition: 3esmeshresource.h:16
Represents a vector in R3.
Definition: 3esvector3.h:14
void addComponents(unsigned components)
Add ComponentFlag values to the existing set.
Definition: 3essimplemesh.h:150
ComponentFlag
Flags indicating which components are present.
Definition: 3essimplemesh.h:23