diff options
Diffstat (limited to 'src/render/vertexes')
-rw-r--r-- | src/render/vertexes/imagecollection.cpp | 52 | ||||
-rw-r--r-- | src/render/vertexes/imagecollection.h | 52 | ||||
-rw-r--r-- | src/render/vertexes/imagevertexes.cpp | 41 | ||||
-rw-r--r-- | src/render/vertexes/imagevertexes.h | 59 | ||||
-rw-r--r-- | src/render/vertexes/openglgraphicsvertexes.cpp | 225 | ||||
-rw-r--r-- | src/render/vertexes/openglgraphicsvertexes.h | 109 |
6 files changed, 0 insertions, 538 deletions
diff --git a/src/render/vertexes/imagecollection.cpp b/src/render/vertexes/imagecollection.cpp deleted file mode 100644 index 2c626e03d..000000000 --- a/src/render/vertexes/imagecollection.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 2 of the License, or - * 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 "render/vertexes/imagecollection.h" - -#include "utils/dtor.h" - -#include "debug.h" - -ImageCollection::ImageCollection() : -#ifdef USE_OPENGL - currentGLImage(0), -#endif // USE_OPENGL - currentImage(nullptr), - currentVert(nullptr), - draws() -{ -} - -ImageCollection::~ImageCollection() -{ - clear(); -} - -void ImageCollection::clear() restrict2 -{ -#ifdef USE_OPENGL - currentGLImage = 0; -#endif // USE_OPENGL - currentImage = nullptr; - currentVert = nullptr; - - delete_all(draws); - draws.clear(); -} diff --git a/src/render/vertexes/imagecollection.h b/src/render/vertexes/imagecollection.h deleted file mode 100644 index c5b9dfe55..000000000 --- a/src/render/vertexes/imagecollection.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 2 of the License, or - * 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/>. - */ - -#ifndef RENDER_VERTEXES_IMAGECOLLECTION_H -#define RENDER_VERTEXES_IMAGECOLLECTION_H - -#include "render/vertexes/imagevertexes.h" - -#include "localconsts.h" - -class Image; - -class ImageCollection final -{ - public: - ImageCollection(); - - A_DELETE_COPY(ImageCollection) - - ~ImageCollection(); - - void clear() restrict2; - -#ifdef USE_OPENGL - GLuint currentGLImage; -#endif // USE_OPENGL - - const Image *restrict currentImage; - - ImageVertexes *restrict currentVert; - - ImageVertexesVector draws; -}; - -#endif // RENDER_VERTEXES_IMAGECOLLECTION_H diff --git a/src/render/vertexes/imagevertexes.cpp b/src/render/vertexes/imagevertexes.cpp deleted file mode 100644 index 3aff57636..000000000 --- a/src/render/vertexes/imagevertexes.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 2 of the License, or - * 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 "render/vertexes/imagevertexes.h" - -#include "utils/dtor.h" - -#include "debug.h" - -ImageVertexes::ImageVertexes() : - image(nullptr), -#ifdef USE_OPENGL - ogl(), -#endif // USE_OPENGL - sdl() -{ - sdl.reserve(30); -} - -ImageVertexes::~ImageVertexes() -{ - delete_all(sdl); - sdl.clear(); -} diff --git a/src/render/vertexes/imagevertexes.h b/src/render/vertexes/imagevertexes.h deleted file mode 100644 index 01390c450..000000000 --- a/src/render/vertexes/imagevertexes.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 2 of the License, or - * 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/>. - */ - -#ifndef RENDER_VERTEXES_IMAGEVERTEXES_H -#define RENDER_VERTEXES_IMAGEVERTEXES_H - -#include "resources/rect/doublerect.h" - -#ifdef USE_OPENGL -#include "render/vertexes/openglgraphicsvertexes.h" -#else // USE_OPENGL -#include "utils/vector.h" -#endif // USE_OPENGL - -#include "localconsts.h" - -class Image; - -typedef STD_VECTOR<DoubleRect*> DoubleRects; - -class ImageVertexes final -{ - public: - ImageVertexes(); - - A_DELETE_COPY(ImageVertexes) - - ~ImageVertexes(); - - const Image *restrict image; -#ifdef USE_OPENGL - OpenGLGraphicsVertexes ogl; -#endif // USE_OPENGL - - DoubleRects sdl; -}; - -typedef STD_VECTOR<ImageVertexes*> ImageVertexesVector; -typedef ImageVertexesVector::iterator ImageCollectionIter; -typedef ImageVertexesVector::const_iterator ImageCollectionCIter; - -#endif // RENDER_VERTEXES_IMAGEVERTEXES_H diff --git a/src/render/vertexes/openglgraphicsvertexes.cpp b/src/render/vertexes/openglgraphicsvertexes.cpp deleted file mode 100644 index a65f0e2b9..000000000 --- a/src/render/vertexes/openglgraphicsvertexes.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 2 of the License, or - * 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/>. - */ - -#ifdef USE_OPENGL - -#include "render/vertexes/openglgraphicsvertexes.h" - -#include "render/graphics.h" - -#include "debug.h" - -unsigned int vertexBufSize = 500; - -OpenGLGraphicsVertexes::OpenGLGraphicsVertexes() : - ptr(0), - mFloatTexArray(nullptr), - mIntTexArray(nullptr), - mIntVertArray(nullptr), - mShortVertArray(nullptr), - mVp(), - mFloatTexPool(), - mIntVertPool(), - mShortVertPool(), - mIntTexPool(), - mVbo() -{ - mFloatTexPool.reserve(30); - mIntVertPool.reserve(30); - mShortVertPool.reserve(30); - mIntTexPool.reserve(30); - mVp.reserve(30); - mVbo.reserve(30); -} - -OpenGLGraphicsVertexes::~OpenGLGraphicsVertexes() -{ - clear(); -} - -void OpenGLGraphicsVertexes::clear() restrict2 -{ - for (STD_VECTOR<GLfloat*>::iterator it = mFloatTexPool.begin(); - it != mFloatTexPool.end(); ++ it) - { - delete [] (*it); - } - mFloatTexPool.clear(); - - for (STD_VECTOR<GLint*>::iterator it = mIntVertPool.begin(); - it != mIntVertPool.end(); ++ it) - { - delete [] (*it); - } - mIntVertPool.clear(); - - for (STD_VECTOR<GLshort*>::iterator it = mShortVertPool.begin(); - it != mShortVertPool.end(); ++ it) - { - delete [] (*it); - } - mShortVertPool.clear(); - - for (STD_VECTOR<GLint*>::iterator it = mIntTexPool.begin(); - it != mIntTexPool.end(); ++ it) - { - delete [] (*it); - } - mIntTexPool.clear(); - - const int sz = CAST_S32(mVbo.size()); - if (sz > 0) - { - mainGraphics->removeArray(sz, &mVbo[0]); - mVbo.clear(); - } - - mVp.clear(); - if (ptr != 0) - { - ptr = 0; - delete []mFloatTexArray; - mFloatTexArray = nullptr; - delete []mIntTexArray; - mIntTexArray = nullptr; - delete []mIntVertArray; - mIntVertArray = nullptr; - delete []mShortVertArray; - mShortVertArray = nullptr; - } -} - -void OpenGLGraphicsVertexes::init() restrict2 -{ - clear(); -} - -GLfloat *OpenGLGraphicsVertexes::switchFloatTexArray() restrict2 -{ - mFloatTexArray = new GLfloat[CAST_SIZE(vertexBufSize * 4 + 30)]; - mFloatTexPool.push_back(mFloatTexArray); - return mFloatTexArray; -} - -GLint *OpenGLGraphicsVertexes::switchIntVertArray() restrict2 -{ - mIntVertArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)]; - mIntVertPool.push_back(mIntVertArray); - return mIntVertArray; -} - -GLshort *OpenGLGraphicsVertexes::switchShortVertArray() restrict2 -{ - mShortVertArray = new GLshort[CAST_SIZE(vertexBufSize * 4 + 30)]; - mShortVertPool.push_back(mShortVertArray); - return mShortVertArray; -} - -GLint *OpenGLGraphicsVertexes::switchIntTexArray() restrict2 -{ - mIntTexArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)]; - mIntTexPool.push_back(mIntTexArray); - return mIntTexArray; -} - -void OpenGLGraphicsVertexes::switchVp(const int n) restrict2 -{ - mVp.push_back(n); -} - -int OpenGLGraphicsVertexes::continueVp() restrict2 -{ - if (mVp.empty()) - { - return 0; - } - else - { - const int val = mVp.back(); - mVp.pop_back(); - return val; - } -} - -void OpenGLGraphicsVertexes::updateVp(const int n) restrict2 -{ - if (!mVp.empty()) - mVp.pop_back(); - mVp.push_back(n); -} - -GLfloat *OpenGLGraphicsVertexes::continueFloatTexArray() restrict2 -{ - if (mFloatTexPool.empty()) - { - mFloatTexArray = new GLfloat[CAST_SIZE( - vertexBufSize * 4 + 30)]; - mFloatTexPool.push_back(mFloatTexArray); - } - else - { - mFloatTexArray = mFloatTexPool.back(); - } - return mFloatTexArray; -} - -GLint *OpenGLGraphicsVertexes::continueIntVertArray() restrict2 -{ - if (mIntVertPool.empty()) - { - mIntVertArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)]; - mIntVertPool.push_back(mIntVertArray); - } - else - { - mIntVertArray = mIntVertPool.back(); - } - return mIntVertArray; -} - -GLshort *OpenGLGraphicsVertexes::continueShortVertArray() restrict2 -{ - if (mShortVertPool.empty()) - { - mShortVertArray = new GLshort[CAST_SIZE( - vertexBufSize * 4 + 30)]; - mShortVertPool.push_back(mShortVertArray); - } - else - { - mShortVertArray = mShortVertPool.back(); - } - return mShortVertArray; -} - -GLint *OpenGLGraphicsVertexes::continueIntTexArray() restrict2 -{ - if (mIntTexPool.empty()) - { - mIntTexArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)]; - mIntTexPool.push_back(mIntTexArray); - } - else - { - mIntTexArray = mIntTexPool.back(); - } - return mIntTexArray; -} -#endif // USE_OPENGL diff --git a/src/render/vertexes/openglgraphicsvertexes.h b/src/render/vertexes/openglgraphicsvertexes.h deleted file mode 100644 index 023abf139..000000000 --- a/src/render/vertexes/openglgraphicsvertexes.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 2 of the License, or - * 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/>. - */ - -#ifndef RENDER_VERTEXES_OPENGLGRAPHICSVERTEXES_H -#define RENDER_VERTEXES_OPENGLGRAPHICSVERTEXES_H - -#ifdef USE_OPENGL - -#include "localconsts.h" - -#ifdef ANDROID -#include <GLES/gl.h> -#else // ANDROID -#ifndef USE_SDL2 -#define GL_GLEXT_PROTOTYPES 1 -#endif // USE_SDL2 -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include <SDL_opengl.h> -PRAGMA48(GCC diagnostic pop) -#endif // ANDROID - -#include "utils/vector.h" - -class OpenGLGraphicsVertexes final -{ - public: - OpenGLGraphicsVertexes(); - - A_DELETE_COPY(OpenGLGraphicsVertexes) - - ~OpenGLGraphicsVertexes(); - - GLfloat *switchFloatTexArray() restrict2; - - GLint *switchIntVertArray() restrict2; - - GLint *switchIntTexArray() restrict2; - - GLshort *switchShortVertArray() restrict2; - - STD_VECTOR<GLfloat*> *getFloatTexPool() restrict2 A_WARN_UNUSED - { return &mFloatTexPool; } - - STD_VECTOR<GLint*> *getIntVertPool() restrict2 A_WARN_UNUSED - { return &mIntVertPool; } - - STD_VECTOR<GLshort*> *getShortVertPool() restrict2 A_WARN_UNUSED - { return &mShortVertPool; } - - STD_VECTOR<GLint*> *getIntTexPool() restrict2 A_WARN_UNUSED - { return &mIntTexPool; } - - void switchVp(const int n) restrict2; - - GLfloat *continueFloatTexArray() restrict2 RETURNS_NONNULL; - - GLint *continueIntVertArray() restrict2 RETURNS_NONNULL; - - GLshort *continueShortVertArray() restrict2 RETURNS_NONNULL; - - GLint *continueIntTexArray() restrict2 RETURNS_NONNULL; - - int continueVp() restrict2; - - void updateVp(const int n) restrict2; - - STD_VECTOR<int> *getVp() restrict2 A_WARN_UNUSED - { return &mVp; } - - void init() restrict2; - - void clear() restrict2; - - int ptr; - - GLfloat *mFloatTexArray; - GLint *mIntTexArray; - GLint *mIntVertArray; - GLshort *mShortVertArray; - STD_VECTOR<int> mVp; - STD_VECTOR<GLfloat*> mFloatTexPool; - STD_VECTOR<GLint*> mIntVertPool; - STD_VECTOR<GLshort*> mShortVertPool; - STD_VECTOR<GLint*> mIntTexPool; - STD_VECTOR<GLuint> mVbo; -}; - -extern unsigned int vertexBufSize; -#endif // USE_OPENGL - -#endif // RENDER_VERTEXES_OPENGLGRAPHICSVERTEXES_H |