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

Light, placed by its transform. More...

#include <rndlight.h>

Inheritance diagram for RndLight:
Collaboration diagram for RndLight:

Public Types

enum  Type { kTypePoint = 0 , kTypeDirectional = 1 , kTypeSpot = 2 }
 The kinds of light. More...
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...

Public Member Functions

 RndLight (const char *pszName)
 Construct a white directional light with a range of 1000, cone angles of a quarter turn, and no attenuation.
 ~RndLight () override
 Destroy the light.
void * operator new (size_t nSize)
 Allocate a light, billed to the class name.
void operator delete (void *pBlock)
 Release a light.
virtual void SetColor (const Color &color)
 Set the colour.
virtual void SetType (int nType)
 Set the kind of light.
virtual void SetRange (float fRange)
 Set the range.
virtual void SetAngles (float fInnerAng, float fOuterAng)
 Set the angles of the cone of a spot light.
virtual void SetAttenuation (float fConstant, float fLinear, float fQuadratic)
 Set the attenuation.
virtual void Sync ()
 Pass the settings to the back end.
void DumpText (PrnStream &stream) override
 Write a description of the light and its base.
void Save (BinStream &stream) override
 Write the light and its base.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a referenced object with another in the base.
const char * ClassName () const override
 Report the class name.
void Copy (const RndObject *pSource, int nFlags) override
 Copy another light and its base, then pass the settings to the back end.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it, then pass the settings to the back end.
const Color & GetColor () const
float GetRange () const
int GetType () const
Public Member Functions inherited from RndTransformable
 RndTransformable ()
 Construct a transformable with identity transforms, no origin offset, and no billboard.
 ~RndTransformable () override
 Drop the references on the children.
virtual void SetBillboard (int nBillboard)
 Set the billboard mode.
virtual int UpdateWorldXfm (RndTransformable *pParent, int bForce)
 Recompute the world transform when it, or the parent's, changed, and then the children's.
void DumpText (PrnStream &stream) override
 Write a description of the transformable.
void Save (BinStream &stream) override
 Write the transforms, the names of the children, the billboard mode, and the origin.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a child with another object.
void Copy (const RndObject *pSource, int nFlags) override
 Copy the transforms, the billboard mode, the origin, and the children when the flags request them.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void SetOrigin (const Vector3 &origin)
 Set the point the world transform subtracts first when there is no billboard.
RndTransformable * Parent ()
 Find the transformable whose children include this object.
bool AddTrans (RndTransformable *pTrans)
 Append a child and mark its world transform dirty.
void RemoveTrans (RndTransformable *pTrans)
 Remove a child.
void ClearTrans ()
 Remove every child.
const Transform & BillboardXfm ()
 Report the world transform turned to face the current camera.
const Transform & GetLocalXfm () const
Transform & GetLocalXfm ()
void SetLocalXfm (const Transform &xfm)
const Transform & GetWorldXfm () const
Transform & GetWorldXfm ()
int GetDirty () const
void SetDirty (int nDirty)
const std::list< RndTransformable * > & GetTransList () const
Public Member Functions inherited from 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 CreateDefault ()
 Create the default light, add it to the default environment, and place it under the default camera.
static RndObject * New (const char *pszName)
 Create a light.
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 Attributes

static RndLight * sDefault
 The light CreateDefault() made.
static const char * sClassName
 The class name a .rnd file writes, Light.
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndTransformable
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.

Additional Inherited Members

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 Attributes inherited from RndTransformable
std::list< RndTransformable * > mTransList
Transform mLocalXfm
Transform mWorldXfm
Vector3 mOrigin
int mDirty
int mBillboard
Protected Attributes inherited from RndObject
std::list< RndObject * > mRefs
String mName

Detailed Description

Light, placed by its transform.

The RTTI includes the class name and records RndTransformable as the one base.

Member Enumeration Documentation

◆ Type

The kinds of light.

Enumerator
kTypePoint 

Light from a point in every direction.

kTypeDirectional 

Light in one direction from infinitely far.

kTypeSpot 

Light from a point in a cone.

Constructor & Destructor Documentation

◆ RndLight()

RndLight::RndLight ( const char * pszName)
explicit

Construct a white directional light with a range of 1000, cone angles of a quarter turn, and no attenuation.

Parameters
pszNameThe registry key.
Ghidra address:
NTSC-U/C: 0x002295d0
Ghidra address:
PAL: 0x00232340

◆ ~RndLight()

RndLight::~RndLight ( )
override

Destroy the light.

Ghidra address:
NTSC-U/C: 0x00382d58
Ghidra address:
PAL: 0x003f1460

Member Function Documentation

◆ operator new()

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

Allocate a light, billed to the class name.

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

◆ operator delete()

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

Release a light.

Parameters
pBlockThe block.

◆ SetColor()

virtual void RndLight::SetColor ( const Color & color)
inlinevirtual

Set the colour.

Parameters
colorThe colour.
Ghidra address:
NTSC-U/C: 0x00382cf0
Ghidra address:
PAL: 0x003f13f8

◆ SetType()

virtual void RndLight::SetType ( int nType)
inlinevirtual

Set the kind of light.

Parameters
nTypeThe Type.
Ghidra address:
NTSC-U/C: 0x00382d00
Ghidra address:
PAL: 0x003f1408

◆ SetRange()

virtual void RndLight::SetRange ( float fRange)
inlinevirtual

Set the range.

Parameters
fRangeThe range.
Ghidra address:
NTSC-U/C: 0x00382d08
Ghidra address:
PAL: 0x003f1410

◆ SetAngles()

virtual void RndLight::SetAngles ( float fInnerAng,
float fOuterAng )
inlinevirtual

Set the angles of the cone of a spot light.

The name is inferred.

Parameters
fInnerAngThe angle of full light.
fOuterAngThe angle light ends at.
Ghidra address:
NTSC-U/C: 0x00382d10
Ghidra address:
PAL: 0x003f1418

◆ SetAttenuation()

virtual void RndLight::SetAttenuation ( float fConstant,
float fLinear,
float fQuadratic )
inlinevirtual

Set the attenuation.

The name is inferred.

Parameters
fConstantThe constant attenuation.
fLinearThe attenuation in proportion to the distance.
fQuadraticThe attenuation in proportion to the square of the distance.
Ghidra address:
NTSC-U/C: 0x00382d20
Ghidra address:
PAL: 0x003f1428

◆ Sync()

virtual void RndLight::Sync ( )
inlinevirtual

Pass the settings to the back end.

The base body does nothing. The name is inferred.

Ghidra address:
NTSC-U/C: 0x00382f88
Ghidra address:
PAL: 0x003f1690

◆ DumpText()

void RndLight::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the light and its base.

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

Reimplemented from RndObject.

◆ Save()

void RndLight::Save ( BinStream & stream)
overridevirtual

Write the light and its base.

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

Implements RndObject.

◆ Replace()

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

Replace a referenced object with another in the base.

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

Implements RndObject.

◆ ClassName()

const char * RndLight::ClassName ( ) const
inlineoverridevirtual

Report the class name.

Returns
sClassName.
Ghidra address:
NTSC-U/C: 0x00382d48
Ghidra address:
PAL: 0x003f1450

Implements RndObject.

◆ Copy()

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

Copy another light and its base, then pass the settings to the back end.

Parameters
pSourceThe light to copy from.
nFlagsThe set of fields to copy.
Ghidra address:
NTSC-U/C: 0x00229dd8
Ghidra address:
PAL: 0x00232b48

Implements RndObject.

◆ Load()

void RndLight::Load ( BinStream & stream)
overridevirtual

Read what Save() wrote, or an earlier version of it, then pass the settings to the back end.

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

Implements RndObject.

◆ CreateDefault()

void RndLight::CreateDefault ( )
static

Create the default light, add it to the default environment, and place it under the default camera.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00229520
Ghidra address:
PAL: 0x00232290

◆ New()

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

Create a light.

Parameters
pszNameThe registry key.
Returns
The light.
Ghidra address:
NTSC-U/C: 0x00382f98
Ghidra address:
PAL: 0x003f16a0

◆ GetColor()

const Color & RndLight::GetColor ( ) const
inline
Returns
The colour.

◆ GetRange()

float RndLight::GetRange ( ) const
inline
Returns
The range.

◆ GetType()

int RndLight::GetType ( ) const
inline
Returns
The Type.

Member Data Documentation

◆ sDefault

RndLight* RndLight::sDefault
static

The light CreateDefault() made.

Ghidra address:
NTSC-U/C: 0x003b09c8
Ghidra address:
PAL: 0x0042f860

◆ sClassName

const char* RndLight::sClassName
static

The class name a .rnd file writes, Light.

Ghidra address:
NTSC-U/C: 0x003b09cc
Ghidra address:
PAL: 0x0042f864

◆ sRev

int RndLight::sRev
static

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

Ghidra address:
NTSC-U/C: 0x003b09d0
Ghidra address:
PAL: 0x0042f868

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