func LightSource(name string, varargs ...interface{}) {
pName := C.CString(name)
defer C.free(unsafe.Pointer(pName))
names, values, ownership := unzipArgs(varargs...)
defer freeArgs(names, ownership)
nArgs := C.RtInt(len(varargs) / 2)
pNames, pVals := safeArgs(names, values)
C.RiLightSourceV(pName, nArgs, pNames, pVals)
}
Teapotをレンダリング
package main
import (
ri "rman"
)
func color(r, g, b float32) [3]float32 {
return [3]float32{r, g, b}
}
func point(x, y, z float32) [3]float32 {
return [3]float32{x, y, z}
}
func main() {
launch := "launch:prman? -t -ctrl $ctrlin $ctrlout -capture test2.rib"
ri.Begin(launch)
ri.Format(512, 480, 1)
ri.Display("test2", "framebuffer", "rgba")
ri.ShadingRate(4)
ri.Option("limits", "int threads", 4)
ri.PixelSamples(4, 4)
ri.Declare("color", "color")
ri.Imager("background","color",color(0.2,0.4,0.6))
ri.Projection("perspective", "fov", 45.)
ri.Translate(0, 0, 9)
ri.WorldBegin()
ri.Declare("from", "point")
ri.Declare("intensity", "float")
ri.LightSource("pointlight","intensity",300. ,"from", point(-10,10,-10))
ri.LightSource("pointlight","intensity",300. ,"from", point(10,10,-10))
ri.LightSource("pointlight","intensity",300. ,"from", point(-10,-10,-10))
ri.Translate(0, -1.2, 0)
ri.Rotate(-110,1,0,0)
ri.Color(0.9, 0, 0.1)
ri.Surface("plastic")
ri.Geometry("teapot")
ri.WorldEnd()
ri.End()
}
- -
- -