Documentation ¶
Overview ¶
Package hitable implements the methods used to compute intersections between a ray and geometry.
Index ¶
- type BVHNode
- func (bn *BVHNode) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (bn *BVHNode) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (bn *BVHNode) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (bn *BVHNode) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type Box
- func (b *Box) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (b *Box) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (b *Box) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (b *Box) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type ConstantMedium
- func (cm *ConstantMedium) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (cm *ConstantMedium) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (cm *ConstantMedium) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (cm *ConstantMedium) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type FlipNormals
- func (fn *FlipNormals) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (fn *FlipNormals) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (fn *FlipNormals) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (fn *FlipNormals) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type Hitable
- type HitableSlice
- func (hs *HitableSlice) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (hs *HitableSlice) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (hs *HitableSlice) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (hs *HitableSlice) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type RotateY
- func (ry *RotateY) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (ry *RotateY) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (ry *RotateY) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (ry *RotateY) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type Sphere
- func (s *Sphere) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (s *Sphere) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (s *Sphere) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (s *Sphere) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type Translate
- func (tr *Translate) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (tr *Translate) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (tr *Translate) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (tr *Translate) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type XYRect
- func (xyr *XYRect) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (xyr *XYRect) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (xyr *XYRect) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (xyr *XYRect) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type XZRect
- func (xzr *XZRect) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (xzr *XZRect) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (xzr *XZRect) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (xzr *XZRect) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
- type YZRect
- func (yzr *YZRect) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool)
- func (yzr *YZRect) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
- func (yzr *YZRect) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64
- func (yzr *YZRect) Random(o *vec3.Vec3Impl) *vec3.Vec3Impl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BVHNode ¶
type BVHNode struct {
// contains filtered or unexported fields
}
BVHNode represents a bounding volume hierarchy node.
func (*BVHNode) BoundingBox ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
Box represents a box.
func (*Box) BoundingBox ¶
type ConstantMedium ¶
type ConstantMedium struct {
// contains filtered or unexported fields
}
ConstantMedium represents a medium with constant density.
func NewConstantMedium ¶
func NewConstantMedium(hitable Hitable, density float64, a texture.Texture) *ConstantMedium
NewConstantMedium returns a new instance of the constant medium hitable.
func (*ConstantMedium) BoundingBox ¶
type FlipNormals ¶
type FlipNormals struct {
// contains filtered or unexported fields
}
FlipNormals represents a hitable with the inverted normal.
func NewFlipNormals ¶
func NewFlipNormals(hitable Hitable) *FlipNormals
NewFlipNormals returns a hitable with inverted normals.
func (*FlipNormals) BoundingBox ¶
type Hitable ¶
type Hitable interface { Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool) BoundingBox(time0 float64, time1 float64) (*aabb.AABB, bool) PDFValue(o *vec3.Vec3Impl, v *vec3.Vec3Impl) float64 Random(o *vec3.Vec3Impl) *vec3.Vec3Impl }
Hitable defines the methods to compute ray/geometry operations.
type HitableSlice ¶
type HitableSlice struct {
// contains filtered or unexported fields
}
HitableSlice represents a list of hitable entities.
func NewSlice ¶
func NewSlice(hitables []Hitable) *HitableSlice
NewSlice returns an instance of HitableSlice.
func (*HitableSlice) BoundingBox ¶
func (*HitableSlice) Hit ¶
func (hs *HitableSlice) Hit(r ray.Ray, tMin float64, tMax float64) (*hitrecord.HitRecord, material.Material, bool)
Hit computes whether a ray intersects with any of the elements in the slice.
type RotateY ¶
type RotateY struct {
// contains filtered or unexported fields
}
RotateY represents a rotation along the Y axis.
func NewRotateY ¶
NewRotateY returns a new hitable rotated along the Y axis.
func (*RotateY) BoundingBox ¶
type Sphere ¶
type Sphere struct {
// contains filtered or unexported fields
}
Sphere represents a sphere in the 3d world.
func NewSphere ¶
func NewSphere(center0 *vec3.Vec3Impl, center1 *vec3.Vec3Impl, time0 float64, time1 float64, radius float64, material material.Material) *Sphere
NewSphere returns a new instance of Sphere.
func (*Sphere) BoundingBox ¶
type Translate ¶
type Translate struct {
// contains filtered or unexported fields
}
Translate represents a hitable with its associated translation.
func NewTranslate ¶
NewTranslate returns an instance of a translated hitable.
func (*Translate) BoundingBox ¶
type XYRect ¶
type XYRect struct {
// contains filtered or unexported fields
}
XYRect represents an axis aligned rectangle.
func NewXYRect ¶
func NewXYRect(x0 float64, x1 float64, y0 float64, y1 float64, k float64, mat material.Material) *XYRect
NewXYRect returns an instance of an axis aligned rectangle.
func (*XYRect) BoundingBox ¶
type XZRect ¶
type XZRect struct {
// contains filtered or unexported fields
}
XZRect represents an axis aligned rectangle.
func NewXZRect ¶
func NewXZRect(x0 float64, x1 float64, z0 float64, z1 float64, k float64, mat material.Material) *XZRect
NewXZRect returns an instance of an axis aligned rectangle.
func (*XZRect) BoundingBox ¶
type YZRect ¶
type YZRect struct {
// contains filtered or unexported fields
}
YZRect represents an axis aligned rectangle.
func NewYZRect ¶
func NewYZRect(y0 float64, y1 float64, z0 float64, z1 float64, k float64, mat material.Material) *YZRect
NewYZRect returns an instance of an axis aligned rectangle.