17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-29 02:17:28 +01:00

pch migration to modules [wip]

This commit is contained in:
maj00r
2026-09-09 20:35:26 +02:00
parent c3007e3237
commit 3f7960aad5
350 changed files with 5958 additions and 3059 deletions

View File

@@ -1,10 +1,14 @@
// https://github.com/inequation/flip-s3tc
// Leszek Godlewski places this file in the public domain.
#pragma once
module;
#include <stdint.h>
export module eu07.rendering.flip_s3tc;
export {
#ifdef __cplusplus
namespace flip_s3tc
{
@@ -205,3 +209,5 @@ void flip_dxt45_image(void *data, int width, int height)
#if __cplusplus
} // namespace flip_s3tc
#endif
} // export

View File

@@ -1,3 +1,11 @@
module;
#include <cmath>
#include "glad/glad.h"
#include "rendering/openglmatrixstack_macros.h"
module eu07.rendering.frustum;
import eu07.glm;
import eu07.rendering.openglmatrixstack;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,8 +15,6 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/frustum.h"
void
cFrustum::calculate() {

View File

@@ -6,10 +6,16 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <vector>
export module eu07.rendering.frustum;
import eu07.glm;
import eu07.utilities.float3d;
export {
#pragma once
#include "utilities/Float3d.h"
inline std::vector<glm::vec4> const ndcfrustumshapepoints //
{
@@ -84,3 +90,5 @@ private:
// members:
float m_frustum[6][4]; // holds the A B C and D values (normal & distance) for each side of the frustum.
};
} // export

View File

@@ -1,4 +1,25 @@
/*
module;
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <istream>
#include <iterator>
#include <memory>
#include <ostream>
#include <vector>
#include "global_include/interfaces/ITexture_macros.h"
#include "utilities/Globals_macros.h"
#include "glad/glad.h"
#include <numeric>
module eu07.rendering.geometrybank;
import eu07.simcore;
import eu07.glm;
import eu07.model.vertex;
import eu07.scene.sn_utils;
import eu07.utilities.logs;
import eu07.utilities.globals;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,13 +28,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/geometrybank.h"
#include "model/vertex.h"
#include "scene/sn_utils.h"
#include "utilities/Logs.h"
#include "utilities/Globals.h"
namespace gfx {

View File

@@ -1,4 +1,21 @@
/*
module;
#include <cstddef>
#include <cstdint>
#include <deque>
#include <istream>
#include <memory>
#include <ostream>
#include <utility>
#include <vector>
#include "glad/glad.h"
export module eu07.rendering.geometrybank;
import eu07.glm;
import eu07.model.vertex;
import eu07.model.resourcemanager;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,11 +24,8 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "model/ResourceManager.h"
struct world_vertex;
namespace gfx {
@@ -262,3 +276,5 @@ private:
};
} // namespace gfx
} // export

View File

@@ -1,4 +1,11 @@
/*
module;
export module eu07.rendering.light;
import eu07.glm;
import eu07.utilities.color;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +14,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "utilities/color.h"
// a simple light source, either omni- or directional
struct basic_light {
@@ -21,3 +26,5 @@ struct basic_light {
glm::vec3 direction;
bool is_directional { true };
};
} // export

View File

@@ -1,3 +1,9 @@
module;
#include <cmath>
#include "vehicle/DynObj_macros.h"
#include <algorithm>
module eu07.rendering.lightarray;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -13,9 +19,6 @@ http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/lightarray.h"
#include "vehicle/DynObj.h"
void
light_array::insert( TDynamicObject const *Owner ) {

View File

@@ -1,6 +1,14 @@
#pragma once
module;
#include <vector>
export module eu07.rendering.lightarray;
import eu07.simcore;
import eu07.glm;
import eu07.utilities.classes;
export {
#pragma once
#include "utilities/Classes.h"
// collection of virtual light sources present in the scene
// used by the renderer to determine most suitable placement for actual light sources during render
@@ -41,3 +49,5 @@ public:
// members
lightrecord_array data;
};
} // export

View File

@@ -1,5 +1,7 @@
#include "stdafx.h"
#include "rendering/nullrenderer.h"
module;
#include <memory>
module eu07.rendering.nullrenderer;
std::unique_ptr<gfx_renderer> null_renderer::create_func()
{

View File

@@ -1,17 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#pragma once
#include "model/Texture.h"
#include "rendering/geometrybank.h"
#include "model/material.h"
#include "rendering/renderer.h"
#include "stdafx.h"
#include <glm/fwd.hpp>
module;
#include "glad/glad.h"
#include <GLFW/glfw3.h>
#include <functional>
#include <memory>
#include <optional>
#include <vector>
#include <stdexcept>
export module eu07.rendering.nullrenderer;
import eu07.gl.shader;
import eu07.simcore;
import eu07.global_include.interfaces.imaterial;
import eu07.global_include.interfaces.itexture;
import eu07.utilities.classes;
import eu07.utilities.globals;
import eu07.glm;
import eu07.model.texture;
import eu07.rendering.geometrybank;
import eu07.model.material;
import eu07.rendering.renderer;
export {
class null_geometrybank : public gfx::geometry_bank {
public:
// constructors:
@@ -160,3 +175,5 @@ public:
gfx::geometrybank_manager m_geometry;
std::vector<std::shared_ptr<opengl_material>> m_materials;
};
} // export

View File

@@ -1,4 +1,11 @@
/*
module;
#include <new>
#include "glad/glad.h"
#include <cstddef>
module eu07.rendering.opengl33geometrybank;
import eu07.utilities.logs;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,10 +14,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengl33geometrybank.h"
#include "utilities/Logs.h"
namespace gfx {

View File

@@ -1,4 +1,15 @@
/*
module;
#include <cstddef>
#include <optional>
#include <vector>
export module eu07.rendering.opengl33geometrybank;
import eu07.rendering.geometrybank;
import eu07.gl.buffer;
import eu07.gl.vao;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,11 +18,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/geometrybank.h"
#include "gl/buffer.h"
#include "gl/vao.h"
namespace gfx {
@@ -77,3 +84,5 @@ private:
};
} // namespace gfx
} // export

View File

@@ -1,4 +1,7 @@
/*
module;
module eu07.rendering.opengl33light;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +10,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengl33light.h"
void opengl33_light::apply_intensity(float const Factor) {

View File

@@ -1,4 +1,11 @@
/*
module;
#include "glad/glad.h"
export module eu07.rendering.opengl33light;
import eu07.rendering.light;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +14,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/light.h"
struct opengl33_light : public basic_light {
@@ -26,3 +31,5 @@ struct opengl33_light : public basic_light {
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,4 +1,20 @@
/*
module;
#include <memory>
#include "glad/glad.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <map>
#include <vector>
#include "utilities/Globals_macros.h"
module eu07.rendering.opengl33particles;
import eu07.utilities.globals;
import eu07.rendering.particles;
import eu07.rendering.openglcamera;
import eu07.simulation.simulation;
import eu07.simulation.simulationenvironment;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,13 +23,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengl33particles.h"
#include "rendering/particles.h"
#include "rendering/openglcamera.h"
#include "simulation/simulation.h"
#include "simulation/simulationenvironment.h"
std::vector<std::pair<glm::vec3, glm::vec2>> const billboard_vertices {

View File

@@ -1,4 +1,17 @@
/*
module;
#include <vector>
#include <memory>
#include <optional>
export module eu07.rendering.opengl33particles;
import eu07.glm;
import eu07.rendering.openglcamera;
import eu07.gl.buffer;
import eu07.gl.vao;
import eu07.gl.shader;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,13 +20,8 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "gl/buffer.h"
#include "gl/vao.h"
#include "gl/shader.h"
class opengl_camera;
// particle data visualizer
class opengl33_particles {
@@ -52,3 +60,5 @@ private:
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,15 @@
module;
#include "glad/glad.h"
#include <cmath>
#include <cstdint>
#include <string>
#include <vector>
#include "utilities/Globals_macros.h"
module eu07.rendering.opengl33precipitation;
import eu07.utilities.globals;
import eu07.rendering.renderer;
import eu07.simulation.simulationenvironment;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,12 +19,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengl33precipitation.h"
#include "utilities/Globals.h"
#include "rendering/renderer.h"
#include "simulation/simulationenvironment.h"
opengl33_precipitation::~opengl33_precipitation() {
// TODO: release allocated resources

View File

@@ -6,12 +6,22 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <cstdint>
#include <vector>
#include <optional>
export module eu07.rendering.opengl33precipitation;
import eu07.glm;
import eu07.gl.buffer;
import eu07.global_include.interfaces.itexture;
import eu07.model.texture;
import eu07.gl.vao;
import eu07.gl.shader;
export {
#pragma once
#include "model/Texture.h"
#include "gl/vao.h"
#include "gl/shader.h"
class opengl33_precipitation {
@@ -41,3 +51,5 @@ private:
std::optional<gl::program> m_shader;
std::optional<gl::vao> m_vao;
};
} // export

View File

@@ -1,4 +1,49 @@
/*
module;
#include "imgui/imgui.h"
#include <random>
#include <GLFW/glfw3.h>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iterator>
#include <limits>
#include <list>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "global_include/interfaces/ITexture_macros.h"
#include "utilities/Globals_macros.h"
#include <imgui/imgui_impl_opengl3.h>
#include "gl/gldebug.h"
#include "glad/glad.h"
#include "utilities/crashreporter_macros.h"
#include "widgets/imgui_scale.h"
#include "rendering/openglmatrixstack_macros.h"
module eu07.rendering.opengl33renderer;
import eu07.gl.buffer;
import eu07.rendering.particles;
import eu07.utilities.utilities;
import eu07.glm;
import eu07.utilities.color;
import eu07.utilities.globals;
import eu07.utilities.timer;
import eu07.vehicle.train;
import eu07.vehicle.camera;
import eu07.simulation.simulation;
import eu07.utilities.logs;
import eu07.simulation.simulationtime;
import eu07.application.application;
import eu07.simcore;
import eu07.rendering.opengl33geometrybank;
import eu07.rendering.screenshot;
import eu07.utilities.crashreporter;
import eu07.rendering.openglmatrixstack;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,21 +52,6 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengl33renderer.h"
#include "utilities/color.h"
#include "utilities/Globals.h"
#include "utilities/Timer.h"
#include "vehicle/Train.h"
#include "vehicle/Camera.h"
#include "simulation/simulation.h"
#include "utilities/Logs.h"
#include "simulation/simulationtime.h"
#include "application/application.h"
#include "model/AnimModel.h"
#include "rendering/opengl33geometrybank.h"
#include "rendering/screenshot.h"
#include <imgui/imgui_impl_opengl3.h>
//#define EU07_DEBUG_OPENGL
@@ -218,7 +248,7 @@ bool opengl33_renderer::Init(GLFWwindow *Window)
if (vr) {
glm::ivec2 target_size = vr->get_target_size();
WriteLog("using vr rendertarget: " + glm::to_string(target_size));
WriteLog("using vr rendertarget: " + std::to_string(target_size.x) + "x" + std::to_string(target_size.y));
// hijack main window for left eye
default_viewport.width = target_size.x;

View File

@@ -1,4 +1,51 @@
/*
module;
#include "glad/glad.h"
#include <GLFW/glfw3.h>
#include <array>
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "utilities/Globals_macros.h"
export module eu07.rendering.opengl33renderer;
import eu07.gl.vao;
import eu07.utilities.color;
import eu07.glm;
import eu07.global_include.interfaces.imaterial;
import eu07.global_include.interfaces.itexture;
import eu07.model.material;
import eu07.model.texture;
import eu07.rendering.geometrybank;
import eu07.utilities.classes;
import eu07.vehicle.camera;
import eu07.utilities.globals;
import eu07.rendering.renderer;
import eu07.rendering.openglcamera;
import eu07.rendering.opengl33light;
import eu07.rendering.opengl33particles;
import eu07.rendering.opengl33skydome;
import eu07.rendering.opengl33precipitation;
import eu07.simulation.simulationenvironment;
import eu07.simcore;
import eu07.rendering.lightarray;
import eu07.vr.vr_interface;
import eu07.gl.ubo;
import eu07.gl.framebuffer;
import eu07.gl.renderbuffer;
import eu07.gl.postfx;
import eu07.gl.shader;
import eu07.gl.cubemap;
import eu07.gl.glsl_common;
import eu07.gl.pbo;
import eu07.gl.query;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,28 +54,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/renderer.h"
#include "rendering/openglcamera.h"
#include "rendering/opengl33light.h"
#include "rendering/opengl33particles.h"
#include "rendering/opengl33skydome.h"
#include "rendering/opengl33precipitation.h"
#include "simulation/simulationenvironment.h"
#include "scene/scene.h"
#include "world/MemCell.h"
#include "rendering/lightarray.h"
#include "vr/vr_interface.h"
#include "gl/ubo.h"
#include "gl/framebuffer.h"
#include "gl/renderbuffer.h"
#include "gl/postfx.h"
#include "gl/shader.h"
#include "gl/cubemap.h"
#include "gl/glsl_common.h"
#include "gl/pbo.h"
#include "gl/query.h"
// bare-bones render controller, in lack of anything better yet
class opengl33_renderer : public gfx_renderer {
@@ -521,3 +547,5 @@ class opengl33_renderer : public gfx_renderer {
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,10 @@
module;
#include "glad/glad.h"
#include <vector>
module eu07.rendering.opengl33skydome;
import eu07.glm;
import eu07.simulation.simulationenvironment;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,10 +14,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengl33skydome.h"
#include "simulation/simulationenvironment.h"
void opengl33_skydome::update() {

View File

@@ -6,12 +6,17 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <optional>
export module eu07.rendering.opengl33skydome;
import eu07.gl.vao;
import eu07.gl.shader;
import eu07.gl.buffer;
export {
#pragma once
#include "gl/vao.h"
#include "gl/shader.h"
#include "gl/buffer.h"
class opengl33_skydome {
@@ -34,3 +39,5 @@ private:
std::optional<gl::program> m_shader;
std::optional<gl::vao> m_vao;
};
} // export

View File

@@ -1,4 +1,11 @@
/*
module;
#include <iterator>
#include "glad/glad.h"
#include "vehicle/DynObj_macros.h"
module eu07.rendering.openglcamera;
import eu07.simcore;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,10 +14,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglcamera.h"
#include "vehicle/DynObj.h"
void
opengl_camera::update_frustum( glm::mat4 const &Projection, glm::mat4 const &Modelview ) {

View File

@@ -1,4 +1,14 @@
/*
module;
#include <algorithm>
#include <vector>
export module eu07.rendering.openglcamera;
import eu07.glm;
import eu07.simcore;
import eu07.rendering.frustum;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,10 +17,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/frustum.h"
#include "scene/scene.h"
// simple camera object. paired with 'virtual camera' in the scene
class opengl_camera {
@@ -79,3 +86,5 @@ private:
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,7 @@
module;
#include "rendering/openglcolor_macros.h"
module eu07.rendering.openglcolor;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,8 +11,6 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglcolor.h"
opengl_color OpenGLColor;

View File

@@ -7,11 +7,18 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "utilities/Globals.h"
// encapsulation of the fixed pipeline opengl color
module;
#include <glad/glad.h>
#include "utilities/Globals_macros.h"
export module eu07.rendering.openglcolor;
import eu07.glm;
import eu07.utilities.globals;
export {
class opengl_color {
public:
@@ -62,16 +69,9 @@ private:
extern opengl_color OpenGLColor;
// NOTE: standard opengl calls re-definitions
#undef glColor3f
#undef glColor3fv
#undef glColor4f
#undef glColor4fv
#define glColor3f OpenGLColor.color3
#define glColor3fv OpenGLColor.color3
#define glColor4f OpenGLColor.color4
#define glColor4fv OpenGLColor.color4
//---------------------------------------------------------------------------
} // export

View File

@@ -0,0 +1,11 @@
#pragma once
// Macros cannot cross a module boundary, so they live in a plain header
// that consumers pull into their global module fragment. The bodies are
// expanded at the use site, where the imported names are in scope, so this
// header deliberately includes nothing.
#define glColor3f OpenGLColor.color3
#define glColor3fv OpenGLColor.color3
#define glColor4f OpenGLColor.color4
#define glColor4fv OpenGLColor.color4

View File

@@ -1,4 +1,15 @@
/*
module;
#include "rendering/openglcolor_macros.h"
#include "glad/glad.h"
#include <cstddef>
#include <typeinfo>
#include <vector>
module eu07.rendering.openglgeometrybank;
import eu07.rendering.openglcolor;
import eu07.glm;
import eu07.utilities.logs;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,11 +18,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglgeometrybank.h"
#include "rendering/openglcolor.h"
#include "utilities/Logs.h"
namespace gfx {

View File

@@ -1,4 +1,13 @@
/*
module;
#include "glad/glad.h"
#include <cstddef>
#include <vector>
export module eu07.rendering.openglgeometrybank;
import eu07.rendering.geometrybank;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +16,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/geometrybank.h"
namespace gfx {
@@ -122,3 +129,5 @@ private:
};
} // namespace gfx
} // export

View File

@@ -1,4 +1,10 @@
/*
module;
#include "glad/glad.h"
#include <algorithm>
module eu07.rendering.opengllight;
import eu07.glm;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +13,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/opengllight.h"
void
opengl_light::apply_intensity( float const Factor ) {

View File

@@ -1,4 +1,11 @@
/*
module;
#include "glad/glad.h"
export module eu07.rendering.opengllight;
import eu07.rendering.light;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +14,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/light.h"
struct opengl_light : public basic_light {
@@ -27,3 +32,5 @@ struct opengl_light : public basic_light {
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,7 @@
module;
#include "rendering/openglmatrixstack_macros.h"
module eu07.rendering.openglmatrixstack;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,6 +11,6 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
opengl_matrices OpenGLMatrices;

View File

@@ -1,4 +1,14 @@
/*
module;
#include "rendering/openglmatrixstack_macros.h"
#include <stack>
#include <vector>
#include "glad/glad.h"
export module eu07.rendering.openglmatrixstack;
import eu07.glm;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,10 +17,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <stack>
#include <vector>
// encapsulation of the fixed pipeline opengl matrix stack
class opengl_matrices {
@@ -234,22 +241,12 @@ extern opengl_matrices OpenGLMatrices;
#undef gluPerspective
#undef gluLookAt
#define glMatrixMode OpenGLMatrices.mode
#define glPushMatrix OpenGLMatrices.push_matrix
#define glPopMatrix OpenGLMatrices.pop_matrix
#define glLoadIdentity OpenGLMatrices.load_identity
#define glLoadMatrixf OpenGLMatrices.load_matrix
#define glLoadMatrixd OpenGLMatrices.load_matrix
#define glRotated OpenGLMatrices.rotate
#define glRotatef OpenGLMatrices.rotate
#define glTranslated OpenGLMatrices.translate
#define glTranslatef OpenGLMatrices.translate
#define glScaled OpenGLMatrices.scale
#define glScalef OpenGLMatrices.scale
#define glMultMatrixd OpenGLMatrices.multiply
#define glMultMatrixf OpenGLMatrices.multiply
#define glOrtho OpenGLMatrices.ortho
#define gluPerspective OpenGLMatrices.perspective
#define gluLookAt OpenGLMatrices.look_at
//---------------------------------------------------------------------------
} // export

View File

@@ -0,0 +1,19 @@
#pragma once
// Macros cannot cross a module boundary, so they live in a plain header
// that consumers pull into their global module fragment. The bodies are
// expanded at the use site, where the imported names are in scope, so this
// header deliberately includes nothing.
#define glMatrixMode OpenGLMatrices.mode
#define glPushMatrix OpenGLMatrices.push_matrix
#define glPopMatrix OpenGLMatrices.pop_matrix
#define glLoadIdentity OpenGLMatrices.load_identity
#define glLoadMatrixf OpenGLMatrices.load_matrix
#define glRotated OpenGLMatrices.rotate
#define glRotatef OpenGLMatrices.rotate
#define glTranslated OpenGLMatrices.translate
#define glTranslatef OpenGLMatrices.translate
#define glScalef OpenGLMatrices.scale
#define glMultMatrixd OpenGLMatrices.multiply
#define glMultMatrixf OpenGLMatrices.multiply

View File

@@ -1,4 +1,20 @@
/*
module;
#include <cstdint>
#include "glad/glad.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <map>
#include <vector>
#include "utilities/Globals_macros.h"
module eu07.rendering.openglparticles;
import eu07.utilities.globals;
import eu07.rendering.particles;
import eu07.rendering.openglcamera;
import eu07.simulation.simulation;
import eu07.utilities.logs;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,13 +23,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglparticles.h"
#include "rendering/particles.h"
#include "rendering/openglcamera.h"
#include "simulation/simulation.h"
#include "utilities/Logs.h"
std::vector<std::pair<glm::vec3, glm::vec2>> const billboard_vertices {

View File

@@ -1,4 +1,15 @@
/*
module;
#include <cstddef>
#include <cstdint>
#include <vector>
#include "glad/glad.h"
export module eu07.rendering.openglparticles;
import eu07.glm;
import eu07.rendering.openglcamera;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +18,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
class opengl_camera;
// particle data visualizer
class opengl_particles {
@@ -49,3 +58,5 @@ private:
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,16 @@
module;
#include "glad/glad.h"
#include <cmath>
#include <cstdint>
#include <string>
#include <vector>
#include "global_include/interfaces/ITexture_macros.h"
#include "utilities/Globals_macros.h"
module eu07.rendering.openglprecipitation;
import eu07.utilities.globals;
import eu07.rendering.renderer;
import eu07.simulation.simulationenvironment;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,12 +20,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglprecipitation.h"
#include "utilities/Globals.h"
#include "rendering/renderer.h"
#include "simulation/simulationenvironment.h"
opengl_precipitation::~opengl_precipitation() {

View File

@@ -6,10 +6,20 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include "global_include/interfaces/ITexture_macros.h"
#include "glad/glad.h"
#include <cstdint>
#include <vector>
export module eu07.rendering.openglprecipitation;
import eu07.glm;
import eu07.global_include.interfaces.itexture;
import eu07.model.texture;
export {
#pragma once
#include "model/Texture.h"
class opengl_precipitation {
@@ -37,3 +47,5 @@ private:
texture_handle m_texture { null_handle };
float m_overcast { -1.f }; // cached overcast level, difference from current state triggers texture update
};
} // export

View File

@@ -1,4 +1,49 @@
/*
module;
#include "imgui/imgui.h"
#include <GLFW/glfw3.h>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
#include <iterator>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "global_include/interfaces/ITexture_macros.h"
#include "rendering/openglrenderer_macros.h"
#include "utilities/Globals_macros.h"
#include "vehicle/DynObj_macros.h"
#include "rendering/openglcolor_macros.h"
#include <imgui/imgui_impl_opengl2.h>
#include "glad/glad.h"
#include "utilities/crashreporter_macros.h"
#include "rendering/openglmatrixstack_macros.h"
module eu07.rendering.openglrenderer;
import eu07.gl.buffer;
import eu07.application.uilayer;
import eu07.rendering.particles;
import eu07.utilities.utilities;
import eu07.glm;
import eu07.utilities.color;
import eu07.utilities.globals;
import eu07.vehicle.camera;
import eu07.utilities.timer;
import eu07.simulation.simulation;
import eu07.simulation.simulationtime;
import eu07.vehicle.train;
import eu07.simcore;
import eu07.application.application;
import eu07.utilities.logs;
import eu07.rendering.openglgeometrybank;
import eu07.rendering.openglcolor;
import eu07.rendering.screenshot;
import eu07.utilities.crashreporter;
import eu07.rendering.openglmatrixstack;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,25 +52,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglrenderer.h"
#include "utilities/color.h"
#include "utilities/Globals.h"
#include "vehicle/Camera.h"
#include "utilities/Timer.h"
#include "simulation/simulation.h"
#include "simulation/simulationtime.h"
#include "vehicle/Train.h"
#include "vehicle/DynObj.h"
#include "model/AnimModel.h"
#include "world/Traction.h"
#include "application/application.h"
#include "utilities/Logs.h"
#include "rendering/openglgeometrybank.h"
#include "rendering/openglcolor.h"
#include "rendering/screenshot.h"
#include <imgui/imgui_impl_opengl2.h>
int constexpr EU07_PICKBUFFERSIZE { 1024 }; // size of (square) textures bound with the pick framebuffer
int constexpr EU07_ENVIRONMENTBUFFERSIZE { 256 }; // size of (square) environmental cube map texture

View File

@@ -1,4 +1,39 @@
/*
module;
#include "glad/glad.h"
#include <GLFW/glfw3.h>
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "rendering/openglrenderer_macros.h"
export module eu07.rendering.openglrenderer;
import eu07.gl.shader;
import eu07.utilities.color;
import eu07.glm;
import eu07.global_include.interfaces.imaterial;
import eu07.global_include.interfaces.itexture;
import eu07.model.material;
import eu07.model.texture;
import eu07.rendering.geometrybank;
import eu07.rendering.opengl33renderer;
import eu07.utilities.classes;
import eu07.utilities.globals;
import eu07.rendering.renderer;
import eu07.rendering.opengllight;
import eu07.rendering.openglcamera;
import eu07.rendering.openglparticles;
import eu07.rendering.openglskydome;
import eu07.rendering.openglprecipitation;
import eu07.rendering.lightarray;
import eu07.simcore;
import eu07.simulation.simulationenvironment;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,20 +42,8 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/renderer.h"
#include "rendering/opengllight.h"
#include "rendering/openglcamera.h"
#include "rendering/openglparticles.h"
#include "rendering/openglskydome.h"
#include "rendering/openglprecipitation.h"
#include "rendering/lightarray.h"
#include "scene/scene.h"
#include "simulation/simulationenvironment.h"
#include "world/MemCell.h"
#define EU07_USE_PICKING_FRAMEBUFFER
//#define EU07_USE_DEBUG_SHADOWMAP
//#define EU07_USE_DEBUG_CABSHADOWMAP
//#define EU07_USE_DEBUG_CAMERA
@@ -391,3 +414,5 @@ private:
};
//---------------------------------------------------------------------------
} // export

View File

@@ -0,0 +1,8 @@
#pragma once
// Macros cannot cross a module boundary, so they live in a plain header
// that consumers pull into their global module fragment. The bodies are
// expanded at the use site, where the imported names are in scope, so this
// header deliberately includes nothing.
#define EU07_USE_PICKING_FRAMEBUFFER

View File

@@ -1,3 +1,9 @@
module;
#include "glad/glad.h"
module eu07.rendering.openglskydome;
import eu07.glm;
import eu07.simulation.simulationenvironment;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,10 +13,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/openglskydome.h"
#include "simulation/simulationenvironment.h"
opengl_skydome::~opengl_skydome() {

View File

@@ -6,8 +6,14 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <cstddef>
#include "glad/glad.h"
export module eu07.rendering.openglskydome;
export {
#pragma once
class opengl_skydome {
@@ -29,3 +35,5 @@ private:
GLuint m_vertexbuffer{ (GLuint)-1 }; // id of the buffer holding vertex data on the opengl end
GLuint m_coloursbuffer{ (GLuint)-1 }; // id of the buffer holding colour data on the opengl end
};
} // export

View File

@@ -1,3 +1,20 @@
module;
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iterator>
#include <string>
#include <unordered_map>
#include "utilities/Globals_macros.h"
module eu07.rendering.particles;
import eu07.glm;
import eu07.simcore;
import eu07.utilities.utilities;
import eu07.utilities.timer;
import eu07.utilities.globals;
import eu07.simulation.simulationenvironment;
import eu07.utilities.logs;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,14 +24,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/particles.h"
#include "utilities/Timer.h"
#include "utilities/Globals.h"
#include "model/AnimModel.h"
#include "simulation/simulationenvironment.h"
#include "utilities/Logs.h"
void

View File

@@ -1,4 +1,19 @@
/*
module;
#include <cstddef>
#include <limits>
#include <string>
#include <unordered_map>
#include <vector>
export module eu07.rendering.particles;
import eu07.glm;
import eu07.audio.sound;
import eu07.utilities.parser;
import eu07.utilities.classes;
import eu07.simcore;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,10 +22,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "utilities/Classes.h"
#include "scene/scene.h"
// particle specialized for drawing smoke
// given smoke features we can take certain shortcuts
@@ -163,9 +175,6 @@ private:
// holds all particle emitters defined in the scene and updates their state
class particle_manager {
friend opengl_renderer;
public:
// types
using source_sequence = std::vector<smoke_source>;
@@ -241,3 +250,5 @@ fixedstep_modifier<Type_>::deserialize( cParser &Input ) {
lookup->second = Input.getToken<Type_>( true, "\n\r\t ,;[]" );
}
}
} // export

View File

@@ -1,3 +1,14 @@
module;
#include <algorithm>
#include <cmath>
#include "utilities/Globals_macros.h"
module eu07.rendering.precipitation;
import eu07.utilities.utilities;
import eu07.utilities.globals;
import eu07.utilities.timer;
import eu07.simulation.simulation;
import eu07.vehicle.train;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,13 +18,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/precipitation.h"
#include "utilities/Globals.h"
#include "utilities/Timer.h"
#include "simulation/simulation.h"
#include "vehicle/Train.h"
basic_precipitation::~basic_precipitation() {
// TODO: release allocated resources

View File

@@ -7,10 +7,16 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
// based on "Rendering Falling Rain and Snow"
// by Niniane Wang, Bretton Wade
module;
export module eu07.rendering.precipitation;
import eu07.glm;
export {
class basic_precipitation {
@@ -40,3 +46,5 @@ private:
int m_activecab{ 0 };
glm::dvec3 m_cabcameramove{ 0.0 };
};
} // export

View File

@@ -1,4 +1,10 @@
/*
module;
#include <memory>
#include <string>
module eu07.rendering.renderer;
import eu07.utilities.logs;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,9 +13,6 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "rendering/renderer.h"
#include "utilities/Logs.h"
std::unique_ptr<gfx_renderer> GfxRenderer;

View File

@@ -1,4 +1,26 @@
/*
module;
#include "glad/glad.h"
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include "global_include/interfaces/ITexture_macros.h"
#include "utilities/Globals_macros.h"
#include <GLFW/glfw3.h>
export module eu07.rendering.renderer;
import eu07.gl.shader;
import eu07.glm;
import eu07.simcore;
import eu07.rendering.geometrybank;
import eu07.utilities.classes;
import eu07.utilities.globals;
import eu07.global_include.interfaces.imaterial;
import eu07.global_include.interfaces.itexture;
export {
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
@@ -7,18 +29,11 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "rendering/geometrybank.h"
#include "interfaces/IMaterial.h"
#include "interfaces/ITexture.h"
#include "utilities/Globals.h"
struct lighting_data;
namespace gl
{
class program;
}
class gfx_renderer {
@@ -121,3 +136,5 @@ class imgui_renderer
extern std::unique_ptr<gfx_renderer> GfxRenderer;
//---------------------------------------------------------------------------
} // export

View File

@@ -1,8 +1,19 @@
#include "stdafx.h"
#include "rendering/screenshot.h"
#include "utilities/Globals.h"
#include "utilities/Logs.h"
module;
#include "utilities/Globals_macros.h"
#include <png.h>
#include "glad/glad.h"
#include <cstring>
#include <thread>
#ifdef _WIN32
#include <windows.h>
#endif
module eu07.rendering.screenshot;
import eu07.utilities.globals;
import eu07.utilities.logs;
#ifdef _WIN32
#endif
void screenshot_manager::screenshot_save_thread( char *img, int w, int h )
{

View File

@@ -1,3 +1,8 @@
module;
export module eu07.rendering.screenshot;
export {
class screenshot_manager
{
static void screenshot_save_thread(char *img , int w, int h);
@@ -5,3 +10,5 @@ class screenshot_manager
public:
static void make_screenshot();
};
} // export