Documentation ¶
Index ¶
- func BackgroundColor(ray Ray) mgl64.Vec3
- func Div(v mgl64.Vec3, t float64) mgl64.Vec3
- func Inverse(v mgl64.Vec3) mgl64.Vec3
- func LinearInterpolation(t float64, color1, color2 mgl64.Vec3) mgl64.Vec3
- func MulByVec(v mgl64.Vec3, v2 mgl64.Vec3) mgl64.Vec3
- func RGBASetVec3(i *image.RGBA, vecColor mgl64.Vec3, x, y int)
- func RandVec3InUnitDisk() (p mgl64.Vec3)
- func RandVec3InUnitSphere() (p mgl64.Vec3)
- func Reflect(v mgl64.Vec3, n mgl64.Vec3) mgl64.Vec3
- func Refract(v mgl64.Vec3, n mgl64.Vec3, niOverNt float64) (refracted mgl64.Vec3, ok bool)
- func ToColumns(rect image.Rectangle, n int) []image.Rectangle
- func Trace(ray Ray, world Primitive, bounces int) (color mgl64.Vec3)
- type Bounce
- type Camera
- type CameraOptions
- type Dielectric
- type HitRecord
- type Image
- type ImageOptions
- type Lambertian
- type Material
- type Metal
- type Primitive
- type Primitives
- type Ray
- type RenderOptions
- type Scene
- type Sphere
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundColor ¶
func LinearInterpolation ¶
func RandVec3InUnitDisk ¶
func RandVec3InUnitSphere ¶
Types ¶
type CameraOptions ¶
type Dielectric ¶
type Dielectric struct {
RefractiveIndex float64
}
type Image ¶
type Image struct { ImageOptions *image.RGBA }
func NewImage ¶
func NewImage(options ImageOptions) Image
type ImageOptions ¶
type Lambertian ¶
type Primitive ¶
type Primitive interface { // Future improvement: return *HitRecord instead of bool, nil return mean no hit found // Disadvantage: a new HitRecord is allocated every time a ray hits an object, instead of just once Hit(r Ray, tMin, tMax float64) *HitRecord }
Future improvement: rename to "object" or "geometry" or something else, hittable seems so awkward
type Primitives ¶
type Primitives struct {
P []Primitive
}
func NewPrimitiveSlice ¶
func NewPrimitiveSlice(primitives ...Primitive) Primitives
func (*Primitives) AddPrimitive ¶
func (p *Primitives) AddPrimitive(primitive Primitive)
func (*Primitives) AddPrimitives ¶
func (p *Primitives) AddPrimitives(primitives ...Primitive)
type RenderOptions ¶
type RenderOptions struct { CameraOptions ImageOptions Samples, Bounces int }
RenderOptions describes all the options available to change how a scene is rendered
type Scene ¶
type Scene struct { RenderOptions World Primitive // contains filtered or unexported fields }
Scene describes everything needed to render and image
func NewScene ¶
func NewScene(options RenderOptions, world Primitive) Scene
func (*Scene) RenderParallel ¶
RenderParallel renders the scene across n goroutines
Source Files ¶
Click to show internal directories.
Click to hide internal directories.