Archive for the tag: graphics programming

Simple Scene Graph in C++

Tags:, , 4 Comments »

There are several articles gathering dust bunnies on the internet on creating a scene graph class in C++ for your 3D engine but most are pretty vague and quite old. Hopefully, this post will give you a foot in the door in creating your own scene graph for your engine.

To start off, let’s go over some basics. A scene graph is a tree-like data structure which holds information about the scene you want to display. Every node has a parent and every node may have children. In this post we’ll use the std::vector to store the scene nodes but you can substitute this with whatever you want. A scene graph can be visualized like so:

             [root node]
                  |
        o=========o=========o
        |         |         |
    [child 1] [child 2] [child 3]
        |
    o===o====o
    |        |
[child 4][child 5]
             |
         [child 6]

Any node may have any number of children who’s children may have any number of children, etc. Each node in the scene graph may have a name for lookup functionality so a very lookup system will be implemented. We will also need functionality to add a child node, remove a child node, set/get a node’s parent and an update function for updating the graph hierarchically.
Read the rest of this entry »

Getting there

Tags:, No Comments »

Scriptionary is growing again. Several articles have been added to the Wiki and a few articles are still coming up. Notably, two articles have been recovered from the old site: Got a minute? Refactor your code and CPUs Maximum Throughput and Overhead which haven’t been altered from their original formats.

Besides the old, new things have been introduced to Scriptionary such as the Creating a Window Wrapper Class and Getting Screen Modes articles for Microsoft Windows Graphics Programmers.

Edit: Additionally, you can keep track of the pages by visiting the “All Pages” page on the wiki.