示例#1
0
func TestTorus(t *testing.T) {

	compileShader(OCCLUSION_SHADER)
	compileShader(VIGNETTE_SHADER)

	launch := "launch:prman? -t -ctrl $ctrlin $ctrlout -capture debug.rib"
	ri.Begin(launch)
	ri.Format(512, 320, 1)
	ri.Display("grasshopper", "framebuffer", "rgba")
	ri.ShadingRate(4)
	ri.Option("limits", "int threads", 2)
	ri.Option("statistics",
		"xmlfilename", "stats.xml",
		"endofframe", true)
	ri.PixelSamples(4, 4)
	ri.Projection("perspective", "fov", 30.)
	ri.Translate(0, 0.25, 4)
	ri.Rotate(-20, 1, 0, 0)
	ri.Rotate(180, 1, 0, 0)
	ri.Imager("Vignette")
	ri.WorldBegin()
	ri.Declare("samples", "float")
	ri.Declare("em", "color")
	ri.Attribute("cull",
		"int backfacing", false,
		"int hidden", false)
	ri.Attribute("visibility",
		"int diffuse", true,
		"int specular", true)
	ri.Attribute("dice",
		"int rasterorient", false)

	// Floor
	ri.Attribute("identifier", "string name", "Floor")
	ri.Surface("Occlusion",
		"em", color(0, 0.65, 0.83),
		"samples", 64.)
	ri.TransformBegin()
	ri.Rotate(90, 1, 0, 0)
	ri.Disk(-0.7, 300, 360)
	ri.TransformEnd()

	// Sculpture
	ri.Attribute("identifier", "string name", "Sculpture")
	ri.Surface("Occlusion",
		"em", gray(1.1),
		"samples", 64.)
	ri.TransformBegin()
	ri.Translate(0, 0.75, 0)
	ri.Torus(1, 0.2, 0, 360, 360)
	ri.TransformEnd()
	ri.WorldEnd()

	ri.End()
}
示例#2
0
文件: curve.go 项目: prideout/lsystem
func drawWorld(curve *Curve) {
	ri.WorldBegin()

	ri.Declare("samples", "float")
	ri.Declare("em", "color")
	ri.Attribute("cull",
		"int backfacing", false,
		"int hidden", false)
	ri.Attribute("visibility",
		"int diffuse", true,
		"int specular", true)
	ri.Attribute("dice",
		"int rasterorient", false)

	// Floor
	ri.Attribute("identifier", "string name", "Floor")
	ri.Surface("Occlusion",
		"em", color(0.12, 0.12, 0.83),
		"samples", 16.)
	ri.TransformBegin()
	ri.Rotate(90, 1, 0, 0)
	ri.Disk(-0.7, 300, 360)
	ri.TransformEnd()

	// Sculpture
	ri.Attribute("identifier", "string name", "Sculpture")
	ri.Surface("Occlusion",
		"em", gray(1.0),
		"samples", 1024.)
	ri.TransformBegin()
	ri.Rotate(90, 1, 0, 0)
	ri.Translate(0, 0, -0.55)

	drawCurve(curve)

	ri.TransformEnd()

	ri.WorldEnd()
}