wavelength 1.0.0
Loading...
Searching...
No Matches
RndLine Class Reference

Line through points, drawn as a ribbon of constant screen width that faces the camera. More...

#include <rndline.h>

Inheritance diagram for RndLine:
Collaboration diagram for RndLine:

Classes

class  Point
 One point and what drawing derives from it. More...
struct  PointVerts
 The mesh vertices of a point. More...

Public Member Functions

 RndLine (const char *pszName)
 Construct a white, unit-width line without points, with caps and a fold at a quarter turn.
 ~RndLine () override
 Delete the mesh.
void ListDrawObjects (std::list< RndObject * > &objects) override
 Add the material of the mesh to a list.
void ListDrawables (std::list< RndDrawable * > &drawables) override
 Add the line, when its mesh has something to draw, then the children, to a list.
void SetHighlight (int nHighlight) override
 Set the highlight of the mesh.
int DrawShowing () override
 Build the ribbon facing the current camera and draw it.
void Collide (const Segment &segment, std::list< Collision > &collisions) override
 Add each face of the mesh the segment strikes, as strikes of the line, then what the children strike, to a list.
void DumpText (PrnStream &stream) override
 Write a description of the line and its bases.
void Save (BinStream &stream) override
 Write the line and its bases.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a referenced object with another in the bases.
const char * ClassName () const override
 Report the class name.
void Copy (const RndObject *pSource, int nFlags) override
 Copy another line and its bases, then rebuild the mesh.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it, then rebuild the mesh.
RndMat * Mat () const
 Report the material of the mesh.
void SetMat (RndMat *pMat)
 Set the material of the mesh.
void SetFoldAngle (float fAngle)
 Set the angle between segments at and beyond which the ribbon folds over.
void SetNumPoints (int nPoints)
 Set the number of points, then size the mesh, its texture coordinates, colours, and faces to match.
void SetPoint (int nIndex, const Vector3 &point)
 Set the position of a point.
void SetPointColor (int nIndex, const Color &color)
 Set the colour of a point and of its mesh vertices.
void FindPointVerts (int nIndex, PointVerts &verts)
 Find the mesh vertices of a point.
void ReleaseMesh ()
 Delete the mesh.
void BuildMesh ()
 Create the mesh for the points.
void BuildStrip (Point *pFirst, Point *pLast)
 Fill the mesh positions with a ribbon through a run of points, extending the clipped points outside the run to its ends.
void BuildPair (Point *pFirst, Point *pSecond)
 Fill the mesh positions with one segment of a line of pairs, or collapse it when both points are the same.
const std::vector< Point > & GetPoints () const
float GetWidth () const
void SetWidth (float fWidth)
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.
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 line.
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 const char * sClassName
 The class name a .rnd file writes, Line.
static int sRev
 The format version Save() writes and Load() accepts.
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.

Additional Inherited Members

Public Types inherited from RndTransformable
enum  Billboard {
  kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 ,
  kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 ,
  kBillboardScale = 128 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 ,
  kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160
}
 How the world transform turns to face the current camera. More...
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 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

Detailed Description

Line through points, drawn as a ribbon of constant screen width that faces the camera.

The RTTI includes the class name and records RndDrawable, RndTransformable, and RndCollideable as bases. The ribbon is a mesh the line rebuilds each time it is drawn. A line of pairs draws each pair of points as a separate segment.

Constructor & Destructor Documentation

◆ RndLine()

RndLine::RndLine ( const char * pszName)
explicit

Construct a white, unit-width line without points, with caps and a fold at a quarter turn.

Parameters
pszNameThe registry key.
Ghidra address:
NTSC-U/C: 0x0022bca0
Ghidra address:
PAL: 0x002349e0

◆ ~RndLine()

RndLine::~RndLine ( )
override

Delete the mesh.

Ghidra address:
NTSC-U/C: 0x00383c50
Ghidra address:
PAL: 0x003f2358

Member Function Documentation

◆ ListDrawObjects()

void RndLine::ListDrawObjects ( std::list< RndObject * > & objects)
overridevirtual

Add the material of the mesh to a list.

The children are not added.

Parameters
objectsThe list to add to.
Ghidra address:
NTSC-U/C: 0x0022c210
Ghidra address:
PAL: 0x00234f50

Reimplemented from RndDrawable.

◆ ListDrawables()

void RndLine::ListDrawables ( std::list< RndDrawable * > & drawables)
overridevirtual

Add the line, when its mesh has something to draw, then the children, to a list.

Parameters
drawablesThe list to add to.
Ghidra address:
NTSC-U/C: 0x0022c2a8
Ghidra address:
PAL: 0x00234fe8

Reimplemented from RndDrawable.

◆ SetHighlight()

void RndLine::SetHighlight ( int nHighlight)
overridevirtual

Set the highlight of the mesh.

The line's own highlight is unchanged.

Parameters
nHighlightNon-zero to highlight.
Ghidra address:
NTSC-U/C: 0x0022a088
Ghidra address:
PAL: 0x00232df8

Reimplemented from RndDrawable.

◆ DrawShowing()

int RndLine::DrawShowing ( )
overridevirtual

Build the ribbon facing the current camera and draw it.

Points nearer than the camera's near plane are clipped. A line wholly behind it, or with fewer than two points, is not drawn.

Returns
1, to draw the children.
Ghidra address:
NTSC-U/C: 0x0022a9f8
Ghidra address:
PAL: 0x00233768

Reimplemented from RndDrawable.

◆ Collide() [1/2]

void RndLine::Collide ( const Segment & segment,
std::list< Collision > & collisions )
overridevirtual

Add each face of the mesh the segment strikes, as strikes of the line, then what the children strike, to a list.

A hidden line adds nothing.

Parameters
segmentThe segment, in world space.
collisionsThe list to add to.
Ghidra address:
NTSC-U/C: 0x00229fc0
Ghidra address:
PAL: 0x00232d30

Reimplemented from RndCollideable.

◆ DumpText()

void RndLine::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the line and its bases.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x0022b5f8
Ghidra address:
PAL: 0x00234368

Reimplemented from RndDrawable.

◆ Save()

void RndLine::Save ( BinStream & stream)
overridevirtual

Write the line and its bases.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x0022b770
Ghidra address:
PAL: 0x002344e0

Reimplemented from RndDrawable.

◆ Replace()

void RndLine::Replace ( RndObject * pFrom,
RndObject * pTo )
overridevirtual

Replace a referenced object with another in the bases.

Parameters
pFromThe object being replaced.
pToThe replacement, or null.
Ghidra address:
NTSC-U/C: 0x00229f60
Ghidra address:
PAL: 0x00232cd0

Reimplemented from RndDrawable.

◆ ClassName()

const char * RndLine::ClassName ( ) const
inlineoverridevirtual

Report the class name.

Returns
sClassName.
Ghidra address:
NTSC-U/C: 0x003840e8
Ghidra address:
PAL: 0x003f27f0

Implements RndObject.

◆ Copy()

void RndLine::Copy ( const RndObject * pSource,
int nFlags )
overridevirtual

Copy another line and its bases, then rebuild the mesh.

Parameters
pSourceThe line to copy from.
nFlagsThe set of fields to copy.
Ghidra address:
NTSC-U/C: 0x0022bba8
Ghidra address:
PAL: 0x002348e8

Reimplemented from RndDrawable.

◆ Load()

void RndLine::Load ( BinStream & stream)
overridevirtual

Read what Save() wrote, or an earlier version of it, then rebuild the mesh.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x0022b9e0
Ghidra address:
PAL: 0x00234738

Reimplemented from RndDrawable.

◆ Mat()

RndMat * RndLine::Mat ( ) const

Report the material of the mesh.

Returns
The material.
Ghidra address:
NTSC-U/C: 0x00229f50
Ghidra address:
PAL: 0x00232cc0

◆ SetMat()

void RndLine::SetMat ( RndMat * pMat)

Set the material of the mesh.

Parameters
pMatThe material, or null.
Ghidra address:
NTSC-U/C: 0x0022af80
Ghidra address:
PAL: 0x00233cf0

◆ SetFoldAngle()

void RndLine::SetFoldAngle ( float fAngle)

Set the angle between segments at and beyond which the ribbon folds over.

The name is inferred.

Parameters
fAngleThe angle in radians.
Ghidra address:
NTSC-U/C: 0x0022afb0
Ghidra address:
PAL: 0x00233d20

◆ SetNumPoints()

void RndLine::SetNumPoints ( int nPoints)

Set the number of points, then size the mesh, its texture coordinates, colours, and faces to match.

Parameters
nPointsThe number of points.
Ghidra address:
NTSC-U/C: 0x0022afe0
Ghidra address:
PAL: 0x00233d50

◆ SetPoint()

void RndLine::SetPoint ( int nIndex,
const Vector3 & point )

Set the position of a point.

Parameters
nIndexThe point.
pointThe position.
Ghidra address:
NTSC-U/C: 0x0022b4b8
Ghidra address:
PAL: 0x00234228

◆ SetPointColor()

void RndLine::SetPointColor ( int nIndex,
const Color & color )

Set the colour of a point and of its mesh vertices.

The name is inferred.

Parameters
nIndexThe point.
colorThe colour.
Ghidra address:
NTSC-U/C: 0x0022b4d8
Ghidra address:
PAL: 0x00234248

◆ FindPointVerts()

void RndLine::FindPointVerts ( int nIndex,
PointVerts & verts )

Find the mesh vertices of a point.

The name is inferred.

Parameters
nIndexThe point.
vertsReceives the vertices.
Ghidra address:
NTSC-U/C: 0x0022aeb8
Ghidra address:
PAL: 0x00233c28

◆ ReleaseMesh()

void RndLine::ReleaseMesh ( )

Delete the mesh.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0022b8a0
Ghidra address:
PAL: 0x002345f8

◆ BuildMesh()

void RndLine::BuildMesh ( )

Create the mesh for the points.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0022b8e8
Ghidra address:
PAL: 0x00234640

◆ BuildStrip()

void RndLine::BuildStrip ( Point * pFirst,
Point * pLast )

Fill the mesh positions with a ribbon through a run of points, extending the clipped points outside the run to its ends.

The name is inferred.

Parameters
pFirstThe first point of the run.
pLastThe last point of the run.
Ghidra address:
NTSC-U/C: 0x0022a118
Ghidra address:
PAL: 0x00232e88

◆ BuildPair()

void RndLine::BuildPair ( Point * pFirst,
Point * pSecond )

Fill the mesh positions with one segment of a line of pairs, or collapse it when both points are the same.

The name is inferred.

Parameters
pFirstThe first point.
pSecondThe second point.
Ghidra address:
NTSC-U/C: 0x0022a650
Ghidra address:
PAL: 0x002333c0

◆ New()

RndObject * RndLine::New ( const char * pszName)
inlinestatic

Create a line.

Parameters
pszNameThe registry key.
Returns
The line.
Ghidra address:
NTSC-U/C: 0x003840f8
Ghidra address:
PAL: 0x003f2800

◆ GetPoints()

const std::vector< Point > & RndLine::GetPoints ( ) const
inline
Returns
The points.

◆ GetWidth()

float RndLine::GetWidth ( ) const
inline
Returns
The width of the ribbon on the screen.

◆ SetWidth()

void RndLine::SetWidth ( float fWidth)
inline
Parameters
fWidthThe width of the ribbon on the screen.

◆ Collide() [2/2]

virtual void RndCollideable::Collide ( const Vector2 & point,
std::list< Collision > & collisions )
virtual

Test a screen point against the collideable and add what it strikes to a list.

The base body tests the children.

Parameters
pointThe screen point.
collisionsThe list to add to.
Ghidra address:
NTSC-U/C: 0x00222568
Ghidra address:
PAL: 0x0022b338

Reimplemented from RndCollideable.

Member Data Documentation

◆ sClassName

const char* RndLine::sClassName
static

The class name a .rnd file writes, Line.

Ghidra address:
NTSC-U/C: 0x003b09d4
Ghidra address:
PAL: 0x0042f86c

◆ sRev

int RndLine::sRev
static

The format version Save() writes and Load() accepts.

Ghidra address:
NTSC-U/C: 0x003b09d8

The documentation for this class was generated from the following file: