mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[ADD] GRRLIB_DrawTessPanel to draw (as the name says) a tessellated pannel ;)
This commit is contained in:
parent
2ad5794867
commit
08f93839ac
2 changed files with 35 additions and 0 deletions
|
@ -587,6 +587,40 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) {
|
|||
GX_End();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a Tesselated pannel (with normal).
|
||||
* @param w Width of the panel.
|
||||
* @param wstep Size of width slices.
|
||||
* @param h Height of the pannel.
|
||||
* @param hstep Size the de height slices.
|
||||
* @param filled Wired or not.
|
||||
* @param col Color of the cone.
|
||||
*/
|
||||
void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col) {
|
||||
f32 x,y,tmpx, tmpy;
|
||||
int tmp;
|
||||
tmpy = h/2.0f;
|
||||
tmpx = w/2.0f;
|
||||
tmp = ((w/wstep)*2)+2;
|
||||
for ( y = -tmpy ; y <= tmpy ; y+=hstep )
|
||||
{
|
||||
if(filled) GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, tmp);
|
||||
else GX_Begin(GX_LINESTRIP, GX_VTXFMT0, tmp);
|
||||
for ( x = -tmpx ; x <= tmpx ; x+=wstep )
|
||||
{
|
||||
GX_Position3f32( x, y, 0.0f );
|
||||
GX_Normal3f32( 0.0f, 0.0f, 1.0f);
|
||||
GX_Color1u32(col);
|
||||
GX_Position3f32( x, y+hstep, 0.0f );
|
||||
GX_Normal3f32( 0.0f, 0.0f, 1.0f);
|
||||
GX_Color1u32(col);
|
||||
}
|
||||
GX_End();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set ambient color.
|
||||
* When no diffuse ligth is shinig on a object, the color is equal to ambient color.
|
||||
|
|
|
@ -163,6 +163,7 @@ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col);
|
|||
void GRRLIB_DrawCube(f32 size, bool filled, u32 col);
|
||||
void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col);
|
||||
void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col);
|
||||
void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col);
|
||||
void GRRLIB_SetLightAmbient(u32 ambientcolor);
|
||||
void GRRLIB_SetLightDiff(u8 num, guVector pos, f32 distattn, f32 brightness, u32 lightcolor);
|
||||
void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 speccolor);
|
||||
|
|
Loading…
Reference in a new issue