Documentation ¶
Index ¶
- func Trace(options *options.Options, gridSize int) *image.NRGBA
- type Camera
- type Coeff
- type Light
- type Result
- type Scene
- func (s *Scene) BackgroundColor(r *ray.Ray) color64.Color64
- func (s *Scene) ColorAt(x, y int) color.NRGBA
- func (s *Scene) TraceDof(nx, ny float64, rayCounts *ray.Counts) color64.Color64
- func (s *Scene) TraceIllumRay(r *ray.Ray, color color64.Color64, depth int)
- func (s *Scene) TraceRay(r *ray.Ray, depth int, contribution float64, rayCounts *ray.Counts) color64.Color64
- type Spot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Camera ¶
type Camera struct { Position mgl64.Vec3 ViewDir mgl64.Vec3 UseDof bool FocalDistance float64 ApertureRadius float64 // contains filtered or unexported fields }
Camera is a viewpoint into a scene and is able to generate Camera rays.
func (*Camera) DofRayThrough ¶
DofRayThrough takes a center ray (which is not midified) and modifies r to be a randomized ray, according do depth of field settings, whose origin is slightly off the center but
type Light ¶
type Light interface { // Attenuation(scene *Scene, point mgl64.Vec3) Color64 // Direction(from mgl64.Vec3) mgl64.Vec3 GenIllumMap(*Scene) }
type Result ¶
Result contains the results of tracing a ray into a scene. It includes the color and the number of each type of ray that was produced.
type Scene ¶
type Scene struct { *options.Options Camera *Camera BgColor color64.Color64 BgTex *texture.Texture Lights []Light Materials map[string]*material.Material // contains filtered or unexported fields }
Scene represents the scene and all data needed to render it.
func (*Scene) BackgroundColor ¶
BackgroundColor returns the color a ray returns when it hits no objects.
func (*Scene) TraceDof ¶
TraceDof handles depth of field logic if the camera is configured to use it, otherwise it traces a normal ray though the camera and the given normalized window coordinates.
func (*Scene) TraceIllumRay ¶
TraceIllumRay traces a ray for the purpose of generating illumination maps.