LiquidFun
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
b2ParticleColor Class Reference

Small color object for each particle. More...

#include <b2Particle.h>

Public Member Functions

b2Inline b2ParticleColor (uint8 r, uint8 g, uint8 b, uint8 a)
 
 b2ParticleColor (const b2Color &color)
 
bool IsZero () const
 
b2Color GetColor () const
 
b2Inline void Set (uint8 r_, uint8 g_, uint8 b_, uint8 a_)
 
void Set (const b2Color &color)
 
b2ParticleColoroperator= (const b2ParticleColor &color)
 Assign a b2ParticleColor to this instance.
 
b2ParticleColoroperator*= (float32 s)
 
b2ParticleColoroperator*= (uint8 s)
 Scales r, g, b, a members by s where s is a value between 0 and 255.
 
b2ParticleColor operator* (float32 s) const
 Scales r, g, b, a members by s returning the modified b2ParticleColor.
 
b2ParticleColor operator* (uint8 s) const
 Scales r, g, b, a members by s returning the modified b2ParticleColor.
 
b2Inline b2ParticleColoroperator+= (const b2ParticleColor &color)
 
b2ParticleColor operator+ (const b2ParticleColor &color) const
 
b2Inline b2ParticleColoroperator-= (const b2ParticleColor &color)
 
b2ParticleColor operator- (const b2ParticleColor &color) const
 
bool operator== (const b2ParticleColor &color) const
 Compare this color with the specified color.
 
b2Inline void Mix (b2ParticleColor *const mixColor, const int32 strength)
 

Static Public Member Functions

static b2Inline void MixColors (b2ParticleColor *const colorA, b2ParticleColor *const colorB, const int32 strength)
 

Public Attributes

uint8 r
 
uint8 g
 
uint8 b
 
uint8 a
 

Static Protected Attributes

static const float32 k_maxValue = (float)B2PARTICLECOLOR_MAX_VALUE
 Maximum value of a b2ParticleColor component.
 
static const float32 k_inverseMaxValue
 1.0 / k_maxValue. More...
 
static const uint8 k_bitsPerComponent
 Number of bits used to store each b2ParticleColor component. More...
 

Detailed Description

Small color object for each particle.

Constructor & Destructor Documentation

b2Inline b2ParticleColor::b2ParticleColor ( uint8  r,
uint8  g,
uint8  b,
uint8  a 
)
inline

Constructor with four elements: r (red), g (green), b (blue), and a (opacity). Each element can be specified 0 to 255.

b2ParticleColor::b2ParticleColor ( const b2Color color)

Constructor that initializes the above four elements with the value of the b2Color object.

Member Function Documentation

b2Color b2ParticleColor::GetColor ( ) const

Used internally to convert the value of b2Color.

bool b2ParticleColor::IsZero ( ) const
inline

True when all four color elements equal 0. When true, a particle color buffer isn't allocated by CreateParticle().

b2Inline void b2ParticleColor::Mix ( b2ParticleColor *const  mixColor,
const int32  strength 
)
inline

Mix mixColor with this color using strength to control how much of mixColor is mixed with this color and vice versa. The range of strength is 0..128 where 0 results in no color mixing and 128 results in an equal mix of both colors. strength 0..128 is analogous to an alpha channel value between 0.0f..0.5f.

static b2Inline void b2ParticleColor::MixColors ( b2ParticleColor *const  colorA,
b2ParticleColor *const  colorB,
const int32  strength 
)
inlinestatic

Mix colorA with colorB using strength to control how much of colorA is mixed with colorB and vice versa. The range of strength is 0..128 where 0 results in no color mixing and 128 results in an equal mix of both colors. strength 0..128 is analogous to an alpha channel value between 0.0f..0.5f.

b2ParticleColor& b2ParticleColor::operator*= ( float32  s)
inline

Multiplies r, g, b, a members by s where s is a value between 0.0 and 1.0.

b2ParticleColor b2ParticleColor::operator+ ( const b2ParticleColor color) const
inline

Add two colors. This is a non-saturating addition so values overflows will wrap.

b2Inline b2ParticleColor& b2ParticleColor::operator+= ( const b2ParticleColor color)
inline

Add two colors. This is a non-saturating addition so values overflows will wrap.

b2ParticleColor b2ParticleColor::operator- ( const b2ParticleColor color) const
inline

Subtract a color from this color returning the result. This is a subtraction without saturation so underflows will wrap.

b2Inline b2ParticleColor& b2ParticleColor::operator-= ( const b2ParticleColor color)
inline

Subtract a color from this color. This is a subtraction without saturation so underflows will wrap.

b2Inline void b2ParticleColor::Set ( uint8  r_,
uint8  g_,
uint8  b_,
uint8  a_ 
)
inline

Sets color for current object using the four elements described above.

void b2ParticleColor::Set ( const b2Color color)

Initializes the object with the value of the b2Color.

Member Data Documentation

const uint8 b2ParticleColor::k_bitsPerComponent
staticprotected
Initial value:
=
B2PARTICLECOLOR_BITS_PER_COMPONENT

Number of bits used to store each b2ParticleColor component.

const float32 b2ParticleColor::k_inverseMaxValue
staticprotected
Initial value:
=
1.0f / (float)B2PARTICLECOLOR_MAX_VALUE

1.0 / k_maxValue.


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