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

Camera, PlayStation 2. More...

#include <pscam.h>

Inheritance diagram for PsCam:
Collaboration diagram for PsCam:

Public Member Functions

 PsCam (const char *pszName)
 Construct a camera with the default projection.
 ~PsCam () override
void * operator new (size_t nSize)
 Allocate a camera, billed to the base class name.
void operator delete (void *pBlock)
 Release a camera.
int DrawShowing () override
 Make this camera the one the frame is drawn through.
Public Member Functions inherited from RndCam
 RndCam (const char *pszName)
 Construct a camera looking along y with a quarter-turn field of view, from 1 to 1000 units.
 ~RndCam () override
 Release the camera and stop drawing through it.
void * operator new (size_t nSize)
 Allocate a camera, billed to the class name.
void operator delete (void *pBlock)
 Release a camera.
void ListDrawObjects (std::list< RndObject * > &objects) override
 Add the camera itself to a list.
void ListDrawables (std::list< RndDrawable * > &drawables) override
 Make the camera current and add the drawables of the children to a list.
int DrawShowing () override
 Make the camera current.
int UpdateWorldXfm (RndTransformable *pParent, int bForce) override
 Recompute the world transform, and the world projection when it changed.
void Collide (const Vector2 &point, std::list< Collision > &collisions) override
 Record the camera as struck when a screen point falls inside mScreenRect, then test the children.
void DumpText (PrnStream &stream) override
 Write a description of the camera and its bases.
void Save (BinStream &stream) override
 Write the camera and its bases.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a referenced object with another.
const char * ClassName () const override
 Report the class name.
void Copy (const RndObject *pSource, int nFlags) override
 Copy another camera and its bases.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void WorldToScreen (const Vector3 &world, Vector2 &screen) const
 Project a world point to a screen point through mWorldProject and mScreenRect.
void SetTargetTex (RndTex *pTex)
 Render into a texture rather than the display, or stop.
void SetFrustum (float fNear, float fFar, float fFov)
 Set the view volume.
void UpdateProjection ()
 Rebuild the local projection and the local view volume, then the world projection.
void UpdateWorldProject ()
 Rebuild the world projection and the world view volume from the world transform.
float GetFarPlane () const
float GetFov () const
const Transform & GetInvWorldXfm () const
const Transform & GetLocalProject () const
float GetNearPlane () const
const Transform & GetOrthoWorldXfm () const
const Rect & GetScreenRect () const
void SetScreenRect (const Rect &rect)
RndTex * GetTargetTex () const
const Frustum & GetWorldFrustum () const
const Vector2 & GetZRange () const
void SetZRange (const Vector2 &range)
virtual void Collide (const Segment &segment, std::list< Collision > &collisions)
 Test a segment against the collideable and add what it strikes to a list.
Public Member Functions inherited from RndDrawable
 RndDrawable ()
 Construct a showing drawable without a highlight or children.
 ~RndDrawable () override
 Drop the references on the children.
virtual void SetShowing (int nShowing)
 Set whether the drawable draws at all.
virtual void SetHighlight (int nHighlight)
 Set whether the drawable draws with its highlight treatment.
void DumpText (PrnStream &stream) override
 Write a description of the drawable.
void Save (BinStream &stream) override
 Write the showing flag and the names of the children.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a child with another object.
void Copy (const RndObject *pSource, int nFlags) override
 Copy the showing flag, and the children when the flags request them.
void Load (BinStream &stream) override
 Read what Save() wrote.
RndDrawable * Parent ()
 Find the drawable whose children include this one.
void Draw ()
 Draw the drawable and then its children, when it is showing.
bool AddDraw (RndDrawable *pDraw, RndDrawable *pBefore)
 Add a child before another.
void RemoveDraw (RndDrawable *pDraw)
 Remove a child.
void ClearDraws ()
 Remove every child.
int GetShowing () const
const std::list< RndDrawable * > & GetDraws () const
Public Member Functions inherited from RndObject
 RndObject (const char *pszName)
 Construct an object and register it under a name.
virtual ~RndObject ()
 Notify every referrer, then erase the registration.
void SetName (const char *pszName)
 Register the object under a different name.
void AddRef (RndObject *pReferrer)
 Register an object as a store of a pointer to this one.
void RemoveRef (RndObject *pReferrer)
 Drop the first registration AddRef() made for a referrer.
const char * GetName () const
const std::list< RndObject * > & GetRefs () const
int GetInternal () const
void SetInternal (int nInternal)
Public Member Functions inherited from RndTransformable
 RndTransformable ()
 Construct a transformable with identity transforms, no origin offset, and no billboard.
 ~RndTransformable () override
 Drop the references on the children.
virtual void SetBillboard (int nBillboard)
 Set the billboard mode.
void DumpText (PrnStream &stream) override
 Write a description of the transformable.
void Save (BinStream &stream) override
 Write the transforms, the names of the children, the billboard mode, and the origin.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a child with another object.
void Copy (const RndObject *pSource, int nFlags) override
 Copy the transforms, the billboard mode, the origin, and the children when the flags request them.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void SetOrigin (const Vector3 &origin)
 Set the point the world transform subtracts first when there is no billboard.
RndTransformable * Parent ()
 Find the transformable whose children include this object.
bool AddTrans (RndTransformable *pTrans)
 Append a child and mark its world transform dirty.
void RemoveTrans (RndTransformable *pTrans)
 Remove a child.
void ClearTrans ()
 Remove every child.
const Transform & BillboardXfm ()
 Report the world transform turned to face the current camera.
const Transform & GetLocalXfm () const
Transform & GetLocalXfm ()
void SetLocalXfm (const Transform &xfm)
const Transform & GetWorldXfm () const
Transform & GetWorldXfm ()
int GetDirty () const
void SetDirty (int nDirty)
const std::list< RndTransformable * > & GetTransList () const
Public Member Functions inherited from RndCollideable
 RndCollideable ()
 Construct a collideable without children.
 ~RndCollideable () override
 Drop the references on the children.
void DumpText (PrnStream &stream) override
 Write a description of the collideable.
void Save (BinStream &stream) override
 Write the names of the children.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a child with another object.
void Copy (const RndObject *pSource, int nFlags) override
 Copy the children when the flags request them.
void Load (BinStream &stream) override
 Read what Save() wrote.
RndCollideable * Parent ()
 Find the collideable whose children include this one.
bool AddCollide (RndCollideable *pCollide)
 Append a child.
void RemoveCollide (RndCollideable *pCollide)
 Remove a child.

Static Public Member Functions

static void Init ()
 Install the camera factory and build the default camera.
static RndObject * New (const char *pszName)
 Create a camera.
Static Public Member Functions inherited from RndCam
static RndObject * New (const char *pszName)
 Create a camera.
static void CreateDefault ()
 Create the internal camera [default cam], 150 units back along y.
static float ConvertFov (float fFrom, float fTo, float fFov)
 Report the field of view that covers the same extent at another aspect.
Static Public Member Functions inherited from RndDrawable
static void CollectChildren (std::list< RndObject * > &objects, RndDrawable *pDrawable)
 Append every draw descendant of a drawable, depth first, each before its descendants.
Static Public Member Functions inherited from RndTransformable
static void CollectChildren (std::list< RndObject * > &objects, RndTransformable *pTransformable)
 Append every transform descendant of a transformable, depth first, each before its descendants.
Static Public Member Functions inherited from RndCollideable
static void CollectChildren (std::list< RndObject * > &objects, RndCollideable *pCollideable)
 Append every collision descendant of a collideable, depth first, each before its descendants.

Additional Inherited Members

Public Types inherited from RndTransformable
enum  Billboard {
  kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 ,
  kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 ,
  kBillboardScale = 128 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 ,
  kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160
}
 How the world transform turns to face the current camera. More...
Static Public Attributes inherited from RndCam
static RndCam * sCurrent
 The camera drawing is set up for.
static RndCam * sDefault
 The internal camera CreateDefault() made.
static const char * sClassName
 The class name a .rnd file writes, Cam.
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndDrawable
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndObject
static constexpr int kCopyChildLists = 0x200
 The bit of the Copy() flags that copies the child lists of the mix-ins.
Static Public Attributes inherited from RndTransformable
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndCollideable
static int sRev
 The format version Save() writes and Load() accepts.
Protected Member Functions inherited from RndCam
void ReleaseTargetTex ()
 Drop the reference on mTargetTex.
void AcquireTargetTex ()
 Take a reference on mTargetTex and rebuild the projection.
Protected Member Functions inherited from RndDrawable
void ReleaseDrawRefs ()
 Drop the reference on every child without emptying the list.
void AcquireDrawRefs ()
 Take a reference on every child.
Protected Member Functions inherited from RndTransformable
void ReleaseTransRefs ()
 Drop the reference on every child without emptying the list.
void AcquireTransRefs ()
 Take a reference on every child.
Protected Member Functions inherited from RndCollideable
void ReleaseCollideRefs ()
 Drop the reference on every child without emptying the list.
void AcquireCollideRefs ()
 Take a reference on every child.
Protected Attributes inherited from RndCam
Transform mOrthoWorldXfm
Transform mInvWorldXfm
Transform mLocalProject
Transform mInvLocalProject
Transform mWorldProject
Transform mInvWorldProject
Frustum mLocalFrustum
Frustum mWorldFrustum
float mNearPlane
float mFarPlane
float mFov
Vector2 mZRange
Rect mScreenRect
RndTex * mTargetTex
Protected Attributes inherited from RndDrawable
int mShowing
Protected Attributes inherited from RndObject
std::list< RndObject * > mRefs
String mName
Protected Attributes inherited from RndTransformable
std::list< RndTransformable * > mTransList
Transform mLocalXfm
Transform mWorldXfm
Vector3 mOrigin
int mDirty
int mBillboard

Detailed Description

Camera, PlayStation 2.

The RTTI includes the class name and records RndCam as the one base. The class adds no data member. DrawShowing() programs the GS scissor and fills the transforms the mesh and particle paths read.

Constructor & Destructor Documentation

◆ PsCam()

PsCam::PsCam ( const char * pszName)
explicit

Construct a camera with the default projection.

Parameters
pszNameThe registry key.
Ghidra address:
NTSC-U/C: 0x00212648
Ghidra address:
PAL: 0x0021b460

◆ ~PsCam()

PsCam::~PsCam ( )
override
Ghidra address:
NTSC-U/C: 0x002127a0
Ghidra address:
PAL: 0x0021b5b8

Member Function Documentation

◆ operator new()

void * PsCam::operator new ( size_t nSize)
inline

Allocate a camera, billed to the base class name.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.

◆ operator delete()

void PsCam::operator delete ( void * pBlock)
inline

Release a camera.

Parameters
pBlockThe block.

◆ DrawShowing()

int PsCam::DrawShowing ( )
overridevirtual

Make this camera the one the frame is drawn through.

A camera following one that drew into a texture flushes the texture cache first. A render target is bound with PsTex::BindAsRenderTarget(), and otherwise a camera following one that drew into a texture points the GS back at the display buffer. The routine then computes the guard band, widens the four side planes of the local frustum by it, moves all six planes into world space as g_drawFrustum, builds the viewport and projection transforms, and programs SCISSOR_1 from the screen rectangle clamped to the unit square. A render target is then cleared to black with depth writes enabled. The camera becomes RndCam::sCurrent. The base implementation is not called.

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

Reimplemented from RndDrawable.

◆ Init()

void PsCam::Init ( )
static

Install the camera factory and build the default camera.

A .rnd file naming the class Cam then loads this subclass. The name is inferred.

Ghidra address:
NTSC-U/C: 0x00212548
Ghidra address:
PAL: 0x0021b360

◆ New()

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

Create a camera.

Parameters
pszNameThe registry key.
Returns
The camera.
Ghidra address:
NTSC-U/C: 0x0037ca10
Ghidra address:
PAL: 0x003eb140

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