Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Nov 2005
Offline Last Active Today, 09:09 AM

Posts I've Made

In Topic: Templated Function results in Circular Inclusion

15 May 2016 - 12:31 AM

While Status is undefined, your code compiles for me on VS2013.

In Topic: What is the best way to update a Quadtree/Octree?

10 May 2016 - 05:50 AM

You could use a 1D or 2D hash for the lowest level of detail and index a cache in which you've allocated you QT/OT nodes directly.

Not only does maintaining a semi-duplicate linear data structure (for each level) help with simple updates, it is much more ergonomic in terms of memory management and most updates/neighbor lookups are bound to be MUCH more cache friendly.

Personally I feel like linear grids are almost always the way to go. If you do need coarse control, it makes more sense to mentally adjust how you think about a quadtree and treat it as a set of tiered linear arrays instead.

In Topic: Do you ever get this?

01 May 2016 - 01:59 AM


So yeah - do you ever get this?

Not so similar but ... here is it anyway
I've had to write algorithms for triangles  of different shapes, from normal to weird lately
Every time I thought I had written my algorithm to cover all the weird shaped triangles another weirder one appears and breaks the code.
And then after a while super weird shaped triangles began to appear that broke the code - triangles that are effectively a single line because you could draw a single straight line through all 3 points
I guess I probably hadn't read my books well enough, because i think veterans have standards ways of dealing with these weird shapes :lol:

I discovered the plentiful nuances of computational geometry firsthand when I wrote my triangulator. It took me months to iron out all the kinks and handle all special cases, and I'm sure there are still a few around that I simply haven't come across :).

A triangulator now seems like the perfect school assignment for students who think they know better. There's always that one special T junction, degenerate vertex or empty triangle they can't think of :)

In Topic: a mechanism to fill in for templated overloads

24 April 2016 - 11:09 AM

Okay, here's one way to do it. I'm guessing it's not the most elegant method, but it does work. In short, the idea is to get rid of push_arg() specialization inside member functions and set up a layer of indirection to pass the arguments to the correct overload. I reckon a snipped will be more illustrative. 



// forward declare an abstact type translator
template <typename T>
void push_arg(IN T arg, IN scriptengine* eng);
class scriptengine {
     // do as before, but this time push_arg() member functions are missing, so the compiler will look at globals
     template <typename T, typename ...Args>
     void push_arg(IN T arg, IN Args ...args)
       { push_arg(arg, this); push_arg(args...); } 

The overloaded engine class remains the same. The changes are instead added to the application code as translator specializations:

template <>
void push_arg<IActor*>(IN IActor* arg, IN scriptengine* eng)
    luaengine* luaEng = static_cast<luaengine*>(eng);
template <>
void push_arg<const char*>(IN const char* arg, IN scriptengine* eng)
    luaengine* luaEng = static_cast<luaengine*>(eng);
template <>
void push_arg<float>(float arg, IN scripting::engine* eng)
    luaengine* luaEng = static_cast<luaengine*>(eng);
// ... and so forth for all supported data types

It's actually really simple, but in all honesty I'd been pondering on and off as to how to pull it off for several weeks now.


Working with templates is, more often than not, like dancing tango on a melting raft made of ice. With a polar bear. There's usually a solution, but first you have to something about the polar bear.

In Topic: Anyone here a self-taught graphics programmer?

16 April 2016 - 02:43 AM

I'm also pretty much all self-taught. I started toying with QBasic just about when it was on its way out, but then arbitrarily picked up this book and started feeling my way around the first IDE (the Borland one) and started learning more serious stuff. I remember arrays and the order of logic operators being strangely elusive when I just started out :).


Eventually I created my first window in WinAPI and thought "now that I have a window, the rest is easy-peasy". Boy, was I wrong  :P .


Like many, I took up OpenGL with the help of NeHe's tutorials and continued reading books, all in my spare time, without really giving up a social life.


Eventually I found myself facing the same choice all people face when they graduate from high school. With no clear idea of what I wanted to do, I rolled in IT, with emphasis on software development. But then two strange things happened: as I took more and more courses, it turned out I knew too much for the school I went to, but too little to actually spearhead a sizeable project on my own; what was far more concerning was the feeling that I didn't want to labor away for someone else's dreams. So I graduated and rerolled in a completely different field, all while I started structuring my code into something a bit more cogent, which eventually turned into a something that started to smell like and feel like an engine. As a hobbyist, I find it surprisingly difficult to keep myself focused on a single objective, so pretty much all parts of my game engine are in very active development. Although, after years and years of rewriting and trying out different things, many of them are really starting to fall into place. Which feels awesome. :)


As time goes on, I do feel the sting of a lack of further formal education and the absence of the discipline of a professional work place in the back of my head. But I'm still not old enough to give up my dreams :).


So yeah - I don't have anything like L. Spiro's video to show for it, but what I can say with confidence is that I've studied and built a lot of stuff that I'm personally really really proud of. And again, that feels awesome:cool: