Skip to content

ExamplesProceduralsSimpleGeometry

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

Simple Procedural Geometry

This example is just about the simplest procedural you can get. It renders a cube!

320px-Cookbook_simpleGeometryGL.jpg opengl

320px-Cookbook_simpleGeometry.jpg renderman

Code

 #=====
 # Simple Geometry
 #
 # This example is just about the simplest procedural you can get. It renders
 # a cube!
 #=====
 from IECore import *
 
 class simpleGeometry(ParameterisedProcedural) :
 
 	def __init__(self) :
 		ParameterisedProcedural.__init__( self, "Simple Geometry." )
 
 	def doBound(self, args) :
 		return Box3f( V3f(-1), V3f(1) )
 
 	def doRenderState(self, renderer, args) :
 		pass
 
 	def doRender(self, renderer, args) :
 		box = MeshPrimitive.createBox( Box3f( V3f(-1), V3f(1) ) )
 		box.render( renderer )
 
 # register
 registerRunTimeTyped( simpleGeometry )
Clone this wiki locally