resonance 1.0.1
Loading...
Searching...
No Matches
color.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Color
 Linear colour with four float components. More...

Functions

void ClampColorToUnitRange (const Color &source, Color &result)
 Clamp all four components of a colour to the unit range.
void AddColor (const Color &left, const Color &right, Color &result)
 Add two colours component by component.
void SubColor (const Color &left, const Color &right, Color &result)
 Subtract one colour from another component by component.
void ScaleColor (const Color &source, float flScale, Color &result)
 Scale all four components of a colour by one factor.

Function Documentation

◆ ClampColorToUnitRange()

void ClampColorToUnitRange ( const Color & source,
Color & result )

Clamp all four components of a colour to the unit range.

The vector unit raises the floor with a maximum against a zero broadcast and lowers the ceiling with a minimum against a 1.0f broadcast, then stores the result as one quadword. All four components pass through both stages, so the alpha word is clamped along with the three colour words. The one caller is Rnd::PsMesh::RefreshAfterLoad().

The title is inferred. No literal in the image identifies the routine.

Parameters
sourceThe colour to clamp.
resultReceives the clamped colour. It may alias the source.
Ghidra address:
NTSC-U/C: 0x00607268
Ghidra address:
PAL: 0x00647ed8

◆ AddColor()

void AddColor ( const Color & left,
const Color & right,
Color & result )

Add two colours component by component.

The result is a parameter rather than a return value, and that is measured rather than assumed. A by-value operator in this ABI receives a hidden result pointer as its first argument and hands it back in the return register, whereas this routine writes through its third argument and never writes the return register at all. So it is a named routine of three parameters and not operator+.

Both call paths operate on colours. The particle system interpolates a colour with it, and the mesh weld path sums vertex colours, reaching each one at the colour offset of a vertex.

The title is inferred. No literal in the image identifies either routine, and nothing distinguishes an addition named this way from one named any other way.

Parameters
leftThe first colour.
rightThe second colour.
resultReceives the sum. It may alias either operand, and the mesh weld path passes the same address as both the first operand and the result.
Ghidra address:
NTSC-U/C: 0x004924a8
Ghidra address:
PAL: 0x004d0358

◆ SubColor()

void SubColor ( const Color & left,
const Color & right,
Color & result )

Subtract one colour from another component by component.

The body is the addition above with a subtracting operation in place of the adding one, and the same reasoning fixes its shape and leaves its title inferred.

Parameters
leftThe colour subtracted from.
rightThe colour to subtract.
resultReceives the difference. It may alias either operand.
Ghidra address:
NTSC-U/C: 0x0052b258
Ghidra address:
PAL: 0x0056b8d0

◆ ScaleColor()

void ScaleColor ( const Color & source,
float flScale,
Color & result )

Scale all four components of a colour by one factor.

The factor arrives in the first floating-point argument register, which consumes no integer argument register, so its position among the parameters is not recoverable from the body. It is placed second to match Vec3Scale(). All four loads precede all four stores.

The title is inferred. No literal in the image identifies the routine.

Parameters
sourceThe colour to scale.
flScaleThe factor applied to every component, alpha included.
resultReceives the scaled colour. It may alias the source.
Ghidra address:
NTSC-U/C: 0x00453e08
Ghidra address:
PAL: 0x00491328