Jafar
|
This module is a 3D viewer based on OpenSceneGraph
This module require OpenSceneGraph OpenSceneGraph.
You can find some documentation about OpenSceneGraph:
The following macro display a sphere
v = Viewer3d::View3D.new root = Viewer3d::Group.new ss = Viewer3d::SphereSegment.new( [0.0, 0.0, 0.0], 10.0, -Math::PI, Math::PI, -Math::PI, Math::PI, 60 ) ss.setAllColors([1.0,1.0,1.0,0.5]) ss.setSideColor([0.0,1.0,1.0,0.1]) root.addChild( ss ) v.setSceneData( root )
The following macro display an osg file
v = Viewer3d::Viewer3D.new
loadedModel = Viewer3d::readNodeFile( "afile.osg" )
v.view.setSceneData( loadedModel )
The following macro disaplay an osg file from Jafar's 3D models directory
v = Viewer3d::Viewer3D.new
loadedModel = Viewer3d::readJafarNodeFile( "walle.osg" )
v.view.setSceneData( loadedModel )
The follwoing macro display an osg file from Jafar's 3D models directory and use a Cell Shaded effect on it
v = Viewer3d::Viewer3D.new
effect = Viewer3d::Cartoon.new
loadedModel = Viewer3d::readJafarNodeFile( "walle.osg" )
effect.addChild( loadedModel )
v.view.setSceneData( effect )
The follwoing macro display an osg file from Jafar's 3D models directory and use a Cell Shaded effect on it
v = Viewer3d::Viewer3D.new
loadedModel = Viewer3d::readJafarNodeFile( "walle.osg" )
v.view.setSceneData( loadedModel )
stateset = Viewer3d::StateSet.new
stateset.setDataVariance(Viewer3d::Object::DYNAMIC)
blendEquation = Viewer3d::BlendEquation.new(Viewer3d::BlendEquation::RGBA_MAX)
blendEquation.setDataVariance(Viewer3d::Object::DYNAMIC)
stateset.setAttributeAndModes(blendEquation, Viewer3d::StateAttribute::OVERRIDE| Viewer3d::StateAttribute::ON )
stateset.setRenderingHint(Viewer3d::StateSet::TRANSPARENT_BIN)
loadedModel.setStateSet( stateset )
v = Viewer3d::Viewer3D.new
loadedModel = Viewer3d::readJafarNodeFile( "walle.osg" )
v.view.setSceneData( loadedModel )
stateset = Viewer3d::StateSet.new
Viewer3d.createGhost( stateset )
loadedModel.setStateSet( stateset )
The following macro show how to use T3D with an OSG MatrixTransform to change the position of an object.
v = Viewer3d::Viewer3D.new
root = Viewer3d::Group.new
loadedModel = Viewer3d::readNodeFile( "afile.osg" )
root.addChild( loadedModel )
loadedModel2 = Viewer3d::readNodeFile( "afile.osg" )
a = Geom::T3DEuler.new
a.set( Jmath::arrayToVec( [2, -1, 0, -3.14, -1.0, 0 ] ) )
mt = Viewer3d::MatrixTransform.new
mt.setT3D( a )
mt.addChild( loadedModel2 )
root.addChild( mt )
v.view.setSceneData( root )
Classes | |
class | jafar::viewer3d::Decorator |
This is a base class for Decorator which allowed to control the color used for objects in clouds (PointsCloud , SegmentsCloud , FacetsCloud ...). More... | |
class | jafar::viewer3d::RandomDecorator |
This class associate a random color to an id, and always return the same color to that id. More... | |
class | jafar::viewer3d::FacetsCloud |
This class allows to display a cloud of Facet3D in a Viewer3D . More... | |
class | jafar::viewer3d::Grid |
This class allows to add a grid to a view. More... | |
class | jafar::viewer3d::PointsCloud |
This class allows to display a cloud of Point3D in a Viewer3D . More... | |
class | jafar::viewer3d::Repere |
This class allows to add a repere to a view. More... | |
class | jafar::viewer3d::SegmentsCloud |
This class allows to display a cloud of Segment3D in a Viewer3D . More... | |
class | jafar::viewer3d::Viewer3D |
This class provide a window with an embedded View3D and some visual elements to control the camera, the configuration... More... | |
class | jafar::viewer3d::Viewer3dException |
Base class for all exceptions defined in the module viewer3d. More... | |
Functions | |
osg::Image * | jafar::viewer3d::jfrImageToOsgImage (image::Image &img, bool _shared=false) |
Convert an image::Image as an osg::Image. | |
image::Image | jafar::viewer3d::osgImageToJfrImage (const osg::Image &img) |
Convert an osg::Image in an image::Image. |
osg::Image* jafar::viewer3d::jfrImageToOsgImage | ( | image::Image & | img, |
bool | _shared = false |
||
) |
Convert an image::Image as an osg::Image.
_shared | indicates wether the data should be shared between the image::Image and osg::Image. This will only work if image::Image has no padding, and then the data will be deleted when image::Image is freed. |
Generated on Wed Oct 15 2014 00:37:30 for Jafar by doxygen 1.7.6.1 |