1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "watchmaker/sdl_wrapper.h"
#include "watchmaker/render.h"
#include "watchmaker/utils.h"
#include "watchmaker/ll/ll_system.h"
#include "watchmaker/tga_util.h"
#include "common/stream.h"
#include "watchmaker/game.h"
#include "watchmaker/rect.h"
#include "watchmaker/renderer.h"
#if defined(USE_OPENGL_GAME)
#include "graphics/opengl/system_headers.h"
#include "math/glmath.h"
#define MAXTEXTURES 2000
#define MAX_BITMAP_LIST 1024
namespace Watchmaker {
bool rInitialize3DEnvironment(WGame &game, char *cfg) {
warning("STUBBED: rInitialize3DEnvironment");
game.sdl->initWindow();
game._renderer->initGL();
return true;
}
#if 0
//*********************************************************************************************
unsigned int gGetTextureListPosition() {
unsigned int pos = 1;
while (gTextureList[pos].surface != NULL) {
pos++;
}
if (pos > MAXTEXTURES)
return 0;
if (pos > gNumTextureList)
gNumTextureList = pos;
return pos;
}
#endif
void rSetRenderMode(int state) {
warning("STUBBED: rSetRenderMode");
}
bool checkGlError(const char *when) {
GLenum error = glGetError();
if (error != GL_NO_ERROR) {
Common::String explanation = "";
switch (error) {
case GL_INVALID_ENUM: explanation = "GL_INVALID_ENUM"; break;
case GL_INVALID_VALUE: explanation = "GL_INVALID_VALUE"; break;
case GL_INVALID_OPERATION: explanation = "GL_INVALID_OPERATION"; break;
case GL_INVALID_FRAMEBUFFER_OPERATION: explanation = "GL_INVALID_FRAMEBUFFER_OPERATION"; break;
case GL_OUT_OF_MEMORY: explanation = "GL_OUT_OF_MEMORY"; break;
case GL_STACK_UNDERFLOW: explanation = "GL_STACK_UNDERFLOW"; break;
case GL_STACK_OVERFLOW: explanation = "GL_STACK_OVERFLOW"; break;
default: break;
}
warning("%s: GL raised error %d - %s", when, error, explanation.c_str());
return false;
}
return true;
}
bool rClearBuffers(char flags) {
checkGlError("Entering rClearBuffers");
bool clearStencil = rGetStencilBitDepth() != 0;
bool clearDepth = flags & rCLEARZBUFFER;
//bool clearBack = flags & rCLEARBACKBUFFER;
bool clearScreen = flags & rCLEARSCREENBUFFER;
// Picking green to make the clear color easy to spot.
glClearColor(0, 1, 0, 1);
GLbitfield mask = (clearStencil ? GL_STENCIL_BUFFER_BIT : 0) | (clearDepth ? GL_DEPTH_BUFFER_BIT : 0) | (clearScreen ? GL_COLOR_BUFFER_BIT : 0);
glClear(mask);
return checkGlError("rClearBuffers");
}
unsigned char *rLockSurfaceDirect(gTexture *t, unsigned int *pitch) {
warning("STUBBED: rLockSurfaceDirect");
return nullptr;
}
void rUnlockSurfaceDirect(gTexture *t) {
warning("STUBBED: rUnlockSurfaceDirect");
}
uint16 rRGBAToTextureFormat(unsigned int r, unsigned int g, unsigned int b, unsigned int a) {
warning("STUBBED: rRGBAToTextureFormat");
return 0;
}
bool rSetMovieFrame(MaterialPtr mat, uint32 dwCurrFrame) {
warning("STUBBED: rSetMovieFrame");
return false;
}
int rCreateSurface(unsigned int dimx, unsigned int dimy, unsigned char flags) {
warning("STUBBED: rCreateSurface");
return 0;
}
void *rCreateSurfaceP(unsigned int dimx, unsigned int dimy, unsigned char flags) {
warning("STUBBED: rCreateSurfaceP");
return nullptr;
}
VertexBuffer rCreateVertexBuffer(unsigned int num) {
//warning("STUBBED: rCreateVertexBuffer");
return VertexBuffer();
}
bool rDeleteVertexBuffer(VertexBuffer &vb) {
warning("STUBBED: rDeleteVertexBuffer");
return false;
}
void rGetScreenInfos(unsigned int *width, unsigned int *height, unsigned int *bpp) {
warning("STUBBED: rGetScreenInfos");
*width = 800;
*height = 600;
*bpp = 32;
}
gTexture *gLoadTexture(char *TextName, unsigned int loaderFlags) {
error("STUBBED gLoadTexture");
return nullptr;
}
bool rGrabVideo(const char *path, char flags) {
error("STUBBED: rGrabVideo");
return true;
}
void rReleaseAllBitmaps(unsigned int NotFlags) {
warning("STUBBED: rReleaseAllBitmaps");
return;
}
void rReleaseBitmap(int i) {
error("STUBBED: rReleaseBitmap");
return;
}
void rReleaseAllTextures(unsigned int NotFlags) {
warning("STUBBED: rReleaseAllTextures");
return;
}
void rSetBitmapName(unsigned int id, const char *s) {
error("STUBBED: rSetBitmapName");
return;
}
uint32 rGetMovieFrame(MaterialPtr mat) {
error("STUBBED: rGetMovieFrame");
return 0;
}
void rPrintText(const char *s, unsigned int dst, unsigned int src, unsigned short *FontTable, unsigned short x, unsigned short y) {
error("STUBBED: rPrintText");
return;
}
void rGetTextDim(const char *s, unsigned short *FontTable, int *x, int *y) {
error("STUBBED: rGetTextDim");
return;
}
} // End of namespace Watchmaker
#endif // USE_OPENGL_GAME
|