wxywxy.ji Posted September 19, 2012 Posted September 19, 2012 i can't get bound box when root node is dummy in NodeReference. ex) -> : child Node referenceNode -> dummy Node -> Mesh Node. how to use NodeReference. can i get that limited list? when i use reference Node.
frustum Posted September 19, 2012 Posted September 19, 2012 Please add two functions into the NodeDummy.h and NodeDummy.cpp files: // NodeDummy.h: virtual const BoundBox &getBoundBox() const; virtual const BoundSphere &getBoundSphere() const; // NodeDummy.cpp: const BoundBox &NodeDummy::getBoundBox() const { BoundBox bound_box; for(int i = 0; i < getNumChilds(); i++) { Node *node = getChild(i); mat4 itransform = mat4(getIWorldTransform() * node->getWorldTransform()); bound_box.expand(itransform * node->getBoundBox()); } static BoundBox ret_bound_box; ret_bound_box.set(bound_box); return ret_bound_box; } const BoundSphere &NodeDummy::getBoundSphere() const { static BoundSphere ret_bound_sphere; ret_bound_sphere.set(getBoundBox()); return ret_bound_sphere; }
wxywxy.ji Posted September 20, 2012 Author Posted September 20, 2012 thank for reply. i can get bound box after add source code. this state ) referenceNode -> dummy Node -> Mesh Node. other question. this state ) referenceNode -> Mesh Node -> Mesh Node referenceNode' Bound Box is Only One Child Node Bound Box?
frustum Posted September 20, 2012 Posted September 20, 2012 NodeReference gets bounding box from their root node only. NodeDummy can combine bounds of all their children nodes.
Recommended Posts