mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- starting separation of hardware dependent and hardware independent code, starting with aabbtree, because it was easy.
This commit is contained in:
parent
52c5328412
commit
60aebff4a1
37 changed files with 43 additions and 60 deletions
|
@ -1044,7 +1044,6 @@ set (PCH_SOURCES
|
|||
gl/compatibility/gl_20.cpp
|
||||
gl/data/gl_vertexbuffer.cpp
|
||||
gl/dynlights/gl_lightbuffer.cpp
|
||||
gl/dynlights/gl_aabbtree.cpp
|
||||
gl/dynlights/gl_shadowmap.cpp
|
||||
gl/renderer/gl_quaddrawer.cpp
|
||||
gl/renderer/gl_renderer.cpp
|
||||
|
@ -1083,6 +1082,8 @@ set (PCH_SOURCES
|
|||
gl/textures/gl_texture.cpp
|
||||
gl/textures/gl_material.cpp
|
||||
gl/textures/gl_samplers.cpp
|
||||
hwrenderer/dynlights/hw_aabbtree.cpp
|
||||
|
||||
menu/joystickmenu.cpp
|
||||
menu/loadsavemenu.cpp
|
||||
menu/menu.cpp
|
||||
|
@ -1410,6 +1411,17 @@ source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fr
|
|||
source_group("Intermission" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/intermission/.+")
|
||||
source_group("Inventory" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_inventory/.+")
|
||||
source_group("Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/menu/.+")
|
||||
source_group("Hardware Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/.+")
|
||||
source_group("Hardware Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/data/.+")
|
||||
source_group("Hardware Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/dynlights/.+")
|
||||
source_group("Hardware Renderer\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/models/.+")
|
||||
source_group("Hardware Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/renderer/.+")
|
||||
source_group("Hardware Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/scene/.+")
|
||||
source_group("Hardware Renderer\\Stereo3D" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/stereo3d/.+")
|
||||
source_group("Hardware Renderer\\Shaders" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/shaders/.+")
|
||||
source_group("Hardware Renderer\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/system/.+")
|
||||
source_group("Hardware Renderer\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/textures/.+")
|
||||
source_group("Hardware Renderer\\Utilities" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/hwrenderer/utility/.+")
|
||||
source_group("OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl_load/.+")
|
||||
source_group("OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/.+")
|
||||
source_group("OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/data/.+")
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
#ifndef __GLC_DATA_H
|
||||
#define __GLC_DATA_H
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "vectors.h"
|
||||
#include "r_utility.h"
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
EXTERN_CVAR(Int, gl_weaponlight);
|
||||
|
||||
inline int getExtraLight()
|
||||
{
|
||||
return r_viewpoint.extralight * gl_weaponlight;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -35,7 +35,6 @@
|
|||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -216,18 +216,18 @@ void FShadowMap::UploadAABBTree()
|
|||
if (mAABBTree)
|
||||
return;
|
||||
|
||||
mAABBTree.reset(new LevelAABBTree());
|
||||
mAABBTree.reset(new hwrenderer::LevelAABBTree());
|
||||
|
||||
int oldBinding = 0;
|
||||
glGetIntegerv(GL_SHADER_STORAGE_BUFFER_BINDING, &oldBinding);
|
||||
|
||||
glGenBuffers(1, (GLuint*)&mNodesBuffer);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, mNodesBuffer);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(AABBTreeNode) * mAABBTree->nodes.Size(), &mAABBTree->nodes[0], GL_STATIC_DRAW);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(hwrenderer::AABBTreeNode) * mAABBTree->nodes.Size(), &mAABBTree->nodes[0], GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, (GLuint*)&mLinesBuffer);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, mLinesBuffer);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(AABBTreeLine) * mAABBTree->lines.Size(), &mAABBTree->lines[0], GL_STATIC_DRAW);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(hwrenderer::AABBTreeLine) * mAABBTree->lines.Size(), &mAABBTree->lines[0], GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, oldBinding);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "gl/dynlights/gl_aabbtree.h"
|
||||
#include "hwrenderer/dynlights/hw_aabbtree.h"
|
||||
#include "tarray.h"
|
||||
#include <memory>
|
||||
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
unsigned mLastNumSegs = 0;
|
||||
|
||||
// AABB-tree of the level, used for ray tests
|
||||
std::unique_ptr<LevelAABBTree> mAABBTree;
|
||||
std::unique_ptr<hwrenderer::LevelAABBTree> mAABBTree;
|
||||
|
||||
FShadowMap(const FShadowMap &) = delete;
|
||||
FShadowMap &operator=(FShadowMap &) = delete;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "gl/system/gl_system.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/renderer/gl_colormap.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/shaders/gl_ambientshader.h"
|
||||
#include "gl/shaders/gl_bloomshader.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "templates.h"
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "r_data/matrix.h"
|
||||
#include "c_cvars.h"
|
||||
#include "r_defs.h"
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
*/
|
||||
|
||||
#include "templates.h"
|
||||
#include "doomstat.h"
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "r_data/matrix.h"
|
||||
#include "gl/textures/gl_material.h"
|
||||
#include "c_cvars.h"
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_scenedrawer.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "r_sky.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/scene/gl_scenedrawer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/dynlights/gl_lightbuffer.h"
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_quaddrawer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_clipper.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
#define __GL_PORTAL_H
|
||||
|
||||
#include "tarray.h"
|
||||
#include "actor.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
||||
struct GLHorizonInfo
|
||||
{
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
#include "gl/scene/gl_scenedrawer.h"
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/models/gl_models.h"
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
#include "gl_portal.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "r_utility.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
EXTERN_CVAR(Int, gl_weaponlight);
|
||||
|
||||
inline int getExtraLight()
|
||||
{
|
||||
return r_viewpoint.extralight * gl_weaponlight;
|
||||
}
|
||||
|
||||
|
||||
class GLSceneDrawer
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "portal.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#include "textures/skyboxtexture.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_scenedrawer.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/dynlights/gl_dynlight.h"
|
||||
#include "gl/dynlights/gl_lightbuffer.h"
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_scenedrawer.h"
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "r_data/matrix.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/textures/gl_hwtexture.h"
|
||||
#include "gl/utility/gl_clock.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/textures/gl_material.h"
|
||||
#include "gl/textures/gl_samplers.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
#include "gl/dynlights/gl_aabbtree.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "r_state.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "hw_aabbtree.h"
|
||||
|
||||
namespace hwrenderer
|
||||
{
|
||||
|
||||
LevelAABBTree::LevelAABBTree()
|
||||
{
|
||||
|
@ -286,3 +286,6 @@ int LevelAABBTree::GenerateTreeNode(int *lines, int num_lines, const FVector2 *c
|
|||
nodes.Push(AABBTreeNode(aabb_min, aabb_max, left_index, right_index));
|
||||
return (int)nodes.Size() - 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
#include "vectors.h"
|
||||
|
||||
namespace hwrenderer
|
||||
{
|
||||
|
||||
// Node in a binary AABB tree
|
||||
struct AABBTreeNode
|
||||
{
|
||||
|
@ -57,3 +60,5 @@ private:
|
|||
// Generate a tree node and its children recursively
|
||||
int GenerateTreeNode(int *lines, int num_lines, const FVector2 *centroids, int *work_buffer);
|
||||
};
|
||||
|
||||
} // namespace
|
|
@ -272,7 +272,7 @@ struct TVector2
|
|||
|
||||
|
||||
// Dot product
|
||||
double operator | (const TVector2 &other) const
|
||||
vec_t operator | (const TVector2 &other) const
|
||||
{
|
||||
return X*other.X + Y*other.Y;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue