Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
|
#include <OpenGLRenderer.h>
Public Member Functions | |
OpenGLRenderer () | |
virtual | ~OpenGLRenderer () |
virtual bool | Initialize (const RenderParams *params) |
virtual void | Shutdown () |
virtual void | SetViewport (int x, int y, int width, int height) |
virtual void | ResizeWindow (float fov, float nearDist, float farDist, int width, int height) |
virtual void | ResizeWindowOrtho (int left, int right, int bottom, int top, float nearDist, float farDist) |
virtual void | SetClearColor (int r, int g, int b, int a) |
virtual void | StartRendering (bool color, bool depth, bool stencil) |
virtual void | EndRendering () |
virtual bool | Enable (RenderState state) |
virtual bool | Disable (RenderState state) |
virtual void | SetAlphaFunc (AlphaState state, float val) |
virtual void | SetView (float posX, float posY, float posZ, float lookX, float lookY, float lookZ, float upX, float upY, float upZ) |
virtual void | SetMatrix (const float *matrix) |
virtual void | MultiplyToCurrentMatrix (const float *m) |
virtual bool | SwitchMatrixType (MatrixType type) |
virtual void | GetMatrix (MatrixType type, float *matrix) |
virtual void | RotateMatrix (float angle, float x, float y, float z) |
virtual void | TranslateMatrix (float x, float y, float z) |
virtual void | LoadIdentityMatrix () |
virtual void | PushMatrix () |
virtual void | PopMatrix () |
virtual void | ApplyFilters (Texture &handle, FilterListPtr filters) |
virtual bool | AddEmptyTexture (const char *name, int width, int height, int numComponents, TextureType type, TextureFormat format, Texture *handle) |
virtual bool | LoadTexFromFile (const char *fileName, TextureType type, Texture *handle) |
virtual bool | LoadTexFromMemory (const char *name, char *fileData, int length, TextureType type, Texture *handle) |
virtual bool | ApplyTexture (int texUnit, Texture &handle) |
virtual void | DeleteTexture (Texture &handle) |
virtual bool | CreateShaderFromFile (const char *vs, const char *ps, ShaderHandle *handle) |
virtual bool | CreateShaderFromMemory (const char *vsFile, const char *psFile, ShaderHandle *handle) |
virtual void | ApplyShader (ShaderHandle shader) |
virtual void | SetupShaderParameter (const char *pname, ShaderHandle shader, ParameterHandle *param) |
virtual void | SetShaderParameter1i (ParameterHandle param, float val) |
virtual void | SetShaderParameter1f (ParameterHandle param, float val) |
virtual void | SetShaderParameter2f (ParameterHandle param, float x, float y) |
virtual void | SetShaderParameter3f (ParameterHandle param, float x, float y, float z) |
virtual void | SetShaderParameter4f (ParameterHandle param, float x, float y, float z, float w) |
virtual void | Render (PrimitiveType type, VertexDescriptor *desc, char *vertexData, unsigned int *indices, int totalVertices, int totalIndices, int stride) |
Public Member Functions inherited from Ult::RenderInterface | |
RenderInterface () | |
virtual | ~RenderInterface () |
Protected Member Functions | |
bool | InitializeOS (const RenderParams *params) |
void | ShutdownOS () |
void | InitializeExtensions () |
Protected Attributes | |
VertexDescriptor * | mCurrentDesc |
bool | mVboSupport |
bool | mFboSupport |
bool | mGlslSupport |
GLuint | mVbo |
GLuint | mIbo |
ResourceManager< GLTexture, Texture > * | mTexManager |
std::vector< GLSLShader > | mShaders |
std::vector< GLSLParameter > | mParameters |
Protected Attributes inherited from Ult::RenderInterface | |
int | mRed |
int | mGreen |
int | mBlue |
int | mAlpha |
bool | mMultiTexSupport |
bool | mCubeMapSupport |
RenderParams | mParams |
CGcontext | mCgContext |
CGprofile | mVsProfile |
CGprofile | mPsProfile |
OpenGL implementation of the RenderInterface.
Ult::OpenGLRenderer::OpenGLRenderer | ( | ) |
|
virtual |
|
virtual |
Initialize an empty texture and store a handle to it in 'handle'.
Implements Ult::RenderInterface.
|
virtual |
Apply the input filters to the input texture.
Implements Ult::RenderInterface.
|
virtual |
Use the given input shader for rendering.
Implements Ult::RenderInterface.
|
virtual |
Use the given texture for rendering in the given texture unit.
Implements Ult::RenderInterface.
|
virtual |
Load/create a shader from the vertex/pixel files and store the result in handle.
Implements Ult::RenderInterface.
|
virtual |
Load/create a shader from vertex/pixel shader strings and store the result in handle.
Implements Ult::RenderInterface.
|
virtual |
Free the texture given by the input handle.
Implements Ult::RenderInterface.
|
virtual |
Disables the input render parameter.
Implements Ult::RenderInterface.
|
virtual |
Enables the input render parameter.
Implements Ult::RenderInterface.
|
virtual |
Updates the window, swaps front/back render buffers.
Implements Ult::RenderInterface.
|
virtual |
Copy the matrix of the input type into the input matrix (as 16 floats).
Implements Ult::RenderInterface.
|
virtual |
Initialize the render system with the given parameters. Assumes the window handle is already created/set.
Implements Ult::RenderInterface.
|
protected |
|
protected |
|
virtual |
Set the current matrix to an identity matrix.
Implements Ult::RenderInterface.
|
virtual |
Initialize a texture from a file and store a handle to it in 'handle'.
Implements Ult::RenderInterface.
|
virtual |
Initialize a texture from memory and store a handle to it in 'handle'.
Implements Ult::RenderInterface.
|
virtual |
Multiplies the input matrix (as 16 floats) with the current matrix type.
Implements Ult::RenderInterface.
|
virtual |
Pop the top of the internal matrix stack to the current matrix.
Implements Ult::RenderInterface.
|
virtual |
Push the current matrix to the internal matrix stack.
Implements Ult::RenderInterface.
|
virtual |
Render a buffer of primitives using the current renderer settings.
type | The type of primitives contained in vertexData. |
desc | Pointer to a descriptor listing the different elements within a single vertex. |
vertexData | Byte pointer to the buffer of vertices to render. |
indices | Optional pointer to an index buffer to render with. |
totalVertices | The size of vertexData in bytes. |
totalIndices | The count/number of indices contained in the indices pointer. |
stride | The size of 1 vertex in bytes. |
Implements Ult::RenderInterface.
|
virtual |
Update the size of the window. Recalculates the perspective-projection matrix with the given parameters.
Implements Ult::RenderInterface.
|
virtual |
Update the size of the window. Recalculates the projection matrix as an orthographic projection using the given parameters.
Implements Ult::RenderInterface.
|
virtual |
Applies a rotation about the given axis to the current matrix.
angle | Rotation angle in degrees. |
x,y,z | Axis of rotation. |
Implements Ult::RenderInterface.
|
virtual |
Sets the type of alpha blending to use during render.
Implements Ult::RenderInterface.
|
virtual |
Sets the background color of the window upon StartRendering.
Implements Ult::RenderInterface.
|
virtual |
Copy the input matrix (as 16 floats) to the current matrix type.
Implements Ult::RenderInterface.
|
virtual |
Set a shader uniform float to the given value.
Implements Ult::RenderInterface.
|
virtual |
Set a shader uniform int to the given value.
Implements Ult::RenderInterface.
|
virtual |
Set a shader uniform vec2 to the given values.
Implements Ult::RenderInterface.
|
virtual |
Set a shader uniform vec3 to the given values.
Implements Ult::RenderInterface.
|
virtual |
Set a shader uniform vec4 to the given values.
Implements Ult::RenderInterface.
|
virtual |
Store a handle to the shader uniform given by pname in the input shader into param. If the uniform isn't found, it prints an error message and does nothing.
Implements Ult::RenderInterface.
|
virtual |
Sets the camera/view/lookat matrix from the given parameters.
Implements Ult::RenderInterface.
|
virtual |
Sets the window viewport - position and size of the rendering area.
Implements Ult::RenderInterface.
|
virtual |
Deinits the render system. Does not free the render params window.
Implements Ult::RenderInterface.
|
protected |
|
virtual |
Clears the corresponding buffers if its boolean is set to true (color buffer, depth buffer, stencil buffer).
Implements Ult::RenderInterface.
|
virtual |
Change the currently used matrix to the input type.
Implements Ult::RenderInterface.
|
virtual |
Applies a translation of x,y,z to the current matrix.
Implements Ult::RenderInterface.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |