Skip to content

Commit d917f2a

Browse files
committed
tests: added signal test, rebuilt documentation
1 parent 3d387d3 commit d917f2a

File tree

443 files changed

+9008
-36152
lines changed

Some content is hidden

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

443 files changed

+9008
-36152
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ HTML_INTRO := utils/website/intro.html
3636
HTML_OUTRO := utils/website/outro.html
3737
TMP_FILE := /tmp/padoc-out.html
3838
HIGHLIGHT_STYLE := tango
39-
PANDOC_FLAGS := --highlight-style ${HIGHLIGHT_STYLE}
39+
PANDOC_FLAGS := --highlight-style ${HIGHLIGHT_STYLE} --ascii
4040

4141
html: doxygen ${HTML} ## Generate website and documentation
4242

@@ -48,12 +48,13 @@ doxygen: ## Generate html documentation
4848
cp -r docs/*.jpg ${HTML_DIR}
4949

5050
$(HTML_DIR)/%.html: ${DOCS_DIR}/%.md ${HTML_INTRO} ${HTML_OUTRO} | ${HTML_DIR}
51-
pandoc $< -o ${TMP_FILE} ${PANDOC_FLAGS}
51+
pandoc $< -f markdown-smart -t html -o ${TMP_FILE} ${PANDOC_FLAGS}
5252
cp ${HTML_INTRO} $@
5353
cat ${TMP_FILE} >> $@
5454
cat ${HTML_OUTRO} >> $@
5555
sed -i 's/\.md/\.html/g' $@
5656
sed -i 's/.\/html/.\//g' $@
57+
sed -i "s/’/\'/g" $@
5758

5859
$(HTML_DIR):
5960
mkdir -p ${HTML_DIR}

docs/BUILD.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ cmake -Bbuild
4343
cmake --build build -j$(nproc)
4444
```
4545

46+
For debug builds, specify `-D CMAKE_BUILD_TYPE=Debug`. This will
47+
generate all debug information and enable address sanitization.
48+
4649
For the static library:
4750

4851
```bash

docs/GUIDE.md

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -317,36 +317,17 @@ TODO
317317

318318
## Audio
319319

320-
The audio subsystem is very simple: there are audio streams and audio
321-
files, you can play an audio file on a stream and stop it. Each stream
322-
can play only one audio at a time, so you need to have multiple
323-
streams if you want to play multiple sounds at the same time.
324-
325-
You can load an audio file like so:
326-
327-
```cpp
328-
Audio::load("guitar", "assets/audio/guitar.wav");
329-
```
330-
331-
We are identifying this audio file with the name `guitar`.
332-
333-
You can create a stream with the name "music" like so:
320+
TODO
334321

335322
```cpp
336-
Audio::create_stream("music");
337-
```
338-
339-
And finally play the `guitar` audio like so:
323+
auto guitar_sound_asset = SoundAsset::Builder()
324+
.path("examples/assets/audio/guitar.wav")
325+
.build();
326+
auto guitar_sound = Sound(guitar_sound_asset.value());
340327

341-
```cpp
342-
Audio::play("guitar");
328+
guitar_sound.play();
343329
```
344330

345-
You can Pause and Resume streams with `brenta::audio::stream_pause` and
346-
`brenta::audio::stream_resume`, set the volume and stop it. You can find
347-
the API in `Brenta::Audio`.
348-
349-
350331
## Opengl
351332

352333
TODO
@@ -367,34 +348,45 @@ GPU so the engine can handle lots and lots of particles. Here's a
367348
quick look on the API:
368349

369350
```cpp
370-
auto emitter = ParticleEmitter::Builder()
371-
.starting_position(glm::vec3(0.0f, 0.0f, 5.0f))
372-
.starting_velocity(glm::vec3(0.0f, 5.0f, 0.0f))
373-
.starting_spread(glm::vec3(10.0f, 10.0f, 10.0f))
374-
.starting_time_to_live(0.5f)
375-
.num_particles(1000)
376-
.spawn_rate(0.01f)
377-
.scale(1.0f)
378-
.atlas_path"assets/textures/particle_atlas.png")
379-
.atlas_width(8)
380-
.atlas_height(8)
381-
.atlas_index(45)
382-
.build();
383-
384-
// Inside the game loop:
385-
emitter.update(Window::get_time().get_delta());
351+
auto emitter =
352+
ParticleEmitter::Builder()
353+
.with_camera(camera)
354+
.starting_position(glm::vec3(0.0f, 0.0f, 0.0f))
355+
.starting_velocity(glm::vec3(0.0f, 5.0f, 0.0f))
356+
.starting_spread(glm::vec3(3.0f, 10.0f, 3.0f))
357+
.starting_time_to_live(0.5f)
358+
.num_particles(1000)
359+
.spawn_rate(0.99f)
360+
.scale(1.0f)
361+
.atlas_path("examples/assets/textures/particle_atlas.png")
362+
.atlas_width(8)
363+
.atlas_height(8)
364+
.atlas_index(3)
365+
.build();
366+
367+
// Inside the main loop
368+
emitter.update(delta_time);
386369
emitter.render();
387370
```
388371
389372
### Text
390373
391374
TODO
392375
393-
The `brenta::text` subsystem allows you to render text on the screen. You can
394-
set the font and font size of your text, and render it in the main loop like
395-
this:
396376
```cpp
397-
Text::render_text("Hello OpenGL!", x, y, scale, glm::vec3(r, g, b));
377+
auto font = Font("examples/assets/fonts/arial.ttf", 100);
378+
auto font_ptr =
379+
tenno::make_shared<Font>(tenno::move(font));
380+
381+
Text hello = {
382+
"Hello OpenGL!",
383+
25.0f,
384+
25.0f,
385+
1.0f,
386+
Color::yellow(),
387+
font_ptr
388+
};
389+
hello.render();
398390
```
399391

400392
## Renderer
@@ -491,12 +483,11 @@ e.add_component<PhysicsComponent>(10.0f);
491483

492484
### System
493485

494-
A System is a function that gets called at each Tick. It contains all
495-
the logic of the World. You will interact with the Entities,
496-
Components and Resources via queries. You can specify an entity to
497-
query by adding components to `system<...>`, the World will provide
498-
you with an `std::vector<entity_t>` of the entities that have all the
499-
components you specified.
486+
A System is a function that gets called at each Tick and implements
487+
the update logic of the World. You can specify entities to query by
488+
adding components to `system<...>`, the World will provide you with an
489+
`std::vector<entity_t>` of the entities that have all the components
490+
you specified.
500491

501492
Here is an example:
502493

@@ -546,7 +537,7 @@ Here is an high level simplified view of those objects:
546537
![image](https://github.com/user-attachments/assets/d76b238d-56f1-4b57-8140-400af6ed1d23)
547538
548539
549-
## Scene graph
540+
## Node graph
550541
551542
TODO
552543
@@ -558,6 +549,10 @@ TODO
558549
559550
TODO
560551
552+
## Node Components
553+
554+
TODO
555+
561556
### Scripts
562557
563558
TODO

docs/html/BUILD.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
<div class="topnav">
1010
<a href="./index.html">Brenta Engine</a>
1111
<a href="./DESIGN.html">Design</a>
12-
<a href="./BUILD.html">Build</a>
1312
<a href="./GUIDE.html">Guide</a>
14-
<a href="./CONTRIBUTING.html">Contributing</a>
13+
<a href="./BUILD.html">Build</a>
1514
<a href="./annotated.html">Data structures</a>
1615
<a href="./files.html">Files</a>
1716
<a href="https://github.com/San7o/Brenta-Engine">Github</a>
1817
</div>
1918
<h1 id="building-the-engine">Building the engine</h1>
20-
<p>Brenta-Engine is written C++23 and uses <code>cmake</code> as its
19+
<p>Brenta-Engine is written C++23 and uses <code>cmake</code> as it's
2120
build system. You can compile the engine as a static or shared library
2221
for both Windows and Linux.</p>
2322
<h2 id="dependencies">Dependencies</h2>
@@ -45,6 +44,9 @@ <h2 id="build">Build</h2>
4544
<div class="sourceCode" id="cb3"><pre
4645
class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cmake</span> <span class="at">-Bbuild</span></span>
4746
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cmake</span> <span class="at">--build</span> build <span class="at">-j</span><span class="va">$(</span><span class="fu">nproc</span><span class="va">)</span></span></code></pre></div>
47+
<p>For debug builds, specify <code>-D CMAKE_BUILD_TYPE=Debug</code>.
48+
This will generate all debug information and enable address
49+
sanitization.</p>
4850
<p>For the static library:</p>
4951
<div class="sourceCode" id="cb4"><pre
5052
class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cmake</span> <span class="at">-Bbuild</span> <span class="at">-DBUILD_SHARED_LIBS</span><span class="op">=</span>off</span>

docs/html/CONTRIBUTING.html

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

docs/html/DESIGN.html

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,13 @@
99
<div class="topnav">
1010
<a href="./index.html">Brenta Engine</a>
1111
<a href="./DESIGN.html">Design</a>
12-
<a href="./BUILD.html">Build</a>
1312
<a href="./GUIDE.html">Guide</a>
14-
<a href="./CONTRIBUTING.html">Contributing</a>
13+
<a href="./BUILD.html">Build</a>
1514
<a href="./annotated.html">Data structures</a>
1615
<a href="./files.html">Files</a>
1716
<a href="https://github.com/San7o/Brenta-Engine">Github</a>
1817
</div>
1918
<h1 id="design">Design</h1>
20-
<p>I could tell you that the Brenta engine was perfectly designed, with
21-
a clear vision from its inception, with a beautiful and powerful API
22-
that makes programming truly enjoyable. Except the fact that it would be
23-
a lie. It does not mean that I don’t find the current design and API
24-
beautiful and fun - I think Brenta is a powerful engine - but its
25-
development has been more iterative than meticulously designed. I
26-
rewrote huge parts of the engine many many times, to the point where I
27-
am not scared to do big refactoring anymore - that is just routine - and
28-
I know I am deemed to repeat this process again. But through these many
29-
refactoring, the API reached a point where all objects work well
30-
together and you can reason about them through what I call the
31-
“architecture” or “design” of the engine. This is what I aim to describe
32-
in this documents.</p>
3319
<p>Game engines are complex pieces of software. They provide an
3420
interface to define logic, render graphics, and access system resources
3521
like audio and input, as well as providing a cross-platform abstraction
@@ -38,6 +24,14 @@ <h1 id="design">Design</h1>
3824
<img src="./brenta-picture.png" alt="high-level-overview" />
3925
<figcaption aria-hidden="true">high-level-overview</figcaption>
4026
</figure>
27+
<p>Brenta's its development has been more iterative than meticulously
28+
designed. I rewrote huge parts of the engine many many times, to the
29+
point where I am not scared to do big refactoring anymore - that is just
30+
routine - and I know I am deemed to repeat this process again. But
31+
through these many refactoring, the API reached a point where all
32+
objects work well together and you can reason about them through what I
33+
call the "architecture" or "design" of the engine. This is what I aim to
34+
describe in this documents.</p>
4135
<p>I wanted to write my own graphics engine primarily because I was
4236
curious to understand how these big systems are designed and
4337
implemented, and as a programming exercise / learning experience. The
@@ -89,11 +83,11 @@ <h2 id="renderer">Renderer</h2>
8983
uses rasterization, which means projecting each surface to the screen
9084
and calculating the color of each pixel by interpolating each one of
9185
them (parallelized on the GPU).</p>
92-
<p>This projection is achieved by multiplying together three matrices:
86+
<p>This "projection" is achieved by multiplying together three matrices:
9387
the <code>model</code> or <code>world</code> matrix which translates a
9488
vertex to its position in world space, the <code>view</code> matrix
9589
which shift and rotates the world based on the camera position (If the
96-
camera moves 5 feet to the right, its mathematically the same as moving
90+
camera moves 5 feet to the right, it&#x2019;s mathematically the same as moving
9791
the entire world 5 feet to the left), and <code>projection</code> matrix
9892
which applies perspective and field-of-view; this ultimately maps the
9993
vertices inside a cube called the Canonical Cube where the GPU can work
@@ -104,7 +98,7 @@ <h2 id="renderer">Renderer</h2>
10498
integrate other methods.</p>
10599
<h2 id="scene">Scene</h2>
106100
<p>There are many ways to define a scene. Brenta supports both the
107-
scene-graph architecture, commonly used in Godot, Unity and Unreal, and
101+
node-graph architecture, commonly used in Godot, Unity and Unreal, and
108102
the ECS (Entity Component System) architecture like in <a
109103
href="https://github.com/bevyengine/bevy/">Bevy</a>.</p>
110104
<h3 id="scene-graph">Scene graph</h3>

0 commit comments

Comments
 (0)