resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::Mat::Stage Class Reference

One texture stage of a material. More...

#include <mat.h>

Collaboration diagram for Rnd::Mat::Stage:

Public Member Functions

void SetTex (Tex *pTex)
 Replace the stage's texture.
 Stage ()
 Construct a stage with the default surface.
void Dump (Dbg &sink) const
 Write the stage to the engine text sink.
void Save (Stream &stream) const
 Serialise the stage.
void Load (Stream &stream)
 Load the stage.

Public Attributes

BlendMode mBlend
int mCoordIndex
TexGen mGenMode
Transform mXfm
int mUseXfm
TexWrap mWrap
Tex * mTex
Mat * mMat

Detailed Description

One texture stage of a material.

The structure is 0x60 bytes and emits no RTTI descriptor. Its member names come from the labels the stage text dump writes, "\n\tblend:", " coordIndex:", " genMode:", " xfm:", "useXfm:", " wrap:", " mat:", and " tex:". The dump writes the material reference before the texture reference even though the texture is stored first.

Constructor & Destructor Documentation

◆ Stage()

Rnd::Mat::Stage::Stage ( )

Construct a stage with the default surface.

The blend becomes kBlendModeMultiply, the coordinate set and the generation mode zero, the transform the identity, the wrap kWrapModeRepeat, and both references null.

Ghidra address:
NTSC-U/C: 0x004dd020
Ghidra address:
PAL: 0x0051b5c0

Member Function Documentation

◆ SetTex()

void Rnd::Mat::Stage::SetTex ( Tex * pTex)

Replace the stage's texture.

Drops mMat's registration on the previous texture, records the new one, and registers mMat on it. The head-up display's FreQ icon is one caller. The title is inferred.

Parameters
pTexThe new texture, or null.
Ghidra address:
NTSC-U/C: 0x004dd0a0
Ghidra address:
PAL: 0x0051b640

◆ Dump()

void Rnd::Mat::Stage::Dump ( Dbg & sink) const

Write the stage to the engine text sink.

Parameters
sinkThe text sink.
Ghidra address:
NTSC-U/C: 0x004d2270
Ghidra address:
PAL: 0x005106c0

◆ Save()

void Rnd::Mat::Stage::Save ( Stream & stream) const

Serialise the stage.

Writes the blend, the coordinate set, the generation mode, the twelve transform floats, the transform flag as one byte, the wrap, and the texture as its name. The material reference is not written.

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

◆ Load()

void Rnd::Mat::Stage::Load ( Stream & stream)

Load the stage.

Rnd::g_nRndMatLoadVersion decides the layout. From revision 3 the blend arrives as a BlendMode. Below that it arrives as two words, of which only the first is used, mapped 0, 1, 2, 3, 4, 5, and 6 to kBlendModeDest, kBlendModeSrc, kBlendModeMultiply, kBlendModeAdd, kBlendModeDestAlpha, kBlendModeSrcAlpha, and kBlendModeInvDestAlpha, and any other value leaves the blend as it was. A revision 0 record then names the material the stage belongs to, and every revision ends with the texture.

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

Member Data Documentation

◆ mBlend

BlendMode Rnd::Mat::Stage::mBlend

◆ mCoordIndex

int Rnd::Mat::Stage::mCoordIndex

◆ mGenMode

TexGen Rnd::Mat::Stage::mGenMode

◆ mXfm

Transform Rnd::Mat::Stage::mXfm

◆ mUseXfm

int Rnd::Mat::Stage::mUseXfm

◆ mWrap

TexWrap Rnd::Mat::Stage::mWrap

◆ mTex

Tex* Rnd::Mat::Stage::mTex

◆ mMat

Mat* Rnd::Mat::Stage::mMat

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