Re: [osg-users] osgdot - a tool to generate a picture ofascenegraph'sstructure

2007-11-22 Thread Paul Melis
Hello Alberto,

Alberto Luaces wrote:

It doesn't compile out of the box on 64bit, because of the casts from pointer 
to 'unsigned int'. Changing those casts to 'unsigned long' works, but it is 
an ugly hack.
  

I could not come up with a better way to store an object's identity. 
The actual memory location where a node is stored is about the only 
fixed reference to it.
Perhaps defining a pointer type with

#ifdef 32 bit
typedef unsigned int pointer;
#elif 64
typedef unsigned long int pointer;
#endif

and then using the pointer type everywhere is a better solution.

Paul

El Thursday 15 November 2007 18:14:23 Mike Weiblen escribió:
  

whups, moved it to

http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/application
s/osgdot/

-- mew



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Mike Weiblen
Sent: Thursday, November 15, 2007 10:58 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgdot - a tool to generate a
picture ofascenegraph'sstructure

  

-Original Message-
On Nov 15, 2007 4:35 PM, Mike Weiblen [EMAIL PROTECTED]

wrote:


Very cool!  Maybe whip up a plugin Writer wrapper around it,
permitting

osgconv cow.osg cow.dot

Then, what about enabling that osgdb_dot.dll plugin as a
  

Reader as well?



;-O
  

I love the sound of some one volunteering :-D


Heh, more than you think: I put the source in the osgToy SVN
for safekeeping and further refinement.  I'm glad to move it
to OSG core SVN later if you wish.

See
http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/s
rc/osgToy/
osgdot.cpp

In the mean time, I'm glad to accept code submissions.  Pls
submit them via the osgToy SourceForge Tracker
http://sourceforge.net/tracker/?group_id=139833

cheers
-- mew
  



  



___
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


Re: [osg-users] osgdot - a tool to generate a picture ofascenegraph'sstructure

2007-11-21 Thread Radu Mihai
Hi Alberto,

There are docs to help with 32-64 migration, I don't remember now the  
name but there is a type for the pointers that is defined for both 32  
and 64. ( in 64bit is the same size as unsigned long, not portable  
though )

--
Radu Mihai
[EMAIL PROTECTED]



On 16-Nov-07, at 4:06 AM, Alberto Luaces wrote:

 It doesn't compile out of the box on 64bit, because of the casts  
 from pointer
 to 'unsigned int'. Changing those casts to 'unsigned long' works,  
 but it is
 an ugly hack.

 El Thursday 15 November 2007 18:14:23 Mike Weiblen escribió:
 whups, moved it to

 http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/application
 s/osgdot/

 -- mew

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf
 Of Mike Weiblen
 Sent: Thursday, November 15, 2007 10:58 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] osgdot - a tool to generate a
 picture ofascenegraph'sstructure

 -Original Message-
 On Nov 15, 2007 4:35 PM, Mike Weiblen [EMAIL PROTECTED]

 wrote:
 Very cool!  Maybe whip up a plugin Writer wrapper around it,
 permitting

osgconv cow.osg cow.dot

 Then, what about enabling that osgdb_dot.dll plugin as a

 Reader as well?

 ;-O

 I love the sound of some one volunteering :-D

 Heh, more than you think: I put the source in the osgToy SVN
 for safekeeping and further refinement.  I'm glad to move it
 to OSG core SVN later if you wish.

 See
 http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/s
 rc/osgToy/
 osgdot.cpp

 In the mean time, I'm glad to accept code submissions.  Pls
 submit them via the osgToy SourceForge Tracker
 http://sourceforge.net/tracker/?group_id=139833

 cheers
 -- mew



 osgdot.cpp___
 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


Re: [osg-users] osgdot - a tool to generate a picture ofascenegraph'sstructure

2007-11-16 Thread Alberto Luaces
It doesn't compile out of the box on 64bit, because of the casts from pointer 
to 'unsigned int'. Changing those casts to 'unsigned long' works, but it is 
an ugly hack.

El Thursday 15 November 2007 18:14:23 Mike Weiblen escribió:
 whups, moved it to

 http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/application
 s/osgdot/

 -- mew

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf
  Of Mike Weiblen
  Sent: Thursday, November 15, 2007 10:58 AM
  To: OpenSceneGraph Users
  Subject: Re: [osg-users] osgdot - a tool to generate a
  picture ofascenegraph'sstructure
 
   -Original Message-
   On Nov 15, 2007 4:35 PM, Mike Weiblen [EMAIL PROTECTED]
  
   wrote:
Very cool!  Maybe whip up a plugin Writer wrapper around it,
permitting
   
osgconv cow.osg cow.dot
   
Then, what about enabling that osgdb_dot.dll plugin as a
  
   Reader as well?
  
;-O
  
   I love the sound of some one volunteering :-D
 
  Heh, more than you think: I put the source in the osgToy SVN
  for safekeeping and further refinement.  I'm glad to move it
  to OSG core SVN later if you wish.
 
  See
  http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/s
  rc/osgToy/
  osgdot.cpp
 
  In the mean time, I'm glad to accept code submissions.  Pls
  submit them via the osgToy SourceForge Tracker
  http://sourceforge.net/tracker/?group_id=139833
 
  cheers
  -- mew



/*

  osgdot -- Output the relations between scenegraph nodes and
drawables in graphviz's dot tool format.

   Paul E.C. Melis ([EMAIL PROTECTED]), November, 2007

This software is hereby placed in the public domain. Use in whichever
way you see fit.

HE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

This is a small tool that reads in a model file (in any format readable
by OSG) and outputs a text file (graph.dot) that describes the connections
between nodes and some other details. The text file is in a format that
can be read by the dot tool from the graphviz package. With dot you can
generate a picture representing the scenegraph. For example, to generate
a PNG file from the graph.dot file use the command:

dot -Tpng -ograph.png graph.dot

* osgdot takes a single argument, the model file to read
* The graph will show nodes and drawable as boxes, labeled with their OSG
  class name. If the node/drawable's getName() method returned a non-empty
  string this will also be shown in the node (below the horizontal line).
* Nodes are shown with a thick border, drawables with a thin border
* Nodes or drawables that have a stateset assigned to them will be filled
  with a grey color.
* Arrows between nodes/drawables indicate a parent - child relationship.
  Arrows from node to node are shown with a solid line, arrows from node
  to drawable with a dashed line.
* For drawables of the class Geometry the number of primitive sets held
  by that object is shown below the horizontal line.

The graphviz package can be found at http://www.graphviz.org/.
Or check your Linux distro for the package. It also seems to be available
for Windows and MacOS.

Compile (on Linux and using gcc) with:

g++ -W -Wall -o osgdot osgdot.cpp -I osg-dir/include -L osg-dir/lib -losg -losgDB

Version used during development: OSG 2.1.1, graphviz 2.12

*/

#include cstdio
#include string
#include map

#include osg/Node
#include osg/Drawable
#include osg/Geometry
#include osg/Group
#include osg/Geode
#include osgDB/ReadFile

class GraphNode
{
public:

GraphNode(osg::Node *node)
{
char s[1024];

_node = node;
mem_location = (unsigned long) node;

osg_class = node-className();
name = node-getName();

has_stateset = node-getStateSet() != NULL;

sprintf(s, %s_%08x, osg_class.c_str(), mem_location);
		dot_id = std::string(s);

type = node;
		extra_label = ;
}

GraphNode(osg::Drawable *drawable)
{
char s[1024];

_drawable = drawable;
mem_location = (unsigned long) drawable;

osg_class = drawable-className();
name = drawable-getName();

has_stateset = drawable-getStateSet() != NULL;

sprintf(s, %s_%08x, osg_class.c_str(), mem_location);
		dot_id = std::string(s);

type = drawable;

extra_label = ;
if (dynamic_castosg::Geometry*(drawable))
{
// include count of primitive sets
sprintf(s, %d psets, dynamic_castosg::Geometry*(drawable)-getNumPrimitiveSets());
extra_label = std::string(s);
}
}

void

Re: [osg-users] osgdot - a tool to generate a picture ofascenegraph'sstructure

2007-11-15 Thread Mike Weiblen
whups, moved it to
 
http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/application
s/osgdot/

-- mew


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf 
 Of Mike Weiblen
 Sent: Thursday, November 15, 2007 10:58 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] osgdot - a tool to generate a 
 picture ofascenegraph'sstructure
 
  -Original Message-
  On Nov 15, 2007 4:35 PM, Mike Weiblen [EMAIL PROTECTED] 
  wrote:
   Very cool!  Maybe whip up a plugin Writer wrapper around it, 
   permitting
  
   osgconv cow.osg cow.dot
  
   Then, what about enabling that osgdb_dot.dll plugin as a
  Reader as well?
   ;-O
  
  I love the sound of some one volunteering :-D
 
 Heh, more than you think: I put the source in the osgToy SVN 
 for safekeeping and further refinement.  I'm glad to move it 
 to OSG core SVN later if you wish.
 
 See
 http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/s
 rc/osgToy/
 osgdot.cpp
 
 In the mean time, I'm glad to accept code submissions.  Pls 
 submit them via the osgToy SourceForge Tracker
 http://sourceforge.net/tracker/?group_id=139833
 
 cheers
 -- mew
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org