object

package
v0.0.0-...-052c9d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dielectric

type Dielectric struct {
	IndexOfRefraction float64
}

func NewDielectric

func NewDielectric(indexOfRefraction float64) *Dielectric

func (*Dielectric) Scatter

func (d *Dielectric) Scatter(r ray.Ray, rec HitRecord) (bool, r3.Vec, ray.Ray)

type HitList

type HitList struct {
	Objects []Hittable
}

func NewHitList

func NewHitList(objects []Hittable) *HitList

func (*HitList) Add

func (h *HitList) Add(obj Hittable)

func (*HitList) Clear

func (h *HitList) Clear()

func (*HitList) Hit

func (h *HitList) Hit(r ray.Ray, tMin, tMax float64) (bool, HitRecord)

type HitRecord

type HitRecord struct {
	Point     r3.Vec
	Normal    r3.Vec
	T         float64
	FrontFace bool
	Mat       Material
}

func NewHitRecord

func NewHitRecord() HitRecord

func (*HitRecord) SetFaceNormal

func (h *HitRecord) SetFaceNormal(r ray.Ray, outwardNormal r3.Vec)

type Hittable

type Hittable interface {
	Hit(r ray.Ray, tMin, tMax float64) (bool, HitRecord)
}

func CreateWorld

func CreateWorld() Hittable

type Lambertian

type Lambertian struct {
	Albedo r3.Vec
}

func NewLambertian

func NewLambertian(albedo r3.Vec) *Lambertian

func (*Lambertian) Scatter

func (l *Lambertian) Scatter(_ ray.Ray, rec HitRecord) (bool, r3.Vec, ray.Ray)

type Material

type Material interface {
	Scatter(r ray.Ray, rec HitRecord) (bool, r3.Vec, ray.Ray)
}

type Metal

type Metal struct {
	Albedo r3.Vec
	Fuzz   float64
}

func NewMetal

func NewMetal(albedo r3.Vec, fuzz float64) *Metal

func (*Metal) Scatter

func (m *Metal) Scatter(r ray.Ray, rec HitRecord) (bool, r3.Vec, ray.Ray)

type Sphere

type Sphere struct {
	Center r3.Vec
	Radius float64
	Mat    Material
}

func NewSphere

func NewSphere(center r3.Vec, radius float64, mat Material) *Sphere

func (*Sphere) Hit

func (s *Sphere) Hit(r ray.Ray, tMin, tMax float64) (bool, HitRecord)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL