br_vertex
typedef
model.h
for precise declaration and ordering)
br_vector3 p Co-ordinates of a point in model space
br_vector2 map Texture co-ordinates of this vertex
br_uint_8 index Colour index for pre-lit models
br_uint_8 red, grn, blu True colour values for pre-lit model
BrModelApplyMap()
231
and BrModelFitMap()
233
to set texture co-ordinates. See BrSceneModelLight()
234
to set pre-lit values.
br_model
228
for the structure in which vertices are used.
See br_material
151 for details of how pre-lighting information is used.
For example, a cube has eight vertices. If it had unit side and was centred about (0,0,0), it would have vertices (0.5,0.5,0.5), (0.5,0.5,-0.5), etc. Faces are polygons (typically triangles) described in terms of a number of vertex indices.
Members
Position
The co-ordinates of a point (in the model's co-ordinate space) representing the vertex of a group of faces (typically triangular).br_vector3 p
Texture and Lighting
The 2D co-ordinates at which this vertex appears in an infinitely*1 tiled texture map.br_vector2 map
Pre-computed lighting index at this vertex. See br_uint_8 index
br_material
151 for how this relates to pre-lit materials.
br_uint_8 red, grn, blu
br_material
151
for how this relates to pre-lit materials.
Copy/Assign
Do not use structure assign. Use member-wise copy only. Access & Maintenance
Members may be freely accessed. Models referencing vertices that are changed should be updated using BrModelUpdate()
237 before rendering. There are private members of vertices that are modified during
BrModelUpdate()
237
Referencing & Lifetime
Be careful of referencing vertices especially ones allocated by BrModelAllocate()
239, they are liable to be moved around during
BrModelUpdate()
237, say. Vertices are generally only allocated as arrays completely describing a model. Always access using indexing from the model's
vertices
member.
Initialisation
Use memset(,0,sizeof(br_vertex))
and set members as appropriate. Updating of models referencing initialised vertices will be needed before there are involved in rendering. Construction & Destruction
Vertices may be constructed conventionally, but BR_MODF_KEEP_ORIGINAL
must be specified in any model that refers to them. Otherwise use BrModelAllocate()
239.
Supplementary
When constructed by BrModelAllocate()
239 vertices are allocated from the
"VERTICES"
memory class. It is probably better to organise any enumeration around models (see br_model
228
Import & Export
Vertices are included with model definitions. See br_model
228 for details of import/export functions.