ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <gfx_opengl_shaders.h>

Inheritance diagram for Grim::GfxOpenGLS:
Collaboration diagram for Grim::GfxOpenGLS:

List of all members.

Classes

struct  Light

Public Member Functions

 GfxOpenGLS ()
virtual ~GfxOpenGLS ()
virtual bytesetupScreen (int screenW, int screenH, bool fullscreen) override
 Creates a render-context.
virtual bool isHardwareAccelerated () override
 Query whether the current context is hardware-accelerated.
virtual bool supportsShaders () override
 Query whether the current context supports shaders.
virtual void setupCameraFrustum (float fov, float nclip, float fclip) override
virtual void positionCamera (const Math::Vector3d &pos, const Math::Vector3d &interest, float roll) override
virtual void positionCamera (const Math::Vector3d &pos, const Math::Matrix4 &rot) override
virtual Math::Matrix4 getModelView () override
virtual Math::Matrix4 getProjection () override
virtual void clearScreen () override
virtual void clearDepthBuffer () override
virtual void flipBuffer () override
 Swap the buffers, making the drawn screen visible.
virtual void getScreenBoundingBox (const Mesh *mesh, int *x1, int *y1, int *x2, int *y2) override
 FIXME: The implementations of these functions (for Grim and EMI, respectively) are very similar.
virtual void getScreenBoundingBox (const EMIModel *model, int *x1, int *y1, int *x2, int *y2) override
void getActorScreenBBox (const Actor *actor, Common::Point &p1, Common::Point &p2) override
virtual void startActorDraw (const Actor *actor) override
virtual void finishActorDraw () override
virtual void setShadow (Shadow *shadow) override
virtual void drawShadowPlanes () override
virtual void setShadowMode () override
virtual void clearShadowMode () override
virtual bool isShadowModeActive () override
virtual void setShadowColor (byte r, byte g, byte b) override
virtual void getShadowColor (byte *r, byte *g, byte *b) override
virtual void destroyShadow (Shadow *shadow) override
virtual void set3DMode () override
virtual void translateViewpointStart () override
virtual void translateViewpoint (const Math::Vector3d &vec) override
virtual void rotateViewpoint (const Math::Angle &angle, const Math::Vector3d &axis) override
virtual void rotateViewpoint (const Math::Matrix4 &rot) override
virtual void translateViewpointFinish () override
virtual void drawEMIModelFace (const EMIModel *model, const EMIMeshFace *face) override
virtual void drawModelFace (const Mesh *mesh, const MeshFace *face) override
virtual void drawSprite (const Sprite *sprite) override
virtual void drawMesh (const Mesh *mesh) override
virtual void drawDimPlane () override
virtual void enableLights () override
virtual void disableLights () override
virtual void setupLight (Light *light, int lightId) override
virtual void turnOffLight (int lightId) override
virtual void createTexture (Texture *texture, const uint8 *data, const CMap *cmap, bool clamp) override
virtual void selectTexture (const Texture *texture) override
virtual void destroyTexture (Texture *texture) override
virtual void createBitmap (BitmapData *bitmap) override
 Prepares a bitmap for drawing performs any format conversions needed for the renderer, and might create an internal representation of the bitmap external changes to the bitmap may not be visible after this is called.
virtual void drawBitmap (const Bitmap *bitmap, int x, int y, uint32 layer=0) override
 Draws a bitmap before this is safe to use, createBitmap MUST have been called.
virtual void destroyBitmap (BitmapData *bitmap) override
 Deletes any internal references and representations of a bitmap after this is called, it is safe to dispose of or change the external bitmapdata.
virtual void createFont (Font *font) override
virtual void destroyFont (Font *font) override
virtual void createTextObject (TextObject *text) override
virtual void drawTextObject (const TextObject *text) override
virtual void destroyTextObject (TextObject *text) override
virtual BitmapgetScreenshot (int w, int h, bool useStored) override
virtual void storeDisplay () override
virtual void copyStoredToDisplay () override
virtual void dimScreen () override
 Dims the entire screen Sets the entire screen to 10% of its current brightness, and converts it to grayscale.
virtual void dimRegion (int x, int y, int w, int h, float level) override
virtual void irisAroundRegion (int x1, int y1, int x2, int y2) override
 Draw a completely opaque Iris around the specified rectangle.
virtual void drawEmergString (int x, int y, const char *text, const Color &fgColor) override
virtual void loadEmergFont () override
virtual void drawRectangle (const PrimitiveObject *primitive) override
virtual void drawLine (const PrimitiveObject *primitive) override
virtual void drawPolygon (const PrimitiveObject *primitive) override
virtual void prepareMovieFrame (Graphics::Surface *frame) override
 Prepare a movie-frame for drawing performing any necessary conversion.
virtual void drawMovieFrame (int offsetX, int offsetY) override
virtual void releaseMovieFrame () override
 Release the currently prepared movie-frame, if one exists.
virtual const char * getVideoDeviceName () override
virtual void renderBitmaps (bool render) override
virtual void renderZBitmaps (bool render) override
virtual void createMesh (Mesh *mesh) override
virtual void destroyMesh (const Mesh *mesh) override
virtual void createEMIModel (EMIModel *model) override
virtual void updateEMIModel (const EMIModel *model) override
virtual void destroyEMIModel (EMIModel *model) override
virtual void setBlendMode (bool additive) override

Protected Member Functions

void setupShaders ()
GLuint compileShader (const char *vertex, const char *fragment)
GLuint compileShader (const char *shader)
void createSpecialtyTextureFromScreen (uint id, uint8 *data, int x, int y, int width, int height) override

Private Member Functions

void setupTexturedQuad ()
void setupQuadEBO ()
void setupZBuffer ()
void drawDepthBitmap (int x, int y, int w, int h, char *data)
void setupTexturedCenteredQuad ()
void setupPrimitives ()
GLuint nextPrimitive ()
void drawGenericPrimitive (const float *vertices, uint32 numVertices, const PrimitiveObject *primitive)

Private Attributes

const Actor_currentActor
float _alpha
int _maxLights
GLuint _emergTexture
OpenGL::Shader_emergProgram
OpenGL::Shader_backgroundProgram
OpenGL::Shader_actorProgram
OpenGL::Shader_spriteProgram
OpenGL::Shader_dimProgram
OpenGL::Shader_dimPlaneProgram
OpenGL::Shader_dimRegionProgram
OpenGL::Shader_smushProgram
GLuint _smushVBO
GLuint _quadEBO
OpenGL::Shader_textProgram
OpenGL::Shader_primitiveProgram
OpenGL::Shader_irisProgram
OpenGL::Shader_shadowPlaneProgram
int _smushWidth
int _smushHeight
GLuint _smushTexId
bool _smushSwizzle
bool _smushSwap
float _fov
float _nclip
float _fclip
Math::Matrix4 _projMatrix
Math::Matrix4 _viewMatrix
Math::Matrix4 _mvpMatrix
Math::Matrix4 _overworldProjMatrix
GLuint _spriteVBO
Common::Stack< Math::Matrix4_matrixStack
Texture_selectedTexture
GLuint _zBufTex
Math::Vector2d _zBufTexCrop
Light_lights
bool _hasAmbientLight
bool _lightsEnabled
GLuint _primitiveVBOs [32]
uint32 _currentPrimitive
GLuint _irisVBO
GLuint _dimVBO
GLuint _dimRegionVBO
GLuint _blastVBO
GLuint _storedDisplay

Detailed Description

Definition at line 34 of file gfx_opengl_shaders.h.


Constructor & Destructor Documentation

Grim::GfxOpenGLS::GfxOpenGLS (  ) 
virtual Grim::GfxOpenGLS::~GfxOpenGLS (  )  [virtual]

Member Function Documentation

virtual void Grim::GfxOpenGLS::clearDepthBuffer (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::clearScreen (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::clearShadowMode (  )  [override, virtual]

Reimplemented from Grim::GfxBase.

GLuint Grim::GfxOpenGLS::compileShader ( const char *  vertex,
const char *  fragment 
) [protected]
GLuint Grim::GfxOpenGLS::compileShader ( const char *  shader  )  [inline, protected]

Definition at line 217 of file gfx_opengl_shaders.h.

virtual void Grim::GfxOpenGLS::copyStoredToDisplay (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::createBitmap ( BitmapData bitmap  )  [override, virtual]

Prepares a bitmap for drawing performs any format conversions needed for the renderer, and might create an internal representation of the bitmap external changes to the bitmap may not be visible after this is called.

Must be called before drawBitmap can be used.

the external bitmap might have its data changed by this function,

Parameters:
bitmap the bitmap to be prepared
See also:
destroyBitmap
drawBitmap

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::createEMIModel ( EMIModel model  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::createFont ( Font font  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::createMesh ( Mesh mesh  )  [override, virtual]

Reimplemented from Grim::GfxBase.

void Grim::GfxOpenGLS::createSpecialtyTextureFromScreen ( uint  id,
uint8 data,
int  x,
int  y,
int  width,
int  height 
) [override, protected, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::createTextObject ( TextObject text  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::createTexture ( Texture texture,
const uint8 data,
const CMap cmap,
bool  clamp 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyBitmap ( BitmapData bitmap  )  [override, virtual]

Deletes any internal references and representations of a bitmap after this is called, it is safe to dispose of or change the external bitmapdata.

Parameters:
bitmap the bitmap to be destroyed
See also:
createBitmap
drawBitmap

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyEMIModel ( EMIModel model  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyFont ( Font font  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyMesh ( const Mesh mesh  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyShadow ( Shadow shadow  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyTextObject ( TextObject text  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::destroyTexture ( Texture texture  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::dimRegion ( int  x,
int  y,
int  w,
int  h,
float  level 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::dimScreen (  )  [override, virtual]

Dims the entire screen Sets the entire screen to 10% of its current brightness, and converts it to grayscale.

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::disableLights (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawBitmap ( const Bitmap bitmap,
int  x,
int  y,
uint32  layer = 0 
) [override, virtual]

Draws a bitmap before this is safe to use, createBitmap MUST have been called.

Parameters:
bitmap the bitmap to be drawn
See also:
createBitmap
destroyBitmap

Implements Grim::GfxBase.

void Grim::GfxOpenGLS::drawDepthBitmap ( int  x,
int  y,
int  w,
int  h,
char *  data 
) [private]
virtual void Grim::GfxOpenGLS::drawDimPlane (  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawEmergString ( int  x,
int  y,
const char *  text,
const Color fgColor 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawEMIModelFace ( const EMIModel model,
const EMIMeshFace face 
) [override, virtual]

Implements Grim::GfxBase.

void Grim::GfxOpenGLS::drawGenericPrimitive ( const float *  vertices,
uint32  numVertices,
const PrimitiveObject primitive 
) [private]
virtual void Grim::GfxOpenGLS::drawLine ( const PrimitiveObject primitive  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawMesh ( const Mesh mesh  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawModelFace ( const Mesh mesh,
const MeshFace face 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawMovieFrame ( int  offsetX,
int  offsetY 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawPolygon ( const PrimitiveObject primitive  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawRectangle ( const PrimitiveObject primitive  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawShadowPlanes (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawSprite ( const Sprite sprite  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::drawTextObject ( const TextObject text  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::enableLights (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::finishActorDraw (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::flipBuffer (  )  [override, virtual]

Swap the buffers, making the drawn screen visible.

Implements Grim::GfxBase.

void Grim::GfxOpenGLS::getActorScreenBBox ( const Actor actor,
Common::Point p1,
Common::Point p2 
) [override, virtual]

Implements Grim::GfxBase.

virtual Math::Matrix4 Grim::GfxOpenGLS::getModelView (  )  [override, virtual]

Implements Grim::GfxBase.

virtual Math::Matrix4 Grim::GfxOpenGLS::getProjection (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::getScreenBoundingBox ( const Mesh mesh,
int *  x1,
int *  y1,
int *  x2,
int *  y2 
) [override, virtual]

FIXME: The implementations of these functions (for Grim and EMI, respectively) are very similar.

Needs refactoring. See issue #789.

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::getScreenBoundingBox ( const EMIModel model,
int *  x1,
int *  y1,
int *  x2,
int *  y2 
) [override, virtual]

Implements Grim::GfxBase.

virtual Bitmap* Grim::GfxOpenGLS::getScreenshot ( int  w,
int  h,
bool  useStored 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::getShadowColor ( byte r,
byte g,
byte b 
) [override, virtual]

Implements Grim::GfxBase.

virtual const char* Grim::GfxOpenGLS::getVideoDeviceName (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::irisAroundRegion ( int  x1,
int  y1,
int  x2,
int  y2 
) [override, virtual]

Draw a completely opaque Iris around the specified rectangle.

the arguments specify the distance from the screen-edge to the first non-iris pixel.

Parameters:
x the width of the Iris
y the height of the Iris

Implements Grim::GfxBase.

virtual bool Grim::GfxOpenGLS::isHardwareAccelerated (  )  [inline, override, virtual]

Query whether the current context is hardware-accelerated.

Returns:
true if hw-accelerated, false otherwise

Implements Grim::GfxBase.

Definition at line 53 of file gfx_opengl_shaders.h.

virtual bool Grim::GfxOpenGLS::isShadowModeActive (  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::loadEmergFont (  )  [override, virtual]

Implements Grim::GfxBase.

GLuint Grim::GfxOpenGLS::nextPrimitive (  )  [private]
virtual void Grim::GfxOpenGLS::positionCamera ( const Math::Vector3d pos,
const Math::Vector3d interest,
float  roll 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::positionCamera ( const Math::Vector3d pos,
const Math::Matrix4 rot 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::prepareMovieFrame ( Graphics::Surface frame  )  [override, virtual]

Prepare a movie-frame for drawing performing any necessary conversion.

Parameters:
width the width of the movie-frame.
height the height of the movie-frame.
bitmap a pointer to the data for the movie-frame.
See also:
drawMovieFrame
releaseMovieFrame

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::releaseMovieFrame (  )  [override, virtual]

Release the currently prepared movie-frame, if one exists.

See also:
drawMovieFrame
prepareMovieFrame

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::renderBitmaps ( bool  render  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::renderZBitmaps ( bool  render  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::rotateViewpoint ( const Math::Angle angle,
const Math::Vector3d axis 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::rotateViewpoint ( const Math::Matrix4 rot  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::selectTexture ( const Texture texture  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::set3DMode (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::setBlendMode ( bool  additive  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::setShadow ( Shadow shadow  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::setShadowColor ( byte  r,
byte  g,
byte  b 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::setShadowMode (  )  [override, virtual]

Reimplemented from Grim::GfxBase.

virtual void Grim::GfxOpenGLS::setupCameraFrustum ( float  fov,
float  nclip,
float  fclip 
) [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::setupLight ( Light light,
int  lightId 
) [override, virtual]
void Grim::GfxOpenGLS::setupPrimitives (  )  [private]
void Grim::GfxOpenGLS::setupQuadEBO (  )  [private]
virtual byte* Grim::GfxOpenGLS::setupScreen ( int  screenW,
int  screenH,
bool  fullscreen 
) [override, virtual]

Creates a render-context.

Parameters:
screenW the width of the context
screenH the height of the context
fullscreen true if fullscreen is desired, false otherwise.

Implements Grim::GfxBase.

void Grim::GfxOpenGLS::setupShaders (  )  [protected]
void Grim::GfxOpenGLS::setupTexturedCenteredQuad (  )  [private]
void Grim::GfxOpenGLS::setupTexturedQuad (  )  [private]
void Grim::GfxOpenGLS::setupZBuffer (  )  [private]
virtual void Grim::GfxOpenGLS::startActorDraw ( const Actor actor  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::storeDisplay (  )  [override, virtual]

Implements Grim::GfxBase.

virtual bool Grim::GfxOpenGLS::supportsShaders (  )  [inline, override, virtual]

Query whether the current context supports shaders.

Returns:
true if supports shaders, false otherwise

Implements Grim::GfxBase.

Definition at line 54 of file gfx_opengl_shaders.h.

virtual void Grim::GfxOpenGLS::translateViewpoint ( const Math::Vector3d vec  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::translateViewpointFinish (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::translateViewpointStart (  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::turnOffLight ( int  lightId  )  [override, virtual]

Implements Grim::GfxBase.

virtual void Grim::GfxOpenGLS::updateEMIModel ( const EMIModel model  )  [override, virtual]

Reimplemented from Grim::GfxBase.


Member Data Documentation

float Grim::GfxOpenGLS::_alpha [private]

Definition at line 222 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_blastVBO [private]

Definition at line 288 of file gfx_opengl_shaders.h.

Definition at line 221 of file gfx_opengl_shaders.h.

Definition at line 283 of file gfx_opengl_shaders.h.

Definition at line 230 of file gfx_opengl_shaders.h.

Definition at line 287 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_dimVBO [private]

Definition at line 286 of file gfx_opengl_shaders.h.

Definition at line 224 of file gfx_opengl_shaders.h.

float Grim::GfxOpenGLS::_fclip [private]

Definition at line 253 of file gfx_opengl_shaders.h.

float Grim::GfxOpenGLS::_fov [private]

Definition at line 251 of file gfx_opengl_shaders.h.

Definition at line 277 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_irisVBO [private]

Definition at line 285 of file gfx_opengl_shaders.h.

Definition at line 276 of file gfx_opengl_shaders.h.

Definition at line 278 of file gfx_opengl_shaders.h.

Definition at line 223 of file gfx_opengl_shaders.h.

Definition at line 256 of file gfx_opengl_shaders.h.

float Grim::GfxOpenGLS::_nclip [private]

Definition at line 252 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_primitiveVBOs[32] [private]

Definition at line 282 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_quadEBO [private]

Definition at line 234 of file gfx_opengl_shaders.h.

Definition at line 264 of file gfx_opengl_shaders.h.

Definition at line 241 of file gfx_opengl_shaders.h.

Definition at line 244 of file gfx_opengl_shaders.h.

Definition at line 243 of file gfx_opengl_shaders.h.

Definition at line 242 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_smushVBO [private]

Definition at line 234 of file gfx_opengl_shaders.h.

Definition at line 240 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_spriteVBO [private]

Definition at line 261 of file gfx_opengl_shaders.h.

Definition at line 289 of file gfx_opengl_shaders.h.

GLuint Grim::GfxOpenGLS::_zBufTex [private]

Definition at line 266 of file gfx_opengl_shaders.h.


The documentation for this class was generated from the following file:


Generated on Sat Jul 20 2019 05:03:01 for ResidualVM by doxygen 1.7.1
curved edge   curved edge