Difference between revisions of "Sead/Color4f"
Jump to navigation
Jump to search
(document setLerp) |
Shibboleet (talk | contribs) |
||
Line 18: | Line 18: | ||
* <code>*=</code> | * <code>*=</code> | ||
* <code>/=</code> | * <code>/=</code> | ||
+ | * <code>==</code>* | ||
− | If provided a second <code>sead::Color4f</code> instance, the requested operation will be performed using the RGBA values in each operand. If provided a float, the single float will be applied to all RGBA values of the target <code>sead::Color4f</code> using the requested operation. | + | If provided a second <code>sead::Color4f</code> instance, the requested operation will be performed using the RGBA values in each operand. If provided a float, the single float will be applied to all RGBA values of the target <code>sead::Color4f</code> using the requested operation. (*only works if given two <code>sead::Color4f</code> instances.) |
=== setLerp(sead::Color4f, sead::Color4f, float) === | === setLerp(sead::Color4f, sead::Color4f, float) === |
Latest revision as of 16:04, 16 November 2018
sead::Color4f
is a helper class containing red, green, blue, and alpha float values.
Contents
Implementation
This class has four floats.
float red; float green; float blue; float alpha;
The following operators are supported:
+=
-=
*=
/=
==
*
If provided a second sead::Color4f
instance, the requested operation will be performed using the RGBA values in each operand. If provided a float, the single float will be applied to all RGBA values of the target sead::Color4f
using the requested operation. (*only works if given two sead::Color4f
instances.)
setLerp(sead::Color4f, sead::Color4f, float)
Linearly interpolates between 2 Color4f values, with the float being the interpolation value.
An implementation looks something like this:
void __fastcall sead::Color4f::setLerp(sead::Color4f *this, const sead::Color4f *start, const sead::Color4f *end, float interpolation) { if ( interpolation >= 0.0 ) { if ( interpolation > 1.0 ) interpolation = 1.0; } else { interpolation = 0.0; } this->alpha = start->alpha + (interpolation * (end->alpha - start->alpha)); this->red = start->red + (interpolation * (end->red - start->red)); this->green = start->green + (interpolation * (end->green - start->green)); this->blue = start->blue + (interpolation * (end->blue - start->blue)); }
setGammaCollection(sead::Color4f, float)
TODO...
lerp(sead::Color4f, sead::Color4f, float)
TODO...
adjustOverflow()
Clamps the RGBA values to 1.0f.