You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0a56357
Browse filesBrowse the repository at this point in the historyBrowse files
This might make you ask *what*are we plotting in this additional dimension, and the answer is simple: nothing that we weren't showing already
3
+
Most of the plotter-related features are already implemented, the only "math-y" thing missing being a few elementary functions, and some non-elementary functions that are convenient (like Lambert-W and the Zeta function). This means that we steer into the bane of every project's existence: making it usable!
4
4
5
-
In our plotter, we use brightness to represent magnitude (how large a number is). Black corresponds to zero, and white corresponds to a very high number, making roots of functions look like "sinks". It turns out that it's far easier to visualize these "sinks", "valleys" and "peaks" with the help of a third dimension (akin to looking at a satellite picture of a mountain range vs being there).
5
+
I plan on shipping this project as a single executable rather than a zipped folder, and later compiling it into web assembly for a demo. In either case, we can't work with files, because browsers don't have file systems in the traditional sense. Virtual file systems _do_ exist, but there is a much simpler solution: turning files into strings!
6
+
Now, this could be done by simply embedding a string like `const std::string vertex_source = R"({our code})"`, but if we wrote code this way, we lose our syntax highlighting and linting! The only solution is to create these strings dynamically at build-time.
6
7
7
-
There's many ways to render functions in 3D, but the one I chose is by laying out a large 256x256 grid of "mini-planes" that are molded to look like the function (there are methods with 'infinite' precision but they are horribly slow and, if we want more precision, we can just add more segments, anyway!). This required me to create a `Mesh` struct and functions to handle their creation and use.
8
-
Also, since all this logic operates on vertices, we have to move the 3D code into a vertex shader. This required massive refactoring of pretty much *all* of our preprocessing functions, since they were all rigged to work with the fragment shader. We also had to do more dependency injection trickery to make sure the 2D and 3D shaders remain synchronized (of course).
9
-
Finally, we had to create a custom camera to actually move around our 3D plot, and update our state variables to see if the plot is 3D.
10
-
11
-
Attached, the third dimension! :O
12
-
13
-
**Related Issues:**
14
-
[Issue #29](https://url.jam06452.uk/ou8zyn): 3D Plotting
15
-
16
-
**Related Commits:**
17
-
[Commit 4a0ab12](https://url.jam06452.uk/dv60mh): Fragment and vertex shader for 3D
18
-
[Commit 0a17f71](https://url.jam06452.uk/zsu6bw): Refactor of preprocessor logic
19
-
[Commit 614238a](https://url.jam06452.uk/u896ze): Created mesh grid
20
-
[Commit 4bfd2ed](https://url.jam06452.uk/fo0yqb): 3D Rendering done
21
-
[Commit 0a17f71](https://url.jam06452.uk/a8oszc): Working camera!
8
+
And that's pretty much it! We just now refactor any file access we wanted to use our `get_source` function, that secretely fetches the built string in compile-time if it's known.
0 commit comments