Skip to content

ExamplesProceduralsMeshRender

Ben Toogood edited this page Jun 13, 2013 · 2 revisions

Simple Mesh Render

This cookbook example demonstrates how to load & render a mesh primitive from disk using a path specified through a path parameter.

320px-Cookbook_meshRenderGL.jpg opengl

320px-Cookbook_meshRenderRI.jpg renderman

Code

from IECore import * 

class meshRender(ParameterisedProcedural) : 

	def __init__(self) : 
 		ParameterisedProcedural.__init__( self, "Renders a mesh." )
 		path = PathParameter( "path", "Path", "" )
 		self.parameters().addParameter( path )

	def doBound(self, args) : 
 		geo = Reader.create( args['path'].value ).read()
 		return geo.bound()

	def doRenderState(self, renderer, args) : 
 		pass

	def doRender(self, renderer, args) : 
 		geo = Reader.create( args['path'].value ).read()
 		geo.render( renderer )

registerRunTimeTyped( meshRender )
Clone this wiki locally