Currently I'm entering all points as 0,0,0 and update them with values
within the render loop.
Except for these:
addPoint(PCPoint(90000, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(-90000, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 90000, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, -90000, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, 90000), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, -90000), PCColor(0,0,0,0));
Which I wont ever update with new values. I never force an update of the
bounding box.
The farthest extent of a point that I modify should be +/- 1000.
Here is my code for creating the pointCloud:
void PointCloud::factory()
{
_lastEntered = -1;
_geometry = new osg::Geometry();
_geometry->setSupportsDisplayList(false);
_geometry->setUseDisplayList(false);
_cloud3DRep = new osg::Geode();
_points = new osg::Vec3Array();
_colors = new osg::Vec4Array();
PCPoint p(0,0,0);
PCColor c(0,0,0,0);
double px, py, pz, cr, cb, cg, ca(1.0);
for (int i = 0; i < _maxSize; i++)
{
_points->push_back(p);
_colors->push_back(c);
}
_geometry->setVertexArray(_points.get());
_geometry->setColorArray(_colors.get());
_geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
_geometry->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, _maxSize));
_cloud3DRep->setCullingActive(false);
_cloud3DRep->addDrawable(_geometry.get());
addChild(_cloud3DRep.get());
osg::StateSet *set = new osg::StateSet();
/// Give some size to the points to be able to see the
sprite
osg::Point *point = new osg::Point();
point->setSize(2.0f);
set->setAttribute(point);
/// Disable depth test to avoid sort problems and
Lighting
set->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
set->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
_cloud3DRep->setStateSet(set);
addPoint(PCPoint(90000, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(-90000, 0, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 90000, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, -90000, 0), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, 90000), PCColor(0,0,0,0));
addPoint(PCPoint(0, 0, -90000), PCColor(0,0,0,0));
}
And my code for editing each point:
void PointCloud::addPoint(PCPoint p, PCColor c)
{
//if we hit the end of the array start at the beginning
_lastEntered++;
if (_lastEntered >= _maxSize && _maxSize >= 0)
_lastEntered = 0;
(*_points.get())[_lastEntered] = p;
(*_colors.get())[_lastEntered] = c;
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gordon
Tomlinson
Sent: Thursday, April 24, 2008 12:15 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] Point cloud culling/paging
Hi
Sounds like it could be a bounding sphere/box issue
How are you loading and creating the point cloud ?
You might possibly have one or more errant points that are out side the
range/volume of all the other points of a geode
Depending on how your loading/creating the geodes, you should check the
bounding box/spheres against the expected
Extents of the point cloud for the geode etc...
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org