SbColor(3)

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

πŸ’– NAME πŸ’–

SbColor β€” bestie, this is the class that holds the red, green and blue components that make up a color value. Periodt.

(It lives in the Coin manual, section 3, and yes the header is literally SbColor(3) β€” we're just folding that in all cute up here instead of pasting it as its own line. πŸ’…)


✨ SYNOPSIS ✨

#include <Inventor/SbColor.h>

Inherits SbVec3f. (Yes bestie, it's a glow-up of a vector. Keep reading. πŸ¦‹)

πŸŽ€ Public Member Functions πŸŽ€

SbColor (void)
SbColor (const SbVec3f &v)
SbColor (const float *const rgb)
SbColor (const float r, const float g, const float b)
SbColor & setHSVValue (float h, float s, float v)
SbColor & setHSVValue (const float hsv[3])
void getHSVValue (float &h, float &s, float &v) const
void getHSVValue (float hsv[3]) const
SbColor & setPackedValue (const uint32_t rgba, float &transparency)
uint32_t getPackedValue (const float transparency=0.0f) const

🌸 Public Member Functions inherited from SbVec3f 🌸

SbVec3f (void)
SbVec3f (const float v[3])
SbVec3f (float x, float y, float z)
SbVec3f (const SbVec3d &v)
SbVec3f (const SbVec3b &v)
SbVec3f (const SbVec3s &v)
SbVec3f (const SbVec3i32 &v)
SbVec3f (const SbPlane &p0, const SbPlane &p1, const SbPlane &p2)
SbVec3f & setValue (const float v[3])
SbVec3f & setValue (float x, float y, float z)
SbVec3f & setValue (const SbVec3f &barycentric, const SbVec3f &v0, const
    SbVec3f &v1, const SbVec3f &v2)
SbVec3f & setValue (const SbVec3d &v)
SbVec3f & setValue (const SbVec3b &v)
SbVec3f & setValue (const SbVec3s &v)
SbVec3f & setValue (const SbVec3i32 &v)
const float * getValue (void) const
void getValue (float &x, float &y, float &z) const
float & operator[] (int i)
const float & operator[] (int i) const
SbBool equals (const SbVec3f &v, float tolerance) const
SbVec3f cross (const SbVec3f &v) const
float dot (const SbVec3f &v) const
SbVec3f getClosestAxis (void) const
float length (void) const
float sqrLength (void) const
float normalize (void)
void negate (void)
SbVec3f & operator*= (float d)
SbVec3f & operator/= (float d)
SbVec3f & operator+= (const SbVec3f &v)
SbVec3f & operator-= (const SbVec3f &v)
SbVec3f operator- (void) const
SbString toString () const
SbBool fromString (const SbString &str)
void print (FILE *fp) const

πŸ’œ Additional Inherited Members πŸ’œ

Protected Attributes inherited from SbVec3f

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

πŸ¦‹ Detailed Description πŸ¦‹

Okay so the SbColor class contains the red, green and blue components which make up a color value. That's the whole vibe. πŸ’…

It's used inside other classes in Coin, and it inherits SbVec3f β€” which means it reads that 3-component vector as a vector in the RGB cube, where red, green and blue correspond to x, y and z respectively. So like, x is red, y is green, z is blue. Not confusing at all, iykyk. 😌

On top of all that, SbColor adds a few extra methods so handling colors is convenient β€” you can set and get color values as 32 bit packed values or as HSV values. It's giving versatility, fr fr. ✨

See also

  • SbVec3f, SbColor4f

🧚 Constructor & Destructor Documentation 🧚

SbColor::SbColor (void )

Default constructor, bestie. Heads up though: the color value will be uninitialized. So don't come for it expecting a color, because it has none. 😭

SbColor::SbColor (const SbVec3f & v)

Constructs and initializes an SbColor using the red, green and blue values given by the v vector. One vector in, one whole color out. Slay. πŸ’–

SbColor::SbColor (const float *const rgb)

Constructs and initializes an SbColor with the red, green and blue taken from the given rgb array. Pointer goes in, color comes out. πŸŽ€

SbColor::SbColor (const float r, const float g, const float b)

Constructs and initializes an SbColor with the given red, green and blue values. Three floats, zero drama. 🫢


🌈 Member Function Documentation 🌈

SbColor & SbColor::setHSVValue (float hue, float saturation, float value)

Sets the color as a hue, saturation, value triplet. Important detail, no cap: 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. Do the math first, bestie, or the hue will be giving chaos. πŸ™ˆ

See also

  • getHSVValue().

SbColor & SbColor::setHSVValue (const float hsv[3])

Sets the color as a hue, saturation, value triplet. Same deal as above: 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 SbColor::getHSVValue (float & h, float & s, float & v) const

Returns the color as a hue, saturation, value triplet. Hand it the refs, it fills them in. Iconic. πŸ‘‘

See also

  • setHSVValue().

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

Returns the color as a hue, saturation, value triplet. Array version, same energy. πŸ’œ

See also

  • setHSVValue().

SbColor & SbColor::setPackedValue (const uint32_t rgba, float & transparency)

Sets 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. Leftmost red, remember that. πŸ’…

Here's the tea: the transparency value is not stored internally in SbColor β€” it's just converted to a transparency value in [0, 1] and returned in the transparency field. A value of 1.0 means completely transparent and a value of 0.0 is completely opaque. So don't go looking for it later, because it is not in there. 😭

See also

  • getPackedValue().

uint32_t SbColor::getPackedValue (const float transparency = 0.0f) const

Returns the color as a 32 bit packed integer in the form 0xRRGGBBAA. The transparency part of the return value is taken from the supplied transparency argument β€” and yeah, it defaults to 0.0f, so if you say nothing you get full opaque energy. 🫢

See also

  • setPackedValue().

⭐ Author ⭐

Generated automatically by Doxygen for Coin from the source code. (Not a human author, just a robot doing its little thing. Respect. πŸ€–πŸ’–)


And that's the whole page, bestie!! This one is Coin version 4.0.10, dated Thu Jun 25 2026 00:00:00 β€” so if you were reading SbColor(3) from that snapshot, you're in exactly the right place. Go paint something gorgeous with it. πŸŽ€βœ¨πŸ¦‹πŸ’…

πŸ“¦ where this page comes from