Documentation
¶
Overview ¶
Package materials provides a generic Material interface and several implemented shaders
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyMaterial ¶
type AnyMaterial struct {
Material
}
AnyMaterial implements the Material interface and is deserialiseable from json
func (*AnyMaterial) UnmarshalJSON ¶
func (m *AnyMaterial) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface
type EmissiveMaterial ¶
type EmissiveMaterial struct { Colour *sampler.AnySampler Strength *sampler.AnySampler }
EmissiveMaterial acts as a lamp
func (*EmissiveMaterial) Shade ¶
func (m *EmissiveMaterial) Shade(intersection *ray.Intersection, raytracer Raytracer) *hdrcolour.Colour
Shade returns the emitted colour after intersecting the material
type LambertMaterial ¶
type LambertMaterial struct {
Colour *sampler.AnySampler
}
LambertMaterial is a simple diffuse material
func (*LambertMaterial) Shade ¶
func (m *LambertMaterial) Shade(intersection *ray.Intersection, raytracer Raytracer) *hdrcolour.Colour
Shade returns the emitted colour after intersecting the material
type Material ¶
type Material interface {
Shade(intersection *ray.Intersection, raytracer Raytracer) *hdrcolour.Colour
}
Material objects are used to shade surfaces
type MixedMaterial ¶
type MixedMaterial struct { First *AnyMaterial Second *AnyMaterial Coefficient float64 }
MixedMaterial mixes two other materials depending on a coefficient
func (*MixedMaterial) Shade ¶
func (m *MixedMaterial) Shade(intersection *ray.Intersection, raytracer Raytracer) *hdrcolour.Colour
Shade returns colour depending on coefficient and random number
type Raytracer ¶
type Raytracer interface { Raytrace(incoming *ray.Ray) *hdrcolour.Colour RandomGen() *random.Random }
Raytracer is any possible raytracer
type ReflectiveMaterial ¶
type ReflectiveMaterial struct { Colour *sampler.AnySampler Roughness *sampler.AnySampler }
ReflectiveMaterial is a reflective material
func (*ReflectiveMaterial) Shade ¶
func (m *ReflectiveMaterial) Shade(intersection *ray.Intersection, raytracer Raytracer) *hdrcolour.Colour
Shade returns the emitted colour after intersecting the material
type RefractiveMaterial ¶
type RefractiveMaterial struct { Colour *sampler.AnySampler Roughness *sampler.AnySampler IOR *sampler.AnySampler }
RefractiveMaterial is a material for modeling glass, etc
func (*RefractiveMaterial) Shade ¶
func (m *RefractiveMaterial) Shade(intersection *ray.Intersection, raytracer Raytracer) *hdrcolour.Colour
Shade returns the emitted colour after intersecting the material