formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Shaders
Description
This is a simple utility function to create a sawtooth
effect. The first parameter (a) is divided by the
second parameter (b) and the floating point remainder is returned.
For example, if b is 1.0 this function yields the following
values for a :
a output
0.0 0.0
0.1 0.1
0.9 0.9
1.0 0.0
1.1 0.1
1.9 0.9
2.0 0.0
2.1 0.1
2.9 0.9
3.0 0.0
etc.
This function is frequently used when calculating repetitive
patterns. Typically the texture space coordinates retrieved
by () are modified by fz_shdr_saw_tooth with
a value of 1.0 for the b argument.
Plugin Prototype
double fz_shdr_saw_tooth(
double | a, |
double | b ) |
Parameters
a [Input]
The input value
b [Input]
The modul
Returns
none
Availability
5.0.0.0
Plugin Example
For example :
fz_shdr_get_tspace_st(&st);
st.x = fz_shdr_saw_tooth(st.x,1.0);
st.y = fz_shdr_saw_tooth(st.y,1.0);
if ( st.x * st.x + st.y * st.y > 0.25 ) col = black;
else col = white;
The above pseudo code creates a repetitive black and white dot pattern,
based on the texture space coordinate of a pixel.
Function Set
Defined in