package main import ( "gitlab.com/mae.earth/rigo/ri" "gitlab.com/mae.earth/rigo" ) func main() { ctx := rigo.New() ctx.Begin("test.rib") ctx.ArchiveRecord(ri.STRUCTURE,ri.RIB) resolution := ctx.Declare("resolution","constant float[2]") ctx.Declare("baseColor","color") /* inline rib archive */ archive1 := ctx.ArchiveBegin("lighting") ctx.AttributeBegin() ctx.ArchiveRecord(ri.COMMENT,"this is our lights") ctx.Translate(5,5,5) ctx.Light("PxrEnvDayLight","light1") ctx.Geometry("envsphere",resolution,[2]float64{1024,1024}) ctx.AttributeEnd() ctx.AttributeBegin() ctx.Translate(-5,5,-5) ctx.Light("PxrEnvDayLight","light2") ctx.Geometry("envsphere",resolution,[2]float64{1024,1024}) ctx.AttributeEnd() ctx.ArchiveEnd() ctx.Display("2_spheres.exr","openexr","rgba") ctx.Format(640,480,1.0) ctx.Projection("perspective","float fov",30.0) ctx.Hider("raytrace","int maxsamples",64,"int minsamples",16,"int incremental",100,"float[4] aperture",[4]float64{0,0,0,0}) ctx.Integrator("PxrPathTracer","production") ctx.Shutter(0,1) ctx.System("date; echo starting job ^{Option:user:jobid}") ctx.WorldBegin() object := ctx.ObjectBegin() ctx.Sphere(1,-1,1,360) ctx.ObjectEnd() ctx.ReadArchive("test2.rib",nil) ctx.Translate(0,0,10) ctx.ReadArchive(archive1,nil) ctx.Illuminate("light1",true) ctx.Illuminate("light2",true) ctx.AttributeBegin() ctx.MotionBegin(0.0,0.5,1.0) ctx.Translate(1,0,0) ctx.Translate(0,0,0) ctx.Translate(-1,0,0) ctx.MotionEnd() ctx.Bxdf("PxrDisney","surface","baseColor",[]float64{1,0,0}) ctx.ObjectInstance(object) ctx.AttributeEnd() ctx.AttributeBegin() ctx.Bxdf("PxrDisney","surface_2","color baseColor",[]float64{0,1,0}) ctx.Sphere(1,-1,1,360) ctx.AttributeEnd() ctx.WorldEnd() ctx.System("date; echo rendered job ^{Option:user:jobid}") for { if ctx.RicGetProgress() == 100 { break } } ctx.End() ctx = rigo.New() ctx.Begin("test2.rib") ctx.ArchiveRecord("structure","RenderMan RIB") ctx.ReadArchive(archive1,nil) ctx.End() ctx = rigo.New() ctx.Begin("driver.rib") ctx.ArchiveRecord("structure","RenderMan RIB") ctx.Option("ribparse","string varsubst","^") ctx.Option("user","string jobid","2_spheres") ctx.End() }