22 #ifndef WINTERMUTE_BASE_RENDER_OPENGL3D_H 23 #define WINTERMUTE_BASE_RENDER_OPENGL3D_H 25 #include "engines/wintermute/base/gfx/base_renderer3d.h" 26 #include "engines/wintermute/math/vector2.h" 27 #include "engines/wintermute/dctypes.h" 29 #include "graphics/transform_struct.h" 31 #if defined(USE_OPENGL_GAME) 33 #include "graphics/opengl/system_headers.h" 37 class BaseSurfaceOpenGL3D;
39 class BaseRenderOpenGL3D :
public BaseRenderer3D {
40 friend class BaseSurfaceOpenGL3D;
41 friend class Mesh3DSOpenGL;
42 friend class XMeshOpenGL;
43 friend class ShadowVolumeOpenGL;
57 struct RectangleVertex {
63 struct SimpleShadowVertex {
75 BaseRenderOpenGL3D(BaseGame *inGame =
nullptr);
76 ~BaseRenderOpenGL3D()
override;
78 bool invalidateTexture(BaseSurfaceOpenGL3D *texture)
override;
80 bool invalidateDeviceObjects()
override;
81 bool restoreDeviceObjects()
override;
83 bool resetDevice()
override;
85 void setSpriteBlendMode(Graphics::TSpriteBlendMode blendMode,
bool forceChange =
false)
override;
87 void setAmbientLightRenderState()
override;
89 int getMaxActiveLights()
override;
90 void lightEnable(
int index,
bool enable)
override;
91 void setLightParameters(
int index,
const DXVector3 &position,
const DXVector3 &direction,
const DXVector4 &diffuse,
bool spotlight)
override;
93 void enableCulling()
override;
94 void disableCulling()
override;
96 bool enableShadows()
override;
97 bool disableShadows()
override;
98 bool stencilSupported()
override;
100 BaseImage *takeScreenshot(
int newWidth = 0,
int newHeight = 0)
override;
101 void fadeToColor(byte r, byte g, byte b, byte a)
override;
103 bool flip()
override;
104 bool clear()
override;
106 bool setViewport(
int left,
int top,
int right,
int bottom)
override;
107 bool fillRect(
int x,
int y,
int w,
int h, uint32 color)
override;
109 DXMatrix *buildMatrix(DXMatrix* out,
const DXVector2 *centre,
const DXVector2 *scaling,
float angle);
110 void transformVertices(
struct SpriteVertex *vertices,
const DXVector2 *centre,
const DXVector2 *scaling,
float angle);
112 bool setProjection()
override;
113 bool setProjection2D();
114 bool setWorldTransform(
const DXMatrix &transform)
override;
115 bool setViewTransform(
const DXMatrix &transform)
override;
116 bool setProjectionTransform(
const DXMatrix &transform)
override;
118 bool initRenderer(
int width,
int height,
bool windowed)
override;
119 bool setup2D(
bool force =
false)
override;
120 bool setup3D(Camera3D *camera,
bool force =
false)
override;
123 return "OpenGL 3D renderer";
125 bool displayDebugInfo()
override {
126 return STATUS_FAILED;
128 bool drawShaderQuad()
override {
129 return STATUS_FAILED;
132 float getScaleRatioX()
const override {
135 float getScaleRatioY()
const override {
139 BaseSurface *createSurface()
override;
141 bool startSpriteBatch()
override;
142 bool endSpriteBatch()
override;
143 bool commitSpriteBatch()
override;
145 bool drawSpriteEx(BaseSurface *texture,
const Common::Rect32 &rect,
const Vector2 &pos,
const Vector2 &rot,
const Vector2 &
scale,
146 float angle, uint32 color,
bool alphaDisable, Graphics::TSpriteBlendMode blendMode,
bool mirrorX,
bool mirrorY)
override;
148 void renderSceneGeometry(
const BaseArray<AdWalkplane *> &planes,
const BaseArray<AdBlock *> &blocks,
149 const BaseArray<AdGeneric *> &generics,
const BaseArray<Light3D *> &lights, Camera3D *camera)
override;
150 void renderShadowGeometry(
const BaseArray<AdWalkplane *> &planes,
const BaseArray<AdBlock *> &blocks,
const BaseArray<AdGeneric *> &generics, Camera3D *camera)
override;
152 Mesh3DS *createMesh3DS()
override;
153 XMesh *createXMesh()
override;
154 ShadowVolume *createShadowVolume()
override;
156 bool setViewport3D(DXViewport *viewport)
override;
158 void postfilter()
override;
159 void setPostfilter(PostFilter postFilter)
override { _postFilterMode = postFilter; };
163 void displaySimpleShadow(BaseObject *
object)
override;
165 Graphics::TSpriteBlendMode _blendMode;
166 SimpleShadowVertex _simpleShadow[4];
169 GLuint _postfilterTexture;
174 #endif // defined(USE_OPENGL_GAME)
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: achievements_tables.h:27