Documentation ¶
Index ¶
- func BuildCLGroup(group *shapes.Group) int32
- func BuildRayBuffer(rays []geom.Ray) []float64
- func BuildSceneBufferCL(in []shapes.Shape) ([]CLObject, []CLTriangle, []CLGroup)
- func Trace(objects []CLObject, triangles []CLTriangle, groups []CLGroup, ...) []float64
- func Trace32(rays []CLRay32, objects []CLObject32, width, height int) []float32
- type CLBoundingBox
- type CLCamera
- type CLGroup
- type CLObject
- type CLObject32
- type CLRay
- type CLRay32
- type CLTriangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCLGroup ¶
func BuildRayBuffer ¶
BuildRayBuffer passes each ray to a float64 slice, using 8 floats per ray. origin + direction.
func BuildSceneBufferCL ¶
func BuildSceneBufferCL(in []shapes.Shape) ([]CLObject, []CLTriangle, []CLGroup)
func Trace ¶
func Trace(objects []CLObject, triangles []CLTriangle, groups []CLGroup, deviceIndex, samples int, camera CLCamera, textures []image.Image, sphereTextures []image.Image, cubeTextures []image.Image) []float64
Trace is the entry point for transforming input data into their OpenCL representations, setting up boilerplate and calling the entry kernel. Should return a slice of float64 RGBA RGBA RGBA once finished.
func Trace32 ¶
func Trace32(rays []CLRay32, objects []CLObject32, width, height int) []float32
Trace32 is the entry point for transforming input data into their OpenCL representations, setting up boilerplate and calling the entry kernel. Should return a slice of float32 RGBA RGBA RGBA once finished.
Types ¶
type CLBoundingBox ¶
type CLGroup ¶
type CLGroup struct { BBMin [4]float64 // 32 bytes BBMax [4]float64 // 32 bytes Color [4]float64 // 32 bytes Emission [4]float64 // 32 bytes TriOffset int32 // 4 bytes TriCount int32 // 4 bytes ChildGroupCount int32 // 4 bytes, should always be 2 or 0 Children [2]int32 // 8 bytes, allow 2 subgroups. Padding [108]byte // padding, 108 bytes (can be used as a label) }
type CLObject ¶
type CLObject struct { Transform [16]float64 // 128 bytes Inverse [16]float64 // 128 bytes InverseTranspose [16]float64 // 128 bytes Color [4]float64 // 32 bytes Emission [4]float64 // 32 bytes == 448 RefractiveIndex float64 // 8 bytes Type int64 // 8 bytes MinY float64 // 8 bytes MaxY float64 // 8 bytes Reflectivity float64 // 8 bytes TextureScaleX float64 TextureScaleY float64 TextureScaleXNM float64 TextureScaleYNM float64 BBMin [4]float64 // 32 bytes BBMax [4]float64 // 32 bytes == 504 + 64 == 568 ChildCount int32 // 4 bytes 572 Children [64]int32 // 64x4 == 256 828 IsTextured bool // 1 byte TextureIndex uint8 // 1 byte IsTexturedNM bool // 1 byte TextureIndexNM uint8 // 1 byte IsEnvMap bool // 1 byte Label [8]byte Padding5 [167]byte }
type CLObject32 ¶
type CLRay ¶
func BuildRayBufferCL ¶
type CLRay32 ¶
func BuildRayBufferCL32 ¶
BuildRayBufferCL32 builds a slice of CLRay32 from the passed geom.Ray slice, i.e. using float32 instead of float64.
type CLTriangle ¶
type CLTriangle struct { P1 [4]float64 // 32 bytes P2 [4]float64 // 32 bytes P3 [4]float64 // 32 bytes E1 [4]float64 // 32 bytes (128) E2 [4]float64 // 32 bytes N1 [4]float64 // 32 bytes N2 [4]float64 // 32 bytes N3 [4]float64 // 32 bytes (256 here) Color [4]float64 // 32 bytes (288 bytes) Padding [224]byte }
Click to show internal directories.
Click to hide internal directories.