JRenderer Class Reference

#include <JRenderer.h>

Collaboration diagram for JRenderer:

List of all members.

Public Member Functions

void RenderQuad (JQuad *quad, float xo, float yo, float angle=0.0f, float xScale=1.0f, float yScale=1.0f)
void RenderQuad (JQuad *quad, VertexColor *points)
void ScreenShot (const char *filename)
JTexture * LoadTexture (const char *filename, int mode=0)
JTexture * CreateTexture (int width, int height, int mode=0)
void ClearScreen (PIXEL_TYPE color)
void EnableVSync (bool flag)
void EnableTextureFilter (bool flag)
void ResetPrivateVRAM ()
void SetSwizzle (int s)
void BindTexture (JTexture *tex)
void SetTexBlend (int src, int dest)
void SetTexBlendSrc (int src)
void SetTexBlendDest (int dest)
void Enable2D ()
void Enable3D ()
void SetClip (int x, int y, int width, int height)
void LoadIdentity ()
void Translate (float x, float y, float z)
void RotateX (float angle)
void RotateY (float angle)
void RotateZ (float angle)
void PushMatrix ()
void PopMatrix ()
void SetFOV (float fov)
void RenderTriangles (JTexture *texture, Vertex3D *tris, int start, int count)
void FillRect (float x, float y, float width, float height, PIXEL_TYPE color)
void FillRect (float x, float y, float width, float height, JColor *color)
void DrawRect (float x, float y, float width, float height, PIXEL_TYPE color)
void DrawLine (float x1, float y1, float x2, float y2, PIXEL_TYPE color)
void DrawLine (float x1, float y1, float x2, float y2, float lineWidth, PIXEL_TYPE color)
void Plot (float x, float y, PIXEL_TYPE color)
void PlotArray (float *x, float *y, int count, PIXEL_TYPE color)
void FillPolygon (float *x, float *y, int count, PIXEL_TYPE color)
void DrawPolygon (float *x, float *y, int count, PIXEL_TYPE color)
void DrawPolygon (float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
void FillPolygon (float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
void FillCircle (float x, float y, float radius, PIXEL_TYPE color)
void DrawCircle (float x, float y, float radius, PIXEL_TYPE color)
void DrawRoundRect (float x, float y, float w, float h, float radius, PIXEL_TYPE color)
void FillRoundRect (float x, float y, float w, float h, float radius, PIXEL_TYPE color)
void SetImageFilter (JImageFilter *imageFilter)

Static Public Member Functions

static JRendererGetInstance ()


Detailed Description

A collection of core rendering functions.

Member Function Documentation

static JRenderer* JRenderer::GetInstance (  )  [static]

Get the singleton instance

void JRenderer::RenderQuad ( JQuad quad,
float  xo,
float  yo,
float  angle = 0.0f,
float  xScale = 1.0f,
float  yScale = 1.0f 
)

Render a textured quad with rotation and scaling.

Parameters:
quad - Quad with texturing info.
xo - x position.
yo - y position.
angle - Rotation (radian).
xScale - Horizontal rendering scale.
yScale - Vertical rendering scale.

void JRenderer::RenderQuad ( JQuad quad,
VertexColor *  points 
)

Render a textured quad with new texture mapping information.

Parameters:
quad - Quad with texturing information.
points - Array of vertices with new texture mapping information.

void JRenderer::ScreenShot ( const char *  filename  ) 

Taking a screen shot.

Note:
This function works on PSP only. A PNG file will be saved in the current folder of the game applicaton.

JTexture* JRenderer::LoadTexture ( const char *  filename,
int  mode = 0 
)

Load a texture from file.

Parameters:
filename - Name of file.
mode - Choose to put texture in VRAM (PSP only).

JTexture* JRenderer::CreateTexture ( int  width,
int  height,
int  mode = 0 
)

Create texture from memory on the fly.

Parameters:
width - Width of texture.
height - Height of texture.
mode - Choose to put texture in VRAM (PSP only)

void JRenderer::ClearScreen ( PIXEL_TYPE  color  ) 

Clear entire screen to a particular color.

Parameters:
color - Color to fill the screen.

void JRenderer::EnableVSync ( bool  flag  ) 

Enable VSync for the smoothness of moving objects. (PSP only)

Parameters:
flag - true to enable, false to disable.

void JRenderer::EnableTextureFilter ( bool  flag  ) 

Enable bi-linear filtering for better looking on-screen images.

Parameters:
flag - true to enable, false to disable.

void JRenderer::ResetPrivateVRAM (  ) 

Remove all textures from VRAM (PSP only)

void JRenderer::SetSwizzle ( int  s  )  [inline]

Enable/disable swizzle optimization. (PSP only)

Parameters:
s - 1 to enable, 0 to disable.

void JRenderer::BindTexture ( JTexture *  tex  ) 

Bind texture to be used for the rendering followed.

Parameters:
tex - Texture to use.

void JRenderer::SetTexBlend ( int  src,
int  dest 
)

Set texture blending options.

Blending options:
                BLEND_ZERO
                BLEND_ONE
                BLEND_SRC_COLOR
                BLEND_ONE_MINUS_SRC_COLOR
                BLEND_SRC_ALPHA
                BLEND_ONE_MINUS_SRC_ALPHA
                BLEND_DST_ALPHA 
                BLEND_ONE_MINUS_DST_ALPHA
                BLEND_DST_COLOR 
                BLEND_ONE_MINUS_DST_COLOR
                BLEND_SRC_ALPHA_SATURATE

Parameters:
src - Blending option for source image.
dest - Blending option for destination image.

void JRenderer::SetTexBlendSrc ( int  src  ) 

Set texture blending option for source image.

Parameters:
src - Blending option for source image.

void JRenderer::SetTexBlendDest ( int  dest  ) 

Set texture blending option for destination image.

Parameters:
dest - Blending option for destination image.

void JRenderer::Enable2D (  ) 

Enable rendering in 2D mode.

Note:
To be implemented.

void JRenderer::Enable3D (  ) 

Enable rendering in 3D mode.

Note:
To be implemented.

void JRenderer::SetClip ( int  x,
int  y,
int  width,
int  height 
)

Restrict all rendering to a rectangular area.

Note:
This is just the glScissor() function of OpenGL.
Parameters:
x - Left of the clipping area.
y - Top of the clipping area.
width - Width of the clipping area.
height - Height of the clipping area.

void JRenderer::LoadIdentity (  ) 

Reset Modelview Identity.

void JRenderer::Translate ( float  x,
float  y,
float  z 
)

Tranlate position in 3D space.

Parameters:
x - X position.
y - Y position.
z - Z position.

void JRenderer::RotateX ( float  angle  ) 

Rotate along X axis.

Parameters:
angle - Angle to rotate ( in radians).

void JRenderer::RotateY ( float  angle  ) 

Rotate along Y axis.

Parameters:
angle - Angle to rotate ( in radians).

void JRenderer::RotateZ ( float  angle  ) 

Rotate along Z axis.

Parameters:
angle - Angle to rotate ( in radians).

void JRenderer::PushMatrix (  ) 

Push matrix.

void JRenderer::PopMatrix (  ) 

Pop matrix.

void JRenderer::SetFOV ( float  fov  ) 

Set the field of view angle (in degrees), effective at the next Enable3D() call.

Parameters:
fov - The field of view angle (in degrees).

void JRenderer::RenderTriangles ( JTexture *  texture,
Vertex3D *  tris,
int  start,
int  count 
)

Render triangles.

Parameters:
texture - Texture for the triangles.
tris - List of triangles.
start - starting index (Note: Index of triangles, NOT vertices).
count - Number of triangles (Note: NOT number of vertices).

void JRenderer::FillRect ( float  x,
float  y,
float  width,
float  height,
PIXEL_TYPE  color 
)

Fill a rectangular area with a specified color.

Parameters:
x - Starting x position.
y - Starting y position.
width - Width of the rectangle.
height - Height of the rectangle.
color - Filling color.

void JRenderer::FillRect ( float  x,
float  y,
float  width,
float  height,
JColor *  color 
)

Fill a rectangular area with a single color for each vertex.

Parameters:
x - Starting x position.
y - Starting y position.
width - Width of the rectangle.
height - Height of the rectangle.
color - Array of colors.

void JRenderer::DrawRect ( float  x,
float  y,
float  width,
float  height,
PIXEL_TYPE  color 
)

Draw a rectangle.

Parameters:
x - Starting x position.
y - Starting y position.
width - Width of the rectangle.
height - Height of the rectangle.
color - Filling color.

void JRenderer::DrawLine ( float  x1,
float  y1,
float  x2,
float  y2,
PIXEL_TYPE  color 
)

Draw a single line.

Parameters:
x1 - Starting vertex, x.
y1 - Starting vertex, y.
x2 - Ending vertex, x.
y2 - Ending vertex, y.
color - Filling color.

void JRenderer::DrawLine ( float  x1,
float  y1,
float  x2,
float  y2,
float  lineWidth,
PIXEL_TYPE  color 
)

Draw thick line.

Parameters:
x1 - Starting vertex, x.
y1 - Starting vertex, y.
x2 - Ending vertex, x.
y2 - Ending vertex, y.
lineWidth - Line width.
color - Filling color.

void JRenderer::Plot ( float  x,
float  y,
PIXEL_TYPE  color 
)

Plot a pixel on screen.

Parameters:
x - X position of the pixel.
y - Y position of the pixel.
color - Draw colour.

void JRenderer::PlotArray ( float *  x,
float *  y,
int  count,
PIXEL_TYPE  color 
)

Plot an array of pixels.

Parameters:
x - Array of X positions.
y - Array of Y positions.
count - Number of pixels to plot.
color - Color of pixel.

void JRenderer::FillPolygon ( float *  x,
float *  y,
int  count,
PIXEL_TYPE  color 
)

Draw polygon with filled colour.

Parameters:
x - Array of X positions.
y - Array of Y positions.
count - Side count of the polygon.
color - Filling colour.

void JRenderer::DrawPolygon ( float *  x,
float *  y,
int  count,
PIXEL_TYPE  color 
)

Draw polygon.

Parameters:
x - Array of X positions.
y - Array of Y positions.
count - Side count of the polygon.
color - Draw colour.

void JRenderer::DrawPolygon ( float  x,
float  y,
float  size,
int  count,
float  startingAngle,
PIXEL_TYPE  color 
)

Draw symmetric polygon with certain number of sides.

Parameters:
x - X positions of center of the polygon.
y - Y positions of center of the polygon.
size - Size of polygon.
count - Side count of the polygon.
startingAngle - Rotation angle of the polygon.
color - Draw colour.

void JRenderer::FillPolygon ( float  x,
float  y,
float  size,
int  count,
float  startingAngle,
PIXEL_TYPE  color 
)

Draw solid symmetric polygon with certain number of sides.

Parameters:
x - X positions of center of the polygon.
y - Y positions of center of the polygon.
size - Size of polygon.
count - Side count of the polygon.
startingAngle - Rotation angle of the polygon.
color - Filling colour.

void JRenderer::FillCircle ( float  x,
float  y,
float  radius,
PIXEL_TYPE  color 
)

Draw circle with filled colour.

Parameters:
x - X positions of center of the circle.
y - Y positions of center of the circle.
radius - Radius of circle.
color - Filling colour.

void JRenderer::DrawCircle ( float  x,
float  y,
float  radius,
PIXEL_TYPE  color 
)

Draw circle.

Parameters:
x - X positions of center of the circle.
y - Y positions of center of the circle.
radius - Radius of circle.
color - Draw colour.

void JRenderer::DrawRoundRect ( float  x,
float  y,
float  w,
float  h,
float  radius,
PIXEL_TYPE  color 
)

Draw a rectangle with round corners.

Parameters:
x - Starting x position.
y - Starting y position.
w - Width of the rectangle.
h - Height of the rectangle.
radius - Radius of the round corners.
color - Drawing color.

void JRenderer::FillRoundRect ( float  x,
float  y,
float  w,
float  h,
float  radius,
PIXEL_TYPE  color 
)

Draw filled rectangle with round corners.

Parameters:
x - Starting x position.
y - Starting y position.
w - Width of the rectangle.
h - Height of the rectangle.
radius - Radius of the round corners.
color - Filling color.

void JRenderer::SetImageFilter ( JImageFilter imageFilter  ) 

Set custom image filter to be used at texture loading.

Parameters:
imageFilter - Custom image filter.


Generated on Mon Oct 22 00:28:22 2007 for JGE++ by  doxygen 1.5.3