[osg-users] DXF plugin bug

2009-04-08 Thread Reed McKenna
I don't know if this is the right place to give this input, but here goes
anyway:

 

I have an application based on OSG. A DXF file was read in using the
readNodeFile function. I noticed that the CIRCLEs in the DXF file had a
thickness associated with them that was not being shown in the imported
node. I reviewed the dxfCircle class and added a _thickness member variable.
Here is the modified class, below. There are probably other DXF ENTITIES
that have the optional thickness parameter, including at least ARC and LINE.
They will need the same thing done to them. I also noticed that, in our
system, the desired default for the inverted parameter passed to
scene::addTriangles and ::addQuads is true. I don't know if anyone else has
experienced it. I saw cylinders that are dark when viewed from the outside
and show the color when viewed from the inside.

 

class dxfCircle : public dxfBasicEntity

{

public:

dxfCircle() : _radius(0), _ocs(0,0,1), _thickness(0) {}

virtual ~dxfCircle() {}

virtual dxfBasicEntity* create() { return new dxfCircle; }

virtual const char* name() { return CIRCLE; }

virtual void assign(dxfFile* dxf, codeValue cv);

virtual void drawScene(scene* sc);

protected:

osg::Vec3d_center;

double_radius;

osg::Vec3d_ocs;

double_thickness;

};

 

dxfCircle::assign(dxfFile* dxf, codeValue cv)

{

double d = cv._double;

//unsigned short s = cv._short;

switch (cv._groupCode) {

case 10:

_center.x() = d;

break;

case 20:

_center.y() = d;

break;

case 30:

_center.z() = d;

break;

case 39:

_thickness = d;

break;

case 40:

_radius = d;

break;

case 210:

_ocs.x() = d;

break;

case 220:

_ocs.y() = d;

break;

case 230:

_ocs.z() = d;

break;

default:

dxfBasicEntity::assign(dxf, cv);

break;

}

}

 

void

dxfCircle::drawScene(scene* sc)

{

Matrixd m;

getOCSMatrix(_ocs, m);

sc-ocs(m);

std::vectorVec3d vlist;

std::vectorVec3d qlist;

int numsteps = 360/5; // baaarghf.

double angle_step = osg::DegreesToRadians((double)360.0 / (double)
numsteps);

double angle1 = 0.0f;

double angle2 = 0.0f;

Vec3d a = _center;

Vec3d b,c,d,e;

for (int r = 0; r  numsteps; r++) 

{

angle1 = angle2;

if (r == numsteps - 1)

angle2 = 0.0f;

else

angle2 += angle_step;

b = a + Vec3d(_radius * (double) sin(angle1), _radius * (double)
cos(angle1), 0);

c = a + Vec3d(_radius * (double) sin(angle2), _radius * (double)
cos(angle2), 0);

d = a + Vec3d(_radius * (double) sin(angle1), _radius * (double)
cos(angle1), _thickness);

e = a + Vec3d(_radius * (double) sin(angle2), _radius * (double)
cos(angle2), _thickness);

if(_thickness == 0)

{

//vlist.push_back(a);

vlist.push_back(b);

vlist.push_back(c);

}

else

{

qlist.push_back(b);

qlist.push_back(c);

qlist.push_back(e);

qlist.push_back(d);

}

}

if(_thickness == 0)

{

sc-addLineStrip(getLayer(), _color, vlist);

//sc-addTriangles(getLayer(), _color, vlist);

}

else

{

sc-addQuads(getLayer(), _color, qlist);

}

sc-ocs_clear();

}

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Vec3dArray - when is it useful

2009-02-05 Thread Reed McKenna
The Vec3dArray was introduced in OSG 2.6 (or 2.4, I forget). The reason, as
I recall it, was to support creation of earth-size datasets. OpenGL does not
accept doubles, IntersectVisitors don't seem to support doubles, etc. How
are developers using Vec3dArrays effectively? I did not find any use of
double arrays in the examples.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Why is using an IntersectVisitor with drawables using indices so time consuming?

2009-01-23 Thread Reed McKenna
I generate large drawables using indices (UIntArray) that point to the
actual vertices (Vec3Array). When an IntersectVisitor visits this drawable,
it takes at least four times the amount of processing time as that used for
the same drawable created without indices. What is the huge difference? It
seems that the one level of indirection for indices should only have a minor
impact. I would appreciate any feedback to help me understand how to get the
memory savings gained by using indices yet maintain the efficiency of the
IntersectVisitor. Thanks.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Precompiled 64-bit OSG dependencies available?

2008-06-09 Thread Reed McKenna
We are building OSG for the x64 configuration using Visual Studio 2005 SP1.
OSG compiles successfully but it appears that I will need to do some more
work on the plug-ins in the 3rd Party dependencies. Has anyone posted
step-by-step instructions for that or has anyone posted any precompiled
64-bit dependency plug-ins? I have not found it by searching the web, as of
now.

 

Thanks,

Reed McKenna

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How to open file with Unicode name using osgDB::readNodeFile?

2008-04-22 Thread Reed McKenna
We build an application for Windows XP using OpenSceneGraph. We have more
and more users from Asian countries who want to read in files that have
names with Asian characters. Windows' NTFS file system stores file names in
Unicode. How can I have osgDB::readNodeFile (and writeNodeFile, etc.) read
from and write to these files, using the full NTFS Unicode file name? If it
is not currently possible, are there any plans in the works to make it
possible?

 

Reed

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org