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

openglsactor.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_GFX_OPENGL_S_ACTOR_H
00024 #define STARK_GFX_OPENGL_S_ACTOR_H
00025 
00026 #include "engines/stark/gfx/renderentry.h"
00027 #include "engines/stark/visual/actor.h"
00028 
00029 #include "common/hashmap.h"
00030 #include "common/hash-ptr.h"
00031 
00032 #include "graphics/opengl/system_headers.h"
00033 
00034 namespace OpenGL {
00035     class Shader;
00036 }
00037 
00038 namespace Stark {
00039 namespace Gfx {
00040 
00041 class OpenGLSDriver;
00042 
00043 class OpenGLSActorRenderer : public VisualActor {
00044 public:
00045     OpenGLSActorRenderer(OpenGLSDriver *gfx);
00046     virtual ~OpenGLSActorRenderer();
00047 
00048     void render(const Math::Vector3d &position, float direction, const LightEntryArray &lights) override;
00049 
00050 protected:
00051     typedef Common::HashMap<Face *, GLuint> FaceBufferMap;
00052 
00053     OpenGLSDriver *_gfx;
00054     OpenGL::Shader *_shader, *_shadowShader;
00055 
00056     GLuint _faceVBO;
00057     FaceBufferMap _faceEBO;
00058 
00059     void clearVertices();
00060     void uploadVertices();
00061     GLuint createModelVBO(const Model *model);
00062     GLuint createFaceEBO(const Face *face);
00063     void setBonePositionArrayUniform(OpenGL::Shader *shader, const char *uniform);
00064     void setBoneRotationArrayUniform(OpenGL::Shader *shader, const char *uniform);
00065     void setLightArrayUniform(const LightEntryArray &lights);
00066 
00067     void setShadowUniform(const LightEntryArray &lights, const Math::Vector3d &actorPosition, Math::Matrix3 worldToModelRot);
00068     
00069     bool getPointLightContribution(LightEntry *light, const Math::Vector3d &actorPosition,
00070             Math::Vector3d &direction, float weight = 1.0f);
00071     bool getDirectionalLightContribution(LightEntry *light, Math::Vector3d &direction);
00072     bool getSpotLightContribution(LightEntry *light, const Math::Vector3d &actorPosition, Math::Vector3d &direction);
00073 };
00074 
00075 } // End of namespace Gfx
00076 } // End of namespace Stark
00077 
00078 #endif // STARK_GFX_OPENGL_S_ACTOR_H


Generated on Sat Jul 13 2019 05:01:11 for ResidualVM by doxygen 1.7.1
curved edge   curved edge