| 1 |
|
|---|
| 2 |
#include <OSGLog.h> |
|---|
| 3 |
#include <OSGNode.h> |
|---|
| 4 |
#include <OSGGroup.h> |
|---|
| 5 |
#include <OSGSimpleGeometry.h> |
|---|
| 6 |
|
|---|
| 7 |
OSG_USING_NAMESPACE |
|---|
| 8 |
|
|---|
| 9 |
int main(int argc, char* argv[]) |
|---|
| 10 |
{ |
|---|
| 11 |
osgInit(argc,argv); |
|---|
| 12 |
|
|---|
| 13 |
Pnt3f minPnt, maxPnt; |
|---|
| 14 |
|
|---|
| 15 |
NodePtr rootNode = Node::create(); |
|---|
| 16 |
GroupPtr rootCore = Group::create(); |
|---|
| 17 |
|
|---|
| 18 |
NodePtr childNode = Node::create(); |
|---|
| 19 |
GeometryPtr childCore = makeBoxGeo(1.0, 1.0, 1.0, 3, 3, 3); |
|---|
| 20 |
|
|---|
| 21 |
beginEditCP(childNode, Node::CoreFieldMask); |
|---|
| 22 |
FLOG(("childNode->setCore(childCore)\n")); |
|---|
| 23 |
childNode->setCore(childCore); |
|---|
| 24 |
endEditCP(childNode, Node::CoreFieldMask); |
|---|
| 25 |
|
|---|
| 26 |
beginEditCP(rootNode, Node::CoreFieldMask | Node::ChildrenFieldMask); |
|---|
| 27 |
FLOG(("rootNode->setCore(rootCore)\n")); |
|---|
| 28 |
rootNode->setCore(rootCore); |
|---|
| 29 |
|
|---|
| 30 |
FLOG(("rootNode->addChild(childNode)\n")); |
|---|
| 31 |
rootNode->addChild(childNode); |
|---|
| 32 |
endEditCP(rootNode, Node::CoreFieldMask | Node::ChildrenFieldMask); |
|---|
| 33 |
|
|---|
| 34 |
FLOG(("rootNode->getVolume(true).getBounds(minPnt, maxPnt)\n")); |
|---|
| 35 |
rootNode->getVolume(true).getBounds(minPnt, maxPnt); |
|---|
| 36 |
FLOG(("minPnt: %f %f %f\n", minPnt[0], minPnt[1], minPnt[2])); |
|---|
| 37 |
FLOG(("maxPnt: %f %f %f\n", maxPnt[0], maxPnt[1], maxPnt[2])); |
|---|
| 38 |
|
|---|
| 39 |
FLOG(("----------------------------\n")); |
|---|
| 40 |
|
|---|
| 41 |
beginEditCP(rootNode, Node::ChildrenFieldMask); |
|---|
| 42 |
FLOG(("rootNode->subChild(0)\n")); |
|---|
| 43 |
rootNode->subChild(0); |
|---|
| 44 |
endEditCP(rootNode, Node::ChildrenFieldMask); |
|---|
| 45 |
|
|---|
| 46 |
rootNode->invalidateVolume(); |
|---|
| 47 |
|
|---|
| 48 |
FLOG(("rootNode->getVolume(true).getBounds(minPnt, maxPnt)\n")); |
|---|
| 49 |
rootNode->getVolume(true).getBounds(minPnt, maxPnt); |
|---|
| 50 |
FLOG(("minPnt: %f %f %f\n", minPnt[0], minPnt[1], minPnt[2])); |
|---|
| 51 |
FLOG(("maxPnt: %f %f %f\n", maxPnt[0], maxPnt[1], maxPnt[2])); |
|---|
| 52 |
|
|---|
| 53 |
return 0; |
|---|
| 54 |
} |
|---|