Functions
/usr/local/google/home/srhines/android_trees/jb-mr2-dev/frameworks/rs/scriptc/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)
uint rsClamp (uint amount, uint low, uint high)
int rsClamp (int amount, int low, int high)
ushort rsClamp (ushort amount, ushort low, ushort high)
short rsClamp (short amount, short low, short high)
uchar rsClamp (uchar amount, uchar low, uchar high)
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)
uchar4 rsPackColorTo8888 (float r, float g, float b)
uchar4 rsPackColorTo8888 (float r, float g, float b, float a)
uchar4 rsPackColorTo8888 (float3 color)
float4 rsUnpackColor8888 (uchar4 c)

Detailed Description

todo-jsams

Definition in file rs_math.rsh.


Function Documentation

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

Clamp the value amount between low and high.

Parameters:
amountThe value to clamp
low
high
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.

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.

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.

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.

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.

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
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
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.

float4 rsUnpackColor8888 ( uchar4  c)

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

Parameters:
c
Returns:
float4