Documentation ¶
Index ¶
- func Hit(intersections []shapes.Intersection) (shapes.Intersection, bool)
- func NormalAt(s shapes.Shape, worldPoint geom.Tuple4, intersection *shapes.Intersection) geom.Tuple4
- func NormalAtPtr(s shapes.Shape, worldPoint geom.Tuple4, intersection *shapes.Intersection, ...) geom.Tuple4
- func NormalToWorld(shape shapes.Shape, normal geom.Tuple4) geom.Tuple4
- func NormalToWorldPtr(shape shapes.Shape, normal *geom.Tuple4)
- func Position(r geom.Ray, distance float64) geom.Tuple4
- func PositionPtr(r geom.Ray, distance float64, out *geom.Tuple4)
- func PrepareComputationForIntersectionPtr(i shapes.Intersection, r geom.Ray, comps *Computation, ...)
- func RandHemi(normalVec geom.Tuple4, rnd *rand.Rand) geom.Tuple4
- func Reflect(vec geom.Tuple4, normal geom.Tuple4) geom.Tuple4
- func ReflectPtr(vec geom.Tuple4, normal geom.Tuple4, out *geom.Tuple4)
- func Schlick(comps Computation) float64
- func TransformRay(r geom.Ray, m1 geom.Mat4x4) geom.Ray
- func TransformRayPtr(r geom.Ray, m1 geom.Mat4x4, out *geom.Ray)
- func WorldToObject(shape shapes.Shape, point geom.Tuple4) geom.Tuple4
- func WorldToObjectPtr(shape shapes.Shape, point geom.Tuple4, out *geom.Tuple4)
- type Computation
- type Ctx
- type LightData
- type PathTracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hit ¶
func Hit(intersections []shapes.Intersection) (shapes.Intersection, bool)
Hit finds the first intersection with a positive T (the passed intersections are assumed to have been sorted already)
func NormalAtPtr ¶
func Position ¶
Position multiplies direction of ray with the passed distance and adds the result onto the origin. Used for finding the position along a ray.
func PrepareComputationForIntersectionPtr ¶
func PrepareComputationForIntersectionPtr(i shapes.Intersection, r geom.Ray, comps *Computation, xs ...shapes.Intersection)
func RandHemi ¶
Also from Hunter Loftis pathtracer. This one produces a similar, but definitely darker result than the one I'm using from https://raytracey.blogspot.com/2016/11/opencl-path-tracing-tutorial-2-path.html.
func ReflectPtr ¶
in - normal * 2 * dot(in, normal)
func Schlick ¶
func Schlick(comps Computation) float64
Types ¶
type Computation ¶
type Computation struct { T float64 Object shapes.Shape Point geom.Tuple4 EyeVec geom.Tuple4 NormalVec geom.Tuple4 Inside bool OverPoint geom.Tuple4 UnderPoint geom.Tuple4 ReflectVec geom.Tuple4 N1 float64 N2 float64 // contains filtered or unexported fields }
func NewComputation ¶
func NewComputation() Computation
type LightData ¶
type LightData struct { //Ambient Tuple4 //Diffuse Tuple4 //Specular Tuple4 //EffectiveColor Tuple4 LightVec geom.Tuple4 ReflectVec geom.Tuple4 }
LightData is used for pre-allocated memory for lighting computations.
func NewLightData ¶
func NewLightData() LightData
type PathTracer ¶
type PathTracer struct { }
func NewPathTracer ¶
func NewPathTracer() *PathTracer
func (*PathTracer) Render ¶
func (t *PathTracer) Render(sceneFactory func() *scenes.Scene)
Click to show internal directories.
Click to hide internal directories.