Re: [osg-users] View Frutrum Culling
I did the following: class CullCallback : public osg::NodeCallback { public: bool isVisible; CullCallback():isVisible(false){} virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { traverse(node,nv); if (!((osgUtil::CullVisitor*) nv)-isCulled(*node)) this-isVisible=true; } }; I installed this to every node where I want to know if its currently visible or not with setCullCallback Then I question somewhere else the flag like this: return ((CullCallback*)this-node-getCullCallback())-isVisible; Even if my camera is far away and facing somewhere, where nothing is visible. Everything is said to be visible. Please help me. I really don't get it. Greeting Hagen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] View Frustrum Culling
Hello everyone, Maybe it sounds basic. I have camera that will never change place. I have a database with one Object/onFile-Mapping. So next time I load my Scene id like to load only relevant Objects to shorten Loading time. Simple Task: I need to get a list of all VISIBLE Objects in the ViewFrustrum. Can this be done with the cull-Traverser. The docs say it collects all the objects in a special order. Are these objects all objects in the end or only the visible? How can I get the visbile Nodes? What things are to be taken care of? Greetings? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineSegmentIntersector LEAK-Problem ?
Yes you are right. Code compiles fine in release-mode. Greetings Hagen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LineSegmentIntersector LEAK-Problem?
Hello everyone, I using the following code: Is it a bug? Its used inside C++/CLI Environment but inside a pure native class. This was halfways copypasted from one of the examples. It's a function inside a GUIEventHandler called in cas of a GUIEvenetAdapter::REALESE: void pick(const osgGA::GUIEventAdapter ea, osgViewer::Viewer* viewer) { osgUtil::LineSegmentIntersector::Intersection intersection; osg::Node* scene = viewer-getSceneData(); if (!scene) return; /*osg::Node* node = 0; osg::Group* parent = 0;*/ osg::ref_ptrosgUtil::LineSegmentIntersector picker; picker = new osgUtil::LineSegmentIntersector( osgUtil::Intersector::PROJECTION, ea.getXnormalized(),ea.getYnormalized() ); picker-setThreadSafeReferenceCounting(true); ---Thought this could solve the problem but didnt change anything picker-setThreadSafeRefUnref(true); Same here osgUtil::IntersectionVisitor iv(picker.get()); viewer-getCamera()-accept(iv); if (picker-containsIntersections()) { intersection = picker-getFirstIntersection(); ---THIS LINE THROWS AN ERROR } return; } I get the following error: The output window may have more diagnostic information. HEAP[interfaceD.exe]: Invalid Address specified to RtlFreeHeap( 0217, 11395350 ) Windows has triggered a breakpoint in interfaceD.exe. This may be due to a corruption of the heap, which indicates a bug in interfaceD.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while interfaceD.exe has focus. The output window may have more diagnostic information. The program '[840] interfaceD.exe: Managed' has exited with code 0 (0x0). The program '[840] interfaceD.exe: Native' has exited with code 0 (0x0). ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LineSegmentIntersector LEAK-Problem?
I traced the error now: The function LineSegementIntersector::getFirstIntersection() executes very well to the last bit that is: Dereference _intersections.begin(); It jumps therefor to xtree.h : reference operator*() const { // return designated value return ((reference)**(const_iterator *)this); --TO HERE } Afterwards it jumps for a reason that i dont understand to vector destructor and there to: void _Tidy() { // free all storage if (_Myfirst != 0) { // something to free, destroy and deallocate it #if _HAS_ITERATOR_DEBUGGING this-_Orphan_all(); #endif /* _HAS_ITERATOR_DEBUGGING */ _Destroy(_Myfirst, _Mylast); this-_Alval.deallocate(_Myfirst, _Myend - _Myfirst); --THIS IS THE POINT WHERE THE PROGRAM DIES } _Myfirst = 0, _Mylast = 0, _Myend = 0; } So it tries somehow to free items in a vector that doesnt exist (?) A solution for my pov is: Instead of writing (picker is a LineSegementIntersector: Picker-getFirstIntersection()-dowhatwever() I write: Picker-getIntersections().begin()-dowhatever(); Still think there must be a bug somewhere at microsoft stl degubimpl or openscenegraph. Greetings, Hagen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transparency during runtime
Hello everyone, Im dont come any further, trying to change transparency of on object at runtime. I have something like this: The stateset in a method: this-material = new osg::Material(); this-material-setDataVariance(osg::Object::DYNAMIC); osg::ref_ptrosg::StateSet stateset = new osg::StateSet(); stateset-setDataVariance(osg::Object::DYNAMIC); // set up the texture. osg::Texture2D* texture = new osg::Texture2D; texture-setImage(image); stateset-setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setAttributeAndModes(this-material.get(),osg::StateAttribute: :OVERRIDE|osg::StateAttribute::ON); stateset-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); The stateset is then applied to a geode once. And in another mehtod after viewer is running and object is shown: this-material-setTransparency(osg::Material::Face::FRONT_AND_BACK,valu e); This method is called continuesly with different float values between 0 and 1 depending an GUI Slider. But I cant see any changes. Do you have some hints maybe? Greetings Hagen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Positioning the viewers camera
Hello everyone, I am desparately trying to position a viewers camera manually and correctly. My give data give me a Position Vector a RotationAxis and a Rotation Angle. And a float that is named fieldofView. Here is how I implement it: osgGA::TrackballManipulator* man = (osgGA::TrackballManipulator*)this-viewer-getCameraManipulator(); osg::Matrix trans; trans.makeTranslate(osg::Vec3(position.x(),position.y(),position.z())); osg::Matrix rot; rot.makeRotate(Angle,osg::Vec3(Axis.x,Axis.y,Axis.z))); osg::Matrix cam = rot*trans; this-viewer-setByMatrix(cam) } But I never get the right position or rotation. After testing around, I noticed the following: Changing trans.makeTranslate(... to trans.makeTranslate(osg::Vec3(position.x, -position.z, position.y)); I somehow get the right position. But the right rotation?? I found a tutorial somewhere, where it says Everything under osgGa:: Namespace has another AxisOrientation. And in the tutorial there is something said about producer::rotate. What is Producer. This namespace doesnt even exist in OpenSceneGraph; Please help!! Thx in advance Greetings to everyone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Positioning the viewers camera
Thanks for the idea, But that doesnt seem to bring me any furhter. Coordinates are somthing like 500, -5,50 so making this all minus brings me so far away, that i cant see anything anymore This is what I found in atutorial about that problem: To position a camera manually, we can use the viewer class setViewByMatrix() method. This call should be placed between the viewer.update and viewer.frame calls within the simulation loop. The following guidelines are useful: * Producer and all classes below osgGA::MatrixManipulator (in terms of abstraction) use 'Y' up coordinates. All others -including the Viewer class matrix manipulators - use 'Z' up. * The inverse of a position/orientation matrix can be used to orient a camera. This correseponds to my makeTranslate call, I think. Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Alejandro Segovia Gesendet: Freitag, 6. Juni 2008 16:24 An: OpenSceneGraph Users Betreff: Re: [osg-users] Positioning the viewers camera Hello, On Fri, Jun 6, 2008 at 11:10 AM, Kaiser, Hagen (CT) [EMAIL PROTECTED] wrote: Hello everyone, I am desparately trying to position a viewers camera manually and correctly. My give data give me a Position Vector a RotationAxis and a Rotation Angle. And a float that is named fieldofView. Here is how I implement it: osgGA::TrackballManipulator* man = (osgGA::TrackballManipulator*)this-viewer-getCameraManipulator(); osg::Matrix trans; trans.makeTranslate(osg::Vec3(position.x(),position.y(),position.z())); osg::Matrix rot; rot.makeRotate(Angle,osg::Vec3(Axis.x,Axis.y,Axis.z))); osg::Matrix cam = rot*trans; this-viewer-setByMatrix(cam) } But I never get the right position or rotation. After testing around, I noticed the following: Changing trans.makeTranslate(... to trans.makeTranslate(osg::Vec3(position.x, -position.z, position.y)); Have you tried making a translation of (-x, -y, -z) instead? Remember that placing the camera at some point P is actually applying a translation of -P to the whole world. cam = rot*trans seems fine. Let me know how it went. Alejandro.- -- [EMAIL PROTECTED] http://varrojo.linuxuruguay.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Positioning the viewers camera
It is in radians. But do you know something about those diffent Up-Vectors? -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Paul Melis Gesendet: Freitag, 6. Juni 2008 16:36 An: OpenSceneGraph Users Betreff: Re: [osg-users] Positioning the viewers camera Kaiser, Hagen (CT) wrote: Thanks for the idea, But that doesnt seem to bring me any furhter. Coordinates are somthing like 500, -5,50 so making this all minus brings me so far away, that i cant see anything anymore This is what I found in atutorial about that problem: To position a camera manually, we can use the viewer class setViewByMatrix() method. This call should be placed between the viewer.update and viewer.frame calls within the simulation loop. The following guidelines are useful: * Producer and all classes below osgGA::MatrixManipulator (in terms of abstraction) use 'Y' up coordinates. All others -including the Viewer class matrix manipulators - use 'Z' up. * The inverse of a position/orientation matrix can be used to orient a camera. This correseponds to my makeTranslate call, I think. Just a check: is the rotation value you apply in degrees or radians? makeRotate() expects a value in radians... Paul *Von:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *Im Auftrag von *Alejandro Segovia *Gesendet:* Freitag, 6. Juni 2008 16:24 *An:* OpenSceneGraph Users *Betreff:* Re: [osg-users] Positioning the viewers camera Hello, On Fri, Jun 6, 2008 at 11:10 AM, Kaiser, Hagen (CT) [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello everyone, I am desparately trying to position a viewers camera manually and correctly. My give data give me a Position Vector a RotationAxis and a Rotation Angle. And a float that is named fieldofView. Here is how I implement it: osgGA::TrackballManipulator* man = (osgGA::TrackballManipulator*)this-viewer-getCameraManipulator(); osg::Matrix trans; trans.makeTranslate(osg::Vec3(position.x(),position.y(),position.z())); osg::Matrix rot; rot.makeRotate(Angle,osg::Vec3(Axis.x,Axis.y,Axis.z))); osg::Matrix cam = rot*trans; this-viewer-setByMatrix(cam) } But I never get the right position or rotation. After testing around, I noticed the following: Changing trans.makeTranslate(... to trans.makeTranslate(osg::Vec3(position.x,* -position.z, position.y*)); Have you tried making a translation of (-x, -y, -z) instead? Remember that placing the camera at some point P is actually applying a translation of -P to the whole world. cam = rot*trans seems fine. Let me know how it went. Alejandro.- -- [EMAIL PROTECTED] http://varrojo.linuxuruguay.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org