146 void *
operator new(
size_t nSize);
157 void operator delete(
void *pBlock);
499 void AddQuad(
unsigned short nV0,
unsigned short nV1,
unsigned short nV2,
unsigned short nV3) {
500 std::vector<MeshFace> &faces =
mFacesOwner->mFaces;
501 faces.push_back(
MeshFace{nV0, nV1, nV2});
502 faces.push_back(
MeshFace{nV2, nV1, nV3});
519 for (
int i = 0; i < nCount - 1; i += nStep) {
520 AddQuad(nRowA, nRowA + nStep, nRowB, nRowB + nStep);
621 void AddObjectRefs();
631 void ReleaseObjects();
642 void ClearSharedGeometry();
685 void AssignFlatVerts(std::list<MeshAnim *> &anims);
Axis-aligned bounding box.
Definition box.h:12
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Collideable()
Construct a collideable with no children.
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
Drawable()
Construct a visible drawable with no children.
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Per-vertex animation of one mesh.
Definition meshanim.h:45
Indexed triangle mesh with one material.
Definition mesh.h:46
ZMode
Depth buffer read and write mode, as the text dump labels the values.
Definition mesh.h:69
@ kZModeZReadWrite
Definition mesh.h:72
@ kZModeWReadOnly
Definition mesh.h:73
@ kZModeDisable
Definition mesh.h:70
@ kZModeZReadOnly
Definition mesh.h:71
@ kZModeWReadWrite
Definition mesh.h:74
virtual void SyncAll()
Report every part of the mesh as changed.
Box BoundingBox()
Compute the bounding box of the vertices.
virtual void AddRefObjects()
Restore the reference bookkeeping and resynchronise after a load or a copy.
std::vector< MeshFace > mFaces
Definition mesh.h:707
void SetFacesOwner(Mesh *pOwner)
Point the mesh at the mesh whose triangles and edges it draws.
virtual void Sync()
Rebuild whatever the platform subclass derives from the geometry.
virtual void Save(Stream &stream)
Serialise the mesh.
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 mFacesOwner.
Definition mesh.h:499
@ kCopyShareFaces
Definition mesh.h:114
@ kCopyShareVerts
Definition mesh.h:113
@ kCopyShareTransforms
Definition mesh.h:115
void MakeCube(float flHalfSize)
Replace the geometry with an axis-aligned cube.
friend bool JoinFaces(Mesh *pMesh, FlatFace &primary, FlatFace &face)
Add face to the fan that primary heads when the two share a vertex of pMesh, their normals are within...
Sphere mSphere
Definition mesh.h:721
Transformable * mTransOwner
Definition mesh.h:735
virtual void FindCollisions(const Segment &ray, std::list< Collision > &collisions)
Test a ray against this mesh and append what it strikes to sink.
void ComputeNormals(bool bPositionOnly)
Recompute the vertex normals of mVertsOwner from the faces of mFacesOwner.
int PrepareDraw(Sphere &worldSphere)
Decide whether this mesh draws, and yield its world bounding sphere.
virtual void Copy(const Object *pSource, unsigned nFlags)
Copy another mesh over this one.
ZMode mZMode
Definition mesh.h:696
void MirrorX()
Mirror the mesh across its local x axis by negating the x row of its local transform,...
Definition mesh.h:467
virtual void Replace(Object *pFrom, Object *pTo)
Replace one object reference with another.
void SetMaterialChain(Mat *pMat)
Set the material of this mesh and of every coarser level of its mNext chain.
Sphere WorldSphere()
Report the bounding sphere in world space.
std::vector< MeshVert > mVerts
Definition mesh.h:704
@ kSyncTexs
Definition mesh.h:103
@ kSyncColors
Definition mesh.h:102
@ kSyncPoints
Definition mesh.h:100
@ kSyncNorms
Definition mesh.h:101
float mMinScreen
Definition mesh.h:750
void SetVertexColor(const Color &color)
Give every vertex of mVertsOwner one colour and report the change through SyncChanged().
void SetVertsOwner(Mesh *pOwner)
Point the mesh at the mesh whose vertices it draws.
void SetTrans1Owner(Transformable *pOwner)
Point the mesh at its second transform owner.
@ kSyncAllMask
Definition mesh.h:90
virtual void SyncChanged(int nMask)
Report which parts of the mesh have changed.
@ kSerialVersion
Definition mesh.h:119
static Mesh *(* sNew)(const HxStr &name)
Creator the registered "Mesh" class builds through.
Definition mesh.h:58
static HxStr sClassName
Registered class name of Rnd::Mesh, the string "Mesh".
Definition mesh.h:66
virtual void DumpText(Dbg &sink)
Write the mesh to the engine text sink.
void SetMat(Mat *pMat)
Point the mesh at a material.
std::vector< MeshEdge > mEdges
Definition mesh.h:710
Mesh * mFacesOwner
Definition mesh.h:729
Mesh * mNext
Definition mesh.h:753
Mesh(const HxStr &name)
Construct an empty mesh that owns its own geometry.
void ForwardSync()
Dispatch Sync().
virtual const HxStr & ClassName() const
Return the registered class name, "Mesh".
void SetTransOwner(Transformable *pOwner)
Point the mesh at the transform it draws with.
ZFunc mZFunc
Definition mesh.h:699
void ScaleUniform(float flScale)
Scale the three basis rows of the local transform by one factor, and mark the transform dirty.
Definition mesh.h:757
int mMaxVerts
Definition mesh.h:743
void SetDepthChain(ZMode zMode, ZFunc zFunc)
Set the depth mode and comparison of this mesh and of every coarser level of its mNext chain.
void SetTrans2Owner(Transformable *pOwner)
Point the mesh at its third transform owner.
ZFunc
Depth comparison, as the text dump labels the values.
Definition mesh.h:78
@ kZFuncEqual
Definition mesh.h:81
@ kZFuncNever
Definition mesh.h:79
@ kZFuncGreaterEqual
Definition mesh.h:85
@ kZFuncNotEqual
Definition mesh.h:84
@ kZFuncGreater
Definition mesh.h:83
@ kZFuncLess
Definition mesh.h:80
@ kZFuncLessEqual
Definition mesh.h:82
@ kZFuncAlways
Definition mesh.h:86
virtual void Load(Stream &stream)
Load the mesh.
void WeldVerts(bool bAverageColors)
Merge duplicate vertices and remove the faces and edges the merge makes redundant.
void AddQuadStrip(int nRowA, int nRowB, int nCount, int nStep)
Append the quads between two rows of vertices with AddQuad().
Definition mesh.h:518
Sphere BoundingSphere()
Compute a bounding sphere of the vertices.
Mat * mMat
Definition mesh.h:717
Mesh * mVertsOwner
Definition mesh.h:726
void SetNext(Mesh *pNext, float flMinScreen)
Set the smallest screen size to draw at, and the mesh to draw in its place below it.
Base of every object the renderer can load, resolve by name, and serialise.
Definition object.h:43
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
Bounding sphere.
Definition sphere.h:15
The rendering engine.
Definition animhelper.h:3
Object * CreateRegisteredMesh(const HxStr &name)
Build a mesh for the registered "Mesh" class.
Manager TheManager
The renderer's object registry.
Mesh * NewMeshThroughHook(const HxStr &name)
Build a mesh through Mesh::sNew, without the narrowing CreateRegisteredMesh() performs.
int g_nRndMeshLoadVersion
Serial version of the mesh record currently being read.
Mesh * NewMesh(const HxStr &name)
Allocate and construct a mesh.
void RegisterMeshClass()
Point Mesh::sNew at NewMesh() and register the "Mesh" class with Rnd::Manager.
Definition mesh.h:815
Linear colour with four float components.
Definition color.h:10
One triangle of a Rnd::Mesh, as three indices into its vertex vector.
Definition meshface.h:12
Line segment a collision query is run along.
Definition collideable.h:22
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12
void Vec3Scale(const float *pSrc, float flScale, float *pOut)
Multiply a three-component vector by a scalar.