#include <renderer.h>
Public Methods | |
Renderer (int w, int h, int depth, bool fullscr) | |
~Renderer () | |
void | setVideoMode (int w, int, int depth, bool fullscr) |
int | getScreenW () |
int | getScreenH () |
int | getScreenDepth () |
bool | getFullScreen () |
void | toggleFullScreen () |
void | toggleWireframe () |
void | swapBuffers () |
void | clearBuffer () |
void | renderSelectionBox (Vector p1, Vector p2) |
void | renderBox (Vector p1, Vector p2, float r, float g, float b, float a, GLint textureid=0) |
void | renderBox (Vector p1, Vector p2, Color col, GLint textureid=0) |
void | renderBox (Vector p1, Vector p2, Vector textureoff1, Vector textureoff2, float r, float g, float b, float a, GLint textureid) |
void | renderBox (Vector p1, Vector p2, Vector textureoff1, Vector textureoff2, Color col, GLint textureid) |
void | setRenderingMode (enum RenderingModes mode) |
void | renderMouseCursor (Vector p) |
void | renderPoint (Vector pos, Color col, float size=1) |
void | initCamera () |
void | setCameraMode (enum CameraModes mode) |
void | setCameraLookAtDistance (float dist) |
void | adjustCameraLookAtDistance (float adjdist) |
float | getCameraLookAtDistance () const |
void | setCameraPosition (float x, float y, float z, bool updateLookat=true) |
void | setCameraPosition (Vector pos, bool updateLookat=true) |
void | setCameraLookAt (Vector pos, bool updatePosition=true) |
void | setCameraAltitude (float z) |
Vector | getCameraPosition () |
Vector | getCameraLookAt () |
void | moveCameraForward (float forward) |
void | moveCameraXYZ (float x, float y, float z=0, bool updateLookat=true) |
void | moveCamera2DRight (float x) |
void | moveCamera2DUp (float y) |
void | setCameraAngle (float angle, float pitch) |
void | rotateCameraAngle (float angle, float pitch) |
void | applyCamera (float prevPosWeight=0.0) |
bool | cameraMoved () |
Vector | screenToWorld (int x, int y, float z=-1) |
Vector | screenToWorld (float x, float y, float z=-1) |
Vector | worldToScreen (Vector &objpos) |
bool | checkError (const char *str=NULL) |
tgl_object * | loadTGLObject (const char *fname) |
tgl_object * | getTGLObject (const char *fname) |
void | freeTGLObject (const char *fname) |
Texture * | loadTexture (const char *texturefile, enum AlphaModes alpha=BLEND_ALPHA, bool mipmap=false, int minfilter=GL_NEAREST, int magfilter=GL_NEAREST, int wrapmode=GL_CLAMP) |
GLint | getTextureID (const char *texturefile, bool warn=true) |
Texture * | getTexture (const char *texturefile, bool warn=true) |
void | setFont (BFont *font) |
void | renderText (int x, int y, const char *str) |
void | renderText (float x, float y, const char *str) |
float | textLength (const char *str) |
Private Types | |
typedef void(* | GL_ActiveTextureARB_Func )(GLenum) |
typedef void(* | GL_MultiTexCoord2fARB_Func )(GLenum, GLfloat, GLfloat) |
Private Methods | |
void | set3DModelView () |
Private Attributes | |
GL_ActiveTextureARB_Func | glActiveTextureARB_ptr |
GL_MultiTexCoord2fARB_Func | glMultiTexCoord2fARB_ptr |
float | fogColor [4] |
enum RenderingModes | currentRenderingMode |
int | screen_h |
int | screen_w |
int | screen_depth |
bool | fullscreen |
SDL_Surface * | screen |
bool | multitexturing |
bool | wireframe |
bool | camera_moved |
bool | camera_changed |
float | cameraAngle |
float | cameraPitch |
float | cameraDistance |
Vector | lookAt |
Vector | lookUp |
Vector | cameraPosition |
Vector | smoothLookAt |
Vector | smoothLookUp |
Vector | smoothCameraPosition |
float | maxViewDistance |
enum CameraModes | cameraMode |
tgl_object * | objects [MAX_TGL_OBJECTS] |
int | object_clients [MAX_TGL_OBJECTS] |
char | object_file_names [MAX_TGL_OBJECTS][MAX_FILE_NAME_LEN] |
Texture * | textures [MAX_TEXTURES] |
BFont * | currentfont |
|
|
|
|
|
Constructor. w=screen width (pixels), h=screen height (pixels), depth=screen BPP (0=current depth), fullscr=use fullscreen mode if true.
|
|
Destructor.
|
|
Adjust distance between camera and lookat point.
|
|
Apply camera trasformations. Variable prevPosWeight can be float between 0.0 and 1.0 which determines how fast the actual camera parameters changes (cool smooth movement effect).
|
|
Returns true if camera has changed/moved by last applyCamera call.
|
|
Check GL/SDL errors. Returns true if error occurred. str=name of error source or NULL.
|
|
Clear GL doublebuffer.
|
|
Unload TGL object. This unloads object only if it doesn't have any clients.
|
|
Get camera lookat position.
|
|
Return distance between camera and lookat point.
|
|
Get camera position.
|
|
Returns true if fullscreen mode is active.
|
|
Returns screen depth (bits per pixel). 0 means default depth.
|
|
Returns screen height in pixels.
|
|
Returns screen width in pixels.
|
|
Returns existing TGL object.
|
|
Retrurn a pointer to Texture class for specified file, Returns NULL if texture not loaded. Parameter warn is only used by loadTexture.
|
|
Return GL texture ID for texture file, if error occurred return value is 0. Note: You have to load textures separately. Parameter warn is only used by loadTexture.
|
|
Initialize camera, this must be called before any other camera operations.
|
|
Load and return newly created TGL object. All loaded objects must be deleted with freeTGLObject. Every model is loaded only once and after first call it returns already loaded model pointer.
|
|
Load and return Texture for texture file. AlphaModes are BLEND_ALPHA, BLEND_SOLID, BLEND_RGB ((r+g+b)/3), BLEND_RGBDIST (sqrt(r2+g2+b2)) or BLEND_STENCIL (1-bit alpha, pure white color is transparent). Currently supports PNG-files.
|
|
Move camera right and left (strafe). x=distance to move.
|
|
Move camera up and down. y=distance to move.
|
|
Move camera towards lookat. forward=distance to move.
|
|
Move camera in x,y,z-space. To leave camera lookat position untouched set updateLookat as false.
|
|
Render a 2d box with custom Color and texture, used in text rendering. texoff1 and texoff2 specifies texture rendering offsets.
|
|
Render a 2d box with custom color (RGBA) and texture, used in text rendering. texoff1 and texoff2 specifies texture rendering offsets.
|
|
Render a 2d box with custom Color, used in GUI rendering. Texture is rendered if textureid is some GL texture ID.
|
|
Render a 2d box with custom color (RGBA), used in GUI rendering. Texture is rendered if textureid is some GL texture ID.
|
|
Render 2d mouse cursor at p.
|
|
Render 2d point at position (pos) wit custom color (col). Size is point radius in pixels.
|
|
Render a 2d selection box.
|
|
|
|
Render str at position (x,y) with custom font.
|
|
Adjust camera angle. angle=rotation around the z-axis, pitch=rotation around the x-axis.
|
|
2d to 3d transoform.
|
|
2d to 3d transoform, if z=-1, the depth value is read from depth buffer.
|
|
Set camera matrices.
|
|
Set camera z (altitude).
|
|
Set angle. angle=rotation around the z-axis, pitch=rotation around the x-axis.
|
|
Set camera 3d lookat position to pos. To leave camera eye position position untouched set updateLookat as false.
|
|
Set distance from camera to lookat point. Distance must be >= 0.001.
|
|
Set camera movement modes: CAMERA_ORBIT or CAMERA_FREE. In orbit mode camera rotates around lookat point but in free mode it rotates around camera position.
|
|
Set camera 3d position to pos, To leave camera lookat position untouched set updateLookat as false.
|
|
Set camera 3d position to (x, y, z). To leave camera lookat position untouched set updateLookat as false.
|
|
Set font. Font must be set before other text methods are usable.
|
|
Set OpenGL state for different operations, enums: RENDER_TGL_OBJECT, RENDER_INTERFACE, RENDER_TERRAIN.
|
|
Update GL viewport when resizing rendering window.
|
|
Swap GL doublebuffers.
|
|
Return a lenghth in pixels of a string with curren font.
|
|
Toggle between fullscreen and windowed mode.
|
|
Toggle wireframe/solid rendering.
|
|
3d to 2d transoform, return objpos in window coordinates.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|