Click here to Skip to main content
11,429,777 members (71,258 online)
Click here to Skip to main content
Add your own
alternative version

Using Quaternions Efficiently in Real-time Applications

, 10 Nov 2010 CPOL
Various methods for using quaternions in ways that maximize performance
#ifndef _NODE_H
#define _NODE_H

#include "NodeBase.h"

//Node class template////////////////////////////////////////////////////////
// This class uses the Decorator design pattern to add Node functionality
// to any Object type.  Node functionality means the containment
// of a vector of Objects and the methods needed to add new Objects
// to the vector, and to iterate through all of them to update their transforms.
// This makes it possible to create a tree of Nodes each representing an Object.
// Leaves in the tree can be simple Objects instead of Nodes.  This is made 
// possible with a function template, addChild where the actual type of the new
// child can be specified as a template parameter.
template< class OBJECT >
class Node : public OBJECT, public NodeBase
{
public:
    void updateWorldTransform( ObjectBase *parent )
    {
        OBJECT::updateWorldTransform( parent );

        updateAllObjects( this );
    }
};


#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

gtdelarosa
Software Developer Gameloft
United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150428.2 | Last Updated 10 Nov 2010
Article Copyright 2010 by gtdelarosa
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid