SbColor4f(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SbColor4f(3) β€” ok so bestie, let me tell you about this Coin class πŸ’–

This is the man page for SbColor4f, straight outta the Coin manual, and I'm gonna walk you through it like we're texting at 2am. Every single deet stays, only the vibe changed. Periodt. ✨


✨ NAME ✨

SbColor4f β€” the SbColor4f class contains the red, green, blue and alpha components which make up a color value. πŸŽ€


🌸 SYNOPSIS 🌸

#include <Inventor/SbColor4f.h>

Inherits SbVec4f. Yes bestie, it's giving nepo baby but make it class hierarchy. πŸ‘‘

πŸ’œ Public Member Functions

SbColor4f (void)
SbColor4f (const SbColor &rgb, const float alpha=1.0f)
SbColor4f (const SbVec4f &v)
SbColor4f (const float *const rgba)
SbColor4f (const float r, const float g, const float b, const float
    a=1.0f)
void setValue (const float r, const float g, const float b, const float
    a=1.0f)
void setValue (const float col[4])
const float * getValue () const
void getValue (float &r, float &g, float &b, float &a)
SbColor4f & setRGB (const SbColor &col)
void getRGB (SbColor &color)
SbColor4f & setHSVValue (float h, float s, float v, float a=1.0f)
SbColor4f & setHSVValue (const float hsv[3], float alpha=1.0f)
void getHSVValue (float &h, float &s, float &v) const
void getHSVValue (float hsv[3]) const
SbColor4f & setPackedValue (const uint32_t rgba)
uint32_t getPackedValue () const
float operator[] (const int idx) const
float & operator[] (const int idx)
SbColor4f & operator*= (const float d)
SbColor4f & operator/= (const float d)
SbColor4f & operator+= (const SbColor4f &c)
SbColor4f & operator-= (const SbColor4f &c)

πŸ¦‹ Public Member Functions inherited from SbVec4f

The whole bloodline, no gatekeeping:

SbVec4f (void)
SbVec4f (const float v[4])
SbVec4f (float x, float y, float z, float w)
SbVec4f (const SbVec4d &v)
SbVec4f (const SbVec4b &v)
SbVec4f (const SbVec4s &v)
SbVec4f (const SbVec4i32 &v)
SbVec4f & setValue (const float v[4])
SbVec4f & setValue (float x, float y, float z, float w)
SbVec4f & setValue (const SbVec4d &v)
SbVec4f & setValue (const SbVec4b &v)
SbVec4f & setValue (const SbVec4s &v)
SbVec4f & setValue (const SbVec4i32 &v)
const float * getValue (void) const
void getValue (float &x, float &y, float &z, float &w) const
float & operator[] (int i)
const float & operator[] (int i) const
SbBool equals (const SbVec4f &v, float tolerance) const
float dot (const SbVec4f &v) const
void getReal (SbVec3f &v) const
float length (void) const
float sqrLength (void) const
void negate (void)
float normalize (void)
SbVec4f & operator*= (float d)
SbVec4f & operator/= (float d)
SbVec4f & operator+= (const SbVec4f &v)
SbVec4f & operator-= (const SbVec4f &v)
SbVec4f operator- (void) const
void print (FILE *fp) const

🌈 Additional Inherited Members

Protected Attributes inherited from SbVec4f

float vec [4]
SbVec4f operator* (const SbVec4f &v, float d)
SbVec4f operator* (float d, const SbVec4f &v)
SbVec4f operator/ (const SbVec4f &v, float d)
SbVec4f operator+ (const SbVec4f &v1, const SbVec4f &v2)
SbVec4f operator- (const SbVec4f &v1, const SbVec4f &v2)
int operator== (const SbVec4f &v1, const SbVec4f &v2)
int operator!= (const SbVec4f &v1, const SbVec4f &v2)

🌟 Detailed Description 🌟

The SbColor4f class contains the red, green, blue and alpha components which make up a color value. No cap, that's literally the whole job description. πŸ’…

This class is used internally within other classes in Coin. It contains a 4 component vector as a position in the RGB cube with an additional transparency value. So it's a 4D point that's lowkey just a color wearing a little transparency accessory. πŸŽ€

The red, green and blue values should be between 0.0 and 1.0, where 0.0 is interpreted as minimum intensity, and 1.0 is maximum intensity. The transparency value is also between 0.0 and 1.0. Stay in your lane, bestie, the range is 0.0 to 1.0 and that's the rule. ✨

SbColor4f contains methods for convenient handling of setting and getting color values as 32 bit packed values or as HSV values. So you can speak RGB, you can speak packed hex-ish, you can speak HSV. Trilingual icon behavior. πŸ¦‹

⚠️ Note: this class is not part of Open Inventor, but is an extension to the API. Don't use it if you want your code to be compatible with Open Inventor. I know 😭 but it's true, it's giving "not like other classes" and if you need that Open Inventor compatibility you gotta leave it on read.

See also

  • SbColor

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

SbColor4f::SbColor4f (void )

Default constructor. The color value will be uninitialized until explicitly set. So like, it exists but it's not giving anything yet β€” you have to feed it. πŸ’€ Don't go reading values before you set them, that's undefined behavior territory and we don't do that here.

SbColor4f::SbColor4f (const SbColor & rgb, const float alpha = 1.0f)

Construct and initialize an SbColor4f with the red, green and blue components from the SbColor rgb, and the alpha value from the supplied alpha argument. Copy-paste the RGB, then alpha comes in as its own little guest star. 🫢

SbColor4f::SbColor4f (const SbVec4f & v)

Construct and initialize an SbColor4f with the red, green, blue and alpha values given by the v vector. All four slots, filled in one go. Slay. ✨

SbColor4f::SbColor4f (const float *const rgba)

Construct and initialize an SbColor4f with the red, green, blue and alpha taken from given rgba array.

SbColor4f::SbColor4f (const float r, const float g, const float b, const float a = 1.0f)

Construct and initialize an SbColor4f with the given red, green, blue and alpha values. Just hand it the numbers, bestie, it'll handle the rest. πŸ’…


πŸ’… Member Function Documentation πŸ’…

void SbColor4f::setValue (const float r, const float g, const float b, const float a = 1.0f)

Set a new color. That's it, that's the function. Iconic minimalism. πŸŽ€

void SbColor4f::setValue (const float col[4])

Set a new color. The elements of the array will be read in turned as red, green, blue and transparency.

const float * SbColor4f::getValue (void ) const

Return pointer to array of 4 float values representing the red, green, blue and transparency values of the color. You get a pointer, not a copy β€” so don't go wild editing through it unless you meant to. πŸ™ˆ

void SbColor4f::getValue (float & r, float & g, float & b, float & a)

Return components of the stored color. Hand it four floats by reference and it fills them all in. Group project where everyone actually does their part. 🫢

SbColor4f & SbColor4f::setRGB (const SbColor & col)

Sets the RGB components of the color. The alpha component is left unchanged. Alpha stays exactly where it was, untouched, minding its own business. πŸ‘‘

void SbColor4f::getRGB (SbColor & color)

Returns the RGB components of this color.

SbColor4f & SbColor4f::setHSVValue (float hue, float saturation, float value, float alpha = 1.0f)

Set the color as a hue, saturation, value triplet. The hue component should be normalized to within [0, 1] before you call this method, where a value of 0 corresponds to 0 degrees and a value of 1 corresponds to 360 degrees. Normalize first, bestie, it will not do it for you. πŸ’€

See also

  • getHSVValue().

SbColor4f & SbColor4f::setHSVValue (const float hsv[3], float a = 1.0f)

Set the color as a hue, saturation, value triplet. The hue component should be normalized to within [0, 1] before you call this method, where a value of 0 corresponds to 0 degrees and a value of 1 corresponds to 360 degrees.

See also

  • getHSVValue().

void SbColor4f::getHSVValue (float & h, float & s, float & v) const

Return the color as a hue, saturation, value triplet. Alpha component is ignored. Sorry alpha, not your moment this time. πŸŽ€

See also

  • setHSVValue().

void SbColor4f::getHSVValue (float hsv[3]) const

Return the color as a hue, saturation, value triplet. Alpha component is ignored. Again β€” alpha, sit this one out. 😭

See also

  • setHSVValue().

SbColor4f & SbColor4f::setPackedValue (const uint32_t rgba)

Set the color value as a 32 bit combined red/green/blue/alpha value. Each component is 8 bit wide (i.e. from 0x00 to 0xff), and the red value should be stored leftmost, like this: 0xRRGGBBAA. Red is the main character, it goes first. πŸ‘‘

See also

  • getPackedValue().

uint32_t SbColor4f::getPackedValue () const

Return color as a 32 bit packed integer in the form 0xRRGGBBAA.

See also

  • setPackedValue().

float SbColor4f::operator[] (const int idx) const

Returns the color component represented by the given index idx. 0 is red, 1 is green, 2 is blue and 3 is the transparency value. Memorize the order: R, G, B, A β€” it's giving alphabet energy and it ate. ✨

float & SbColor4f::operator[] (const int idx)

Returns the color component represented by the given index idx. 0 is red, 1 is green, 2 is blue and 3 is the transparency value. (This one hands you a reference, so yes you can write through it. Respect the power. 🫢)

SbColor4f & SbColor4f::operator*= (const float d)

Multiplies the RGB components by d. The alpha component is left unchanged. Alpha is unbothered, flourishing, staying put. πŸ’…

SbColor4f & SbColor4f::operator/= (const float d)

Divides the RGB components by d. The alpha component is left unchanged.

SbColor4f & SbColor4f::operator+= (const SbColor4f & c)

Adds the RGB components. Alpha is ignored.

SbColor4f & SbColor4f::operator-= (const SbColor4f & c)

Subtracts the RGB components. Alpha is ignored.


🌸 Author 🌸

Generated automatically by Doxygen for Coin from the source code. It's giving "written by a robot that doesn't need sleep," and honestly, respect. πŸ€–πŸ’–


And that's the whole page, bestie! Version 4.0.10, dated Thu Jun 25 2026 00:00:00, and it's the SbColor4f(3) manual page β€” generated automatically by Doxygen for Coin from the source code. Go set some colors, stay in the [0, 1] range, and remember: alpha gets ignored a lot and honestly, same. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from