Documentation ¶
Index ¶
- func IntersectionEqual(i1, i2 Intersection) bool
- type Basic
- type Cube
- func (c *Cube) CastsShadow() bool
- func (c *Cube) GetInverse() geom.Mat4x4
- func (c *Cube) GetInverseTranspose() geom.Mat4x4
- func (c *Cube) GetLocalRay() geom.Ray
- func (c *Cube) GetMaterial() material.Material
- func (c *Cube) GetParent() Shape
- func (c *Cube) GetTransform() geom.Mat4x4
- func (c *Cube) ID() int64
- func (c *Cube) Init()
- func (c *Cube) IntersectLocal(ray geom.Ray, xs *Intersections)
- func (c *Cube) Name() string
- func (c *Cube) NormalAtLocal(point geom.Tuple4, intersection *Intersection) geom.Tuple4
- func (c *Cube) SetMaterial(material material.Material)
- func (c *Cube) SetParent(shape Shape)
- func (c *Cube) SetTransform(transform geom.Mat4x4)
- type Cylinder
- func (c *Cylinder) CastsShadow() bool
- func (c *Cylinder) GetInverse() geom.Mat4x4
- func (c *Cylinder) GetInverseTranspose() geom.Mat4x4
- func (c *Cylinder) GetLocalRay() geom.Ray
- func (c *Cylinder) GetMaterial() material.Material
- func (c *Cylinder) GetParent() Shape
- func (c *Cylinder) GetTransform() geom.Mat4x4
- func (c *Cylinder) ID() int64
- func (c *Cylinder) Init()
- func (c *Cylinder) IntersectLocal(ray geom.Ray, xs *Intersections)
- func (c *Cylinder) NormalAtLocal(point geom.Tuple4, intersection *Intersection) geom.Tuple4
- func (c *Cylinder) SetMaterial(material material.Material)
- func (c *Cylinder) SetParent(shape Shape)
- func (c *Cylinder) SetTransform(transform geom.Mat4x4)
- type Intersection
- type Intersections
- type Plane
- func (p *Plane) CastsShadow() bool
- func (p *Plane) GetInverse() geom.Mat4x4
- func (p *Plane) GetInverseTranspose() geom.Mat4x4
- func (p *Plane) GetLocalRay() geom.Ray
- func (p *Plane) GetMaterial() material.Material
- func (p *Plane) GetParent() Shape
- func (p *Plane) GetTransform() geom.Mat4x4
- func (p *Plane) ID() int64
- func (p *Plane) IntersectLocal(ray geom.Ray, xs *Intersections)
- func (p *Plane) NormalAtLocal(point geom.Tuple4, intersection *Intersection) geom.Tuple4
- func (p *Plane) SetMaterial(m material.Material)
- func (p *Plane) SetParent(shape Shape)
- func (p *Plane) SetTransform(translation geom.Mat4x4)
- type Shape
- type Sphere
- func (s *Sphere) CastsShadow() bool
- func (s *Sphere) GetInverse() geom.Mat4x4
- func (s *Sphere) GetInverseTranspose() geom.Mat4x4
- func (s *Sphere) GetLocalRay() geom.Ray
- func (s *Sphere) GetMaterial() material.Material
- func (s *Sphere) GetParent() Shape
- func (s *Sphere) GetTransform() geom.Mat4x4
- func (s *Sphere) ID() int64
- func (s *Sphere) IntersectLocal(ray geom.Ray, xs *Intersections)
- func (s *Sphere) NormalAtLocal(point geom.Tuple4, intersection *Intersection) geom.Tuple4
- func (s *Sphere) SetMaterial(m material.Material)
- func (s *Sphere) SetParent(shape Shape)
- func (s *Sphere) SetTransform(translation geom.Mat4x4)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntersectionEqual ¶
func IntersectionEqual(i1, i2 Intersection) bool
Types ¶
type Cube ¶
func (*Cube) CastsShadow ¶
func (*Cube) GetInverse ¶
func (*Cube) GetInverseTranspose ¶
func (*Cube) GetLocalRay ¶
func (*Cube) GetMaterial ¶
func (*Cube) GetTransform ¶
func (*Cube) IntersectLocal ¶
func (c *Cube) IntersectLocal(ray geom.Ray, xs *Intersections)
func (*Cube) NormalAtLocal ¶
NormalAtLocal uses the fact that given a unit cube, the point of the surface axis X,Y or Z is always either 1.0 for positive XYZ and -1.0 for negative XYZ. I.e - if the point is 0.4, 1, -0.5, we know that the point is on the top Y surface and we can return a 0,1,0 normal
func (*Cube) SetMaterial ¶
func (*Cube) SetTransform ¶
type Cylinder ¶
type Cylinder struct { Basic MinY float64 MaxY float64 CastShadow bool // contains filtered or unexported fields }
func NewCylinder ¶
func NewCylinder() *Cylinder
func NewCylinderMM ¶
func NewCylinderMMC ¶
func (*Cylinder) CastsShadow ¶
func (*Cylinder) GetInverse ¶
func (*Cylinder) GetInverseTranspose ¶
func (*Cylinder) GetLocalRay ¶
func (*Cylinder) GetMaterial ¶
func (*Cylinder) GetTransform ¶
func (*Cylinder) IntersectLocal ¶
func (c *Cylinder) IntersectLocal(ray geom.Ray, xs *Intersections)
func (*Cylinder) NormalAtLocal ¶
func (*Cylinder) SetMaterial ¶
func (*Cylinder) SetTransform ¶
type Intersection ¶
func NewIntersection ¶
func NewIntersection(t float64, s Shape) Intersection
func NewIntersectionUV ¶
func NewIntersectionUV(t float64, s Shape, u, v float64) Intersection
type Intersections ¶
type Intersections []Intersection
func (Intersections) Len ¶
func (xs Intersections) Len() int
func (Intersections) Less ¶
func (xs Intersections) Less(i, j int) bool
func (Intersections) Swap ¶
func (xs Intersections) Swap(i, j int)
type Plane ¶
func (*Plane) CastsShadow ¶
func (*Plane) GetInverse ¶
func (*Plane) GetInverseTranspose ¶
func (*Plane) GetLocalRay ¶
func (*Plane) GetMaterial ¶
func (*Plane) GetTransform ¶
func (*Plane) IntersectLocal ¶
func (p *Plane) IntersectLocal(ray geom.Ray, xs *Intersections)
func (*Plane) NormalAtLocal ¶
func (*Plane) SetMaterial ¶
SetMaterial passes a pointer to the Plane on which to set the material
func (*Plane) SetTransform ¶
SetTransform passes a pointer to the Plane on which to apply the translation matrix
type Shape ¶
type Shape interface { ID() int64 GetTransform() geom.Mat4x4 GetInverse() geom.Mat4x4 GetInverseTranspose() geom.Mat4x4 SetTransform(transform geom.Mat4x4) GetMaterial() material.Material SetMaterial(material material.Material) IntersectLocal(ray geom.Ray, xs *Intersections) NormalAtLocal(point geom.Tuple4, intersection *Intersection) geom.Tuple4 GetLocalRay() geom.Ray GetParent() Shape SetParent(shape Shape) CastsShadow() bool }
type Sphere ¶
func (*Sphere) CastsShadow ¶
func (*Sphere) GetInverse ¶
func (*Sphere) GetInverseTranspose ¶
func (*Sphere) GetLocalRay ¶
func (*Sphere) GetMaterial ¶
func (*Sphere) GetTransform ¶
func (*Sphere) IntersectLocal ¶
func (s *Sphere) IntersectLocal(ray geom.Ray, xs *Intersections)
IntersectLocal implements Sphere-ray intersection
func (*Sphere) NormalAtLocal ¶
func (*Sphere) SetMaterial ¶
SetMaterial passes a pointer to the Sphere on which to set the material
func (*Sphere) SetTransform ¶
SetTransform passes a pointer to the Sphere on which to apply the translation matrix
Source Files ¶
Click to show internal directories.
Click to hide internal directories.