Documentation ¶
Index ¶
- Constants
- type AABB
- type FloatColor
- func (self *FloatColor) Add(other FloatColor)
- func (self *FloatColor) Added(other FloatColor) FloatColor
- func (self *FloatColor) Blend(factor float32, otherColor FloatColor)
- func (self *FloatColor) Multiplied(other FloatColor) FloatColor
- func (self FloatColor) RGBA() (r, g, b, a uint32)
- func (self *FloatColor) Scaled(scalar float32) FloatColor
- type LightSource
- type Material
- type Plane
- type Ray
- type Sphere
- type SphereIntersectionInfo
- type Traceable
- type TraceableBase
Constants ¶
View Source
const EPSILON = 0.001
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FloatColor ¶
type FloatColor struct {
R, G, B float32
}
Color whose components are represented as float value in the range [0; 1]
func MakeFloatColor ¶
func MakeFloatColor(color color.RGBA) FloatColor
func (*FloatColor) Add ¶
func (self *FloatColor) Add(other FloatColor)
func (*FloatColor) Added ¶
func (self *FloatColor) Added(other FloatColor) FloatColor
func (*FloatColor) Blend ¶
func (self *FloatColor) Blend(factor float32, otherColor FloatColor)
func (*FloatColor) Multiplied ¶
func (self *FloatColor) Multiplied(other FloatColor) FloatColor
func (*FloatColor) Scaled ¶
func (self *FloatColor) Scaled(scalar float32) FloatColor
type LightSource ¶
type LightSource struct { Position vecmath.Vec3d Diffuse, Specular FloatColor }
A point light source
func MakeColoredLight ¶
func MakeColoredLight(position vecmath.Vec3d, color color.RGBA) LightSource
Create a simple colored light with default specularity
type Material ¶
type Material struct { Ambient FloatColor Diffuse FloatColor Specular FloatColor Specularity float32 Reflectivity float32 Transparency float32 RefractionIndex float32 }
func MakeSimpleMaterial ¶
type Plane ¶
type Plane struct { TraceableBase DistanceToOrigin float32 PlaneNormal vecmath.Vec3d // Due to the plane being infinite, it's impossible (or rather, it's // pointless) to determine its bounding box. So we allow specifying one // instead. AssignedBounds AABB }
An infinite plane
type Sphere ¶
type Sphere struct { TraceableBase SphereIntersectionInfo }
type SphereIntersectionInfo ¶
"Hot" sphere data optimized for fast cache-friendly access
func (*SphereIntersectionInfo) CheckIntersection ¶
func (self *SphereIntersectionInfo) CheckIntersection(ray *Ray) (bool, float32)
type Traceable ¶
type Traceable interface { // Do we intersect ray? If so, return distance from ray origin to // point of intersection CheckIntersection(ray *Ray) (bool, float32) // Surface normal at given intersection point Normal(intersection *vecmath.Vec3d) vecmath.Vec3d Material() *Material Bounds() AABB }
Thing that can be intersected with rays and thus rendered via ray tracing
type TraceableBase ¶
type TraceableBase struct {
ObjectMaterial Material
}
Base class for traceables
func (*TraceableBase) Material ¶
func (self *TraceableBase) Material() *Material
Click to show internal directories.
Click to hide internal directories.