def setupCube(): geode = osg.Geode() geode.addDrawable(osg.ShapeDrawable(osg.Box(osg.Vec3(0.0,0.0,0.0),2))) geode.setStateSet(setupStateSet()) return geode
def createTouchRepresentations(parent_group, num_objects): # create some geometry which is shown for every touch-point for(unsigned int i = 0 i not = num_objects ++i) ss = std.ostringstream() geode = osg.Geode() drawable = osg.ShapeDrawable(osg.Box(osg.Vec3(0,0,0), 100)) drawable.setColor(osg.Vec4(0.5, 0.5, 0.5,1)) geode.addDrawable(drawable) ss, "Touch ", i text = osgText.Text() geode.addDrawable( text ) drawable.setDataVariance(osg.Object.DYNAMIC) _drawables.push_back(drawable) text.setFont("fonts/arial.ttf") text.setPosition(osg.Vec3(110,0,0)) text.setText(ss.str()) _texts.push_back(text) text.setDataVariance(osg.Object.DYNAMIC) mat = osg.MatrixTransform() mat.addChild(geode) mat.setNodeMask(0x0) _mats.push_back(mat) parent_group.addChild(mat)
def buildEndEffector(): mt = osg.MatrixTransform() m = osg.Matrix() length = 17.0 m.makeTranslate(0,0,length/2) mt.setMatrix(m) geode_3 = osg.Geode() shape1 = osg.ShapeDrawable(osg.Box(osg.Vec3(-EndEffector, 0.0, 0.0), .5, 1.5, length), hints) shape2 = osg.ShapeDrawable(osg.Box(osg.Vec3( EndEffector, 0.0, 0.0), .5, 1.5, length), hints) shape1.setColor(osg.Vec4(0.8, 0.8, 0.4, 1.0)) shape2.setColor(osg.Vec4(0.8, 0.8, 0.4, 1.0)) geode_3.addDrawable(shape1) geode_3.addDrawable(shape2) mt.addChild(geode_3) return mt
def createShapes(): geode = osg.Geode() # --------------------------------------- # Set up a StateSet to texture the objects # --------------------------------------- stateset = osg.StateSet() image = osgDB.readImageFile( "Images/lz.rgb" ) if image : texture = osg.Texture2D() texture.setImage(image) texture.setFilter(osg.Texture.MIN_FILTER, osg.Texture.LINEAR) stateset.setTextureAttributeAndModes(0,texture, osg.StateAttribute.ON) stateset.setMode(GL_LIGHTING, osg.StateAttribute.ON) geode.setStateSet( stateset ) radius = 0.8 height = 1.0 hints = osg.TessellationHints() hints.setDetailRatio(0.5) geode.addDrawable(osg.ShapeDrawable(osg.Sphere(osg.Vec3(0.0,0.0,0.0),radius),hints)) geode.addDrawable(osg.ShapeDrawable(osg.Box(osg.Vec3(2.0,0.0,0.0),2*radius),hints)) geode.addDrawable(osg.ShapeDrawable(osg.Cone(osg.Vec3(4.0,0.0,0.0),radius,height),hints)) geode.addDrawable(osg.ShapeDrawable(osg.Cylinder(osg.Vec3(6.0,0.0,0.0),radius,height),hints)) geode.addDrawable(osg.ShapeDrawable(osg.Capsule(osg.Vec3(8.0,0.0,0.0),radius,height),hints)) grid = osg.HeightField() grid.allocate(38,39) grid.setXInterval(0.28) grid.setYInterval(0.28) for(unsigned int r=0r<39++r) for(unsigned int c=0c<38++c) grid.setHeight(c,r,vertex[r+c*39][2])
def main(argv): # use an ArgumentParser object to manage the program arguments. arguments = osg.ArgumentParser(argv) # read the scene from the list of file specified commandline args. scene = osgDB.readNodeFiles(arguments) # if not loaded assume no arguments passed in, try use default model instead. if not scene : scene = osgDB.readNodeFile("dumptruck.osgt") if not scene : geode = osg.Geode() drawable = osg.ShapeDrawable(osg.Box(osg.Vec3(0,0,0), 100)) drawable.setColor(osg.Vec4(0.5, 0.5, 0.5,1)) geode.addDrawable(drawable) scene = geode # construct the viewer. viewer = osgViewer.Viewer() group = osg.Group() # add the HUD subgraph. if scene.valid() : group.addChild(scene) viewer.setCameraManipulator(osgGA.MultiTouchTrackballManipulator()) viewer.realize() gc = viewer.getCamera().getGraphicsContext() #ifdef __APPLE__ # as multitouch is disabled by default, enable it now win = dynamic_cast<osgViewer.GraphicsWindowCocoa*>(gc) if win : win.setMultiTouchEnabled(True)
def createTexturedCube(fRadius, vPosition, texture, geodeName): # create a cube shape bCube = osg.Box(vPosition,fRadius) # osg.Box *bCube = osg.Box(vPosition,fRadius) # create a container that makes the cube drawable sdCube = osg.ShapeDrawable(bCube) # create a geode object to as a container for our drawable cube object geodeCube = osg.Geode() geodeCube.setName( geodeName ) # set the object texture state SetObjectTextureState(geodeCube, texture) # add our drawable cube to the geode container geodeCube.addDrawable(sdCube) return(geodeCube)
def createDemoScene(fixedSizeInScreen): root = osg.Group() geode_1 = osg.Geode() transform_1 = osg.MatrixTransform() geode_2 = osg.Geode() transform_2 = osg.MatrixTransform() geode_3 = osg.Geode() transform_3 = osg.MatrixTransform() geode_4 = osg.Geode() transform_4 = osg.MatrixTransform() geode_5 = osg.Geode() transform_5 = osg.MatrixTransform() geode_6 = osg.Geode() transform_6 = osg.MatrixTransform() geode_7 = osg.Geode() transform_7 = osg.MatrixTransform() radius = 0.8 height = 1.0 hints = osg.TessellationHints() hints.setDetailRatio(2.0) shape = osg.ShapeDrawable() shape = osg.ShapeDrawable(osg.Box(osg.Vec3(0.0, 0.0, -2.0), 10, 10.0, 0.1), hints) shape.setColor(osg.Vec4(0.5, 0.5, 0.7, 1.0)) geode_1.addDrawable(shape) shape = osg.ShapeDrawable(osg.Cylinder(osg.Vec3(0.0, 0.0, 0.0), radius * 2,radius), hints) shape.setColor(osg.Vec4(0.8, 0.8, 0.8, 1.0)) geode_2.addDrawable(shape) shape = osg.ShapeDrawable(osg.Cylinder(osg.Vec3(-3.0, 0.0, 0.0), radius,radius), hints) shape.setColor(osg.Vec4(0.6, 0.8, 0.8, 1.0)) geode_3.addDrawable(shape) shape = osg.ShapeDrawable(osg.Cone(osg.Vec3(3.0, 0.0, 0.0), 2 * radius,radius), hints) shape.setColor(osg.Vec4(0.4, 0.9, 0.3, 1.0)) geode_4.addDrawable(shape) shape = osg.ShapeDrawable(osg.Cone(osg.Vec3(0.0, -3.0, 0.0), radius, height), hints) shape.setColor(osg.Vec4(0.2, 0.5, 0.7, 1.0)) geode_5.addDrawable(shape) shape = osg.ShapeDrawable(osg.Cylinder(osg.Vec3(0.0, 3.0, 0.0), radius, height), hints) shape.setColor(osg.Vec4(1.0, 0.3, 0.3, 1.0)) geode_6.addDrawable(shape) shape = osg.ShapeDrawable(osg.Cone(osg.Vec3(0.0, 0.0, 3.0), 2.0, 2.0), hints) shape.setColor(osg.Vec4(0.8, 0.8, 0.4, 1.0)) geode_7.addDrawable(shape) # material matirial = osg.Material() matirial.setColorMode(osg.Material.DIFFUSE) matirial.setAmbient(osg.Material.FRONT_AND_BACK, osg.Vec4(0, 0, 0, 1)) matirial.setSpecular(osg.Material.FRONT_AND_BACK, osg.Vec4(1, 1, 1, 1)) matirial.setShininess(osg.Material.FRONT_AND_BACK, 64.0) root.getOrCreateStateSet().setAttributeAndModes(matirial, osg.StateAttribute.ON) transform_1.addChild(addDraggerToScene(geode_1,"TabBoxDragger",fixedSizeInScreen)) transform_2.addChild(addDraggerToScene(geode_2,"TabPlaneDragger",fixedSizeInScreen)) transform_3.addChild(addDraggerToScene(geode_3,"TabBoxTrackballDragger",fixedSizeInScreen)) transform_4.addChild(addDraggerToScene(geode_4,"TrackballDragger",fixedSizeInScreen)) transform_5.addChild(addDraggerToScene(geode_5,"Translate1DDragger",fixedSizeInScreen)) transform_6.addChild(addDraggerToScene(geode_6,"Translate2DDragger",fixedSizeInScreen)) transform_7.addChild(addDraggerToScene(geode_7,"TranslateAxisDragger",fixedSizeInScreen)) root.addChild(transform_1) root.addChild(transform_2) root.addChild(transform_3) root.addChild(transform_4) root.addChild(transform_5) root.addChild(transform_6) root.addChild(transform_7) return root
def main(argv): # use an ArgumentParser object to manage the program arguments. arguments = osg.ArgumentParser(argv) # read the scene from the list of file specified commandline args. scene = osgDB.readNodeFiles(arguments) if not scene and arguments.read("--relative-camera-scene") : # Create a test scene with a camera that has a relative reference frame. group = osg.Group() sphere = osg.Geode() sphere.setName("Sphere") sphere.addDrawable(osg.ShapeDrawable(osg.Sphere())) cube = osg.Geode() cube.setName("Cube") cube.addDrawable(osg.ShapeDrawable(osg.Box())) camera = osg.Camera() camera.setRenderOrder(osg.Camera.POST_RENDER) camera.setClearMask(GL_DEPTH_BUFFER_BIT) camera.setReferenceFrame(osg.Transform.RELATIVE_RF) camera.setViewMatrix(osg.Matrix.translate(-2, 0, 0)) xform = osg.MatrixTransform(osg.Matrix.translate(1, 1, 1)) xform.addChild(camera) group.addChild(sphere) group.addChild(xform) camera.addChild(cube) scene = group # if not loaded assume no arguments passed in, try use default mode instead. if not scene : scene = osgDB.readNodeFile("fountain.osgt") group = dynamic_cast<osg.Group*>(scene) if not group : group = osg.Group() group.addChild(scene) updateText = osgText.Text() # add the HUD subgraph. group.addChild(createHUD(updateText)) if arguments.read("--CompositeViewer") : view = osgViewer.View() # add the handler for doing the picking view.addEventHandler(PickHandler(updateText)) # set the scene to render view.setSceneData(group) view.setUpViewAcrossAllScreens() viewer = osgViewer.CompositeViewer() viewer.addView(view) return viewer.run() else: viewer = osgViewer.Viewer() # add all the camera manipulators keyswitchManipulator = osgGA.KeySwitchMatrixManipulator() keyswitchManipulator.addMatrixManipulator( ord("1"), "Trackball", osgGA.TrackballManipulator() ) keyswitchManipulator.addMatrixManipulator( ord("2"), "Flight", osgGA.FlightManipulator() ) keyswitchManipulator.addMatrixManipulator( ord("3"), "Drive", osgGA.DriveManipulator() ) num = keyswitchManipulator.getNumMatrixManipulators() keyswitchManipulator.addMatrixManipulator( ord("4"), "Terrain", osgGA.TerrainManipulator() ) pathfile = str() keyForAnimationPath = ord("5") while arguments.read("-p",pathfile) : apm = osgGA.AnimationPathManipulator(pathfile) if apm or not apm.valid() : num = keyswitchManipulator.getNumMatrixManipulators() keyswitchManipulator.addMatrixManipulator( keyForAnimationPath, "Path", apm ) ++keyForAnimationPath keyswitchManipulator.selectMatrixManipulator(num) viewer.setCameraManipulator( keyswitchManipulator ) # add the handler for doing the picking viewer.addEventHandler(PickHandler(updateText)) # set the scene to render viewer.setSceneData(group) return viewer.run()
AnimateCallback(Operation op) : _operation(op) virtual void operator() ( osg.Uniform* uniform, osg.NodeVisitor* nv ) angle = 2.0 * nv.getFrameStamp().getSimulationTime() sine = sinf( angle ) # -1 . 1 switch(_operation) case SIN : uniform.set( sine ) break _operation = Operation() int main(int, char **) # construct the viewer. viewer = osgViewer.Viewer() # use a geode with a Box ShapeDrawable basicModel = osg.Geode() basicModel.addDrawable(osg.ShapeDrawable(osg.Box(osg.Vec3(0.0,0.0,0.0),1.0))) # create the "blocky" shader, a simple animation test ss = basicModel.getOrCreateStateSet() program = osg.Program() program.setName( "blocky" ) program.addShader( osg.Shader( osg.Shader.VERTEX, blockyVertSource ) ) program.addShader( osg.Shader( osg.Shader.FRAGMENT, blockyFragSource ) ) ss.setAttributeAndModes(program, osg.StateAttribute.ON) # attach some animated Uniform variable to the state set SineUniform = osg.Uniform( "Sine", 0.0 ) ss.addUniform( SineUniform ) SineUniform.setUpdateCallback(AnimateCallback(AnimateCallback.SIN)) # run the osg.Viewer using our model
def main(): viewer = osgViewer.Viewer() # Declare a group to act as root node of a scene: root = osg.Group() # Declare a box class (derived from shape class) instance # This constructor takes an osg.Vec3 to define the center # and a float to define the height, width and depth. # (an overloaded constructor allows you to specify unique # height, width and height values.) unitCube = osg.Box( osg.Vec3(0,0,0), 1.0) unitCube.setDataVariance(osg.Object.DYNAMIC) # Declare an instance of the shape drawable class and initialize # it with the unitCube shape we created above. # This class is derived from 'drawable' so instances of this # class can be added to Geode instances. unitCubeDrawable = osg.ShapeDrawable(unitCube) # Declare a instance of the geode class: basicShapesGeode = osg.Geode() # Add the unit cube drawable to the geode: basicShapesGeode.addDrawable(unitCubeDrawable) # Add the goede to the scene: root.addChild(basicShapesGeode) unitSphere = osg.Sphere( osg.Vec3(0,0,0), 1.0) unitSphereDrawable = osg.ShapeDrawable(unitSphere) unitSphereDrawable.setColor( osg.Vec4(0.1, 0.1, 0.1, 0.1) ) unitSphereXForm = osg.PositionAttitudeTransform() unitSphereXForm.setPosition(osg.Vec3(3.0,0,0)) unitSphereGeode = osg.Geode() root.addChild(unitSphereXForm) unitSphereXForm.addChild(unitSphereGeode) unitSphereGeode.addDrawable(unitSphereDrawable) pyramidGeode = createPyramid() pyramidXForm = osg.PositionAttitudeTransform() pyramidXForm.setPosition(osg.Vec3(0,-3.0,0)) root.addChild(pyramidXForm) pyramidXForm.addChild(pyramidGeode) KLN89FaceTexture = osg.Texture2D() # protect from being optimized away as static state: KLN89FaceTexture.setDataVariance(osg.Object.DYNAMIC) klnFace = osgDB.readImageFile("../NPS_Data/Textures/KLN89FaceB.tga") if klnFace is None: print " couldn't find texture, quitting." sys.exit(-1) KLN89FaceTexture.setImage(klnFace) # Declare a state set for 'BLEND' texture mode blendStateSet = osg.StateSet() # Declare a TexEnv instance, set the mode to 'BLEND' blendTexEnv = osg.TexEnv() blendTexEnv.setMode(osg.TexEnv.BLEND) # Turn the attribute of texture 0 'ON' blendStateSet.setTextureAttributeAndModes(0,KLN89FaceTexture,osg.StateAttribute.ON) # Set the texture texture environment for texture 0 to the # texture envirnoment we declared above: blendStateSet.setTextureAttribute(0,blendTexEnv) decalStateSet = osg.StateSet() decalTexEnv = osg.TexEnv() decalTexEnv.setMode(osg.TexEnv.DECAL) decalStateSet.setTextureAttributeAndModes(0,KLN89FaceTexture,osg.StateAttribute.ON) decalStateSet.setTextureAttribute(0,decalTexEnv) root.setStateSet(blendStateSet) unitSphereGeode.setStateSet(decalStateSet) # OSG1 viewer.setUpViewer(osgProducer.Viewer.STANDARD_SETTINGS) viewer.setSceneData( root ) viewer.setCameraManipulator(osgGA.TrackballManipulator()) viewer.realize() while not viewer.done(): viewer.frame() return 0
def main(argv): arguments = osg.ArgumentParser(argv) # construct the viewer. viewer = osgViewer.Viewer(arguments) typedef std.list< osg.OperationThread > Threads operationThreads = Threads() updateOperation = UpdateTextOperation() numThreads = 0 if arguments.read("--mt", numThreads) or arguments.read("--mt") : # construct a multi-threaded text updating test. if numThreads==0 : numThreads = 1 # create a group to add everything into. mainGroup = osg.Group() center = osg.Vec3(0.5,0.5,0.5) diameter = 1.0 loadedModel = osgDB.readNodeFiles(arguments) if loadedModel.valid() : mainGroup.addChild(loadedModel) center = loadedModel.getBound().center() diameter = loadedModel.getBound().radius() * 2.0 for(unsigned int i=0 i<numThreads ++i) textGroup = osg.Group() mainGroup.addChild(textGroup) # create the background thread operationThread = osg.OperationThread() operationThreads.push_back(operationThread) # create the operation that will run in the background and # sync once per frame with the main viewer loop. updateOperation = UpdateTextOperation(center, diameter, textGroup) # add the operation to the operation thread and start it. operationThread.add(updateOperation) operationThread.startThread() # add the operation to the viewer to sync once per frame. viewer.addUpdateOperation(updateOperation) # add a unit cube for the text to appear within. geode = osg.Geode() geode.getOrCreateStateSet().setAttribute(osg.PolygonMode(osg.PolygonMode.FRONT_AND_BACK,osg.PolygonMode.LINE)) geode.addDrawable(osg.ShapeDrawable(osg.Box(center,diameter))) mainGroup.addChild(geode) viewer.setSceneData(mainGroup)
def main(argv): arguments = osg.ArgumentParser( argc, argv ) textureFile = str("Images/smoke.rgb") while arguments.read("--texture", textureFile) : pointSize = 20.0 while arguments.read("--point", pointSize) : visibilityDistance = -1.0 while arguments.read("--visibility", visibilityDistance) : customShape = False while arguments.read("--enable-custom") : customShape = True useShaders = True while arguments.read("--disable-shaders") : useShaders = False #** # Customize particle template and system attributes # ** ps = osgParticle.ParticleSystem() ps.getDefaultParticleTemplate().setLifeTime( 5.0 ) if customShape : # osgParticle now supports making use of customized drawables. The draw() method will be executed # and display lists will be called for each particle. It is always a huge consumption of memory, and # hardly to use shaders to render them, so please be careful using this feature. ps.getDefaultParticleTemplate().setShape( osgParticle.Particle.USER ) ps.getDefaultParticleTemplate().setDrawable( osg.ShapeDrawable(osg.Box(osg.Vec3(), 1.0)) ) useShaders = False else: # The shader only supports rendering points at present. ps.getDefaultParticleTemplate().setShape( osgParticle.Particle.POINT ) # Set the visibility distance of particles, due to their Z-value in the eye coordinates. # Particles that are out of the distance (or behind the eye) will not be rendered. ps.setVisibilityDistance( visibilityDistance ) if useShaders : # Set using local GLSL shaders to render particles. # At present, this is slightly efficient than ordinary methods. The bottlenack here seems to be the cull # traversal time. Operators go through the particle list again and again... ps.setDefaultAttributesUsingShaders( textureFile, True, 0 ) else: # The default methods uses glBegin()/glEnd() pairs. Fortunately the GLBeginEndAdapter does improve the # process, which mimics the immediate mode with glDrawArrays(). ps.setDefaultAttributes( textureFile, True, False, 0 ) # Without the help of shaders, we have to sort particles to make the visibility distance work. Sorting is # also useful in rendering transparent particles in back-to-front order. if visibilityDistance>0.0 : ps.setSortMode( osgParticle.ParticleSystem.SORT_BACK_TO_FRONT ) # At last, to make the point sprite work, we have to set the points size and the sprite attribute. stateset = ps.getOrCreateStateSet() stateset.setAttribute( osg.Point(pointSize) ) stateset.setTextureAttributeAndModes( 0, osg.PointSprite, osg.StateAttribute.ON )() #** # Construct other particle system elements, including the emitter and program # ** emitter = osgParticle.ModularEmitter() emitter.setParticleSystem( ps ) program = osgParticle.ModularProgram() program.setParticleSystem( ps ) createFountainEffect( emitter, program ) #** # Add the entire particle system to the scene graph # ** parent = osg.MatrixTransform() parent.addChild( emitter ) parent.addChild( program ) # The updater can receive particle systems as child drawables now. The addParticleSystem() method # is still usable, with which we should define another geode to contain a particle system. updater = osgParticle.ParticleSystemUpdater() #updater.addDrawable( ps ) root = osg.Group() root.addChild( parent ) root.addChild( updater ) # FIXME 2010.9.19: the updater can't be a drawable otehrwise the ParticleEffect will not work properly. why? updater.addParticleSystem( ps ) geode = osg.Geode() geode.addDrawable( ps ) root.addChild( geode ) #** # Start the viewer # ** viewer = osgViewer.Viewer() viewer.addEventHandler( osgGA.StateSetManipulator(viewer.getCamera().getOrCreateStateSet()) ) viewer.addEventHandler( osgViewer.StatsHandler )() viewer.addEventHandler( osgViewer.WindowSizeHandler )() viewer.setSceneData( root ) viewer.setCameraManipulator( osgGA.TrackballManipulator )() # A floating error of delta-time should be explained here: # The particles emitter, program and updater all use a 'dt' to compute the time value in every frame. # Because the 'dt' is a double value, it is not suitable to keep three copies of it seperately, which # is the previous implementation. The small error makes some opeartors unable to work correctly, e.g. # the BounceOperator. # Now we make use of the getDeltaTime() of ParticleSystem to maintain and dispatch the delta time. But.. # it is not the best solution so far, since there are still very few particles acting unexpectedly. return viewer.run() # FIXME 2010.9.19: At present, getDeltaTime() is not used and the implementations in the updater and processors still # use a (t - _t0) as the delta time, which is of course causing floating errors. ParticleEffect will not work if we # replace the delta time with getDeltaTime()... Need to find a solution. if __name__ == "__main__": main(sys.argv)
geode.addDrawable( geometry ) geode.getOrCreateStateSet().setMode(GL_LIGHTING, False) return geode int main (int argc, char* argv[]) arguments = osg.ArgumentParser(argv) viewer = osgViewer.Viewer(arguments) viewer.setCameraManipulator(osgGA.TrackballManipulator()) root = osg.Group() axe = createAxis() geode = osg.Geode() geode.addDrawable(osg.ShapeDrawable(osg.Box(osg.Vec3(0.0,0.0,0.0),0.5))) #Tranformation to be manipulated by the animation trans = osg.MatrixTransform() trans.setName("AnimatedNode") #Dynamic object, has to be updated during update traversal trans.setDataVariance(osg.Object.DYNAMIC) #Animation callback for Matrix transforms, name is targetName for Channels updatecb = osgAnimation.UpdateMatrixTransform("AnimatedCallback") #add manipulator Stack, names must match with channel names #elements are applied in LIFO order #The first element modifies the position component of the matrix #The second element modifies the rotation around x-axis updatecb.getStackedTransforms().push_back(osgAnimation.StackedTranslateElement("position")) updatecb.getStackedTransforms().push_back(osgAnimation.StackedRotateAxisElement("euler",osg.Vec3(1,0,0),0)) #connect the UpdateMatrixTransform callback to the MatrixTRanform
extern osg.Node * CreateSimpleHierarchy( osg.Node * model ) extern osg.Node * CreateAdvancedHierarchy( osg.Node * model ) ######################################## osg.Node * CreateGlobe( void ) # File not found - create textured sphere geode = osg.Geode() hints = osg.TessellationHints() hints.setDetailRatio( 0.3 ) #if 1 shape = osg.ShapeDrawable ( osg.Sphere(osg.Vec3(0.0, 0.0, 0.0), 4.0 ), hints ) #else: shape = osg.ShapeDrawable ( osg.Box( osg.Vec3(-1.0, -1.0, -1.0), 2.0, 2.0, 2.0 ) ) #endif shape.setColor(osg.Vec4(0.8, 0.8, 0.8, 1.0)) geode.addDrawable( shape ) stateSet = osg.StateSet() texture = osg.Texture2D( osgDB.readImageFile("Images/land_shallow_topo_2048.jpg") ) material = osg.Material() material.setAmbient