165 void *
operator new(
size_t nSize) {
166 return PoolMemAlloc(
static_cast<int>(nSize),
"Mesh", 0);
174 void operator delete(
void *pBlock) {
209 virtual void Sync([[maybe_unused]]
int nFlags) {
349 void AddQuad(
unsigned short nV0,
unsigned short nV1,
unsigned short nV2,
unsigned short nV3);
365 void AddQuadStrip(
int nRowA,
int nRowB,
int nCount,
int nStride,
int nStep);
414 const Color &colorA0,
415 const Color &colorB0,
416 const Color &colorA1,
417 const Color &colorB1,
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Axis-aligned bounding box.
Definition box.h:12
Text output stream.
Definition prnstream.h:16
virtual void Collide(const Segment &segment, std::list< Collision > &collisions)
Test a segment against the collideable and add what it strikes to a list.
RndCollideable()
Construct a collideable without children.
Definition rndcollideable.h:34
RndDrawable()
Construct a showing drawable without a highlight or children.
Definition rnddrawable.h:23
Surface description: blending, lighting colours, culling, and a list of texture stages.
Definition rndmat.h:20
One edge, as indices into the vertices.
Definition rndmesh.h:121
unsigned short mVerts[2]
Definition rndmesh.h:127
Edge()
Construct an edge from the first vertex to itself.
Definition rndmesh.h:124
One triangle, as indices into the vertices.
Definition rndmesh.h:107
unsigned short mVerts[3]
Definition rndmesh.h:113
Face()
Construct a triangle of the first vertex three times.
Definition rndmesh.h:110
One vertex.
Definition rndmesh.h:78
Vector3 mNorm
Definition rndmesh.h:95
Vert()
Construct a white vertex at the origin with no normal and no weights.
Definition rndmesh.h:81
Vector3 mPos
Definition rndmesh.h:94
Vector2 mTex
Definition rndmesh.h:97
Color mColor
Definition rndmesh.h:96
float mWeight1
Definition rndmesh.h:98
float mWeight2
Definition rndmesh.h:99
static RndObject * New(const char *pszName)
Create a mesh.
Definition rndmesh.h:429
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 came...
RndMesh * mNext
Definition rndmesh.h:575
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.
RndMesh(const char *pszName)
Construct an empty mesh that draws with a Z depth test and write, passing when nearer.
void SetZFunc(int nZFunc)
Definition rndmesh.h:516
float GetMinScreen() const
Definition rndmesh.h:476
RndTransformable * mTransOwner
Definition rndmesh.h:569
RndMat * mMat
Definition rndmesh.h:563
std::vector< Vert > mVerts
Definition rndmesh.h:557
void TransformVerts(const Transform &xfm)
Move every vertex of the geometry by a transform, then rebuild the positions and normals.
int GetMutable() const
Definition rndmesh.h:481
const Sphere & GetSphere() const
Definition rndmesh.h:491
std::unique_ptr< Bones > mBones
Definition rndmesh.h:571
void SetZMode(int nZMode)
Definition rndmesh.h:526
RndMesh * mGeomOwner
Definition rndmesh.h:567
static int sRev
The format version Save() writes and Load() accepts.
Definition rndmesh.h:446
void ReleaseRefs()
Drop the references on the next mesh, the material, the owners, and the bones, and delete the bones.
void Replace(RndObject *pFrom, RndObject *pTo) override
Replace a referenced object with another.
void Copy(const RndObject *pSource, int nFlags) override
Copy another mesh and its bases.
std::vector< Vert > & GetVerts()
Definition rndmesh.h:506
int mMutable
Definition rndmesh.h:577
void SetMutable(int nMutable)
Definition rndmesh.h:486
Sphere mSphere
Definition rndmesh.h:565
static const char * sClassName
The class name a .rnd file writes, Mesh.
Definition rndmesh.h:439
SyncFlags
The parts of the geometry Sync() rebuilds.
Definition rndmesh.h:61
@ kSyncAll
Definition rndmesh.h:69
@ kSyncVertexData
Definition rndmesh.h:66
@ kSyncPositions
Definition rndmesh.h:62
@ kSyncColors
Definition rndmesh.h:64
@ kSyncNormals
Definition rndmesh.h:63
@ kSyncFaces
Definition rndmesh.h:67
@ kSyncTexCoords
Definition rndmesh.h:65
@ kSyncEdges
Definition rndmesh.h:68
int mZMode
Definition rndmesh.h:553
void SetMat(RndMat *pMat)
Set the material.
void Load(BinStream &stream) override
Read what Save() wrote, or an earlier version of it.
static constexpr int kCopyBones
The bit of the Copy() flags that copies the bones.
Definition rndmesh.h:58
static int sLoadRev
The version Load() read last, which the vertex and face readers read by.
Definition rndmesh.h:453
float mMinScreen
Definition rndmesh.h:573
void AcquireRefs()
Take references on the next mesh, the material, the owners, and the bones, then rebuild everything.
virtual void Sync(int nFlags)
Rebuild what the back end derives from parts of the geometry.
Definition rndmesh.h:209
int GetZFunc() const
Definition rndmesh.h:511
ZMode
How drawing reads and writes depth.
Definition rndmesh.h:34
@ kZModeWReadWrite
Definition rndmesh.h:39
@ kZModeZReadOnly
Definition rndmesh.h:36
@ kZModeZReadWrite
Definition rndmesh.h:37
@ kZModeDisable
Definition rndmesh.h:35
@ kZModeWReadOnly
Definition rndmesh.h:38
const std::vector< Vert > & GetVerts() const
Definition rndmesh.h:501
int mZFunc
Definition rndmesh.h:555
RndMat * GetMat() const
Definition rndmesh.h:471
int GetZMode() const
Definition rndmesh.h:521
std::vector< Edge > mEdges
Definition rndmesh.h:561
std::vector< Face > mFaces
Definition rndmesh.h:559
void Save(BinStream &stream) override
Write the mesh and its bases.
Sphere & GetSphere()
Definition rndmesh.h:496
RndMesh * GetGeomOwner() const
Definition rndmesh.h:466
const char * ClassName() const override
Report the class name.
Definition rndmesh.h:265
std::vector< Face > & GetFaces()
Definition rndmesh.h:461
~RndMesh() override
Drop the references the mesh has.
const std::vector< Face > & GetFaces() const
Definition rndmesh.h:456
bool CheckLod(Sphere &worldSphere)
Report whether the mesh itself is to be drawn, drawing a lower detail mesh in its place when the curr...
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 ListDrawObjects(std::list< RndObject * > &objects) override
Add the mesh, its material, its owners, the textures of the material stages from the last,...
ZFunc
The depth comparison.
Definition rndmesh.h:43
@ kZFuncNotEqual
Definition rndmesh.h:49
@ kZFuncEqual
Definition rndmesh.h:46
@ kZFuncLessEqual
Definition rndmesh.h:47
@ kZFuncNever
Definition rndmesh.h:44
@ kZFuncLess
Definition rndmesh.h:45
@ kZFuncGreater
Definition rndmesh.h:48
@ kZFuncGreaterEqual
Definition rndmesh.h:50
@ kZFuncAlways
Definition rndmesh.h:51
static constexpr int kCopyShareGeometry
The bit of the Copy() flags that shares the source's geometry rather than copying it.
Definition rndmesh.h:55
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 AddQuadStrip(int nRowA, int nRowB, int nCount, int nStride, int nStep)
Append the quads between two rows of vertices with AddQuad().
void BoundingBox(Box &box)
Compute the bounding box of the vertices in the mesh's own space.
void DumpText(PrnStream &stream) override
Write a description of the mesh and its bases.
RndObject(const char *pszName)
Construct an object and register it under a name.
Bounding sphere.
Definition sphere.h:17
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.
PrnStream & operator<<(PrnStream &stream, const RndMesh::Vert &vert)
Write a vertex.
BinStream & operator>>(BinStream &stream, RndMesh::Vert &vert)
Read a vertex the vertex writer wrote, or an earlier version of it.
Linear colour with four float components.
Definition color.h:12
The two bone transforms the vertex weights blend.
Definition rndmesh.h:135
Transform mXfms[2]
Definition rndmesh.h:137
RndTransformable * mTrans[2]
Definition rndmesh.h:136
Two points that fix a line or a segment.
Definition plane.h:39
Two-component vector, used for texture coordinates.
Definition vector2.h:12
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:14