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

Environment, PlayStation 2. More...

#include <psenviron.h>

Inheritance diagram for PsEnviron:
Collaboration diagram for PsEnviron:

Public Types

enum  LightProgram { kLightProgramPoint = 0x6c , kLightProgramDirectional = 0x260 , kLightProgramAmbient = 0x373 , kLightProgramUnlit = 0x3d7 }
 The VU1 lighting microprograms, by their addresses in VU1 code memory. More...
Public Types inherited from RndEnviron
enum  FogMode {
  kFogNone = 0 , kFogVertExp = 1 , kFogVertExp2 = 2 , kFogVertLinear = 3 ,
  kFogPixelExp = 4 , kFogPixelExp2 = 5 , kFogPixelLinear = 6
}
 The fog modes. More...

Public Member Functions

 PsEnviron (const char *pszName)
 Construct an environment.
 ~PsEnviron () override
int DrawShowing () override
 Set the fog and the lights up for the drawables after the environment, and make it current.
Public Member Functions inherited from RndEnviron
 RndEnviron (const char *pszName)
 Construct an environment without lights, with a black ambient colour and no white fog.
 ~RndEnviron () override
 Drop the references on the lights.
void * operator new (size_t nSize)
 Allocate an environment, billed to the class name.
void operator delete (void *pBlock)
 Release an environment.
void ListDrawObjects (std::list< RndObject * > &objects) override
 Add the lights to a list.
int DrawShowing () override
 Make the environment current.
void DumpText (PrnStream &stream) override
 Write a description of the environment and its base.
void Save (BinStream &stream) override
 Write the environment and its base.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a referenced light with another.
const char * ClassName () const override
 Report the class name.
void Copy (const RndObject *pSource, int nFlags) override
 Copy another environment and its base.
void Load (BinStream &stream) override
 Read what Save() wrote.
void AddLight (RndLight *pLight)
 Add a light, or report one already among the lights.
const Color & GetAmbientColor () const
void SetAmbientColor (const Color &color)
const Color & GetFogColor () const
void SetFogColor (const Color &color)
float GetFogDensity () const
void SetFogDensity (float fFogDensity)
float GetFogEnd () const
void SetFogEnd (float fFogEnd)
float GetFogStart () const
void SetFogStart (float fFogStart)
const std::list< RndLight * > & GetLights () const
std::list< RndLight * > & GetLights ()
Public Member Functions inherited from RndDrawable
 RndDrawable ()
 Construct a showing drawable without a highlight or children.
 ~RndDrawable () override
 Drop the references on the children.
virtual void ListDrawables (std::list< RndDrawable * > &drawables)
 Add the drawables to draw this frame to a list.
virtual void SetShowing (int nShowing)
 Set whether the drawable draws at all.
virtual void SetHighlight (int nHighlight)
 Set whether the drawable draws with its highlight treatment.
RndDrawable * Parent ()
 Find the drawable whose children include this one.
void Draw ()
 Draw the drawable and then its children, when it is showing.
bool AddDraw (RndDrawable *pDraw, RndDrawable *pBefore)
 Add a child before another.
void RemoveDraw (RndDrawable *pDraw)
 Remove a child.
void ClearDraws ()
 Remove every child.
int GetShowing () const
const std::list< RndDrawable * > & GetDraws () const
Public Member Functions inherited from RndObject
 RndObject (const char *pszName)
 Construct an object and register it under a name.
virtual ~RndObject ()
 Notify every referrer, then erase the registration.
void SetName (const char *pszName)
 Register the object under a different name.
void AddRef (RndObject *pReferrer)
 Register an object as a store of a pointer to this one.
void RemoveRef (RndObject *pReferrer)
 Drop the first registration AddRef() made for a referrer.
const char * GetName () const
const std::list< RndObject * > & GetRefs () const
int GetInternal () const
void SetInternal (int nInternal)

Static Public Member Functions

static void SelectLights (const Transform *pXfm, const Sphere *pSphere)
 Add the lighting block of the VU1 mesh microprogram to the packet, eight quadwords.
static void Init ()
 Install the environment factory for the class Environ of a .rnd file, and create the default environment and light.
static void Terminate ()
 Restore the generic environment factory.
static RndObject * New (const char *pszName)
 Create an environment.
Static Public Member Functions inherited from RndEnviron
static void CreateDefault ()
 Create the default environment and add it to the default camera.
static RndObject * New (const char *pszName)
 Create an environment.
Static Public Member Functions inherited from RndDrawable
static void CollectChildren (std::list< RndObject * > &objects, RndDrawable *pDrawable)
 Append every draw descendant of a drawable, depth first, each before its descendants.

Additional Inherited Members

Static Public Attributes inherited from RndEnviron
static constexpr int kCopyKeepLights = 1
 The bit of the Copy() flags that keeps the lights rather than copying the source's.
static const char * sClassName
 The class name a .rnd file writes, Environ.
static RndEnviron * sCurrent
 The environment drawn last.
static RndEnviron * sDefault
 The environment CreateDefault() made.
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndDrawable
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndObject
static constexpr int kCopyChildLists = 0x200
 The bit of the Copy() flags that copies the child lists of the mix-ins.
Protected Member Functions inherited from RndEnviron
void ReleaseRefs ()
 Drop the references on the lights.
void AcquireRefs ()
 Take references on the lights.
Protected Member Functions inherited from RndDrawable
void ReleaseDrawRefs ()
 Drop the reference on every child without emptying the list.
void AcquireDrawRefs ()
 Take a reference on every child.
Protected Attributes inherited from RndEnviron
std::list< RndLight * > mLights
Color mAmbientColor
float mFogStart
float mFogEnd
float mFogDensity
Color mFogColor
int mFogMode
Protected Attributes inherited from RndDrawable
int mShowing
Protected Attributes inherited from RndObject
std::list< RndObject * > mRefs
String mName

Detailed Description

Environment, PlayStation 2.

The RTTI includes the class name and records RndEnviron as the one base. The class adds no data member. DrawShowing() turns the fog and the lights into the globals below, and SelectLights() sends them to VU1 ahead of each mesh. One point light, or else up to three directional lights, light the meshes. Spot lights are ignored.

Member Enumeration Documentation

◆ LightProgram

The VU1 lighting microprograms, by their addresses in VU1 code memory.

Enumerator
kLightProgramPoint 

One point light.

kLightProgramDirectional 

Up to three directional lights.

kLightProgramAmbient 

The ambient colour only.

kLightProgramUnlit 

No lighting.

Constructor & Destructor Documentation

◆ PsEnviron()

PsEnviron::PsEnviron ( const char * pszName)
inlineexplicit

Construct an environment.

The binary expands the constructor inline in New().

Parameters
pszNameThe registry key.

◆ ~PsEnviron()

PsEnviron::~PsEnviron ( )
inlineoverride
Ghidra address:
NTSC-U/C: 0x0037d2e0
Ghidra address:
PAL: 0x003eba10

Member Function Documentation

◆ DrawShowing()

int PsEnviron::DrawShowing ( )
overridevirtual

Set the fog and the lights up for the drawables after the environment, and make it current.

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

Reimplemented from RndDrawable.

◆ SelectLights()

void PsEnviron::SelectLights ( const Transform * pXfm,
const Sphere * pSphere )
static

Add the lighting block of the VU1 mesh microprogram to the packet, eight quadwords.

The block is a quadword of settings, the base colour, and the lights moved into the space of the object. Without lighting the block is the settings alone and the cursor skips the rest. A point light out of reach of the bounds of the object, and an object without a transform, take the ambient program. The name is inferred.

Parameters
pXfmThe transform of the object drawn, or null.
pSphereThe bounding sphere of the object in its own space. A radius of 0 skips the reach test. It is read only for a point light and a transform.
Ghidra address:
NTSC-U/C: 0x002197a0
Ghidra address:
PAL: 0x002225b8

◆ Init()

void PsEnviron::Init ( )
static

Install the environment factory for the class Environ of a .rnd file, and create the default environment and light.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00219268
Ghidra address:
PAL: 0x00222080

◆ Terminate()

void PsEnviron::Terminate ( )
static

Restore the generic environment factory.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00219370
Ghidra address:
PAL: 0x00222188

◆ New()

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

Create an environment.

Parameters
pszNameThe registry key.
Returns
The environment.
Ghidra address:
NTSC-U/C: 0x0037d680
Ghidra address:
PAL: 0x003ebdb0

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