When working on my OpenGL tech demo, i needed to look up resources that were loaded, sources such as models, shaders or cube maps. I did this using std::map. When starting to work on my games fleadh game from scratch again i wanted to change how i did resource look up. I decided to roll my own hash table along with create my own hash function using fvn-1a.
When re-reading Real-Time Collision Detection by Christer Ericson i came across a section called Determinant Predicates in Chapter 3 A Math and Geometry Primer. I thought it was interesting that from just filling a matrix with data such a points in space and finding the determinate of that matrix you could do geometrical tests. Although the tests are not the most efficient ways for solving the problems outlined here i just wanted to make an implementation in C++ to test it myself.
In this blog i will talk about some bitwise operators and their uses in programming. Operators such as: << , >> , | , & , ^ , ~ will be discussed.
The bitwise left shift operator <<
The bitwise shift operators works by shifting a number by a number of bits. For example if you shift the int value of 5 by the number of bits 2 in binary form, so 0100 now becomes 10100. We essential shifted the binary number 0100 by two bits. An interesting application for this is
Lets say you have three equations with 3 unknowns:
- x + y + z = -5
- x -4y + z = 35
- x – 3y + 4z = -18
It’s currently 2:00 AM and wanted to make a quick post.
Since as of this morning I have switched to Visual Studio 2015 along with windows 10. I have my physics engine on BitBucket so I cloned that and got all my GLFW lib and headers, this took about 5 minutes to get my project set up from my older computer. Continue reading “GLFW and Visual Studio 2015”
We all know what virtual functions are and how to use them but it’s also important to know how they are implemented under the hood. Lets first take a look a non-virtual functions. They are easy because a particular function call always maps to a particular part of the code. The compiler can calculate the address of that function at compile and link time. At runtime all it does is make a call to a fixed address.
I’ve been reading Jason Gregory’s book Game Engine Architecture a lot lately. In Chapter 9 “Tools for Debugging and Development” he talks about how Naughty Dog use their own debug drawing API to visualize the results of mathematical calculations. I decide that this was a very nice simple feature to implement in my own physics engine. Continue reading “Debug Drawing”