resonance 1.0.1
Loading...
Searching...
No Matches
Rnd Namespace Reference

The rendering engine. More...

Classes

class  VRAM
 Cache of GS video memory, divided into a reserved palette region and a pool of texture blocks. More...
struct  Ray
 Line in a plane, given as a point on it and its direction. More...
class  Dbg
 Sink that the engine formats its diagnostic and failure text into. More...
struct  AMovieChunkHdr
 Header of every chunk in a movie file, followed by mSize payload bytes. More...
class  AMovieSet
 Reader that plays a chunked movie file into per-track handlers. More...
class  Animatable
 Mix-in for an object driven by a frame number. More...
class  Arena
 Loop of views the renderer walks as one continuous space. More...
class  Blur
 Motion trail that redraws one drawable at the transforms it recently occupied. More...
class  BufStream
 Stream over a fixed buffer the caller owns. More...
class  Button
 Selectable widget, as one mesh and one text run plus a palette for each. More...
class  Cam
 Camera. More...
struct  Segment
 Line segment a collision query is run along. More...
class  Collideable
 Mix-in for an object that can be hit-tested. More...
class  Drawable
 Mix-in for an object that draws itself and then a list of other drawables. More...
struct  DrawVert
 Vertex as the software draw paths leave it, ready for the GS. More...
class  Environ
 Lighting and fog a subtree is drawn under. More...
class  FilePath
 File name that the renderer resolves against a shared root directory. More...
class  FileStream
 Stream over a C library FILE. More...
class  Font
 Glyph atlas, either a host font description or a grid of cells inside a material texture. More...
class  Generator
 Emitter that spawns copies of one drawable along an animated path. More...
struct  ColorKey
 One keyframe of a colour channel. More...
struct  FloatKey
 One keyframe of a scalar channel. More...
struct  Vector3Key
 One keyframe of a three-component vector channel. More...
class  Light
 Light in a scene. More...
class  LightAnim
 Keyframed animation of the three colours of one Rnd::Light. More...
class  LodMesh
 Chain of generated meshes, one per level of detail, that deletes its meshes with itself. More...
class  Manager
 Registry of every loaded renderer object, and of every class a .rnd file may instantiate. More...
class  Mat
 Surface description a Rnd::Mesh draws with. More...
class  MatAnim
 Animation of the colours and the texture stages of one material. More...
class  MemStream
 Stream over a buffer the stream owns and grows. More...
class  Mesh
 Indexed triangle mesh with one material. More...
class  MeshAnim
 Per-vertex animation of one mesh. More...
struct  MeshEdge
 One drawn edge of a Rnd::Mesh, as two indices into its vertex vector. More...
struct  MeshFace
 One triangle of a Rnd::Mesh, as three indices into its vertex vector. More...
struct  MeshVert
 One vertex of a Rnd::Mesh. More...
class  Movie
 Animation that streams a compressed video file into a set of textures. More...
class  MultiMesh
 Draws one mesh many times, once per recorded instance transform. More...
class  Object
 Base of every object the renderer can load, resolve by name, and serialise. More...
struct  Particle
 One live particle of a Rnd::ParticleSys. More...
class  ParticleSys
 Emitter that spawns, integrates, and draws a population of particles. More...
class  ParticleSysAnim
 Keyframed animation of one Rnd::ParticleSys. More...
class  PsCam
 Camera, PlayStation 2. More...
struct  DirectionalLightRecord
 One directional light as the vertex lighting path consumes it. More...
struct  PointLightRecord
 One point light as the vertex lighting path consumes it. More...
class  PsEnviron
 Lighting and fog a subtree is drawn under, PlayStation 2. More...
class  PsMat
 PlayStation 2 material, which drives the GS register state. More...
class  PsMesh
 PlayStation 2 mesh, which draws through VU1 and the GS. More...
class  PsMultiMesh
 PlayStation 2 multi-mesh, which submits one GIF packet run per instance. More...
class  PsParticleSys
 PlayStation 2 particle system, which submits its particles to the GS. More...
class  PsTex
 PlayStation 2 texture, owner of the GS residency of its mip levels. More...
struct  TriangleTest
 Triangle prepared for one ray test. More...
class  Stream
 Byte stream that every renderer object serialises itself through. More...
class  String
 Screen-aligned ribbon drawn through a list of world-space points. More...
class  Tex
 Texture, as a bitmap path plus the load state of its mip levels. More...
class  Text
 Run of text drawn as a quad per glyph. More...
class  ToolStream
 Stream over a refilling transport. More...
class  TransAnim
 Animation that drives one transformable from three keyframe channels. More...
class  Transformable
 Mix-in for an object with a local and a world transform. More...
class  Tunnel
 Procedural tunnel the game flies the player through. More...
class  TunnelEvent
 One drawable scheduled at a frame of a Rnd::Tunnel. More...
class  TunnelSeeker
 Marker that travels around the tunnel rings towards a target ring. More...
class  TunnelSeekSection
 One section of a Rnd::TunnelSeekStrip, a copy of the tunnel's cell geometry placed on one slice. More...
class  TunnelSeekStrip
 Run of consecutive tunnel slices a Rnd::TunnelSeeker highlights on one ring. More...
class  TunnelSortEntry
 A mesh of a Rnd::Tunnel keyed by its squared distance from an eye point. More...
class  View
 Root of a loadable scene. More...

Typedefs

typedef Object *(* ClassFactory) (const HxStr &name)
 Builds one instance of a registered class under the given object name.

Enumerations

enum  DrawVertPosLane { kDrawVertPosX = 0 , kDrawVertPosY = 1 , kDrawVertPosZ = 2 , kDrawVertPosFog = 3 }
 Lanes of DrawVert::mPos. More...
enum  FogMode {
  kFogModeNone = 0 , kFogModeVertExp = 1 , kFogModeVertExp2 = 2 , kFogModeVertLinear = 3 ,
  kFogModePixelExp = 4 , kFogModePixelExp2 = 5 , kFogModePixelLinear = 6
}
 How fog attenuates a drawn pixel. More...
enum  FontWeight { kFontWeightThin = 0 , kFontWeightNormal = 1 , kFontWeightBold = 2 }
 Stroke weight of a Builtin font. More...
enum  FontFamily { kFontFamilyModern = 0 , kFontFamilyRoman = 1 , kFontFamilySwiss = 2 , kFontFamilyScript = 3 }
 Typeface family of a Builtin font. More...
enum  SeekOrigin { kSeekSet = 0 , kSeekCur = 1 , kSeekEnd = 2 }
 Origin a Stream::Seek() offset is measured from. More...

Functions

void MakeAxisAngle (const Quat &quat, float *pAxis, float *pflAngle)
 Recover the axis and angle of a rotation quaternion.
void MakeRotMatrix (const Quat &quat, float *pMat3Rows)
 Convert a rotation quaternion to a rotation matrix.
void MakeEuler (const float *pMat3Rows, float *pAngles)
 Extract Euler angles from a rotation matrix, inverting MakeRotMatrix() from three angles.
Vector2 Intersect (const Ray &first, const Ray &second)
 Find where two lines in a plane cross.
void MakeRotMatrix (const float *pAngles, float *pMat3Rows)
 Build a rotation matrix from three Euler angles.
void Scale (const float *pScale, const float *pMat3Rows, float *pOut)
 Scale each row of a rotation matrix by one component of a vector.
void Add (const Vector2 &a, const Vector2 &b, Vector2 &out)
 Add two two-component vectors.
void Multiply (const Vector2 &v, float flScale, Vector2 &out)
 Scale a two-component vector.
void Negate (const Vector2 &v, Vector2 &out)
 Negate a two-component vector.
void Normalize (const Vector2 &v, Vector2 &out)
 Scale a two-component vector to unit length.
float Length (const Vector2 &v)
 Report the length of a two-component vector.
void Add (const float *pA, const float *pB, float *pOut)
 Add two three-component vectors.
void Subtract (const float *pA, const float *pB, float *pOut)
 Subtract one three-component vector from another.
const char * MakeString (const char *pszFormat,...)
 Format text into one shared buffer and return it.
Arena * NewArena (const HxStr &name)
 Allocate and construct a loop.
Object * CreateRegisteredArena (const HxStr &name)
 Build a loop for the registered "Arena" class.
Arena * NewArenaThroughHook (const HxStr &name)
 Build a loop through g_pfnNewArena, without the narrowing CreateRegisteredArena() performs.
Button * NewButton (const HxStr &name)
 Allocate and construct a button.
Button * NewButtonThroughHook (const HxStr &name)
 Build a button through the creator hook.
Object * CreateRegisteredButton (const HxStr &name)
 Build a button for the registered "Button" class.
void RegisterButtonClass ()
 Point g_pfnNewButton at NewButton() and register the "Button" class with Rnd::Manager.
Object * CreateRegisteredCam (const HxStr &name)
 Build a camera for the registered "Cam" class.
Cam * NewCamThroughHook (const HxStr &name)
 Build a camera through Cam::sNew, without the narrowing CreateRegisteredCam() performs.
void RegisterCamClass ()
 Point Cam::sNew at Cam::NewCam(), clear Cam::sCurrent, and register the "Cam" class with Rnd::Manager.
void CollectChildren (std::list< Object * > &objects, Animatable *pAnimatable)
 Append every animation descendant of an animatable.
void CollectChildren (std::list< Object * > &objects, Collideable *pCollideable)
 Append every collision descendant of a collideable.
void CollectChildren (std::list< Object * > &objects, Drawable *pDrawable)
 Append every draw descendant of a drawable.
void CollectChildren (std::list< Object * > &objects, Transformable *pTransformable)
 Append every transform descendant of a transformable.
int IsSphereInsideFrustum (const Sphere &sphere, const Frustum &frustum)
 Report whether a sphere lies wholly inside a frustum.
int IsSphereInDrawFrustum (const Sphere &sphere)
 Report whether a sphere lies wholly inside the draw frustum, g_drawFrustum.
void TransformAndLightMeshVerts (DrawVert *pOutVerts, const float *pXfm, MeshVert *pVerts, int nCount, int bWriteClipFlags, const Sphere &sphere)
 Transform and light a run of vertices into the shared draw buffer.
void TransformMeshVertsNoLight (DrawVert *pOutVerts, MeshVert *pVerts, int nCount, const float *pXfm)
 Transform a run of vertices without lighting them.
void ClipTriangleToFrustum (unsigned nIdx0, unsigned nIdx1, unsigned nIdx2, DrawVert *pVerts, int *pnNextIndex)
 Clip one triangle against the near plane and the scissor rectangle and append the polygon to the vertex buffer.
int EmitFaceVu1Setup (const float *pXfm, const Sphere &sphere)
 Emit the VU1 parameter block for a face pass and return the microprogram entry to run.
void EmitEdgeVu1Setup (const float *pXfm, const Color &color)
 Emit the VU1 parameter quadwords for an edge pass.
void EmitParticleVu1Setup ()
 Emit the VU1 parameter quadwords for a particle pass.
int PackParticleQuads (DrawVert *pOutVerts, int nMode, const Particle *pFirst, int nLineLength)
 Pack a run of live particles into the shared draw buffer.
Object * CreateRegisteredEnviron (const HxStr &name)
 Build an environment for the registered "Environ" class.
Environ * NewEnvironThroughHook (const HxStr &name)
 Build an environment through the creator hook.
void RegisterEnvironClass ()
 Point g_pfnNewEnviron at Environ::NewEnviron() and register the "Environ" class with Rnd::Manager.
Font * NewFont (const HxStr &name)
 Allocate and construct a font.
Font * NewFontThroughHook (const HxStr &name)
 Build a font through g_pfnNewFont.
Object * CreateRegisteredFont (const HxStr &name)
 Build a font for the registered "Font" class.
void RegisterFontClass ()
 Point g_pfnNewFont at NewFont() and register the "Font" class with Rnd::Manager.
Generator * NewGenerator (const HxStr &name)
 Allocate and construct an emitter.
Dbg & DumpColorKeys (Dbg &sink, const std::list< ColorKey > &keys)
 Write a channel of colour keyframes to the engine text sink.
Dbg & DumpFloatKeys (Dbg &sink, const std::list< FloatKey > &keys)
 Write a channel of scalar keyframes to the engine text sink.
Stream & ReadColorKeys (Stream &stream, std::list< ColorKey > &keys)
 Read a channel of colour keyframes from a .rnd stream.
Stream & WriteColorKeys (Stream &stream, const std::list< ColorKey > &keys)
 Write a channel of colour keyframes to a .rnd stream.
Stream & WriteFloatKeys (Stream &stream, const std::list< FloatKey > &keys)
 Write a channel of scalar keyframes to a .rnd stream.
Stream & ReadFloatKeys (Stream &stream, std::list< FloatKey > &keys)
 Read a channel of scalar keyframes from a .rnd stream.
Dbg & DumpVector3Keys (Dbg &sink, const std::list< Vector3Key > &keys)
 Write a channel of vector keyframes to the engine text sink.
Stream & ReadVector3Keys (Stream &stream, std::list< Vector3Key > &keys)
 Read a channel of vector keyframes from a .rnd stream.
Stream & operator<< (Stream &stream, const std::list< Vector3Key > &keys)
 Write a channel of vector keyframes to a .rnd stream.
template<class Key>
float ChannelEndFrame (const std::list< Key > &keys)
 Report the frame of the last keyframe of a channel, and zero for an empty channel.
template<class Key>
void SelectKeyPair (const std::list< Key > &keys, float flFrame, const Key *&pFrom, const Key *&pTo, float &flBlend)
 Select the keyframe pair bracketing a frame, and the blend between the pair.
Light * NewLight (const HxStr &name)
 Allocate and construct a light.
Light * NewLightThroughHook (const HxStr &name)
 Build a light through the creator hook.
Object * CreateRegisteredLight (const HxStr &name)
 Build a light for the registered "Light" class by calling through g_pfnNewLight.
void RegisterLightClass ()
 Point g_pfnNewLight at NewLight() and register the "Light" class with Rnd::Manager.
LightAnim * NewLightAnim (const HxStr &name)
 Allocate and construct a light animation.
Object * CreateRegisteredLightAnim (const HxStr &name)
 Build a light animation for the registered "LightAnim" class.
void RegisterLightAnimClass ()
 Register the "LightAnim" class with Rnd::Manager, through CreateRegisteredLightAnim().
Mat * NewMat (const HxStr &name)
 Allocate and construct a material, the base creator of the "Mat" class.
Mat * NewMatThroughHook (const HxStr &name)
 Build a material through the creator hook.
Object * CreateRegisteredMat (const HxStr &name)
 Build a material for the registered "Mat" class by calling through g_pfnNewMat.
void RegisterMatClass ()
 Point g_pfnNewMat at NewMat() and register the "Mat" class with Rnd::Manager.
Object * CreateRegisteredMatAnim (const HxStr &name)
 Allocate and construct a material animation for the registered "MatAnim" class.
MatAnim * NewMatAnim (const HxStr &name)
 Allocate and construct a material animation.
void RegisterMatAnimClass ()
 Register the "MatAnim" class with Rnd::Manager, created through Rnd::CreateRegisteredMatAnim().
Mesh * NewMesh (const HxStr &name)
 Allocate and construct a mesh.
Object * CreateRegisteredMesh (const HxStr &name)
 Build a mesh for the registered "Mesh" class.
Mesh * NewMeshThroughHook (const HxStr &name)
 Build a mesh through Mesh::sNew, without the narrowing CreateRegisteredMesh() performs.
void RegisterMeshClass ()
 Point Mesh::sNew at NewMesh() and register the "Mesh" class with Rnd::Manager.
Object * CreateRegisteredMeshAnim (const HxStr &name)
 Allocate and construct a mesh animation for the registered "MeshAnim" class.
MeshAnim * NewMeshAnim (const HxStr &name)
 Allocate and construct a mesh animation, without the narrowing CreateRegisteredMeshAnim() performs.
void RegisterMeshAnimClass ()
 Register the "MeshAnim" class with Rnd::Manager.
Object * CreateRegisteredMovie (const HxStr &name)
 Allocate and construct a movie.
Movie * NewMovie (const HxStr &name)
 Allocate and construct a movie, returning the Movie pointer itself.
void RegisterMovieClass ()
 Register the "Movie" class with Rnd::Manager.
MultiMesh * NewMultiMesh (const HxStr &name)
 Allocate and construct a multi-mesh.
Object * CreateRegisteredMultiMesh (const HxStr &name)
 Build a multi-mesh for the registered "MultiMesh" class.
void RegisterMultiMeshClass ()
 Point g_pfnNewMultiMesh at NewMultiMesh() and register the "MultiMesh" class with Rnd::Manager.
ParticleSys * NewParticleSys (const HxStr &name)
 Allocate and construct a particle system.
Object * CreateRegisteredParticleSys (const HxStr &name)
 Build a system for the registered "ParticleSys" class.
ParticleSys * NewParticleSysThroughHook (const HxStr &name)
 Build a system through the creator hook, the same shape as Rnd::NewButtonThroughHook().
void RegisterParticleSysClass ()
 Point g_pfnNewParticleSys at NewParticleSys() and register the "ParticleSys" class.
ParticleSysAnim * NewParticleSysAnim (const HxStr &name)
 Allocate and construct a particle system animation.
Object * CreateRegisteredParticleSysAnim (const HxStr &name)
 Build a particle system animation for the registered "ParticleSysAnim" class.
void RegisterParticleSysAnimClass ()
 Register the "ParticleSysAnim" class with Rnd::Manager.
int TransformLightRecords (DirectionalLightRecord *&pDirectionalBegin, DirectionalLightRecord *&pDirectionalEnd, PointLightRecord *&pPointBegin, PointLightRecord *&pPointEnd, const float *pXfm, const Sphere *pSphere)
 Bring every light record into an object's space and cull the point lights against its bounds.
int SelectLightForVertex (GifQuadword *pLight, GifQuadword *pAmbient, GifQuadword *pDiffuse, const float *pXfm, const Sphere *pSphere)
 Choose the one light the VU1 face program applies to an object and write its parameters.
Mat * NewPsMat (const HxStr &name)
 Allocate and construct a PlayStation 2 material.
Mesh * NewPsMesh (const HxStr &name)
 Allocate and construct a PlayStation 2 mesh.
MultiMesh * NewPsMultiMesh (const HxStr &name)
 Allocate and construct a PlayStation 2 multi-mesh.
ParticleSys * NewPsParticleSys (const HxStr &name)
 Allocate and construct a PlayStation 2 particle system.
Tex * NewPsTex (const HxStr &name)
 Allocate and construct a PlayStation 2 texture.
int TestRayAgainstSphere (const Segment &ray, const Sphere &sphere, float *pflDistance)
 Test a ray against a bounding sphere.
int TestRayAgainstTriangle (const Segment &ray, const TriangleTest &tri, int nCull, float *pflDistance)
 Test a ray against one triangle.
Tex * NewTex (const HxStr &name)
 Allocate and construct a texture, the base creator of the "Tex" class.
Tex * NewTexThroughHook (const HxStr &name)
 Build a texture through the creator hook.
Object * CreateRegisteredTex (const HxStr &name)
 Build a texture for the registered "Tex" class by calling through Tex::sNew.
void RegisterTexClass ()
 Point Tex::sNew at NewTex() and register the "Tex" class with Rnd::Manager.
Text * NewText (const HxStr &name)
 Allocate and construct a text run.
Text * NewTextThroughHook (const HxStr &name)
 Build a text run through the creator hook.
Object * CreateRegisteredText (const HxStr &name)
 Build a text run for the registered "Text" class.
void RegisterTextClass ()
 Point Text::sNew at NewText() and register the "Text" class with Rnd::Manager.
float Length (const TransAnim::TransKey &first, const TransAnim::TransKey &next)
 Approximate the arc length of the segment TransAnim::TransKey::EvaluateSpline() traces from first to next.
TransAnim * NewTransAnim (const HxStr &name)
 Allocate and construct a transform animation, the base creator of the "TransAnim" class.
TransAnim * NewTransAnimThroughHook (const HxStr &name)
 Build a transform animation through the creator hook.
Object * CreateRegisteredTransAnim (const HxStr &name)
 Build a transform animation for the registered "TransAnim" class by calling through TransAnim::sNew.
void RegisterTransAnimClass ()
 Point TransAnim::sNew at NewTransAnim() and register the "TransAnim" class with Rnd::Manager.
Tunnel * NewTunnel (const HxStr &name)
 Allocate and construct a tunnel.
Object * CreateRegisteredTunnel (const HxStr &name)
 Build a tunnel for the registered "Tunnel" class.
void RegisterTunnelClass ()
 Register the "Tunnel" class with Rnd::Manager.

Variables

GfxDevice ThePs
 The display device.
VRAM TheVRAM
 The video memory cache.
Dbg TheDbg
 Engine-wide failure sink.
const unsigned int g_nMovsTag
 Chunk type codes, four characters read as a word, built by the unit's static initialiser.
const unsigned int g_nMovtTag
const unsigned int g_nPallTag
const unsigned int g_nFramTag
const unsigned int g_nBlakTag
const unsigned int g_nLoopTag
const unsigned int g_nSndhTag
const unsigned int g_nSndbTag
const unsigned int g_nSndpTag
const char *const g_apszMovieStreamErrors []
 Text for each error an AMovieSet reports, indexed by the negated error code.
HxStr g_arenaClassName
 Registered class name of Rnd::Arena, the string "Arena".
int g_nRndArenaLoadRevision
 Revision word Load() has most recently consumed.
Arena *(* g_pfnNewArena )(const HxStr &name)
 Factory the registered loop creator dispatches through.
HxStr g_blurClassName
 Class key a .rnd file writes for a trail.
int g_nRndBlurLoadRevision
 Revision word the reader of the .rnd container has most recently consumed.
Blur *(* g_pfnNewBlur )(const HxStr &name)
 Factory the registered trail creator dispatches through.
Button *(* g_pfnNewButton )(const HxStr &name)
 Creator the registered "Button" class builds through.
HxStr g_buttonClassName
 Registered class name of Rnd::Button, the string "Button".
int g_nRndButtonLoadVersion
 Serial revision of the button record currently being read.
constexpr int kDrawVertCapacity = 2500
 Vertices a single draw may submit, from the overflow guard in Rnd::PsMesh::DrawShowing().
constexpr int kDrawVertLanes = 4
 Integer lanes in DrawVert::mColor and DrawVert::mPos.
constexpr int kDrawVertClipAnyPlane = 0x3f
 Every plane of the six-plane frustum.
constexpr int kDrawVertClipFarPlane = 0x10
 Far plane, the vclipw judgement z > w, which drops a triangle outright rather than clipping it.
constexpr int kDrawVertClipOtherPlanes = 0x2f
 The five planes a triangle is rejected against only when all its vertices fail one.
DrawVert g_aDrawVerts []
 Buffer every software draw path transforms its vertices into.
Frustum g_drawFrustum
 World-space frustum IsSphereInsideFrustum() tests against.
int g_nFogEnabled
 Non-zero while fog is enabled.
Environ *(* g_pfnNewEnviron )(const HxStr &name)
 Factory the registered environment creator dispatches through.
Font *(* g_pfnNewFont )(const HxStr &name)
 Creator the registered "Font" class builds through.
HxStr g_fontClassName
 Registered class name of Rnd::Font, the string "Font".
constexpr int kPathVarAxisCount = 3
 Number of axes the random path variation covers.
HxStr g_generatorClassName
 Registered class name of Rnd::Generator, the string "Generator".
HxStr g_lightClassName
 Registered class name of Rnd::Light, the string "Light".
Light *(* g_pfnNewLight )(const HxStr &name)
 Creator the registered "Light" class builds through.
HxStr g_lightAnimClassName
 Registered class name of Rnd::LightAnim, the string "LightAnim".
Manager TheManager
 The renderer's object registry.
int g_nRndManagerFileVersion
 Version word of the .rnd file Manager::Read() is loading.
int g_nRndManagerLoadFrameCounter
 Table entries Manager::Read() has passed since it last called g_pfnLongOperationDrawProc.
int g_nRndMatLoadVersion
 Serial version of the material record currently being read.
Mat *(* g_pfnNewMat )(const HxStr &name)
 Creator the registered "Mat" class builds through.
int g_nStageTextureBound
 Non-zero while the material stage being applied has a texture bound.
constexpr int kMemStreamReserve = 0x1000
 Bytes the constructor reserves before the first write.
int g_nRndMeshLoadVersion
 Serial version of the mesh record currently being read.
HxStr g_meshAnimClassName
 Registered class name of Rnd::MeshAnim, the string "MeshAnim".
HxStr g_movieClassName
 Registered class name of Rnd::Movie, the string "Movie".
MultiMesh *(* g_pfnNewMultiMesh )(const HxStr &name)
 Creator the registered "MultiMesh" class builds through.
HxStr g_multiMeshClassName
 Registered class name of Rnd::MultiMesh, the string "MultiMesh".
int g_nRndMultiMeshLoadVersion
 Serial version of the multi-mesh record currently being read.
constexpr unsigned kCopyChildLists = 0x200
 Bit of the Copy() flags word that requests copying the child object lists.
void(* g_pfnNameChanged )(Object *pObject)
 Hook invoked with the object whenever a registry key is about to change.
ParticleSys *(* g_pfnNewParticleSys )(const HxStr &name)
 Creator the registered "ParticleSys" class builds through.
HxStr g_particleSysClassName
 Registered class name of Rnd::ParticleSys, the string "ParticleSys".
HxStr g_particleSysAnimClassName
 Registered class name of Rnd::ParticleSysAnim, the string "ParticleSysAnim".
Transform g_viewProjectXfm
 Camera to clip transform, the local projection widened by the guard band and then preceded by the camera's world to camera transform.
Transform g_viewProjectUnscaledXfm
 The same transform without the guard band widening.
Transform g_viewportXfm
 Clip to GS coordinate transform, scaled by the guard band.
Transform g_viewportUnscaledXfm
 The same transform without the guard band scaling.
Transform g_viewportBiasedXfm
 g_viewportXfm with a small depth bias added to the translation.
Vector3 g_particleScreenScale
 Screen scale of a particle's extent, the widened projection scale times the viewport scale.
Vector3 g_particleProjectScale
 The widened projection scale on each axis, with y negated.
Vector3 g_guardBandScale
 Factor the view is widened by on each axis before clipping.
Vector3 g_invGuardBandScale
 Reciprocal of g_guardBandScale, left unchanged when either axis of it is zero.
float g_flCamNear
 Near plane distance of the camera last drawn through.
int g_nScissorX0
 Scissor rectangle of the camera last drawn through, in GS primitive coordinates of 1/16 pixel.
int g_nScissorX1
int g_nScissorY0
int g_nScissorY1
PsEnviron * g_pDefaultEnviron
 Environment the renderer falls back on when a scene selects none.
Light * g_pDefaultLight
 Light the default environment applies when a scene supplies none.
float g_flFogScale
 Scale a camera space depth is multiplied by to arrive at the byte range of the GS fog register.
float g_flFogOffset
 Offset added after g_flFogScale has been applied.
int g_nSelectedGenMode
 Coordinate generation mode of the stage Rnd::PsMat::SetupUvXfm() last processed.
int g_nSelectedFlat
 Flat shading flag of the selected material.
int g_nAlphaBlendEnabled
 Non-zero once the GS ALPHA_1 register holds a blending equation rather than an opaque copy.
int g_nStageBlendDoubles
 Non-zero when the bound stage blend is Rnd::Mat::kBlendModeMultiply2.
Transform * g_pSelectedUvXfm
 Fixed UV transform the selected stage requires, or null when the stage needs none.
Transform * g_pSelectedStageXfm
 Stage transform of the selected stage when it uses one, otherwise null.
int g_nLightingEnabled
 Lighting enable flag of the selected material, cleared when the stage texture function is decal.
const unsigned int g_dwDefaultClutEntry
 The palette entry a level that fails validation is left with, an opaque 8888 colour.
const int g_anClutSwizzleBlocks [4]
 Block groups of a 256-entry CLUT in the order the CSM1 layout stores them, {0, 2, 1, 3}.
const int g_anPackedMipPageOffsets [6]
 Block offset of each packed mip level inside the page of the level before mFirstPackedMip.
HxStr g_stringClassName
 Class key a .rnd file writes for a ribbon.
HxStr g_textClassName
 Registered class name of Rnd::Text, the string "Text".
constexpr unsigned kCopyShareFrames = 0x100
 Bit of the Copy() flags word that makes the copy share the source's keyframes.
HxStr g_transAnimClassName
 Registered class name of Rnd::TransAnim, the string "TransAnim".
constexpr int kXfmRowCount = 4
 Rows in one transform.
constexpr int kXfmRowFloatCount = 4
 Floats in one transform row.
float g_drawXfm [kXfmRowCount][kXfmRowFloatCount]
 Scratch transform GetDrawXfm() returns.
HxStr g_tunnelClassName
 Registered class name of Rnd::Tunnel, the string "Tunnel".
int g_nTunnelLoadVersion
 Stream revision of the tunnel currently being read.
constexpr int kTunnelSeekNoSlice = -9999
 Slice value of a TunnelSeekSection that is not placed.
HxStr g_viewClassName
 Class key a .rnd file writes for a view.

Detailed Description

The rendering engine.

Scene objects, meshes, materials, textures, cameras, lights, and their animations, with the PlayStation 2 renderer that draws them.

Typedef Documentation

◆ ClassFactory

typedef Object *(* Rnd::ClassFactory) (const HxStr &name)

Builds one instance of a registered class under the given object name.

Rnd::Manager::Init() pairs one of these with each type name a .rnd file may write. Each factory allocates its class and forwards the name to the constructor, which registers the new object in Rnd::TheManager.

Parameters
nameThe object name for the new instance.
Returns
The new object.

Enumeration Type Documentation

◆ DrawVertPosLane

Lanes of DrawVert::mPos.

Enumerator
kDrawVertPosX 

Horizontal GS coordinate with four fractional bits.

kDrawVertPosY 

Vertical GS coordinate with four fractional bits.

kDrawVertPosZ 

Depth.

kDrawVertPosFog 

Fog term with four fractional bits.

◆ FogMode

How fog attenuates a drawn pixel.

The seven names come from the routine at 0x00519470, which writes one of "None", "VertExp", "VertExp2", "VertLinear", "PixelExp", "PixelExp2", and "PixelLinear" for the values below and nothing at all for any other. The PlayStation 2 renderer distinguishes none of the six enabled modes. Rnd::PsEnviron::DrawShowing() tests only whether the mode is None.

Enumerator
kFogModeNone 
kFogModeVertExp 
kFogModeVertExp2 
kFogModeVertLinear 
kFogModePixelExp 
kFogModePixelExp2 
kFogModePixelLinear 

◆ FontWeight

Stroke weight of a Builtin font.

The three titles come from the table of pointers at 0x006fecc0, which the printer at 0x004d0858 indexes with mWeight and hands straight to Dbg::Print() with no bound check. A fourth word follows the three and reads zero. The family table begins at the next quadword boundary, so that word is as likely to be alignment padding as a null element, and the source below writes three entries.

Enumerator
kFontWeightThin 
kFontWeightNormal 
kFontWeightBold 

◆ FontFamily

Typeface family of a Builtin font.

The four titles come from the table of pointers at 0x006fecd0, which the printer at 0x004d0898 indexes with mFamily.

Enumerator
kFontFamilyModern 
kFontFamilyRoman 
kFontFamilySwiss 
kFontFamilyScript 

◆ SeekOrigin

Origin a Stream::Seek() offset is measured from.

The values pass straight to fseek.

Enumerator
kSeekSet 
kSeekCur 
kSeekEnd 

Function Documentation

◆ MakeAxisAngle()

void Rnd::MakeAxisAngle ( const Quat & quat,
float * pAxis,
float * pflAngle )

Recover the axis and angle of a rotation quaternion.

A scalar part above one yields a zero angle rather than a domain error from the arc cosine. A zero angle yields the Z axis, because the axis is otherwise indeterminate.

Parameters
quatThe quaternion, treated as unit length.
pAxisReceives the axis, three floats.
pflAngleReceives the angle in radians.
Ghidra address:
NTSC-U/C: 0x004f0350
Ghidra address:
PAL: 0x0052ef40

◆ MakeRotMatrix() [1/2]

void Rnd::MakeRotMatrix ( const Quat & quat,
float * pMat3Rows )

Convert a rotation quaternion to a rotation matrix.

The result is the transpose of the usual column-vector rotation, because this engine transforms row vectors. Only nine of the twelve words are written, and the fourth word of each row is untouched.

Parameters
quatThe rotation, treated as unit length.
pMat3RowsReceives the rotation, three rows of four floats.
Ghidra address:
NTSC-U/C: 0x004f0600
Ghidra address:
PAL: 0x0052f1f0

◆ MakeEuler()

void Rnd::MakeEuler ( const float * pMat3Rows,
float * pAngles )

Extract Euler angles from a rotation matrix, inverting MakeRotMatrix() from three angles.

The rows are taken as a pure rotation and are not normalised. When the Z component of the Y row is beyond the gimbal lock limit, the X angle is a quarter turn with that component's sign, the Y angle is zero, and the whole remaining rotation goes to the Z angle. Mat34DecomposeEulerScale() performs the same extraction inline, and no call site of this copy survives in the shipped program.

Parameters
pMat3RowsThe rotation, three rows of four floats.
pAnglesReceives the three angles in radians, ordered X, Y, and Z.
Ghidra address:
NTSC-U/C: 0x004efe08
Ghidra address:
PAL: 0x0052e9f8

◆ Intersect()

Vector2 Rnd::Intersect ( const Ray & first,
const Ray & second )

Find where two lines in a plane cross.

Parallel lines report the point of the first line. Rnd::String::EmitRibbonVerts() is the one caller.

Parameters
firstThe first line.
secondThe second line.
Returns
The crossing point.
Ghidra address:
NTSC-U/C: 0x00551190
Ghidra address:
PAL: 0x005917d0

◆ MakeRotMatrix() [2/2]

void Rnd::MakeRotMatrix ( const float * pAngles,
float * pMat3Rows )

Build a rotation matrix from three Euler angles.

The product is Ry * Rx * Rz, with each factor a rotation about one axis by the matching component and every factor written for row vectors. Mat34DecomposeEulerScale() inverts the same composition and EulerAnglesToQuat() reproduces it as a quaternion. Only nine of the twelve words are written, and the fourth word of each row is untouched.

Parameters
pAnglesThe three angles in radians, ordered X, Y, and Z.
pMat3RowsReceives the rotation, three rows of four floats.
Ghidra address:
NTSC-U/C: 0x004f0430
Ghidra address:
PAL: 0x0052f020

◆ Scale()

void Rnd::Scale ( const float * pScale,
const float * pMat3Rows,
float * pOut )

Scale each row of a rotation matrix by one component of a vector.

Row zero takes the first component, row one the second, and row two the third. This is how a non-uniform scale is folded into a basis. Only nine of the twelve words are written, and the fourth word of each row is untouched.

Parameters
pScaleThe three scales.
pMat3RowsThe basis to scale, three rows of four floats.
pOutReceives the scaled basis, and may alias pMat3Rows.
Ghidra address:
NTSC-U/C: 0x0045da58
Ghidra address:
PAL: 0x0049b100

◆ Add() [1/2]

void Rnd::Add ( const Vector2 & a,
const Vector2 & b,
Vector2 & out )

Add two two-component vectors.

The destination may alias either source because both loads precede both stores. The routine reads y before x and stores y before x, with the x store in the return delay slot.

Parameters
aThe first vector.
bThe second vector.
outReceives a plus b, and may alias either input.
Ghidra address:
NTSC-U/C: 0x00169818
Ghidra address:
PAL: 0x0016ba00

◆ Multiply()

void Rnd::Multiply ( const Vector2 & v,
float flScale,
Vector2 & out )

Scale a two-component vector.

The destination may alias the source because both loads precede both stores. The scale arrives in the first floating-point argument register.

Parameters
vThe vector.
flScaleThe scale.
outReceives v times flScale.
Ghidra address:
NTSC-U/C: 0x00169840
Ghidra address:
PAL: 0x0016ba28

◆ Negate()

void Rnd::Negate ( const Vector2 & v,
Vector2 & out )

Negate a two-component vector.

The destination may alias the source because both loads precede both stores.

Parameters
vThe vector.
outReceives the negated vector.
Ghidra address:
NTSC-U/C: 0x004bec88
Ghidra address:
PAL: 0x004fcd10

◆ Normalize()

void Rnd::Normalize ( const Vector2 & v,
Vector2 & out )

Scale a two-component vector to unit length.

The zero vector yields the zero vector rather than a division by zero.

Parameters
vThe vector.
outReceives the unit vector.
Ghidra address:
NTSC-U/C: 0x004beca8
Ghidra address:
PAL: 0x004fcd30

◆ Length() [1/2]

float Rnd::Length ( const Vector2 & v)

Report the length of a two-component vector.

Parameters
vThe vector.
Returns
The length.
Ghidra address:
NTSC-U/C: 0x004bfcc0
Ghidra address:
PAL: 0x004fdd60

◆ Add() [2/2]

void Rnd::Add ( const float * pA,
const float * pB,
float * pOut )

Add two three-component vectors.

Writes three components and does not touch the fourth word of the destination. The two inputs arrive in $a0 and $a1 and the destination in $a2.

Parameters
pAThe first vector.
pBThe second vector.
pOutReceives pA plus pB, and may alias either input.
Ghidra address:
NTSC-U/C: 0x0028c218
Ghidra address:
PAL: 0x002a7ea8

◆ Subtract()

void Rnd::Subtract ( const float * pA,
const float * pB,
float * pOut )

Subtract one three-component vector from another.

Writes three components and does not touch the fourth word of the destination. The minuend arrives in $a0, the subtrahend in $a1, and the destination in $a2.

Parameters
pAThe vector subtracted from.
pBThe vector to subtract.
pOutReceives pA less pB, and may alias either input.
Ghidra address:
NTSC-U/C: 0x00317160
Ghidra address:
PAL: 0x0033d418

◆ MakeString()

const char * Rnd::MakeString ( const char * pszFormat,
... )

Format text into one shared buffer and return it.

The buffer is the static array at 0x008de390. The result therefore remains valid only until the next call, and no caller releases it. The routine saves seven integer and four single-precision argument registers into a contiguous frame and hands that frame to vsprintf. That frame is what fixes the argument list as variadic.

Parameters
pszFormatA printf-style format string.
Returns
The shared buffer.
Ghidra address:
NTSC-U/C: 0x0054f688
Ghidra address:
PAL: 0x0058fcc8

◆ NewArena()

Arena * Rnd::NewArena ( const HxStr & name)

Allocate and construct a loop.

This is the creator Init() installs over g_pfnNewArena. The allocation is billed to the tag "Rnd::Arena" and takes 0x150 bytes.

Parameters
nameThe object name.
Returns
The new loop.
Ghidra address:
NTSC-U/C: 0x005bbb28
Ghidra address:
PAL: 0x005fe1f0

◆ CreateRegisteredArena()

Object * Rnd::CreateRegisteredArena ( const HxStr & name)

Build a loop for the registered "Arena" class.

Calls through g_pfnNewArena and converts the result to its Rnd::Object virtual base, reading the base pointer only when the loop is not null. Init() registers it.

Parameters
nameThe object name.
Returns
The new loop, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x005bba98
Ghidra address:
PAL: 0x005fe160

◆ NewArenaThroughHook()

Arena * Rnd::NewArenaThroughHook ( const HxStr & name)

Build a loop through g_pfnNewArena, without the narrowing CreateRegisteredArena() performs.

The one recovered reference to this routine is its entry in the exception range table at 0x0086ea58, and nothing in the image calls it. The title follows Rnd::NewCamThroughHook().

Parameters
nameThe object name.
Returns
The new loop.
Ghidra address:
NTSC-U/C: 0x005bb8f0
Ghidra address:
PAL: 0x005fdfb8

◆ NewButton()

Button * Rnd::NewButton ( const HxStr & name)

Allocate and construct a button.

The binary bills the allocation to the tag "Rnd::Button" and requests exactly 0x40 bytes.

Parameters
nameThe object name.
Returns
The new button.
Ghidra address:
NTSC-U/C: 0x005346f8
Ghidra address:
PAL: 0x00573f78

◆ NewButtonThroughHook()

Button * Rnd::NewButtonThroughHook ( const HxStr & name)

Build a button through the creator hook.

Parameters
nameThe object name.
Returns
The new button.
Ghidra address:
NTSC-U/C: 0x00534538
Ghidra address:
PAL: 0x00573db8

◆ CreateRegisteredButton()

Object * Rnd::CreateRegisteredButton ( const HxStr & name)

Build a button for the registered "Button" class.

Parameters
nameThe object name.
Returns
The new button, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x00534678
Ghidra address:
PAL: 0x00573ef8

◆ RegisterButtonClass()

void Rnd::RegisterButtonClass ( )

Point g_pfnNewButton at NewButton() and register the "Button" class with Rnd::Manager.

No call site survives in the shipped program, because Rnd::Manager::Init() performs both steps itself. The routine is dead code in the original rather than an unfinished analysis.

Ghidra address:
NTSC-U/C: 0x005344f8
Ghidra address:
PAL: 0x00573d78

◆ CreateRegisteredCam()

Object * Rnd::CreateRegisteredCam ( const HxStr & name)

Build a camera for the registered "Cam" class.

Calls through Cam::sNew and converts the result to its Rnd::Object virtual base, reading the base pointer only when the camera is not null.

Parameters
nameThe object name.
Returns
The new camera, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004b23e0
Ghidra address:
PAL: 0x004f0608

◆ NewCamThroughHook()

Cam * Rnd::NewCamThroughHook ( const HxStr & name)

Build a camera through Cam::sNew, without the narrowing CreateRegisteredCam() performs.

The one recovered reference to this routine is its entry in the exception range table at 0x00868e64, and nothing in the image calls it. The title follows Rnd::NewTextThroughHook(). The binary also expands this inline at its callers.

Parameters
nameThe object name.
Returns
The new camera.
Ghidra address:
NTSC-U/C: 0x004b1f20
Ghidra address:
PAL: 0x004f0148

◆ RegisterCamClass()

void Rnd::RegisterCamClass ( )
inline

Point Cam::sNew at Cam::NewCam(), clear Cam::sCurrent, and register the "Cam" class with Rnd::Manager.

The out-of-line copy has no caller. Rnd::PsCam::Terminate() expands the body after destroying the default camera. The name is inferred.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004b1ed0
Ghidra address:
PAL: 0x004f00f8

◆ CollectChildren() [1/4]

void Rnd::CollectChildren ( std::list< Object * > & objects,
Animatable * pAnimatable )
inline

Append every animation descendant of an animatable.

Parameters
objectsThe list to append to.
pAnimatableThe animatable to start from, or null.
Ghidra address:
NTSC-U/C: 0x00519fc8
Ghidra address:
PAL: 0x0055a3c0

◆ CollectChildren() [2/4]

void Rnd::CollectChildren ( std::list< Object * > & objects,
Collideable * pCollideable )
inline

Append every collision descendant of a collideable.

Parameters
objectsThe list to append to.
pCollideableThe collideable to start from, or null.
Ghidra address:
NTSC-U/C: 0x0051a0e0
Ghidra address:
PAL: 0x0055a4d8

◆ CollectChildren() [3/4]

void Rnd::CollectChildren ( std::list< Object * > & objects,
Drawable * pDrawable )
inline

Append every draw descendant of a drawable.

Parameters
objectsThe list to append to.
pDrawableThe drawable to start from, or null.
Ghidra address:
NTSC-U/C: 0x0051a1f8
Ghidra address:
PAL: 0x0055a5f0

◆ CollectChildren() [4/4]

void Rnd::CollectChildren ( std::list< Object * > & objects,
Transformable * pTransformable )
inline

Append every transform descendant of a transformable.

Parameters
objectsThe list to append to.
pTransformableThe transformable to start from, or null.
Ghidra address:
NTSC-U/C: 0x0051a310
Ghidra address:
PAL: 0x0055a708

◆ IsSphereInsideFrustum()

int Rnd::IsSphereInsideFrustum ( const Sphere & sphere,
const Frustum & frustum )

Report whether a sphere lies wholly inside a frustum.

Each plane is dotted with the centre and the radius subtracted, on VU0 in macro mode, and the accumulated sign bit decides the result. A sphere that straddles a plane therefore reports false, which is what lets a caller skip clipping only on a true.

Parameters
sphereThe sphere, in the space the planes are expressed in.
frustumThe view volume.
Returns
Non-zero when no plane gives a negative distance.
Ghidra address:
NTSC-U/C: 0x005514a0
Ghidra address:
PAL: 0x00591ae0

◆ IsSphereInDrawFrustum()

int Rnd::IsSphereInDrawFrustum ( const Sphere & sphere)
inline

Report whether a sphere lies wholly inside the draw frustum, g_drawFrustum.

The only copy in the image is an out-of-line emission at the end of the Rnd::PsCam unit with no caller, which marks the routine as an inline of a header that unit includes. The name is inferred.

Parameters
sphereThe sphere, in world space.
Returns
Non-zero when no plane gives a negative distance.
Ghidra address:
NTSC-U/C: 0x005884e0
Ghidra address:
PAL: 0x005cb740

◆ TransformAndLightMeshVerts()

void Rnd::TransformAndLightMeshVerts ( DrawVert * pOutVerts,
const float * pXfm,
MeshVert * pVerts,
int nCount,
int bWriteClipFlags,
const Sphere & sphere )

Transform and light a run of vertices into the shared draw buffer.

With lighting on, the lights are first brought into object space and culled against the sphere through TransformLightRecords(). Each vertex colour then starts from the material emissive colour and the environment ambient light, unless the material takes a term from the vertex colour, and gains every directional light by the clamped cosine and every point light not culled by the cosine and a linear falloff over its range, before the sum is clamped to the unit range. Texture coordinates come from the vertex or from sphere mapping as in TransformMeshVertsNoLight(), and positions are projected, scaled to the viewport, and given the fog term. The vertices are processed 400 at a time with the long operation poll between batches.

The sphere arrives in the sixth argument register and passes through to TransformLightRecords() untouched.

Parameters
pOutVertsDestination, normally g_aDrawVerts.
pXfmThe transform, four rows of four floats.
pVertsThe source vertices.
nCountHow many vertices to transform.
bWriteClipFlagsNon-zero to record per-vertex clip flags.
sphereThe bounds the point lights are culled against.
Ghidra address:
NTSC-U/C: 0x00584040
Ghidra address:
PAL: 0x005c7238

◆ TransformMeshVertsNoLight()

void Rnd::TransformMeshVertsNoLight ( DrawVert * pOutVerts,
MeshVert * pVerts,
int nCount,
const float * pXfm )

Transform a run of vertices without lighting them.

Returns immediately when no texture coordinate transform is selected or the count is zero, and branches on the selected texture coordinate generation mode.

Parameters
pOutVertsDestination, normally g_aDrawVerts.
pVertsThe source vertices.
nCountHow many vertices to transform.
pXfmThe transform, four rows of four floats.
Ghidra address:
NTSC-U/C: 0x00584700
Ghidra address:
PAL: 0x005c78f8

◆ ClipTriangleToFrustum()

void Rnd::ClipTriangleToFrustum ( unsigned nIdx0,
unsigned nIdx1,
unsigned nIdx2,
DrawVert * pVerts,
int * pnNextIndex )

Clip one triangle against the near plane and the scissor rectangle and append the polygon to the vertex buffer.

The three vertices first gain the scissor edge flags (0x40 left, 0x80 right, 0x100 top, 0x200 bottom) against g_nScissorX0 through g_nScissorY1, and a triangle whose vertices share a flag is dropped. Otherwise g_renderStats.mnSplitTriangles is incremented and the polygon is clipped in a nine-vertex scratch vector, one plane at a time and only against the planes some vertex falls outside. The near plane is clipped where w equals g_flCamNear, with the texture coordinates and colours interpolated by the perspective-corrected fraction, and the scissor edges linearly in screen space. A flat-shaded material first gives the second and third vertices the colour of the first.

The polygon vertices go above the index the fifth argument points at, and that index is advanced in place. The routine returns nothing: the value left in the return register at the single exit is the advanced index, but it is there as a by-product of storing it through the pointer, and neither caller reads the register.

Parameters
nIdx0First vertex of the triangle.
nIdx1Second vertex.
nIdx2Third vertex.
pVertsThe vertex buffer, indexed by the three arguments above.
pnNextIndexWhere the next vertex is written, advanced by this call.
Ghidra address:
NTSC-U/C: 0x00584cc8
Ghidra address:
PAL: 0x005c7ec0

◆ EmitFaceVu1Setup()

int Rnd::EmitFaceVu1Setup ( const float * pXfm,
const Sphere & sphere )

Emit the VU1 parameter block for a face pass and return the microprogram entry to run.

One UNPACK of 18 quadwords to VU address 0 carries the inverse guard band scale, the draw transform composed with the unscaled projection, the colour scale, the unscaled viewport scale and offset with the two fog terms, the selected texture coordinate transform, a triangle GIFtag and a fan GIFtag built from the material state, and a five-quadword lighting block. With lighting on the block is the light SelectLightForVertex() chooses, the material's emissive, ambient, and diffuse colours, and its four vertex colour flags. With lighting off the block is skipped, left as whatever the packet buffer held. Rnd::PsMesh::DrawFacesVU1() stores the result in the third slot of each run's parameter quadword.

Parameters
pXfmThe draw transform.
sphereThe mesh bounding sphere.
Returns
The VU1 program entry, 0x2ee for an unlit pass.
Ghidra address:
NTSC-U/C: 0x00583358
Ghidra address:
PAL: 0x005c6550

◆ EmitEdgeVu1Setup()

void Rnd::EmitEdgeVu1Setup ( const float * pXfm,
const Color & color )

Emit the VU1 parameter quadwords for an edge pass.

The colour is the material specular colour, or opaque white when the mesh has no material.

Parameters
pXfmThe draw transform.
colorThe line colour.
Ghidra address:
NTSC-U/C: 0x005837d0
Ghidra address:
PAL: 0x005c69c8

◆ EmitParticleVu1Setup()

void Rnd::EmitParticleVu1Setup ( )

Emit the VU1 parameter quadwords for a particle pass.

Takes no argument. The routine overwrites the first argument register with the packet write pointer before reading it, and the value the one call site leaves there is incidental. It returns nothing: the single exit leaves the advanced write pointer in the return register as a by-product of storing it, and the caller discards it.

Ghidra address:
NTSC-U/C: 0x005839d0
Ghidra address:
PAL: 0x005c6bc8

◆ PackParticleQuads()

int Rnd::PackParticleQuads ( DrawVert * pOutVerts,
int nMode,
const Particle * pFirst,
int nLineLength )

Pack a run of live particles into the shared draw buffer.

Walks the linked live set from pFirst rather than the pool. The line mode passes over each particle twice, first from Particle::mPos and then from the quadword nLineLength past it, with the colour alpha scaled by 0.1 on the second pass.

Parameters
pOutVertsDestination, normally g_aDrawVerts.
nModeThe point, line, or sprite mode of the emitting system.
pFirstHead of the live particle list.
nLineLengthRnd::ParticleSys::mLineLength of the emitting system.
Returns
Vertices packed, one per point particle and two per line or sprite particle.
Ghidra address:
NTSC-U/C: 0x00584980
Ghidra address:
PAL: 0x005c7b78

◆ CreateRegisteredEnviron()

Object * Rnd::CreateRegisteredEnviron ( const HxStr & name)

Build an environment for the registered "Environ" class.

Calls through g_pfnNewEnviron and converts the result to its Rnd::Object virtual base, reading the base pointer only when the environment is not null.

Parameters
nameThe object name.
Returns
The new environment, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x00519278
Ghidra address:
PAL: 0x00559610

◆ NewEnvironThroughHook()

Environ * Rnd::NewEnvironThroughHook ( const HxStr & name)

Build an environment through the creator hook.

No call site survives in the shipped program. The name is inferred from the Rnd::Tex counterpart.

Parameters
nameThe object name.
Returns
The new environment.
Ghidra address:
NTSC-U/C: 0x00518eb0
Ghidra address:
PAL: 0x00559248

◆ RegisterEnvironClass()

void Rnd::RegisterEnvironClass ( )
inline

Point g_pfnNewEnviron at Environ::NewEnviron() and register the "Environ" class with Rnd::Manager.

The out-of-line copy has no caller, and Rnd::PsEnviron::Terminate() expands the body. The name is inferred.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x00518e70
Ghidra address:
PAL: 0x00559208

◆ NewFont()

Font * Rnd::NewFont ( const HxStr & name)

Allocate and construct a font.

The binary bills the allocation to the tag "Rnd::Font" and requests exactly 0x60 bytes.

Parameters
nameThe object name.
Returns
The new font.
Ghidra address:
NTSC-U/C: 0x004cf060
Ghidra address:
PAL: 0x0050d3c0

◆ NewFontThroughHook()

Font * Rnd::NewFontThroughHook ( const HxStr & name)

Build a font through g_pfnNewFont.

The one recovered reference to this routine is its entry in the exception range table, and nothing in the image calls it. The title follows NewTextThroughHook(), its counterpart in the Text half of the unit.

Parameters
nameThe object name.
Returns
The new font.
Ghidra address:
NTSC-U/C: 0x004ced40
Ghidra address:
PAL: 0x0050d078

◆ CreateRegisteredFont()

Object * Rnd::CreateRegisteredFont ( const HxStr & name)

Build a font for the registered "Font" class.

Calls through g_pfnNewFont. Rnd::Object is the non-virtual base at offset 0, so the result needs no adjustment.

Parameters
nameThe object name.
Returns
The new font, as its Rnd::Object base.
Ghidra address:
NTSC-U/C: 0x004cefe0
Ghidra address:
PAL: 0x0050d340

◆ RegisterFontClass()

void Rnd::RegisterFontClass ( )

Point g_pfnNewFont at NewFont() and register the "Font" class with Rnd::Manager.

The image has no caller. The name is inferred from RegisterTextClass().

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004ced00
Ghidra address:
PAL: 0x0050d038

◆ NewGenerator()

Generator * Rnd::NewGenerator ( const HxStr & name)

Allocate and construct an emitter.

The allocation is billed to the tag "Rnd::Generator" and takes 0x160 bytes. Nothing in the image references this routine, which is the unused out-of-line copy the toolchain emits for an inline function. The thunk the registry stores is the separate routine at 0x0045e300.

Parameters
nameThe object name.
Returns
The new emitter.
Ghidra address:
NTSC-U/C: 0x0045dcf0
Ghidra address:
PAL: 0x0049b398

◆ DumpColorKeys()

Dbg & Rnd::DumpColorKeys ( Dbg & sink,
const std::list< ColorKey > & keys )

Write a channel of colour keyframes to the engine text sink.

Rnd::MatAnim dumps its emissive, ambient, diffuse, and specular channels through this one, Rnd::LightAnim its three colour channels, and Rnd::ParticleSysAnim its two spawn colour channels. The dump opens with the keyframe count from std::list::size() and then writes one indexed line per keyframe. Further emissions of this routine and of its per-key helper sit at 0x0052a688/0x0052a528 and 0x00543da8/0x00543c48, identical apart from their literal and branch addresses, and have no callers.

Parameters
sinkThe text sink.
keysThe channel.
Returns
The sink.
Ghidra address:
NTSC-U/C: 0x004d8de8
Ghidra address:
PAL: 0x00517300

◆ DumpFloatKeys()

Dbg & Rnd::DumpFloatKeys ( Dbg & sink,
const std::list< FloatKey > & keys )

Write a channel of scalar keyframes to the engine text sink.

The companion of DumpColorKeys(), reached for a channel whose keys are single floats. Rnd::MatAnim dumps its alpha channel through it and Rnd::ParticleSysAnim its emission rate.

Parameters
sinkThe text sink.
keysThe channel.
Returns
The sink.
Ghidra address:
NTSC-U/C: 0x004d8f08
Ghidra address:
PAL: 0x00517420

◆ ReadColorKeys()

Stream & Rnd::ReadColorKeys ( Stream & stream,
std::list< ColorKey > & keys )

Read a channel of colour keyframes from a .rnd stream.

Reads the keyframe count, resizes the channel to it, and then reads one element per node. A second emission at 0x0052cde0, in the Rnd::ParticleSysAnim unit, differs only in its branch targets and has no caller.

Parameters
streamThe stream to read from.
keysThe channel to fill.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x004dd9b0
Ghidra address:
PAL: 0x0051bf68

◆ WriteColorKeys()

Stream & Rnd::WriteColorKeys ( Stream & stream,
const std::list< ColorKey > & keys )

Write a channel of colour keyframes to a .rnd stream.

Writes the keyframe count and then one element per node, in the layout ReadColorKeys() expects.

Parameters
streamThe stream to write to.
keysThe channel.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x004d9180
Ghidra address:
PAL: 0x00517698

◆ WriteFloatKeys()

Stream & Rnd::WriteFloatKeys ( Stream & stream,
const std::list< FloatKey > & keys )

Write a channel of scalar keyframes to a .rnd stream.

Parameters
streamThe stream to write to.
keysThe channel.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x004d9238
Ghidra address:
PAL: 0x00517750

◆ ReadFloatKeys()

Stream & Rnd::ReadFloatKeys ( Stream & stream,
std::list< FloatKey > & keys )

Read a channel of scalar keyframes from a .rnd stream.

Reads the keyframe count, resizes the channel to it, and then reads the value and the frame of each element, in the layout WriteFloatKeys() writes.

Parameters
streamThe stream to read from.
keysThe channel to fill.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x004d98d8
Ghidra address:
PAL: 0x00517df0

◆ DumpVector3Keys()

Dbg & Rnd::DumpVector3Keys ( Dbg & sink,
const std::list< Vector3Key > & keys )

Write a channel of vector keyframes to the engine text sink.

The same layout as DumpColorKeys(), with three components per value. Rnd::MatAnim dumps its stage channels through it.

Parameters
sinkThe text sink.
keysThe channel.
Returns
The sink.
Ghidra address:
NTSC-U/C: 0x004da9b0
Ghidra address:
PAL: 0x00518ec8

◆ ReadVector3Keys()

Stream & Rnd::ReadVector3Keys ( Stream & stream,
std::list< Vector3Key > & keys )

Read a channel of vector keyframes from a .rnd stream.

Reads the keyframe count, resizes the channel with default keys, and then reads three components and the frame of each element.

Parameters
streamThe stream to read from.
keysThe channel to fill.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x004db3d0
Ghidra address:
PAL: 0x00519918

◆ operator<<()

Stream & Rnd::operator<< ( Stream & stream,
const std::list< Vector3Key > & keys )

Write a channel of vector keyframes to a .rnd stream.

Writes the keyframe count and then three components and the frame of each element.

Parameters
streamThe stream to write to.
keysThe channel.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x004dac80
Ghidra address:
PAL: 0x00519198

◆ ChannelEndFrame()

template<class Key>
float Rnd::ChannelEndFrame ( const std::list< Key > & keys)
inline

Report the frame of the last keyframe of a channel, and zero for an empty channel.

No standalone body survives. Every user inlines it, and the count loop the image emits ahead of the emptiness test is what makes the test a std::list::size() comparison rather than a sentinel comparison.

Parameters
keysThe channel.
Returns
The frame of the last keyframe.

◆ SelectKeyPair()

template<class Key>
void Rnd::SelectKeyPair ( const std::list< Key > & keys,
float flFrame,
const Key *& pFrom,
const Key *& pTo,
float & flBlend )
inline

Select the keyframe pair bracketing a frame, and the blend between the pair.

A frame at or before the first keyframe yields that keyframe with a blend of zero, and a frame at or after the last keyframe yields that keyframe with a blend of one, so a channel clamps rather than extrapolating. The channel has to be non-empty. No standalone body survives; every user inlines it, three times over in each of the three animation classes.

Parameters
keysThe channel to search.
flFrameThe frame to bracket.
pFromThe keyframe at or below flFrame.
pToThe keyframe at or above flFrame.
flBlendThe position of flFrame between the pair, from zero to one.

◆ NewLight()

Light * Rnd::NewLight ( const HxStr & name)

Allocate and construct a light.

The binary bills the 0x120-byte allocation to the tag "Rnd::Light".

Parameters
nameThe object name.
Returns
The new light.
Ghidra address:
NTSC-U/C: 0x005448b8
Ghidra address:
PAL: 0x00584630

◆ NewLightThroughHook()

Light * Rnd::NewLightThroughHook ( const HxStr & name)

Build a light through the creator hook.

No call site survives in the shipped program. The name follows the Rnd::Tex counterpart.

Parameters
nameThe object name.
Returns
The new light.
Ghidra address:
NTSC-U/C: 0x00544490
Ghidra address:
PAL: 0x00584208

◆ CreateRegisteredLight()

Object * Rnd::CreateRegisteredLight ( const HxStr & name)

Build a light for the registered "Light" class by calling through g_pfnNewLight.

The result is converted to its Rnd::Object virtual base.

Parameters
nameThe object name.
Returns
The new light, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x00544828
Ghidra address:
PAL: 0x005845a0

◆ RegisterLightClass()

void Rnd::RegisterLightClass ( )

Point g_pfnNewLight at NewLight() and register the "Light" class with Rnd::Manager.

The out-of-line copy has no caller, and Rnd::Manager::Init() expands the same body. The name is inferred.

Ghidra address:
NTSC-U/C: 0x00544450
Ghidra address:
PAL: 0x005841c8

◆ NewLightAnim()

LightAnim * Rnd::NewLightAnim ( const HxStr & name)

Allocate and construct a light animation.

The allocation is 0x48 untagged bytes. The out-of-line copy has no caller, and CreateRegisteredLightAnim() expands the same body.

Parameters
nameThe object name.
Returns
The new animation.
Ghidra address:
NTSC-U/C: 0x005449f8
Ghidra address:
PAL: 0x00584770

◆ CreateRegisteredLightAnim()

Object * Rnd::CreateRegisteredLightAnim ( const HxStr & name)

Build a light animation for the registered "LightAnim" class.

Builds as NewLightAnim() does and converts the result to its Rnd::Object virtual base. The class installs no creator hook, unlike Rnd::Light. There is one creator and no platform subclass.

Parameters
nameThe object name.
Returns
The new animation, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x005452d0
Ghidra address:
PAL: 0x00585048

◆ RegisterLightAnimClass()

void Rnd::RegisterLightAnimClass ( )

Register the "LightAnim" class with Rnd::Manager, through CreateRegisteredLightAnim().

The out-of-line copy has no caller, and Rnd::Manager::Init() expands the same registration. The name is inferred.

Ghidra address:
NTSC-U/C: 0x005449c8
Ghidra address:
PAL: 0x00584740

◆ NewMat()

Mat * Rnd::NewMat ( const HxStr & name)

Allocate and construct a material, the base creator of the "Mat" class.

Parameters
nameThe object name.
Returns
The new material.
Ghidra address:
NTSC-U/C: 0x004dbd00
Ghidra address:
PAL: 0x0051a2a0

◆ NewMatThroughHook()

Mat * Rnd::NewMatThroughHook ( const HxStr & name)

Build a material through the creator hook.

No call site survives in the shipped program. The name is inferred from the Rnd::Button counterpart. The binary also expands this inline at its callers.

Parameters
nameThe object name.
Returns
The new material.
Ghidra address:
NTSC-U/C: 0x004dba28
Ghidra address:
PAL: 0x00519fc8

◆ CreateRegisteredMat()

Object * Rnd::CreateRegisteredMat ( const HxStr & name)

Build a material for the registered "Mat" class by calling through g_pfnNewMat.

Parameters
nameThe object name.
Returns
The new material, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004dbc80
Ghidra address:
PAL: 0x0051a220

◆ RegisterMatClass()

void Rnd::RegisterMatClass ( )
inline

Point g_pfnNewMat at NewMat() and register the "Mat" class with Rnd::Manager.

The out-of-line copy has no caller, and GfxDevice::Terminate() expands the body. The name is inferred.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004db9e8
Ghidra address:
PAL: 0x00519f88

◆ CreateRegisteredMatAnim()

Object * Rnd::CreateRegisteredMatAnim ( const HxStr & name)

Allocate and construct a material animation for the registered "MatAnim" class.

Allocates 0x5c bytes and returns the Rnd::Object subobject of the new animation, the same shape Rnd::CreateRegisteredMeshAnim() has.

Parameters
nameThe object name.
Returns
The new animation, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004dcb00
Ghidra address:
PAL: 0x0051b0a0

◆ NewMatAnim()

MatAnim * Rnd::NewMatAnim ( const HxStr & name)

Allocate and construct a material animation.

The allocation is untagged and 0x5c bytes. No call site survives in the shipped program.

Parameters
nameThe object name.
Returns
The new animation.
Ghidra address:
NTSC-U/C: 0x004dbfb0
Ghidra address:
PAL: 0x0051a550

◆ RegisterMatAnimClass()

void Rnd::RegisterMatAnimClass ( )

Register the "MatAnim" class with Rnd::Manager, created through Rnd::CreateRegisteredMatAnim().

No call site survives in the shipped program.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004dbf80
Ghidra address:
PAL: 0x0051a520

◆ NewMesh()

Mesh * Rnd::NewMesh ( const HxStr & name)

Allocate and construct a mesh.

This is the creator the mesh class registers with Rnd::Manager, invoked through the hook below.

Parameters
nameThe object name.
Returns
The new mesh.
Ghidra address:
NTSC-U/C: 0x00492ff0
Ghidra address:
PAL: 0x004d0ea0

◆ CreateRegisteredMesh()

Object * Rnd::CreateRegisteredMesh ( const HxStr & name)

Build a mesh for the registered "Mesh" class.

Calls through Mesh::sNew and narrows the result to its Rnd::Object subobject, which is why the routine exists at all rather than the hook being registered directly. Rnd::Manager::Init() registers this factory.

Parameters
nameThe object name.
Returns
The new mesh, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x00492f50
Ghidra address:
PAL: 0x004d0e00

◆ NewMeshThroughHook()

Mesh * Rnd::NewMeshThroughHook ( const HxStr & name)

Build a mesh through Mesh::sNew, without the narrowing CreateRegisteredMesh() performs.

The one recovered reference to this routine is its entry in the exception range table at 0x00868634, and nothing in the image calls it. The title follows Rnd::NewCamThroughHook(). The binary also expands this inline at its callers.

Parameters
nameThe object name.
Returns
The new mesh.
Ghidra address:
NTSC-U/C: 0x004926f0
Ghidra address:
PAL: 0x004d05a0

◆ RegisterMeshClass()

void Rnd::RegisterMeshClass ( )
inline

Point Mesh::sNew at NewMesh() and register the "Mesh" class with Rnd::Manager.

An inline function. The image has two identical out-of-line copies without callers (the second at 0x006068c8), and the static initialiser at 0x0049afe0 inlines the body.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004926b0
Ghidra address:
PAL: 0x004d0560

◆ CreateRegisteredMeshAnim()

Object * Rnd::CreateRegisteredMeshAnim ( const HxStr & name)

Allocate and construct a mesh animation for the registered "MeshAnim" class.

Rnd::Manager::Init() registers this factory under g_meshAnimClassName. There is no replaceable creator hook of the kind Rnd::Mesh has, because no platform subclass of this class exists.

Parameters
nameThe object name.
Returns
The new animation, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x00493a00
Ghidra address:
PAL: 0x004d18b0

◆ NewMeshAnim()

MeshAnim * Rnd::NewMeshAnim ( const HxStr & name)

Allocate and construct a mesh animation, without the narrowing CreateRegisteredMeshAnim() performs.

Nothing in the image calls it. The title follows Rnd::NewMesh().

Parameters
nameThe object name.
Returns
The new animation.
Ghidra address:
NTSC-U/C: 0x00493170
Ghidra address:
PAL: 0x004d1020

◆ RegisterMeshAnimClass()

void Rnd::RegisterMeshAnimClass ( )
inline

Register the "MeshAnim" class with Rnd::Manager.

An inline function, in the shape of Rnd::RegisterMeshClass(). The out-of-line copy has no caller.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x00493140
Ghidra address:
PAL: 0x004d0ff0

◆ CreateRegisteredMovie()

Object * Rnd::CreateRegisteredMovie ( const HxStr & name)

Allocate and construct a movie.

The binary bills the allocation to the tag "Rnd::Movie" and requests exactly 0x458 bytes. Rnd::Manager::Init() registers this factory for the type name "Movie".

Parameters
nameThe object name.
Returns
The new movie, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x005d20b8
Ghidra address:
PAL: 0x006140e8

◆ NewMovie()

Movie * Rnd::NewMovie ( const HxStr & name)
inline

Allocate and construct a movie, returning the Movie pointer itself.

The out-of-line copy has no caller, and CreateRegisteredMovie() expands the body before converting the result to its Rnd::Object subobject. The name is inferred. An exception from the constructor produces null, which is what the binary's handler returns.

Parameters
nameThe object name.
Returns
The new movie, or null.
Ghidra address:
NTSC-U/C: 0x005d1f28
Ghidra address:
PAL: 0x00613f58

◆ RegisterMovieClass()

void Rnd::RegisterMovieClass ( )
inline

Register the "Movie" class with Rnd::Manager.

The class has no creator hook, so the body is the registration alone. The out-of-line copy has no caller, and Rnd::Manager::Init() registers the class itself. The name is inferred.

Ghidra address:
NTSC-U/C: 0x005d1ef8
Ghidra address:
PAL: 0x00613f28

◆ NewMultiMesh()

MultiMesh * Rnd::NewMultiMesh ( const HxStr & name)

Allocate and construct a multi-mesh.

This is the creator the multi-mesh class registers with Rnd::Manager, invoked through the hook below.

Parameters
nameThe object name.
Returns
The new multi-mesh.
Ghidra address:
NTSC-U/C: 0x004ebbe8
Ghidra address:
PAL: 0x0052a758

◆ CreateRegisteredMultiMesh()

Object * Rnd::CreateRegisteredMultiMesh ( const HxStr & name)

Build a multi-mesh for the registered "MultiMesh" class.

Calls through g_pfnNewMultiMesh and narrows the result to its Rnd::Object subobject. The image has a second byte-identical copy of this routine at 0x004eb998, which is the same inline function emitted in the Rnd::PsMultiMesh translation unit as well.

Parameters
nameThe object name.
Returns
The new multi-mesh, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004ebb58
Ghidra address:
PAL: 0x0052a6c8

◆ RegisterMultiMeshClass()

void Rnd::RegisterMultiMeshClass ( )
inline

Point g_pfnNewMultiMesh at NewMultiMesh() and register the "MultiMesh" class with Rnd::Manager.

An inline function. Neither out-of-line copy has a caller. The second, byte-identical copy at 0x005b5be8 lies in the Rnd::PsMultiMesh translation unit. GfxDevice::Terminate() expands the body. Every copy installs the portable creator rather than the PlayStation 2 one.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004eb958
Ghidra address:
PAL: 0x0052a4c8

◆ NewParticleSys()

ParticleSys * Rnd::NewParticleSys ( const HxStr & name)

Allocate and construct a particle system.

This is the creator the class registers with Rnd::Manager, invoked through the hook below.

Parameters
nameThe object name.
Returns
The new system.
Ghidra address:
NTSC-U/C: 0x0052b768
Ghidra address:
PAL: 0x0056bde0

◆ CreateRegisteredParticleSys()

Object * Rnd::CreateRegisteredParticleSys ( const HxStr & name)

Build a system for the registered "ParticleSys" class.

Calls through g_pfnNewParticleSys and narrows the result to its Rnd::Object subobject, or to null for a null result.

Parameters
nameThe object name.
Returns
The new system, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x0052b6d8
Ghidra address:
PAL: 0x0056bd50

◆ NewParticleSysThroughHook()

ParticleSys * Rnd::NewParticleSysThroughHook ( const HxStr & name)

Build a system through the creator hook, the same shape as Rnd::NewButtonThroughHook().

The routine has no caller, and its address appears only in the exception range table at 0x0086c370. The name follows the Rnd::Button counterpart and is inferred.

Parameters
nameThe object name.
Returns
The new system.
Ghidra address:
NTSC-U/C: 0x0052b3c0
Ghidra address:
PAL: 0x0056ba38

◆ RegisterParticleSysClass()

void Rnd::RegisterParticleSysClass ( )
inline

Point g_pfnNewParticleSys at NewParticleSys() and register the "ParticleSys" class.

The routine is inline. It has an out-of-line copy in this unit and another in the Rnd::PsParticleSys unit at 0x005ffa38, neither with a caller, and GfxDevice::Terminate() expands the same sequence. The name is inferred.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x0052b380
Ghidra address:
PAL: 0x0056b9f8

◆ NewParticleSysAnim()

ParticleSysAnim * Rnd::NewParticleSysAnim ( const HxStr & name)
inline

Allocate and construct a particle system animation.

The allocation is untagged, unlike every other renderer class, and exactly 0x4c bytes. The out-of-line copy has no caller, and CreateRegisteredParticleSysAnim() expands the body. An exception from the constructor produces null, which is what the binary's handler returns.

Parameters
nameThe object name.
Returns
The new animation, or null.
Ghidra address:
NTSC-U/C: 0x0052b8a8
Ghidra address:
PAL: 0x0056bf20

◆ CreateRegisteredParticleSysAnim()

Object * Rnd::CreateRegisteredParticleSysAnim ( const HxStr & name)

Build a particle system animation for the registered "ParticleSysAnim" class.

Converts the result of NewParticleSysAnim() to its Rnd::Object virtual base. Unlike Rnd::ParticleSys, the class installs no creator hook, so there is one creator and no platform subclass.

Parameters
nameThe object name.
Returns
The new animation, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x0052c180
Ghidra address:
PAL: 0x0056c7f8

◆ RegisterParticleSysAnimClass()

void Rnd::RegisterParticleSysAnimClass ( )
inline

Register the "ParticleSysAnim" class with Rnd::Manager.

The class has no creator hook to reset, so the body is the registration alone. The out-of-line copy has no caller. The name is inferred.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x0052b878
Ghidra address:
PAL: 0x0056bef0

◆ TransformLightRecords()

int Rnd::TransformLightRecords ( DirectionalLightRecord *& pDirectionalBegin,
DirectionalLightRecord *& pDirectionalEnd,
PointLightRecord *& pPointBegin,
PointLightRecord *& pPointEnd,
const float * pXfm,
const Sphere * pSphere )

Bring every light record into an object's space and cull the point lights against its bounds.

Each directional record receives its direction rotated by the inverse of pXfm, and each point record its position transformed by it. A point light is culled when the distance from the sphere centre exceeds its range plus the sphere radius. A null sphere or one of zero radius culls nothing. TransformAndLightMeshVerts() is the one caller.

The name is inferred.

Parameters
pDirectionalBeginReceives the first directional record.
pDirectionalEndReceives the end of the directional records.
pPointBeginReceives the first point record.
pPointEndReceives the end of the point records.
pXfmThe object transform, four rows of four floats.
pSphereThe object bounds, or null.
Returns
The directional lights plus the point lights not culled.
Ghidra address:
NTSC-U/C: 0x005af0c8
Ghidra address:
PAL: 0x005f1670

◆ SelectLightForVertex()

int Rnd::SelectLightForVertex ( GifQuadword * pLight,
GifQuadword * pAmbient,
GifQuadword * pDiffuse,
const float * pXfm,
const Sphere * pSphere )

Choose the one light the VU1 face program applies to an object and write its parameters.

With lighting off the unlit program is chosen and nothing is written. Otherwise the first directional light wins, and failing one the first point light that reaches the bounding sphere. The light's direction or position in object space goes to pLight, and its ambient and diffuse colours scale the material colours at pAmbient and pDiffuse, or replace them where the material takes that term from the vertex colours.

The name is inferred.

Parameters
pLightReceives the light direction or position, one packet quadword.
pAmbientThe material ambient colour in the packet, updated in place.
pDiffuseThe material diffuse colour in the packet, updated in place.
pXfmThe object transform, four rows of four floats.
pSphereThe object bounds, or null.
Returns
The VU1 program entry: 0x2ee unlit, 0x2f8 directional, 0x35c point, or 0x3d4 when lit by no light.
Ghidra address:
NTSC-U/C: 0x005af2c0
Ghidra address:
PAL: 0x005f1868

◆ NewPsMat()

Mat * Rnd::NewPsMat ( const HxStr & name)

Allocate and construct a PlayStation 2 material.

PsMat::InstallCreator() stores this creator in the material creator hook at 0x00700418.

Parameters
nameThe object name.
Returns
The new material.
Ghidra address:
NTSC-U/C: 0x005914b8
Ghidra address:
PAL: 0x005d4850

◆ NewPsMesh()

Mesh * Rnd::NewPsMesh ( const HxStr & name)

Allocate and construct a PlayStation 2 mesh.

GfxDevice::Init() stores this creator in the mesh creator hook at 0x006eed60.

Parameters
nameThe object name.
Returns
The new mesh.
Ghidra address:
NTSC-U/C: 0x00606928
Ghidra address:
PAL: 0x00647580

◆ NewPsMultiMesh()

MultiMesh * Rnd::NewPsMultiMesh ( const HxStr & name)

Allocate and construct a PlayStation 2 multi-mesh.

GfxDevice::Init() installs this creator in Rnd::g_pfnNewMultiMesh at 0x0049af88, so a multi-mesh loaded from a file on the PlayStation 2 is a PsMultiMesh.

Parameters
nameThe object name.
Returns
The new multi-mesh.
Ghidra address:
NTSC-U/C: 0x005b5c28
Ghidra address:
PAL: 0x005f8278

◆ NewPsParticleSys()

ParticleSys * Rnd::NewPsParticleSys ( const HxStr & name)

Allocate and construct a PlayStation 2 particle system.

GfxDevice::Init() stores this creator in the system creator hook at 0x0071aef8.

Parameters
nameThe object name.
Returns
The new system.
Ghidra address:
NTSC-U/C: 0x005ffa78
Ghidra address:
PAL: 0x006407f0

◆ NewPsTex()

Tex * Rnd::NewPsTex ( const HxStr & name)

Allocate and construct a PlayStation 2 texture.

This is the creator Init() installs over Rnd::Tex::sNew. The body is return new PsTex(name);, and the binary bills the 0x4b0-byte allocation to the tag "Rnd::Tex". The gap between 0x0059a7a8 and 0x0059a7d4 is the exception cleanup that releases the block when the constructor throws.

Parameters
nameThe object name.
Returns
The new texture.
Ghidra address:
NTSC-U/C: 0x0059a770
Ghidra address:
PAL: 0x005ddbf0

◆ TestRayAgainstSphere()

int Rnd::TestRayAgainstSphere ( const Segment & ray,
const Sphere & sphere,
float * pflDistance )

Test a ray against a bounding sphere.

Parameters
rayThe ray, in the same space as the sphere.
sphereThe sphere to test.
pflDistanceReceives the distance to the strike.
Returns
Non-zero when the ray strikes the sphere.
Ghidra address:
NTSC-U/C: 0x005501b0
Ghidra address:
PAL: 0x005907f0

◆ TestRayAgainstTriangle()

int Rnd::TestRayAgainstTriangle ( const Segment & ray,
const TriangleTest & tri,
int nCull,
float * pflDistance )

Test a ray against one triangle.

The facing test is skipped when nCull is Mat::kCullModeNone, which the routine recognises by comparing the argument against 2 on entry.

Parameters
rayThe ray, in the same space as the triangle.
triThe prepared triangle.
nCullThe cull mode to apply.
pflDistanceReceives the distance to the strike.
Returns
Non-zero when the ray strikes the triangle.
Ghidra address:
NTSC-U/C: 0x0054fe98
Ghidra address:
PAL: 0x005904d8

◆ NewTex()

Tex * Rnd::NewTex ( const HxStr & name)

Allocate and construct a texture, the base creator of the "Tex" class.

Parameters
nameThe object name.
Returns
The new texture.
Ghidra address:
NTSC-U/C: 0x004e77f0
Ghidra address:
PAL: 0x005262a0

◆ NewTexThroughHook()

Tex * Rnd::NewTexThroughHook ( const HxStr & name)

Build a texture through the creator hook.

No call site survives in the shipped program. The name is inferred from the Rnd::Button counterpart.

Parameters
nameThe object name.
Returns
The new texture.
Ghidra address:
NTSC-U/C: 0x004e7448
Ghidra address:
PAL: 0x00525ee8

◆ CreateRegisteredTex()

Object * Rnd::CreateRegisteredTex ( const HxStr & name)

Build a texture for the registered "Tex" class by calling through Tex::sNew.

Parameters
nameThe object name.
Returns
The new texture, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004e7770
Ghidra address:
PAL: 0x00526220

◆ RegisterTexClass()

void Rnd::RegisterTexClass ( )
inline

Point Tex::sNew at NewTex() and register the "Tex" class with Rnd::Manager.

Neither out-of-line copy has a caller. The second, at 0x0059a518, lies in the Rnd::PsTex unit, and GfxDevice::Terminate() expands the body.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004e7408
Ghidra address:
PAL: 0x00525ea8

◆ NewText()

Text * Rnd::NewText ( const HxStr & name)

Allocate and construct a text run.

The binary bills the allocation to the tag "Rnd::Text" and requests exactly 0x130 bytes.

Parameters
nameThe object name.
Returns
The new text run.
Ghidra address:
NTSC-U/C: 0x004cf800
Ghidra address:
PAL: 0x0050db78

◆ NewTextThroughHook()

Text * Rnd::NewTextThroughHook ( const HxStr & name)

Build a text run through the creator hook.

The one recovered reference to this routine is the data word at 0x00869c28, and nothing in the image calls it, so what consumed it did not ship. The binary also expands this inline at its callers.

Parameters
nameThe object name.
Returns
The new text run.
Ghidra address:
NTSC-U/C: 0x004cf1d0
Ghidra address:
PAL: 0x0050d530

◆ CreateRegisteredText()

Object * Rnd::CreateRegisteredText ( const HxStr & name)

Build a text run for the registered "Text" class.

Calls through Text::sNew and narrows the result to its Rnd::Object subobject, which is why the routine exists at all rather than the hook being registered directly.

Parameters
nameThe object name.
Returns
The new text run, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004cf770
Ghidra address:
PAL: 0x0050dae8

◆ RegisterTextClass()

void Rnd::RegisterTextClass ( )

Point Text::sNew at NewText() and register the "Text" class with Rnd::Manager.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004cf190
Ghidra address:
PAL: 0x0050d4f0

◆ Length() [2/2]

float Rnd::Length ( const TransAnim::TransKey & first,
const TransAnim::TransKey & next )

Approximate the arc length of the segment TransAnim::TransKey::EvaluateSpline() traces from first to next.

A left Riemann sum of the derivative's length in parameter steps of 0.005, stopping once the accumulated parameter arrives at one.

Parameters
firstThe keyframe that starts the segment.
nextThe keyframe that ends the segment.
Returns
The approximate length.
Ghidra address:
NTSC-U/C: 0x00554d90
Ghidra address:
PAL: 0x00595418

◆ NewTransAnim()

TransAnim * Rnd::NewTransAnim ( const HxStr & name)

Allocate and construct a transform animation, the base creator of the "TransAnim" class.

The allocation is untagged and 0x70 bytes, the 0x54 of this class and the 0x1c of the shared Rnd::Object subobject, and the constructor is inlined into this body.

Parameters
nameThe object name.
Returns
The new animation.
Ghidra address:
NTSC-U/C: 0x004fc740
Ghidra address:
PAL: 0x0053b428

◆ NewTransAnimThroughHook()

TransAnim * Rnd::NewTransAnimThroughHook ( const HxStr & name)

Build a transform animation through the creator hook.

No call site survives in the shipped program. The name is inferred from the Rnd::Button counterpart.

Parameters
nameThe object name.
Returns
The new animation.
Ghidra address:
NTSC-U/C: 0x004fba90
Ghidra address:
PAL: 0x0053a778

◆ CreateRegisteredTransAnim()

Object * Rnd::CreateRegisteredTransAnim ( const HxStr & name)

Build a transform animation for the registered "TransAnim" class by calling through TransAnim::sNew.

Rnd::Manager::Init() registers it as well.

Parameters
nameThe object name.
Returns
The new animation, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x004fbf70
Ghidra address:
PAL: 0x0053ac58

◆ RegisterTransAnimClass()

void Rnd::RegisterTransAnimClass ( )

Point TransAnim::sNew at NewTransAnim() and register the "TransAnim" class with Rnd::Manager.

No call site survives in the shipped program. The name is inferred.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004fba50
Ghidra address:
PAL: 0x0053a738

◆ NewTunnel()

Tunnel * Rnd::NewTunnel ( const HxStr & name)

Allocate and construct a tunnel.

This is the creator the class registers with Rnd::Manager. The class installs no creator hook, so there is one creator and no platform subclass.

Parameters
nameThe object name.
Returns
The new tunnel.
Ghidra address:
NTSC-U/C: 0x00476288
Ghidra address:
PAL: 0x004b3f00

◆ CreateRegisteredTunnel()

Object * Rnd::CreateRegisteredTunnel ( const HxStr & name)

Build a tunnel for the registered "Tunnel" class.

The body is that of NewTunnel(), with the result narrowed to its Rnd::Object subobject. Rnd::Manager::Init() registers this factory.

Parameters
nameThe object name.
Returns
The new tunnel, as its Rnd::Object subobject.
Ghidra address:
NTSC-U/C: 0x00476468
Ghidra address:
PAL: 0x004b40e0

◆ RegisterTunnelClass()

void Rnd::RegisterTunnelClass ( )
inline

Register the "Tunnel" class with Rnd::Manager.

An inline function. The out-of-line copy has no callers, and Rnd::Manager::Init() performs the same registration itself.

Ghidra address:
NTSC-U/C: 0x00476258
Ghidra address:
PAL: 0x004b3ed0

Variable Documentation

◆ ThePs

GfxDevice Rnd::ThePs
extern

The display device.

Ghidra address:
NTSC-U/C: 0x006f2a80
Ghidra address:
PAL: 0x007364c0

◆ TheVRAM

VRAM Rnd::TheVRAM
extern

The video memory cache.

Ghidra address:
NTSC-U/C: 0x0070d400
Ghidra address:
PAL: 0x007512f0

◆ TheDbg

Dbg Rnd::TheDbg
extern

Engine-wide failure sink.

Ghidra address:
NTSC-U/C: 0x00702470
Ghidra address:
PAL: 0x00745ec0

◆ g_nMovsTag

const unsigned int Rnd::g_nMovsTag
extern

Chunk type codes, four characters read as a word, built by the unit's static initialiser.

Rnd::Movie's chunk handler compares against the three video codes as well.

Ghidra address:
NTSC-U/C: 0x007678f0
Ghidra address:
PAL: 0x007ab620

◆ g_nMovtTag

const unsigned int Rnd::g_nMovtTag
extern
Ghidra address:
NTSC-U/C: 0x007678f8
Ghidra address:
PAL: 0x007ab628

◆ g_nPallTag

const unsigned int Rnd::g_nPallTag
extern
Ghidra address:
NTSC-U/C: 0x00767900
Ghidra address:
PAL: 0x007ab630

◆ g_nFramTag

const unsigned int Rnd::g_nFramTag
extern
Ghidra address:
NTSC-U/C: 0x00767908
Ghidra address:
PAL: 0x007ab638

◆ g_nBlakTag

const unsigned int Rnd::g_nBlakTag
extern
Ghidra address:
NTSC-U/C: 0x00767910
Ghidra address:
PAL: 0x007ab640

◆ g_nLoopTag

const unsigned int Rnd::g_nLoopTag
extern
Ghidra address:
NTSC-U/C: 0x00767918
Ghidra address:
PAL: 0x007ab648

◆ g_nSndhTag

const unsigned int Rnd::g_nSndhTag
extern
Ghidra address:
NTSC-U/C: 0x00767920
Ghidra address:
PAL: 0x007ab650

◆ g_nSndbTag

const unsigned int Rnd::g_nSndbTag
extern
Ghidra address:
NTSC-U/C: 0x00767928
Ghidra address:
PAL: 0x007ab658

◆ g_nSndpTag

const unsigned int Rnd::g_nSndpTag
extern
Ghidra address:
NTSC-U/C: 0x00767930
Ghidra address:
PAL: 0x007ab660

◆ g_apszMovieStreamErrors

const char* const Rnd::g_apszMovieStreamErrors[]
extern

Text for each error an AMovieSet reports, indexed by the negated error code.

"NO ERROR", "Out of memory", "Can't open file", "Read error", "Write error", "Invalid filename or extension", "File/data format is bad", "Missing driver", "Driver/file is wrong version", "Invalid mode", "Can't access device", and "Exceeded limit". Rnd::Movie::OpenMovieFile() is the one reader.

Ghidra address:
NTSC-U/C: 0x007a8400
Ghidra address:
PAL: 0x007ec100

◆ g_arenaClassName

HxStr Rnd::g_arenaClassName
extern

Registered class name of Rnd::Arena, the string "Arena".

Ghidra address:
NTSC-U/C: 0x00777100
Ghidra address:
PAL: 0x007bafe8

◆ g_nRndArenaLoadRevision

int Rnd::g_nRndArenaLoadRevision
extern

Revision word Load() has most recently consumed.

Load() stores the revision here rather than in a local, which is what lets the helpers it calls test it.

Ghidra address:
NTSC-U/C: 0x008e4a4c
Ghidra address:
PAL: 0x00929a74

◆ g_pfnNewArena

Arena *(* Rnd::g_pfnNewArena) (const HxStr &name) ( const HxStr & name)
extern

Factory the registered loop creator dispatches through.

Init() fills it with NewArena(), and the thunk the class registry stores loads it rather than calling the factory directly, which is what lets a platform layer substitute a subclass.

Ghidra address:
NTSC-U/C: 0x00777108
Ghidra address:
PAL: 0x007baff0

◆ g_blurClassName

HxStr Rnd::g_blurClassName
extern

Class key a .rnd file writes for a trail.

Ghidra address:
NTSC-U/C: 0x006fd248
Ghidra address:
PAL: 0x00740c38

◆ g_nRndBlurLoadRevision

int Rnd::g_nRndBlurLoadRevision
extern

Revision word the reader of the .rnd container has most recently consumed.

Load() stores the revision here rather than in a local, which is what lets the helpers it calls test it. The word sits one word below Rnd::g_nRndMatLoadVersion in the same pool.

Ghidra address:
NTSC-U/C: 0x00894e28
Ghidra address:
PAL: 0x008d9e38

◆ g_pfnNewBlur

Blur *(* Rnd::g_pfnNewBlur) (const HxStr &name) ( const HxStr & name)
extern

Factory the registered trail creator dispatches through.

Init() fills it with NewBlur(), and the thunk the class registry stores loads it rather than calling the factory directly, which is what lets a platform layer substitute a subclass. Rnd::Manager::Init() writes the hook a second time, at 0x00519c98.

Blur::NewFromHook() is a second dispatcher through the same hook.

Ghidra address:
NTSC-U/C: 0x006fd250
Ghidra address:
PAL: 0x00740c40

◆ g_pfnNewButton

Button *(* Rnd::g_pfnNewButton) (const HxStr &name) ( const HxStr & name)
extern

Creator the registered "Button" class builds through.

Rnd::Manager::Init() writes NewButton() into the hook directly rather than calling RegisterButtonClass().

Ghidra address:
NTSC-U/C: 0x0071d900
Ghidra address:
PAL: 0x00761370

◆ g_buttonClassName

HxStr Rnd::g_buttonClassName
extern

Registered class name of Rnd::Button, the string "Button".

The stub at 0x00534410 is the per-unit static-initialisation glue for this global, invoked with a priority of 0xffff. Called to initialise it constructs the string from the literal "Button" at 0x00828320, and called to finalise it frees the buffer. The compiler emits the stub, so this tree writes no body for it, only the constructor argument above.

Ghidra address:
NTSC-U/C: 0x0071d8f8
Ghidra address:
PAL: 0x00761368

◆ g_nRndButtonLoadVersion

int Rnd::g_nRndButtonLoadVersion
extern

Serial revision of the button record currently being read.

Load() reads the revision out of the file into this global and then tests it, which is why no store to it appears in the routine. The store happens through the pointer the stream receives.

Ghidra address:
NTSC-U/C: 0x0089e060
Ghidra address:
PAL: 0x008e2ffc

◆ kDrawVertCapacity

int Rnd::kDrawVertCapacity = 2500
constexpr

Vertices a single draw may submit, from the overflow guard in Rnd::PsMesh::DrawShowing().

◆ kDrawVertLanes

int Rnd::kDrawVertLanes = 4
constexpr

Integer lanes in DrawVert::mColor and DrawVert::mPos.

◆ kDrawVertClipAnyPlane

int Rnd::kDrawVertClipAnyPlane = 0x3f
constexpr

Every plane of the six-plane frustum.

◆ kDrawVertClipFarPlane

int Rnd::kDrawVertClipFarPlane = 0x10
constexpr

Far plane, the vclipw judgement z > w, which drops a triangle outright rather than clipping it.

ClipTriangleToFrustum() clips against the opposite judgement at the camera near distance, which identifies this one as the far plane.

◆ kDrawVertClipOtherPlanes

int Rnd::kDrawVertClipOtherPlanes = 0x2f
constexpr

The five planes a triangle is rejected against only when all its vertices fail one.

◆ g_aDrawVerts

DrawVert Rnd::g_aDrawVerts[]
extern

Buffer every software draw path transforms its vertices into.

One buffer serves the mesh paths and the particle system alike, and is shared rather than owned by any one of them. The bound above is the guard the mesh path applies to its own vertex count, not the size of the allocation: the clipper appends beyond that index and the triangle fan reads its results back from there.

Ghidra address:
NTSC-U/C: 0x00784960
Ghidra address:
PAL: 0x007c8660

◆ g_drawFrustum

Frustum Rnd::g_drawFrustum
extern

World-space frustum IsSphereInsideFrustum() tests against.

Rnd::PsCam::DrawShowing() rebuilds it for each camera, with the side planes widened by the guard band. Rnd::Cam retains a second, per-camera set that Rnd::Mesh::PrepareDraw() uses instead. The two tests do not share a plane set.

Ghidra address:
NTSC-U/C: 0x00768420
Ghidra address:
PAL: 0x007ac170

◆ g_nFogEnabled

int Rnd::g_nFogEnabled
extern

Non-zero while fog is enabled.

Both software draw paths shift it into the GS PRIM fog-enable bit, which is what identifies it as fog rather than a general flag. Rnd::PsEnviron::DrawShowing() is the one writer.

Ghidra address:
NTSC-U/C: 0x00776118
Ghidra address:
PAL: 0x007b9ff0

◆ g_pfnNewEnviron

Environ *(* Rnd::g_pfnNewEnviron) (const HxStr &name) ( const HxStr & name)
extern

Factory the registered environment creator dispatches through.

Rnd::Manager::Init() fills it with Environ::NewEnviron() and Rnd::PsEnviron::Init() replaces it with Rnd::PsEnviron::NewEnviron(), which is how the PlayStation 2 layer substitutes its subclass under the unchanged class key.

Ghidra address:
NTSC-U/C: 0x00718d10
Ghidra address:
PAL: 0x0075cc00

◆ g_pfnNewFont

Font *(* Rnd::g_pfnNewFont) (const HxStr &name) ( const HxStr & name)
extern

Creator the registered "Font" class builds through.

RegisterFontClass() points it at NewFont(), and Rnd::Manager::Init() writes it a second time at 0x00519d44.

Ghidra address:
NTSC-U/C: 0x006fecb8
Ghidra address:
PAL: 0x007426b8

◆ g_fontClassName

HxStr Rnd::g_fontClassName
extern

Registered class name of Rnd::Font, the string "Font".

Ghidra address:
NTSC-U/C: 0x006fecb0
Ghidra address:
PAL: 0x007426b0

◆ kPathVarAxisCount

int Rnd::kPathVarAxisCount = 3
constexpr

Number of axes the random path variation covers.

◆ g_generatorClassName

HxStr Rnd::g_generatorClassName
extern

Registered class name of Rnd::Generator, the string "Generator".

Ghidra address:
NTSC-U/C: 0x006e8280
Ghidra address:
PAL: 0x0072bc08

◆ g_lightClassName

HxStr Rnd::g_lightClassName
extern

Registered class name of Rnd::Light, the string "Light".

Ghidra address:
NTSC-U/C: 0x00720bd0
Ghidra address:
PAL: 0x00764660

◆ g_pfnNewLight

Light *(* Rnd::g_pfnNewLight) (const HxStr &name) ( const HxStr & name)
extern

Creator the registered "Light" class builds through.

Rnd::PsEnviron::Init() calls through it to build the default light.

Ghidra address:
NTSC-U/C: 0x00720bc8
Ghidra address:
PAL: 0x00764658

◆ g_lightAnimClassName

HxStr Rnd::g_lightAnimClassName
extern

Registered class name of Rnd::LightAnim, the string "LightAnim".

Ghidra address:
NTSC-U/C: 0x00720bd8
Ghidra address:
PAL: 0x00764668

◆ TheManager

Manager Rnd::TheManager
extern

The renderer's object registry.

Ghidra address:
NTSC-U/C: 0x00719868
Ghidra address:
PAL: 0x0075d768

◆ g_nRndManagerFileVersion

int Rnd::g_nRndManagerFileVersion
extern

Version word of the .rnd file Manager::Read() is loading.

Manager::Read() stores it before anything else, and Manager::RemapLegacyClassName() tests it.

Ghidra address:
NTSC-U/C: 0x0089df90
Ghidra address:
PAL: 0x008e2fd0

◆ g_nRndManagerLoadFrameCounter

int Rnd::g_nRndManagerLoadFrameCounter
extern

Table entries Manager::Read() has passed since it last called g_pfnLongOperationDrawProc.

Counts to 8 and resets to 0. Manager::Read() does not reset it between loads.

Ghidra address:
NTSC-U/C: 0x00719888
Ghidra address:
PAL: 0x0075d788

◆ g_nRndMatLoadVersion

int Rnd::g_nRndMatLoadVersion
extern

Serial version of the material record currently being read.

Load() reads the version into this global at its start and then tests it, the same arrangement Rnd::Mesh uses with its own word at 0x00894d68. The two are distinct globals, so a material loaded inside a mesh record does not disturb the mesh version.

Ghidra address:
NTSC-U/C: 0x00894e2c
Ghidra address:
PAL: 0x008d9e3c

◆ g_pfnNewMat

Mat *(* Rnd::g_pfnNewMat) (const HxStr &name) ( const HxStr & name)
extern

Creator the registered "Mat" class builds through.

Rnd::PsMat::InstallCreator() overwrites the hook with the Rnd::PsMat creator at 0x005914b8, the same arrangement Rnd::Tex uses.

Ghidra address:
NTSC-U/C: 0x00700418
Ghidra address:
PAL: 0x00743e40

◆ g_nStageTextureBound

int Rnd::g_nStageTextureBound
extern

Non-zero while the material stage being applied has a texture bound.

Rnd::Mat::BindStageTexture() sets it from whether the bind succeeded. Rnd::PsMesh reads it to choose how much of each vertex to upload, which is what identifies Rnd::MeshVert's fourth quadword as the texture coordinate.

Ghidra address:
NTSC-U/C: 0x0076d668
Ghidra address:
PAL: 0x007b13c0

◆ kMemStreamReserve

int Rnd::kMemStreamReserve = 0x1000
constexpr

Bytes the constructor reserves before the first write.

◆ g_nRndMeshLoadVersion

int Rnd::g_nRndMeshLoadVersion
extern

Serial version of the mesh record currently being read.

Load() reads the version out of the file into this global at its start and then tests it eighteen times, which is why no store to it appears in the routine. The store happens through the pointer the stream receives. The word belongs to the mesh class rather than to a stream, and the neighbouring words are the same thing for other classes; 0x00894d64 is the tunnel version and 0x00894e2c is the material version. The file-wide version Rnd::Manager::Read() consults at 0x0089df90 is a separate mechanism that never interacts with this one.

Ghidra address:
NTSC-U/C: 0x00894d68
Ghidra address:
PAL: 0x008d9d78

◆ g_meshAnimClassName

HxStr Rnd::g_meshAnimClassName
extern

Registered class name of Rnd::MeshAnim, the string "MeshAnim".

Ghidra address:
NTSC-U/C: 0x006eed70
Ghidra address:
PAL: 0x00732790

◆ g_movieClassName

HxStr Rnd::g_movieClassName
extern

Registered class name of Rnd::Movie, the string "Movie".

Ghidra address:
NTSC-U/C: 0x0077a590
Ghidra address:
PAL: 0x007be350

◆ g_pfnNewMultiMesh

MultiMesh *(* Rnd::g_pfnNewMultiMesh) (const HxStr &name) ( const HxStr & name)
extern

Creator the registered "MultiMesh" class builds through.

GfxDevice::Init() overwrites the hook at 0x0049af88 with Rnd::NewPsMultiMesh, so a multi-mesh loaded from a file on the PlayStation 2 is a PsMultiMesh.

Ghidra address:
NTSC-U/C: 0x00704070
Ghidra address:
PAL: 0x00747b40

◆ g_multiMeshClassName

HxStr Rnd::g_multiMeshClassName
extern

Registered class name of Rnd::MultiMesh, the string "MultiMesh".

Ghidra address:
NTSC-U/C: 0x00704068
Ghidra address:
PAL: 0x00747b38

◆ g_nRndMultiMeshLoadVersion

int Rnd::g_nRndMultiMeshLoadVersion
extern

Serial version of the multi-mesh record currently being read.

Load() reads the version out of the file into this global through the pointer the stream receives, which is why no store to it appears in the routine. The arrangement matches Rnd::g_nRndMeshLoadVersion.

Ghidra address:
NTSC-U/C: 0x00895038
Ghidra address:
PAL: 0x008da048

◆ kCopyChildLists

unsigned Rnd::kCopyChildLists = 0x200
constexpr

Bit of the Copy() flags word that requests copying the child object lists.

Recovered from Rnd::Drawable::Copy() and Rnd::Animatable::Copy(), both of which copy their child list only when this bit is set.

◆ g_pfnNameChanged

void(* Rnd::g_pfnNameChanged) (Object *pObject) ( Object * pObject)
extern

Hook invoked with the object whenever a registry key is about to change.

Both the destructor and SetName() call this before erasing the old key. The hook is optional and starts null.

Ghidra address:
NTSC-U/C: 0x00719860
Ghidra address:
PAL: 0x0075d760

◆ g_pfnNewParticleSys

ParticleSys *(* Rnd::g_pfnNewParticleSys) (const HxStr &name) ( const HxStr & name)
extern

Creator the registered "ParticleSys" class builds through.

GfxDevice::Init() overwrites the hook with the Rnd::PsParticleSys creator, so a system loaded from a file on the PlayStation 2 is a PsParticleSys.

Ghidra address:
NTSC-U/C: 0x0071aef8
Ghidra address:
PAL: 0x0075ee20

◆ g_particleSysClassName

HxStr Rnd::g_particleSysClassName
extern

Registered class name of Rnd::ParticleSys, the string "ParticleSys".

Ghidra address:
NTSC-U/C: 0x0071aef0
Ghidra address:
PAL: 0x0075ee18

◆ g_particleSysAnimClassName

HxStr Rnd::g_particleSysAnimClassName
extern

Registered class name of Rnd::ParticleSysAnim, the string "ParticleSysAnim".

Ghidra address:
NTSC-U/C: 0x0071af00
Ghidra address:
PAL: 0x0075ee28

◆ g_viewProjectXfm

Transform Rnd::g_viewProjectXfm
extern

Camera to clip transform, the local projection widened by the guard band and then preceded by the camera's world to camera transform.

Ghidra address:
NTSC-U/C: 0x008e4020
Ghidra address:
PAL: 0x009293a0

◆ g_viewProjectUnscaledXfm

Transform Rnd::g_viewProjectUnscaledXfm
extern

The same transform without the guard band widening.

Ghidra address:
NTSC-U/C: 0x008e4060
Ghidra address:
PAL: 0x009293e0

◆ g_viewportXfm

Transform Rnd::g_viewportXfm
extern

Clip to GS coordinate transform, scaled by the guard band.

Ghidra address:
NTSC-U/C: 0x008e40a0
Ghidra address:
PAL: 0x00929420

◆ g_viewportUnscaledXfm

Transform Rnd::g_viewportUnscaledXfm
extern

The same transform without the guard band scaling.

Ghidra address:
NTSC-U/C: 0x008e40e0
Ghidra address:
PAL: 0x00929460

◆ g_viewportBiasedXfm

Transform Rnd::g_viewportBiasedXfm
extern

g_viewportXfm with a small depth bias added to the translation.

Ghidra address:
NTSC-U/C: 0x008e4120
Ghidra address:
PAL: 0x009294a0

◆ g_particleScreenScale

Vector3 Rnd::g_particleScreenScale
extern

Screen scale of a particle's extent, the widened projection scale times the viewport scale.

Ghidra address:
NTSC-U/C: 0x008e4160
Ghidra address:
PAL: 0x009294e0

◆ g_particleProjectScale

Vector3 Rnd::g_particleProjectScale
extern

The widened projection scale on each axis, with y negated.

Ghidra address:
NTSC-U/C: 0x008e4170
Ghidra address:
PAL: 0x009294f0

◆ g_guardBandScale

Vector3 Rnd::g_guardBandScale
extern

Factor the view is widened by on each axis before clipping.

Each axis is the room left in the 4096-unit GS coordinate space around the screen rectangle, divided by the rectangle's extent with a 2 per cent margin. Primitives inside the widened view need no clipping, because the GS scissors them.

Ghidra address:
NTSC-U/C: 0x008e4180
Ghidra address:
PAL: 0x00929500

◆ g_invGuardBandScale

Vector3 Rnd::g_invGuardBandScale
extern

Reciprocal of g_guardBandScale, left unchanged when either axis of it is zero.

Ghidra address:
NTSC-U/C: 0x008e4190
Ghidra address:
PAL: 0x00929510

◆ g_flCamNear

float Rnd::g_flCamNear
extern

Near plane distance of the camera last drawn through.

Ghidra address:
NTSC-U/C: 0x008e41a0
Ghidra address:
PAL: 0x00929520

◆ g_nScissorX0

int Rnd::g_nScissorX0
extern

Scissor rectangle of the camera last drawn through, in GS primitive coordinates of 1/16 pixel.

DrawShowing() first stores pixel bounds here to program SCISSOR_1 and then converts them.

Ghidra address:
NTSC-U/C: 0x008e41a4
Ghidra address:
PAL: 0x00929524

◆ g_nScissorX1

int Rnd::g_nScissorX1
extern
Ghidra address:
NTSC-U/C: 0x008e41a8
Ghidra address:
PAL: 0x00929528

◆ g_nScissorY0

int Rnd::g_nScissorY0
extern
Ghidra address:
NTSC-U/C: 0x008e41ac
Ghidra address:
PAL: 0x0092952c

◆ g_nScissorY1

int Rnd::g_nScissorY1
extern
Ghidra address:
NTSC-U/C: 0x008e41b0
Ghidra address:
PAL: 0x00929530

◆ g_pDefaultEnviron

PsEnviron* Rnd::g_pDefaultEnviron
extern

Environment the renderer falls back on when a scene selects none.

Ghidra address:
NTSC-U/C: 0x0077613c
Ghidra address:
PAL: 0x007ba014

◆ g_pDefaultLight

Light* Rnd::g_pDefaultLight
extern

Light the default environment applies when a scene supplies none.

Ghidra address:
NTSC-U/C: 0x00776140
Ghidra address:
PAL: 0x007ba018

◆ g_flFogScale

float Rnd::g_flFogScale
extern

Scale a camera space depth is multiplied by to arrive at the byte range of the GS fog register.

Ghidra address:
NTSC-U/C: 0x00776110
Ghidra address:
PAL: 0x007b9fe8

◆ g_flFogOffset

float Rnd::g_flFogOffset
extern

Offset added after g_flFogScale has been applied.

Ghidra address:
NTSC-U/C: 0x00776114
Ghidra address:
PAL: 0x007b9fec

◆ g_nSelectedGenMode

int Rnd::g_nSelectedGenMode
extern

Coordinate generation mode of the stage Rnd::PsMat::SetupUvXfm() last processed.

Ghidra address:
NTSC-U/C: 0x0076d660
Ghidra address:
PAL: 0x007b13b8

◆ g_nSelectedFlat

int Rnd::g_nSelectedFlat
extern

Flat shading flag of the selected material.

Ghidra address:
NTSC-U/C: 0x0076d664
Ghidra address:
PAL: 0x007b13bc

◆ g_nAlphaBlendEnabled

int Rnd::g_nAlphaBlendEnabled
extern

Non-zero once the GS ALPHA_1 register holds a blending equation rather than an opaque copy.

Ghidra address:
NTSC-U/C: 0x0076d66c
Ghidra address:
PAL: 0x007b13c4

◆ g_nStageBlendDoubles

int Rnd::g_nStageBlendDoubles
extern

Non-zero when the bound stage blend is Rnd::Mat::kBlendModeMultiply2.

Ghidra address:
NTSC-U/C: 0x0076d670
Ghidra address:
PAL: 0x007b13c8

◆ g_pSelectedUvXfm

Transform* Rnd::g_pSelectedUvXfm
extern

Fixed UV transform the selected stage requires, or null when the stage needs none.

A sphere generation mode yields the sphere-map transform, and any other mode with a stage transform yields the composed transform.

Ghidra address:
NTSC-U/C: 0x0076d674
Ghidra address:
PAL: 0x007b13cc

◆ g_pSelectedStageXfm

Transform* Rnd::g_pSelectedStageXfm
extern

Stage transform of the selected stage when it uses one, otherwise null.

Only a sphere generation mode publishes a value here, because the other modes fold the stage transform into g_pSelectedUvXfm instead.

Ghidra address:
NTSC-U/C: 0x0076d678
Ghidra address:
PAL: 0x007b13d0

◆ g_nLightingEnabled

int Rnd::g_nLightingEnabled
extern

Lighting enable flag of the selected material, cleared when the stage texture function is decal.

Ghidra address:
NTSC-U/C: 0x0076d67c
Ghidra address:
PAL: 0x007b13d4

◆ g_dwDefaultClutEntry

const unsigned int Rnd::g_dwDefaultClutEntry
extern

The palette entry a level that fails validation is left with, an opaque 8888 colour.

Ghidra address:
NTSC-U/C: 0x0076f360
Ghidra address:
PAL: 0x007b30c0

◆ g_anClutSwizzleBlocks

const int Rnd::g_anClutSwizzleBlocks[4]
extern

Block groups of a 256-entry CLUT in the order the CSM1 layout stores them, {0, 2, 1, 3}.

RebuildClut() permutes each run of four 32-byte groups by it.

Ghidra address:
NTSC-U/C: 0x0076f368
Ghidra address:
PAL: 0x007b30c8

◆ g_anPackedMipPageOffsets

const int Rnd::g_anPackedMipPageOffsets[6]
extern

Block offset of each packed mip level inside the page of the level before mFirstPackedMip.

Indexed by the level's distance past mFirstPackedMip. The six values are 16, 20, 21, 22, 23, and 24. The words after them are zero and have no recovered reader, so the length is a lower bound.

Ghidra address:
NTSC-U/C: 0x0076f378
Ghidra address:
PAL: 0x007b30d8

◆ g_stringClassName

HxStr Rnd::g_stringClassName
extern

Class key a .rnd file writes for a ribbon.

Ghidra address:
NTSC-U/C: 0x006fc348
Ghidra address:
PAL: 0x0073fd28

◆ g_textClassName

HxStr Rnd::g_textClassName
extern

Registered class name of Rnd::Text, the string "Text".

Ghidra address:
NTSC-U/C: 0x006feca0
Ghidra address:
PAL: 0x007426a0

◆ kCopyShareFrames

unsigned Rnd::kCopyShareFrames = 0x100
constexpr

Bit of the Copy() flags word that makes the copy share the source's keyframes.

Only Rnd::TransAnim::Copy() tests it among the routines recovered so far. With the bit clear a copy duplicates the three keyframe lists and owns its own frames; with it set the copy points mFramesOwner at whatever the source's owner is and empties its own lists.

◆ g_transAnimClassName

HxStr Rnd::g_transAnimClassName
extern

Registered class name of Rnd::TransAnim, the string "TransAnim".

Ghidra address:
NTSC-U/C: 0x00706828
Ghidra address:
PAL: 0x0074a348

◆ kXfmRowCount

int Rnd::kXfmRowCount = 4
constexpr

Rows in one transform.

Three store the basis and the fourth stores the translation.

◆ kXfmRowFloatCount

int Rnd::kXfmRowFloatCount = 4
constexpr

Floats in one transform row.

Three store x, y, and z, and the fourth is padding.

◆ g_drawXfm

float Rnd::g_drawXfm[kXfmRowCount][kXfmRowFloatCount]
extern

Scratch transform GetDrawXfm() returns.

One buffer serves every caller, which is why the value it returns survives only until the next call.

Ghidra address:
NTSC-U/C: 0x007067e0
Ghidra address:
PAL: 0x0074a300

◆ g_tunnelClassName

HxStr Rnd::g_tunnelClassName
extern

Registered class name of Rnd::Tunnel, the string "Tunnel".

Ghidra address:
NTSC-U/C: 0x006eab10
Ghidra address:
PAL: 0x0072e510

◆ g_nTunnelLoadVersion

int Rnd::g_nTunnelLoadVersion
extern

Stream revision of the tunnel currently being read.

Load() stores the revision here, and the element loaders of Rnd::TunnelEvent and Rnd::TunnelSeeker test it.

Ghidra address:
NTSC-U/C: 0x00894d64
Ghidra address:
PAL: 0x008d9d74

◆ kTunnelSeekNoSlice

int Rnd::kTunnelSeekNoSlice = -9999
constexpr

Slice value of a TunnelSeekSection that is not placed.

◆ g_viewClassName

HxStr Rnd::g_viewClassName
extern

Class key a .rnd file writes for a view.

Ghidra address:
NTSC-U/C: 0x00702b20
Ghidra address:
PAL: 0x007465c0