From: <vo...@us...> - 2008-02-24 10:26:00
|
Revision: 649 http://opde.svn.sourceforge.net/opde/?rev=649&view=rev Author: volca Date: 2008-02-24 02:25:43 -0800 (Sun, 24 Feb 2008) Log Message: ----------- Inlining the tree traversal Modified Paths: -------------- trunk/src/scenemanager/DarkBspNode.cpp trunk/src/scenemanager/DarkBspNode.h Modified: trunk/src/scenemanager/DarkBspNode.cpp =================================================================== --- trunk/src/scenemanager/DarkBspNode.cpp 2008-02-24 10:22:16 UTC (rev 648) +++ trunk/src/scenemanager/DarkBspNode.cpp 2008-02-24 10:25:43 UTC (rev 649) @@ -73,32 +73,6 @@ } //----------------------------------------------------------------------- - bool BspNode::isLeaf(void) const - { - return mIsLeaf; - } - - //----------------------------------------------------------------------- - BspNode* BspNode::getFront(void) const - { - if (mIsLeaf) - throw Exception(Exception::ERR_INVALIDPARAMS, - "This method is not valid on a leaf node.", - "BspNode::getFront"); - return mFront; - } - - //----------------------------------------------------------------------- - BspNode* BspNode::getBack(void) const - { - if (mIsLeaf) - throw Exception(Exception::ERR_INVALIDPARAMS, - "This method is not valid on a leaf node.", - "BspNode::getBack"); - return mBack; - } - - //----------------------------------------------------------------------- const Plane& BspNode::getSplitPlane(void) const { if (mIsLeaf) Modified: trunk/src/scenemanager/DarkBspNode.h =================================================================== --- trunk/src/scenemanager/DarkBspNode.h 2008-02-24 10:22:16 UTC (rev 648) +++ trunk/src/scenemanager/DarkBspNode.h 2008-02-24 10:25:43 UTC (rev 649) @@ -61,6 +61,7 @@ friend class DarkCamera; friend class BspRaySceneQuery; friend class BspIntersectionSceneQuery; + friend class BspTree; public: BspNode(SceneManager* owner, int id, bool isLeaf); @@ -77,19 +78,19 @@ virtual methods / run-time type identification would have a performance hit, and it would not make the code much (any?) simpler anyway. I think this is a fair trade-off in this case. */ - bool isLeaf(void) const; + inline bool isLeaf(void) const { return mIsLeaf; }; /** Returns a pointer to a BspNode containing the subspace on the positive side of the splitting plane. This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this method on a leaf node will throw an exception. */ - BspNode* getFront(void) const; + inline BspNode* getFront(void) const { assert(!mIsLeaf); return mFront; }; /** Returns a pointer to a BspNode containing the subspace on the negative side of the splitting plane. This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this method on a leaf node will throw an exception. */ - BspNode* getBack(void) const; + BspNode* getBack(void) const { assert(!mIsLeaf); return mBack; }; /** Determines which side of the splitting plane a worldspace point is. This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |