Dear All,
I'm trying to create arbitray shape by manually entering the vertices normals 
and indices of object. For this I use the following pseudo algorithm for object 
creation, but the resulting shape edges are not discernible as shown in the 
attached snapshot (marked with purple ellipse).
Also manually created object is not recognized by the Intersectors while the 
"T" shaped object is recognized.
osg::Node * CreatObject(){    //    VERTICES    osg::Vec3Array* obj_vertices  = 
new osg::Vec3Array;    obj_vertices->push_back(osg::Vec3d(-3.0000, 4.0000, 
-0.0000));    ......     /// NORMALS    osg::Vec3d vec1, vec2, vec3;    
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;    vec1[0] = 0; 
vec1[1] = 0; vec1[3] =-1;     ....    
normals->push_back(vec1);normals->push_back(vec1);normals->push_back(vec1);normals->push_back(vec1);
    
normals->push_back(vec1);normals->push_back(vec1);normals->push_back(vec1);normals->push_back(vec1);
    
normals->push_back(vec1);normals->push_back(vec1);normals->push_back(vec1);normals->push_back(vec1);
    ............
    // INDICES     osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;    
geom->setVertexArray( obj_vertices );    geom->addPrimitiveSet( indices.get() 
);    geom->setNormalArray(normals.get());    
geom->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL,osg::StateAttribute::ON);
    geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
    osgUtil::SmoothingVisitor::smooth( *geom );    osg::ref_ptr<osg::Geode> 
I_object = new osg::Geode;    I_object->addDrawable( geom.get() );    
scene_ALL->addChild(I_object);}                                         
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to