Skip to content

Commit 1f50707

Browse files
ZzzhHeheinezen
authored andcommitted
Revert file(s) to pre-PR state
1 parent 720f075 commit 1f50707

4 files changed

Lines changed: 3 additions & 121 deletions

File tree

assets/shaders/world2d.frag.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ void main() {
4040
break;
4141
}
4242
id = u_id;
43-
}
43+
}

assets/test/shaders/world_commands.config

Lines changed: 0 additions & 23 deletions
This file was deleted.

libopenage/renderer/stages/world/render_stage.cpp

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2025 the openage authors. See copying.md for legal info.
1+
// Copyright 2022-2024 the openage authors. See copying.md for legal info.
22

33
#include "render_stage.h"
44

@@ -12,7 +12,6 @@
1212
#include "renderer/resources/texture_info.h"
1313
#include "renderer/shader_program.h"
1414
#include "renderer/stages/world/object.h"
15-
#include "renderer/stages/world/world_shader_commands.h"
1615
#include "renderer/texture.h"
1716
#include "renderer/window.h"
1817
#include "time/clock.h"
@@ -47,30 +46,6 @@ WorldRenderStage::WorldRenderStage(const std::shared_ptr<Window> &window,
4746
log::log(INFO << "Created render stage 'World'");
4847
}
4948

50-
WorldRenderStage::WorldRenderStage(const std::shared_ptr<Window> &window,
51-
const std::shared_ptr<renderer::Renderer> &renderer,
52-
const std::shared_ptr<renderer::camera::Camera> &camera,
53-
const util::Path &shaderdir,
54-
const util::Path &configdir,
55-
const std::shared_ptr<renderer::resources::AssetManager> &asset_manager,
56-
const std::shared_ptr<time::Clock> clock) :
57-
renderer{renderer},
58-
camera{camera},
59-
asset_manager{asset_manager},
60-
render_objects{},
61-
clock{clock},
62-
default_geometry{this->renderer->add_mesh_geometry(WorldObject::get_mesh())} {
63-
auto size = window->get_size();
64-
this->initialize_render_pass_with_shader_commands(size[0], size[1], shaderdir, configdir);
65-
this->init_uniform_ids();
66-
67-
window->add_resize_callback([this](size_t width, size_t height, double /*scale*/) {
68-
this->resize(width, height);
69-
});
70-
71-
log::log(INFO << "Created render stage 'World' with shader command");
72-
}
73-
7449
std::shared_ptr<renderer::RenderPass> WorldRenderStage::get_render_pass() {
7550
return this->render_pass;
7651
}
@@ -181,37 +156,4 @@ void WorldRenderStage::init_uniform_ids() {
181156
WorldObject::anchor_offset = this->display_shader->get_uniform_id("anchor_offset");
182157
}
183158

184-
void WorldRenderStage::initialize_render_pass_with_shader_commands(size_t width, size_t height, const util::Path &shaderdir, const util::Path &config_path) {
185-
auto vert_shader_file = (shaderdir / "demo_7_world.vert.glsl").open();
186-
auto vert_shader_src = renderer::resources::ShaderSource(
187-
resources::shader_lang_t::glsl,
188-
resources::shader_stage_t::vertex,
189-
vert_shader_file.read());
190-
vert_shader_file.close();
191-
192-
auto frag_shader_file = (shaderdir / "demo_7_world.frag.glsl").open();
193-
log::log(INFO << "Loading shader commands config from: " << (shaderdir / "demo_7_display.frag.glsl"));
194-
this->shader_template = std::make_shared<ShaderCommandTemplate>(frag_shader_file.read());
195-
if (not this->shader_template->load_commands(config_path / "world_commands.config")) {
196-
log::log(ERR << "Failed to load shader commands configuration for world stage");
197-
return;
198-
}
199-
200-
auto frag_shader_src = renderer::resources::ShaderSource(
201-
resources::shader_lang_t::glsl,
202-
resources::shader_stage_t::fragment,
203-
this->shader_template->generate_source());
204-
frag_shader_file.close();
205-
206-
this->output_texture = renderer->add_texture(resources::Texture2dInfo(width, height, resources::pixel_format::rgba8));
207-
this->depth_texture = renderer->add_texture(resources::Texture2dInfo(width, height, resources::pixel_format::depth24));
208-
this->id_texture = renderer->add_texture(resources::Texture2dInfo(width, height, resources::pixel_format::r32ui));
209-
210-
this->display_shader = this->renderer->add_shader({vert_shader_src, frag_shader_src});
211-
this->display_shader->bind_uniform_buffer("camera", this->camera->get_uniform_buffer());
212-
213-
auto fbo = this->renderer->create_texture_target({this->output_texture, this->depth_texture, this->id_texture});
214-
this->render_pass = this->renderer->add_render_pass({}, fbo);
215-
}
216-
217159
} // namespace openage::renderer::world

libopenage/renderer/stages/world/render_stage.h

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2025 the openage authors. See copying.md for legal info.
1+
// Copyright 2022-2024 the openage authors. See copying.md for legal info.
22

33
#pragma once
44

@@ -33,7 +33,6 @@ class AssetManager;
3333
namespace world {
3434
class RenderEntity;
3535
class WorldObject;
36-
class ShaderCommandTemplate;
3736

3837
/**
3938
* Renderer for drawing and displaying entities in the game world (units, buildings, etc.)
@@ -61,26 +60,6 @@ class WorldRenderStage {
6160
const util::Path &shaderdir,
6261
const std::shared_ptr<renderer::resources::AssetManager> &asset_manager,
6362
const std::shared_ptr<time::Clock> clock);
64-
65-
/**
66-
* Create a new render stage for the game world with shader command.
67-
*
68-
* @param window openage window targeted for rendering.
69-
* @param renderer openage low-level renderer.
70-
* @param camera Camera used for the rendered scene.
71-
* @param shaderdir Directory containing the shader source files.
72-
* @param configdir Directory containing the config for shader command.
73-
* @param asset_manager Asset manager for loading resources.
74-
* @param clock Simulation clock for timing animations.
75-
*/
76-
WorldRenderStage(const std::shared_ptr<Window> &window,
77-
const std::shared_ptr<renderer::Renderer> &renderer,
78-
const std::shared_ptr<renderer::camera::Camera> &camera,
79-
const util::Path &shaderdir,
80-
const util::Path &configdir,
81-
const std::shared_ptr<renderer::resources::AssetManager> &asset_manager,
82-
const std::shared_ptr<time::Clock> clock);
83-
8463
~WorldRenderStage() = default;
8564

8665
/**
@@ -132,17 +111,6 @@ class WorldRenderStage {
132111
*/
133112
void init_uniform_ids();
134113

135-
/**
136-
* Initialize render pass with shader commands.
137-
* This is an alternative to initialize_render_pass() that uses configurable shader commands.
138-
*
139-
* @param width Width of the FBO.
140-
* @param height Height of the FBO.
141-
* @param shaderdir Directory containing shader files.
142-
* @param configdir Directory containing configuration file.
143-
*/
144-
void initialize_render_pass_with_shader_commands(size_t width, size_t height, const util::Path &shaderdir, const util::Path &config_path);
145-
146114
/**
147115
* Reference to the openage renderer.
148116
*/
@@ -163,11 +131,6 @@ class WorldRenderStage {
163131
*/
164132
std::shared_ptr<renderer::RenderPass> render_pass;
165133

166-
/**
167-
* Template for the world shader program.
168-
*/
169-
std::shared_ptr<ShaderCommandTemplate> shader_template;
170-
171134
/**
172135
* Render entities requested by the game world.
173136
*/

0 commit comments

Comments
 (0)