|
wavelength 1.0.0
|
Triangle mesh with a material. More...
#include <rndmesh.h>


Classes | |
| class | Vert |
| One vertex. More... | |
| class | Face |
| One triangle, as indices into the vertices. More... | |
| class | Edge |
| One edge, as indices into the vertices. More... | |
| struct | Bones |
| The two bone transforms the vertex weights blend. More... | |
Public Member Functions | |
| RndMesh (const char *pszName) | |
| Construct an empty mesh that draws with a Z depth test and write, passing when nearer. | |
| ~RndMesh () override | |
| Drop the references the mesh has. | |
| void * | operator new (size_t nSize) |
| Allocate a mesh, billed to the class name. | |
| void | operator delete (void *pBlock) |
| Release a mesh. | |
| void | ListDrawObjects (std::list< RndObject * > &objects) override |
| Add the mesh, its material, its owners, the textures of the material stages from the last, and the bones to a list. | |
| void | ListDrawables (std::list< RndDrawable * > &drawables) override |
| Add the mesh and then its children to a list, unless the mesh is outside the view of the current camera. | |
| virtual void | Sync (int nFlags) |
| Rebuild what the back end derives from parts of the geometry. | |
| void | Collide (const Segment &segment, std::list< Collision > &collisions) override |
| Add each face the segment strikes, then what the children strike, to a list. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the mesh and its bases. | |
| void | Save (BinStream &stream) override |
| Write the mesh and its bases. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a referenced object with another. | |
| const char * | ClassName () const override |
| Report the class name. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy another mesh and its bases. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it. | |
| void | SetMat (RndMat *pMat) |
| Set the material. | |
| bool | CheckLod (Sphere &worldSphere) |
| Report whether the mesh itself is to be drawn, drawing a lower detail mesh in its place when the current camera shows it too small. | |
| void | BoundingBox (Box &box) |
| Compute the bounding box of the vertices in the mesh's own space. | |
| void | TransformVerts (const Transform &xfm) |
| Move every vertex of the geometry by a transform, then rebuild the positions and normals. | |
| void | AddQuad (unsigned short nV0, unsigned short nV1, unsigned short nV2, unsigned short nV3) |
| Append the two triangles of a quad to the faces of mGeomOwner. | |
| void | AddQuadStrip (int nRowA, int nRowB, int nCount, int nStride, int nStep) |
| Append the quads between two rows of vertices with AddQuad(). | |
| void | FillEdges (int nEdgeA, int nEdgeB, int nCount, int nStride, const Vector3 &pointA0, const Vector3 &pointB0, const Vector3 &pointA1, const Vector3 &pointB1, const Vector2 &texA0, const Vector2 &texB0, const Vector2 &texA1, const Vector2 &texB1, const Vector2 &weightsA0, const Vector2 &weightsB0, const Vector2 &weightsA1, const Vector2 &weightsB1, const Color &colorA0, const Color &colorB0, const Color &colorA1, const Color &colorB1, const Vector3 &normA, const Vector3 &normB) |
| Fill the vertices of two edges of a tunnel panel, interpolating every field along them. | |
| const std::vector< Face > & | GetFaces () const |
| std::vector< Face > & | GetFaces () |
| RndMesh * | GetGeomOwner () const |
| RndMat * | GetMat () const |
| float | GetMinScreen () const |
| int | GetMutable () const |
| void | SetMutable (int nMutable) |
| const Sphere & | GetSphere () const |
| Sphere & | GetSphere () |
| const std::vector< Vert > & | GetVerts () const |
| std::vector< Vert > & | GetVerts () |
| int | GetZFunc () const |
| void | SetZFunc (int nZFunc) |
| int | GetZMode () const |
| void | SetZMode (int nZMode) |
| virtual void | Collide (const Vector2 &point, std::list< Collision > &collisions) |
| Test a screen point against the collideable and add what it strikes to a list. | |
| Public Member Functions inherited from RndDrawable | |
| RndDrawable () | |
| Construct a showing drawable without a highlight or children. | |
| ~RndDrawable () override | |
| Drop the references on the children. | |
| virtual void | SetShowing (int nShowing) |
| Set whether the drawable draws at all. | |
| virtual void | SetHighlight (int nHighlight) |
| Set whether the drawable draws with its highlight treatment. | |
| virtual int | DrawShowing () |
| Draw the drawable alone. | |
| RndDrawable * | Parent () |
| Find the drawable whose children include this one. | |
| void | Draw () |
| Draw the drawable and then its children, when it is showing. | |
| bool | AddDraw (RndDrawable *pDraw, RndDrawable *pBefore) |
| Add a child before another. | |
| void | RemoveDraw (RndDrawable *pDraw) |
| Remove a child. | |
| void | ClearDraws () |
| Remove every child. | |
| int | GetShowing () const |
| const std::list< RndDrawable * > & | GetDraws () const |
| Public Member Functions inherited from RndObject | |
| RndObject (const char *pszName) | |
| Construct an object and register it under a name. | |
| virtual | ~RndObject () |
| Notify every referrer, then erase the registration. | |
| void | SetName (const char *pszName) |
| Register the object under a different name. | |
| void | AddRef (RndObject *pReferrer) |
| Register an object as a store of a pointer to this one. | |
| void | RemoveRef (RndObject *pReferrer) |
| Drop the first registration AddRef() made for a referrer. | |
| const char * | GetName () const |
| const std::list< RndObject * > & | GetRefs () const |
| int | GetInternal () const |
| void | SetInternal (int nInternal) |
| Public Member Functions inherited from RndTransformable | |
| RndTransformable () | |
| Construct a transformable with identity transforms, no origin offset, and no billboard. | |
| ~RndTransformable () override | |
| Drop the references on the children. | |
| virtual void | SetBillboard (int nBillboard) |
| Set the billboard mode. | |
| virtual int | UpdateWorldXfm (RndTransformable *pParent, int bForce) |
| Recompute the world transform when it, or the parent's, changed, and then the children's. | |
| void | DumpText (PrnStream &stream) override |
| Write a description of the transformable. | |
| void | Save (BinStream &stream) override |
| Write the transforms, the names of the children, the billboard mode, and the origin. | |
| void | Replace (RndObject *pFrom, RndObject *pTo) override |
| Replace a child with another object. | |
| void | Copy (const RndObject *pSource, int nFlags) override |
| Copy the transforms, the billboard mode, the origin, and the children when the flags request them. | |
| void | Load (BinStream &stream) override |
| Read what Save() wrote, or an earlier version of it. | |
| void | SetOrigin (const Vector3 &origin) |
| Set the point the world transform subtracts first when there is no billboard. | |
| RndTransformable * | Parent () |
| Find the transformable whose children include this object. | |
| bool | AddTrans (RndTransformable *pTrans) |
| Append a child and mark its world transform dirty. | |
| void | RemoveTrans (RndTransformable *pTrans) |
| Remove a child. | |
| void | ClearTrans () |
| Remove every child. | |
| const Transform & | BillboardXfm () |
| Report the world transform turned to face the current camera. | |
| const Transform & | GetLocalXfm () const |
| Transform & | GetLocalXfm () |
| void | SetLocalXfm (const Transform &xfm) |
| const Transform & | GetWorldXfm () const |
| Transform & | GetWorldXfm () |
| int | GetDirty () const |
| void | SetDirty (int nDirty) |
| const std::list< RndTransformable * > & | GetTransList () const |
| Public Member Functions inherited from RndCollideable | |
| RndCollideable () | |
| Construct a collideable without children. | |
| ~RndCollideable () override | |
| Drop the references on the children. | |
| RndCollideable * | Parent () |
| Find the collideable whose children include this one. | |
| bool | AddCollide (RndCollideable *pCollide) |
| Append a child. | |
| void | RemoveCollide (RndCollideable *pCollide) |
| Remove a child. | |
Static Public Member Functions | |
| static RndObject * | New (const char *pszName) |
| Create a mesh. | |
| Static Public Member Functions inherited from RndDrawable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndDrawable *pDrawable) |
| Append every draw descendant of a drawable, depth first, each before its descendants. | |
| Static Public Member Functions inherited from RndTransformable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndTransformable *pTransformable) |
| Append every transform descendant of a transformable, depth first, each before its descendants. | |
| Static Public Member Functions inherited from RndCollideable | |
| static void | CollectChildren (std::list< RndObject * > &objects, RndCollideable *pCollideable) |
| Append every collision descendant of a collideable, depth first, each before its descendants. | |
Static Public Attributes | |
| static constexpr int | kCopyShareGeometry = 8 |
| The bit of the Copy() flags that shares the source's geometry rather than copying it. | |
| static constexpr int | kCopyBones = 0x20 |
| The bit of the Copy() flags that copies the bones. | |
| static const char * | sClassName |
| The class name a .rnd file writes, Mesh. | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| static int | sLoadRev |
| The version Load() read last, which the vertex and face readers read by. | |
| Static Public Attributes inherited from RndDrawable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndObject | |
| static constexpr int | kCopyChildLists = 0x200 |
| The bit of the Copy() flags that copies the child lists of the mix-ins. | |
| Static Public Attributes inherited from RndTransformable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
| Static Public Attributes inherited from RndCollideable | |
| static int | sRev |
| The format version Save() writes and Load() accepts. | |
Protected Member Functions | |
| void | ReleaseRefs () |
| Drop the references on the next mesh, the material, the owners, and the bones, and delete the bones. | |
| void | AcquireRefs () |
| Take references on the next mesh, the material, the owners, and the bones, then rebuild everything. | |
| Protected Member Functions inherited from RndDrawable | |
| void | ReleaseDrawRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireDrawRefs () |
| Take a reference on every child. | |
| Protected Member Functions inherited from RndTransformable | |
| void | ReleaseTransRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireTransRefs () |
| Take a reference on every child. | |
| Protected Member Functions inherited from RndCollideable | |
| void | ReleaseCollideRefs () |
| Drop the reference on every child without emptying the list. | |
| void | AcquireCollideRefs () |
| Take a reference on every child. | |
Protected Attributes | |
| int | mZMode |
| int | mZFunc |
| std::vector< Vert > | mVerts |
| std::vector< Face > | mFaces |
| std::vector< Edge > | mEdges |
| RndMat * | mMat |
| Sphere | mSphere |
| RndMesh * | mGeomOwner |
| RndTransformable * | mTransOwner |
| std::unique_ptr< Bones > | mBones |
| float | mMinScreen |
| RndMesh * | mNext |
| int | mMutable |
| Protected Attributes inherited from RndDrawable | |
| int | mShowing |
| Protected Attributes inherited from RndObject | |
| std::list< RndObject * > | mRefs |
| String | mName |
| Protected Attributes inherited from RndTransformable | |
| std::list< RndTransformable * > | mTransList |
| Transform | mLocalXfm |
| Transform | mWorldXfm |
| Vector3 | mOrigin |
| int | mDirty |
| int | mBillboard |
Triangle mesh with a material.
The RTTI includes the class name and records RndDrawable, RndTransformable, and RndCollideable as bases. The geometry may be shared, in which case mGeomOwner identifies the mesh that has it, and the transform may come from another transformable, mTransOwner. A chain of lower detail meshes follows mNext.
| enum RndMesh::ZMode |
| enum RndMesh::ZFunc |
| enum RndMesh::SyncFlags |
The parts of the geometry Sync() rebuilds.
|
explicit |
Construct an empty mesh that draws with a Z depth test and write, passing when nearer.
The mesh is its own geometry owner and its own transform owner.
| pszName | The registry key. |
|
override |
Drop the references the mesh has.
|
inline |
Allocate a mesh, billed to the class name.
| nSize | The object size the compiler supplies. |
|
inline |
Release a mesh.
| pBlock | The block. |
|
overridevirtual |
Add the mesh, its material, its owners, the textures of the material stages from the last, and the bones to a list.
The children are not added.
| objects | The list to add to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Add the mesh and then its children to a list, unless the mesh is outside the view of the current camera.
| drawables | The list to add to. |
Reimplemented from RndDrawable.
|
inlinevirtual |
|
overridevirtual |
Add each face the segment strikes, then what the children strike, to a list.
A hidden mesh adds nothing, and nor does a mesh whose bounding sphere the segment misses.
| segment | The segment, in world space. |
| collisions | The list to add to. |
Reimplemented from RndCollideable.
|
overridevirtual |
Write a description of the mesh and its bases.
| stream | The stream to write to. |
Reimplemented from RndDrawable.
|
overridevirtual |
Write the mesh and its bases.
Without bones, the mesh writes a 0 where the first bone name would go.
| stream | The stream to write to. |
Reimplemented from RndDrawable.
Replace a referenced object with another.
An owner replaced by null becomes the mesh itself. Bones without a first bone are deleted.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Reimplemented from RndDrawable.
|
inlineoverridevirtual |
Report the class name.
Implements RndObject.
|
overridevirtual |
Copy another mesh and its bases.
The geometry is copied when the source has its own and the flags do not request sharing. Otherwise the source's geometry owner becomes this one's.
| pSource | The mesh to copy from. |
| nFlags | The set of fields to copy. |
Reimplemented from RndDrawable.
|
overridevirtual |
Read what Save() wrote, or an earlier version of it.
| stream | The stream to read from. |
Reimplemented from RndDrawable.
| void RndMesh::SetMat | ( | RndMat * | pMat | ) |
Set the material.
| pMat | The material, or null. |
| bool RndMesh::CheckLod | ( | Sphere & | worldSphere | ) |
Report whether the mesh itself is to be drawn, drawing a lower detail mesh in its place when the current camera shows it too small.
A mesh without a bounding sphere is always drawn, and one outside the view never is. The name is inferred.
| worldSphere | Receives the bounding sphere in world space when the mesh has one. |
| void RndMesh::BoundingBox | ( | Box & | box | ) |
Compute the bounding box of the vertices in the mesh's own space.
A mesh without vertices reports a box with both corners at the origin.
| box | Receives the box. |
| void RndMesh::TransformVerts | ( | const Transform & | xfm | ) |
Move every vertex of the geometry by a transform, then rebuild the positions and normals.
The normals turn with the basis and are normalised. The name is inferred.
| xfm | The transform. |
| void RndMesh::AddQuad | ( | unsigned short | nV0, |
| unsigned short | nV1, | ||
| unsigned short | nV2, | ||
| unsigned short | nV3 ) |
Append the two triangles of a quad to the faces of mGeomOwner.
The triangles are (nV0, nV1, nV2) and (nV2, nV1, nV3). The only out-of-line copy is in the tunnel geometry unit.
| nV0 | The first corner. |
| nV1 | The corner after nV0 along the first row. |
| nV2 | The corner of the second row beside nV0. |
| nV3 | The corner of the second row beside nV1. |
| void RndMesh::AddQuadStrip | ( | int | nRowA, |
| int | nRowB, | ||
| int | nCount, | ||
| int | nStride, | ||
| int | nStep ) |
Append the quads between two rows of vertices with AddQuad().
Each row has nCount vertices nStride apart, and a quad spans nStep of them. The only out-of-line copy is in the tunnel geometry unit.
| nRowA | The first vertex of the first row. |
| nRowB | The first vertex of the second row. |
| nCount | The vertices in each row. |
| nStride | The distance between two neighbouring vertices of a row. |
| nStep | The vertices a quad spans. |
| void RndMesh::FillEdges | ( | int | nEdgeA, |
| int | nEdgeB, | ||
| int | nCount, | ||
| int | nStride, | ||
| const Vector3 & | pointA0, | ||
| const Vector3 & | pointB0, | ||
| const Vector3 & | pointA1, | ||
| const Vector3 & | pointB1, | ||
| const Vector2 & | texA0, | ||
| const Vector2 & | texB0, | ||
| const Vector2 & | texA1, | ||
| const Vector2 & | texB1, | ||
| const Vector2 & | weightsA0, | ||
| const Vector2 & | weightsB0, | ||
| const Vector2 & | weightsA1, | ||
| const Vector2 & | weightsB1, | ||
| const Color & | colorA0, | ||
| const Color & | colorB0, | ||
| const Color & | colorA1, | ||
| const Color & | colorB1, | ||
| const Vector3 & | normA, | ||
| const Vector3 & | normB ) |
Fill the vertices of two edges of a tunnel panel, interpolating every field along them.
Each edge blends in a straight line between two corners. The vertex vector grows to twice nCount first when it is shorter.
| nEdgeA | The first vertex of the first edge. |
| nEdgeB | The first vertex of the second edge. |
| nCount | The vertices of each edge. |
| nStride | The distance between two neighbouring vertices of an edge. |
| pointA0 | The position at the start of the first edge. |
| pointB0 | The position at the start of the second edge. |
| pointA1 | The position at the end of the first edge. |
| pointB1 | The position at the end of the second edge. |
| texA0 | The first texture coordinate at the start of the first edge. |
| texB0 | The first texture coordinate at the start of the second edge. |
| texA1 | The first texture coordinate at the end of the first edge. |
| texB1 | The first texture coordinate at the end of the second edge. |
| weightsA0 | The two vertex weights at the start of the first edge. |
| weightsB0 | The two vertex weights at the start of the second edge. |
| weightsA1 | The two vertex weights at the end of the first edge. |
| weightsB1 | The two vertex weights at the end of the second edge. |
| colorA0 | The colour at the start of the first edge. |
| colorB0 | The colour at the start of the second edge. |
| colorA1 | The colour at the end of the first edge. |
| colorB1 | The colour at the end of the second edge. |
| normA | The normal of the first edge. |
| normB | The normal of the second edge. |
|
inlinestatic |
Create a mesh.
| pszName | The registry key. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| nMutable | Non-zero when the geometry changes at run time. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| nZFunc | The ZFunc. |
|
inline |
|
inline |
| nZMode | The ZMode. |
|
protected |
Drop the references on the next mesh, the material, the owners, and the bones, and delete the bones.
The name is inferred.
|
protected |
Take references on the next mesh, the material, the owners, and the bones, then rebuild everything.
The name is inferred.
|
virtual |
Test a screen point against the collideable and add what it strikes to a list.
The base body tests the children.
| point | The screen point. |
| collisions | The list to add to. |
Reimplemented from RndCollideable.
|
staticconstexpr |
The bit of the Copy() flags that shares the source's geometry rather than copying it.
|
staticconstexpr |
The bit of the Copy() flags that copies the bones.
|
static |
The class name a .rnd file writes, Mesh.
|
static |
|
static |
The version Load() read last, which the vertex and face readers read by.
|
protected |
The ZMode.
|
protected |
The ZFunc.
|
protected |
The vertices.
|
protected |
The triangles.
|
protected |
The edges.
|
protected |
The material, or null.
|
protected |
The bounding sphere, of radius 0 for none.
|
protected |
The mesh that has the geometry.
|
protected |
The transformable whose world transform places the mesh.
|
protected |
The bones, or null.
|
protected |
The least projected size to draw at, or 0 for any.
|
protected |
The next lower detail mesh, or null.
|
protected |
Non-zero when the geometry changes at run time.