Skip to content

Instantly share code, notes, and snippets.

@Memresable
Memresable / gizmo.md
Last active May 14, 2025 06:44
A Simple And Intuitive Explanation of How Gizmos Work In 3D Space

A Simple And Intuitive Explanation of How Gizmos Work In 3D Space

If you've ever used a 3D editor, then you've most likely used a certain thing called "Gizmo", Gizmos are essentially transformation modifiers that's within a world, they let you modify the object's position, orientation and scale. The implementation of a Gizmo is actually fairly straightforward for the most part (or may not be depending on how your application handles things internally, but at the fundamental level it's simple).

This article would only cover Translations and Rotations, Scaling is very easy to implement after understanding how the first two work. And also this may give you a hint into how Blender's robust implementation of Gizmo works as well!

box-gizmo


@Memresable
Memresable / binary_file_trees.md
Last active December 29, 2024 05:19
Binary file construction with trees

A different approach to binary file construction with trees

Lately I've been struggling creating custom file formats for my game, and every time i wanted to create a file format i would have gone through the same design process that's tedious and boring, usually i become selective on whether it should be binary/XML/JSON etc, there's so many options to do the same exact thing but they all have tradeoffs, it heavily depends on what i'm storing

Take renderable objects as an example, meshes usually have arbitrary primitives that are not constant in count size, and so jumping around and putting next_offset and previous_offset variables with magic numbers everywhere manually is extremely annoying, and they sometimes describe scenes of sub renderables as well and so you would have to somehow store the transform components along how many children a node currently has (which is unknown!) and so on

@Memresable
Memresable / rotational_dynamics_rigid.md
Last active June 10, 2025 08:42
The Fundamentals Of Rotational Dynamics In 3D Rigid Body Simulation

The Fundamentals Of Rotational Dynamics In 3D Rigid Body Simulation

intro

In this article, I hopefully clear the most important parts in rotational dynamics related to 3D rigid body simulation and introduce them in an intuitive way, this is mainly for non-physicists (I'm not even a physicist myself, so that's that...), so if you're a physicist or already familiar with moments of inertia well, then I don't think you're going to get anything new out of this, otherwise then this is probably for you!

It's mainly focused on engineers and programmers, so there's not a whole lot of walls of math text and giggles, mostly focused on the very fundamentals and applications of them

The article is also mainly to make sure I have gotten certain concepts right for the most part, so there may be some mistakes here and there, be warned

@Memresable
Memresable / randy_gaul_obb.md
Last active December 23, 2024 13:58
A look at Randy Gaul's 3D OBB-OBB collision detection & resolution

UPDATE

The article seems to have a really bad tune, it was back then me writing this and i learned a whole lot later on, i don't find this to be a decent article to follow through and i wouldn't recommend it anymore per se, i'm thinking of doing a complete rewrite of this with my own simplified implementation of it (which isn't perfect and contains errors, but would be quite good for understanding), it still contains some useful information however in case you're interested.

And the little rant has been removed since I've found it to be distracting and not helpful, i've learned that they have a good use for some other things, I still don't recommend the GJK + EPA combination however, but they have some useful uses.

Some helpful resources for the time being:

Dirk Gregorius, The Seperating Axis Test

@Memresable
Memresable / win32_page_merging.md
Last active November 14, 2024 18:20
Combining Memory Pages in Windows

WARNING

This may contain tons of errors, I have not carefully checked if the method used here is fully correct/safe, read the docs!

Also this is a very old gist, I'm thinking of doing a modernaized version of this for fun at some point

Combined Pages

So lately i've been playing around the idea of merging pages together to be a single linear writable memory, I've searched through the web a lot and i've never seen anyone actually doing it in a way i did, the reason behind researching around this topic was i was curious, but also it seemed useful to just merge stuff together and eliminate memory fragmentation by merging multiple chunks together to form one contigues memory you can write to

what i basically need to do is create a file mapping object that is multiple of 64KB pages of total size, each file map created is an object returned by the OS that is a "file" but can be treated as a regular memory that can be written to as well, then i allocate a virtual memory that is "reserved" to be replaced by ma