Functions
rs_math.rsh File Reference

Functions

int rsRand (int max_value)
int rsRand (int min_value, int max_value)
float rsRand (float max_value)
float rsRand (float min_value, float max_value)
float rsFrac (float)
_RS_RUNTIME uint rsClamp (uint amount, uint low, uint high)
_RS_RUNTIME int rsClamp (int amount, int low, int high)
_RS_RUNTIME ushort rsClamp (ushort amount, ushort low, ushort high)
_RS_RUNTIME short rsClamp (short amount, short low, short high)
_RS_RUNTIME uchar rsClamp (uchar amount, uchar low, uchar high)
_RS_RUNTIME char rsClamp (char amount, char low, char high)
static __inline__ void rsExtractFrustumPlanes (const rs_matrix4x4 *viewProj, float4 *left, float4 *right, float4 *top, float4 *bottom, float4 *near, float4 *far)
static __inline__ bool rsIsSphereInFrustum (float4 *sphere, float4 *left, float4 *right, float4 *top, float4 *bottom, float4 *near, float4 *far)
_RS_RUNTIME uchar4 rsPackColorTo8888 (float r, float g, float b)
_RS_RUNTIME uchar4 rsPackColorTo8888 (float r, float g, float b, float a)
_RS_RUNTIME uchar4 rsPackColorTo8888 (float3 color)
_RS_RUNTIME float4 rsUnpackColor8888 (uchar4 c)

Detailed Description

todo-jsams

Definition in file rs_math.rsh.


Function Documentation

_RS_RUNTIME uint rsClamp ( uint  amount,
uint  low,
uint  high 
)

Clamp the value amount between low and high.

Parameters:
amountThe value to clamp
low
high
_RS_RUNTIME int rsClamp ( int  amount,
int  low,
int  high 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME ushort rsClamp ( ushort  amount,
ushort  low,
ushort  high 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME short rsClamp ( short  amount,
short  low,
short  high 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME uchar rsClamp ( uchar  amount,
uchar  low,
uchar  high 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME char rsClamp ( char  amount,
char  low,
char  high 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

static __inline__ void rsExtractFrustumPlanes ( const rs_matrix4x4 viewProj,
float4 left,
float4 right,
float4 top,
float4 bottom,
float4 near,
float4 far 
) [static]

Computes 6 frustum planes from the view projection matrix

Parameters:
viewProjmatrix to extract planes from
leftplane
rightplane
topplane
bottomplane
nearplane
farplane

Definition at line 102 of file rs_math.rsh.

float rsFrac ( float  )

Returns the fractional part of a float

static __inline__ bool rsIsSphereInFrustum ( float4 sphere,
float4 left,
float4 right,
float4 top,
float4 bottom,
float4 near,
float4 far 
) [static]

Checks if a sphere is withing the 6 frustum planes

Parameters:
spherefloat4 representing the sphere
leftplane
rightplane
topplane
bottomplane
nearplane
farplane

Definition at line 162 of file rs_math.rsh.

_RS_RUNTIME uchar4 rsPackColorTo8888 ( float  r,
float  g,
float  b 
)

Pack floating point (0-1) RGB values into a uchar4. The alpha component is set to 255 (1.0).

Parameters:
r
g
b
Returns:
uchar4
_RS_RUNTIME uchar4 rsPackColorTo8888 ( float  r,
float  g,
float  b,
float  a 
)

Pack floating point (0-1) RGBA values into a uchar4.

Parameters:
r
g
b
a
Returns:
uchar4
_RS_RUNTIME uchar4 rsPackColorTo8888 ( float3  color)

Pack floating point (0-1) RGB values into a uchar4. The alpha component is set to 255 (1.0).

Parameters:
color
Returns:
uchar4

Pack floating point (0-1) RGBA values into a uchar4.

Parameters:
color
Returns:
uchar4
int rsRand ( int  max_value)

Return a random value between 0 (or min_value) and max_malue.

int rsRand ( int  min_value,
int  max_value 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

float rsRand ( float  max_value)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

float rsRand ( float  min_value,
float  max_value 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME float4 rsUnpackColor8888 ( uchar4  c)

Unpack a uchar4 color to float4. The resulting float range will be (0-1).

Parameters:
c
Returns:
float4