Jump to content

[SOLVED] i failed that get NodeReference's Bound Box.


photo

Recommended Posts

Posted

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.

Posted

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;
}

Posted

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?

Posted

NodeReference gets bounding box from their root node only. NodeDummy can combine bounds of all their children nodes.

×
×
  • Create New...