Skip to content

Commit 3d387d3

Browse files
committed
brenta: general polishing and documentation improvement
1 parent e1637a6 commit 3d387d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+569
-486
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Brenta-Engine-Banner](./utils/docs-images/brenta-engine-banner.png)
22

33
**Brenta Engine** is a simple 3D graphics engine written in modern
4-
C++/OpenGL using a hybrid scene-graph and Entity Component System
4+
C++/OpenGL using a hybrid node-graph and Entity Component System
55
architecture.
66

77
Check out [DESIGN.md](./docs/DESIGN.md) for an overview of
@@ -14,7 +14,7 @@ introduction to its API.
1414
- GPU particles
1515
- loading TrueType fonts, textures, audio and .obj meshes
1616
- central asset management
17-
- scene graph
17+
- node graph
1818
- ECS
1919
- lua node scripting
2020
- GUI using ImGui

TODO

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
- remove unnecessary setters and getters
2-
- add drawable abstraction for the renderer
3-
- rework website

docs/DESIGN.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
# Design
22

3-
I could tell you that the Brenta engine was perfectly designed, with a
4-
clear vision from its inception, with a beautiful and powerful API
5-
that makes programming truly enjoyable. Except the fact that it would
6-
be a lie. I do not mean that I don't find the current design and API
7-
beautiful and fun - I think Brenta is a powerful engine - but its
8-
development has been more iterative than meticulously designed. I
9-
rewrote huge parts of the engine many many times, to the point where I
10-
am not scared to do big refactoring anymore - that is just routine -
11-
and I know I am deemed to repeat this process again. But through these
12-
many refactoring, the API reached a point where all objects work well
13-
together and you can reason about them through what I call the
14-
"architecture" or "design" of the engine. This is what I aim to
15-
describe in this documents.
163

174
Game engines are complex pieces of software. They provide an interface
185
to define logic, render graphics, and access system resources like
@@ -21,6 +8,15 @@ the developer.
218

229
![high-level-overview](./brenta-picture.png)
2310

11+
Brenta's its development has been more iterative than meticulously
12+
designed. I rewrote huge parts of the engine many many times, to the
13+
point where I am not scared to do big refactoring anymore - that is
14+
just routine - and I know I am deemed to repeat this process
15+
again. But through these many refactoring, the API reached a point
16+
where all objects work well together and you can reason about them
17+
through what I call the "architecture" or "design" of the engine. This
18+
is what I aim to describe in this documents.
19+
2420
I wanted to write my own graphics engine primarily because I was
2521
curious to understand how these big systems are designed and
2622
implemented, and as a programming exercise / learning experience. The
@@ -94,7 +90,7 @@ provides the abstractions necessary to integrate other methods.
9490
## Scene
9591

9692
There are many ways to define a scene. Brenta supports both the
97-
scene-graph architecture, commonly used in Godot, Unity and Unreal,
93+
node-graph architecture, commonly used in Godot, Unity and Unreal,
9894
and the ECS (Entity Component System) architecture like in
9995
[Bevy](https://github.com/bevyengine/bevy/).
10096

docs/GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ ModelNodeComponent(Model&& m, bool transparent = false);
120120
ModelNodeComponent(tenno::shared_ptr<Model> m, bool transparent = false);
121121
```
122122
123-
In general, more "high-level" objects (such as the scene-graph) work
123+
In general, more "high-level" objects (such as the node-graph) work
124124
with shared pointers, while "low-level" objects such as textures and
125125
meshes store their data directly without pointers. If you only work
126126
with these objects you are not required to create shared pointers for

examples/aircraft.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ int main()
115115

116116
// Camera movement
117117

118-
auto camera = scene.get_camera();
118+
auto camera = scene.get_camera();
119119
glm::vec3 acceleration = glm::vec3(0.0);
120120
glm::vec3 speed = glm::vec3(0.0);
121121

122-
Mouse mouse = {};
122+
Mouse mouse = {};
123123
mouse.set_sensitivity(0.05f);
124124
bool capture_mouse = true;
125125

@@ -145,10 +145,10 @@ int main()
145145
delta_x *= sensitivity;
146146
delta_y *= sensitivity;
147147

148-
auto pos = camera->get_pos();
148+
auto pos = camera->get_pos();
149149
auto acam = std::get<Camera::Aircraft>(pos);
150150

151-
acam.yaw += delta_x;
151+
acam.yaw += delta_x;
152152
acam.pitch -= delta_y;
153153
camera->set_pos(acam);
154154
return;
@@ -167,7 +167,7 @@ int main()
167167

168168
while (!Window::should_close())
169169
{
170-
float delta_time = Window::get_time().get_delta();
170+
float delta_time = Window::get_time().delta;
171171
if (Window::is_key_pressed(Key::Escape))
172172
Window::close();
173173
if (Window::is_key_pressed(Key::W))

examples/app.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bool App::setup()
9999
scene_builder);
100100
auto root_node = scene->get_root();
101101
auto model_node = Scene::create_child(root_node);
102-
model_node->set_local(glm::vec3(10.0f, 0.0f, 0.0f));
102+
model_node->transform = glm::vec3(10.0f, 0.0f, 0.0f);
103103
Scene::add_component(model_node, model_component);
104104

105105
return true;
@@ -114,9 +114,18 @@ bool App::update(float delta_time)
114114
Gl::clear();
115115

116116
auto scene = AssetManager::get<Scene>("main_scene");
117-
if (!scene) return true;
117+
if (!scene) return false;
118118

119119
scene->update(delta_time);
120+
121+
return true;
122+
}
123+
124+
bool App::draw()
125+
{
126+
auto scene = AssetManager::get<Scene>("main_scene");
127+
if (!scene) return false;
128+
120129
scene->draw();
121130

122131
return true;

examples/asset_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ int main()
9696

9797
auto root_node = scene->get_root();
9898
auto model_node = Scene::create_child(root_node);
99-
model_node->set_local(glm::vec3(10.0f, 0.0f, 0.0f));
99+
model_node->transform = glm::vec3(10.0f, 0.0f, 0.0f);
100100

101101
Scene::add_component(model_node, model_component);
102102

103103
while (!Window::should_close())
104104
{
105-
auto delta_time = Window::get_time().get_delta();
105+
auto delta_time = Window::get_time().delta;
106106
if (Window::is_key_pressed(Key::Escape))
107107
Window::close();
108108

examples/demo/include/demo/systems/physics.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct PhysicsSystem : System<PhysicsEcsComponent,
3333
auto transform_component =
3434
World::entity_to_component<TransformEcsComponent>(match);
3535

36-
auto dt = Window::get_time().get_delta();
36+
auto dt = Window::get_time().delta;
3737
if (physics_component->acceleration != glm::vec3(0.0f))
3838
{
3939
physics_component->velocity += physics_component->acceleration * dt;

examples/demo/include/demo/systems/sprite_animation.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ struct SpriteAnimationSystem : System<SpriteAnimationEcsComponent,
2727
{
2828
for (auto& entity : matches)
2929
{
30-
// TODO: update the sprite index after some time
31-
auto dt = Window::get_time().get_delta();
30+
auto dt = Window::get_time().delta;
3231

3332
auto e = Entity(entity);
3433
auto sprite_animation =

examples/hot_reloading.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int main()
139139

140140
// Point light
141141
auto point_node = Scene::create_child(root_node);
142-
point_node->get_local().translate({-2.0, 2.0, 0.0});
142+
point_node->transform.translate({-2.0, 2.0, 0.0});
143143
auto point_light_component =
144144
tenno::make_shared<PointLightNodeComponent>(phong_point_ptr);
145145
Scene::add_component(point_node, point_light_component);
@@ -314,7 +314,7 @@ int main()
314314

315315
while (!Window::should_close())
316316
{
317-
float delta_time = Window::get_time().get_delta();
317+
float delta_time = Window::get_time().delta;
318318
if (Window::is_key_pressed(Key::Escape))
319319
Window::close();
320320

0 commit comments

Comments
 (0)