aeno

package module
v0.1.68 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 24 Imported by: 2

README


Aeno

Aeno is a modified FauxGl port that adds several optimizations, The Weiler Atherton algorithm and pure 3D software rendering in Go. Without OpenGL, C extensions, or anything of that matter.


Dragon

About

It's like OpenGL, but it's not. It's Based on FauxGL, but it's not. Its Aeno.

It doesn't use your graphics card, only your CPU. So it's slow and unsuitable for realtime rendering. But it's still pretty fast. It works the same way OpenGL works - rasterizing.

Features
  • GLTF, OBJ, NTSM file formats
  • triangle rasterization
  • vertex and fragment "shaders"
  • view volume clipping
  • face culling
  • alpha blending
  • vertex and image-based textures
  • triangle & line meshes
  • depth biasing
  • wireframe rendering
  • built-in shapes (plane, sphere, cube, cylinder, cone)
  • anti-aliasing (via supersampling)
  • voxel rendering
  • parallel processing
Performance

Aeno uses all of your CPU cores. But none of your GPU.

Rendering the Stanford Dragon shown above (871306 triangles) at 1920x1080px takes about 150 milliseconds on my machine. With 4x4=16x supersampling, it takes about 950 milliseconds. This is the time to render a frame and does not include loading the mesh from disk.

Go Get
go get -u github.com/netisu/aeno
Go Doc

https://godoc.org/github.com/netisu/aeno

Complete Example
package main

import (
	. "github.com/im-aeo/aeno"
	"github.com/nfnt/resize"
)

const (
	scale  = 1    // optional supersampling
	width  = 1920 // output width in pixels
	height = 1080 // output height in pixels
	fovy   = 30   // vertical field of view in degrees
	near   = 1    // near clipping plane
	far    = 10   // far clipping plane
)

var (
	eye    = V(-3, 1, -0.75)               // camera position
	center = V(0, -0.07, 0)                // view center position
	up     = V(0, 1, 0)                    // up vector
	light  = V(-0.75, 1, 0.25).Normalize() // light direction
	color  = HexColor("#468966")           // object color
)

func main() {
	// load a mesh
	mesh, err := LoadOBJ("examples/dragon.obj")
	if err != nil {
		panic(err)
	}

	// fit mesh in a bi-unit cube centered at the origin
	mesh.BiUnitCube()

	// smooth the normals
	mesh.SmoothNormalsThreshold(Radians(30))

	// create a rendering context
	context := NewContext(width*scale, height*scale)
	context.ClearColorBufferWith(HexColor("#FFF8E3"))

	// create transformation matrix and light direction
	aspect := float64(width) / float64(height)
	matrix := LookAt(eye, center, up).Perspective(fovy, aspect, near, far)

	// use builtin phong shader
	shader := NewPhongShader(matrix, light, eye)
	shader.ObjectColor = color
	context.Shader = shader

	// render
	context.DrawMesh(mesh)

	// downsample image for antialiasing
	image := context.Image()
	image = resize.Resize(width, height, image, resize.Bilinear)

	// save image
	SavePNG("out.png", image)
}

Teapot

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Discard empty color
	Discard = Color{}
	// Transparent transparent color
	Transparent = Color{}
	// Black black color
	Black = Color{0, 0, 0, 1}
	// White white color
	White = Color{1, 1, 1, 1}
)
View Source
var EmptyBox = Box{}

EmptyBox f

Functions

func AbsInt

func AbsInt(x int) int

AbsInt f

func Clamp

func Clamp(x, lo, hi float64) float64

Clamp f

func ClampInt

func ClampInt(x, lo, hi int) int

ClampInt f

func Degrees

func Degrees(radians float64) float64

Degrees f

func GenerateScene

func GenerateScene(fit bool, path string, objects []*Object, eye Vector, center Vector, up Vector, fovy float64, size int, scale int, light Vector, ambient string, diffuse string, near, far float64)

GenerateScene is a high-level helper

func GenerateSceneToWriter

func GenerateSceneToWriter(writer io.Writer, objects []*Object, eye Vector, center Vector, up Vector, fovy float64, size int, scale int, light Vector, ambient string, diffuse string, near, far float64, fit bool) error

func InterpolateFloats

func InterpolateFloats(v1, v2, v3 float64, b VectorW) float64

InterpolateFloats f

func LoadGLTF

func LoadGLTF(path string) (*Mesh, Matrix, error)

func LoadGLTFFromBytes

func LoadGLTFFromBytes(b []byte) (*Mesh, Matrix, error)

func LoadGLTFFromReader

func LoadGLTFFromReader(r io.Reader) (*Mesh, Matrix, error)

func LoadImage

func LoadImage(path string) (image.Image, error)

LoadImage f

func ParseFloats

func ParseFloats(items []string) []float64

ParseFloats f

func Radians

func Radians(degrees float64) float64

Radians f

func Round

func Round(a float64) int

Round f

func RoundPlaces

func RoundPlaces(a float64, places int) float64

RoundPlaces f

func SavePNG

func SavePNG(path string, im image.Image) error

SavePNG f

Types

type Box

type Box struct {
	Min, Max Vector
}

Box f

func BoxForBoxes

func BoxForBoxes(boxes []Box) Box

BoxForBoxes f

func (Box) Anchor

func (a Box) Anchor(anchor Vector) Vector

Anchor f

func (Box) Center

func (a Box) Center() Vector

Center f

func (Box) Contains

func (a Box) Contains(b Vector) bool

Contains f

func (Box) ContainsBox

func (a Box) ContainsBox(b Box) bool

ContainsBox f

func (Box) Corners

func (b Box) Corners() []Vector

Corners f

func (Box) Extend

func (a Box) Extend(b Box) Box

Extend f

func (Box) Intersection

func (a Box) Intersection(b Box) Box

Intersection f

func (Box) Intersects

func (a Box) Intersects(b Box) bool

Intersects f

func (Box) Offset

func (a Box) Offset(x float64) Box

Offset f

func (Box) Size

func (a Box) Size() Vector

Size f

func (Box) Transform

func (a Box) Transform(m Matrix) Box

Transform f

func (Box) Translate

func (a Box) Translate(v Vector) Box

Translate f

func (Box) Volume

func (a Box) Volume() float64

Volume f

type Color

type Color struct {
	R, G, B, A float64
}

Color color struct

func Gray

func Gray(x float64) Color

Gray returns gray of given value

func HexColor

func HexColor(x string) Color

HexColor converts hex string to color

func InterpolateColors

func InterpolateColors(v1, v2, v3 Color, b VectorW) Color

InterpolateColors f

func MakeColor

func MakeColor(c color.Color) Color

MakeColor converts color from color module to fauxgl

func (Color) Add

func (a Color) Add(b Color) Color

Add adds two colors

func (Color) AddScalar

func (a Color) AddScalar(b float64) Color

AddScalar adds based on scalar

func (Color) Alpha

func (a Color) Alpha(alpha float64) Color

Alpha sets the alpha of a color

func (Color) Div

func (a Color) Div(b Color) Color

Div divides two colors

func (Color) DivScalar

func (a Color) DivScalar(b float64) Color

DivScalar divides based on scalar

func (Color) Lerp

func (a Color) Lerp(b Color, t float64) Color

Lerp lerps two colors

func (Color) Max

func (a Color) Max(b Color) Color

Max maxes each color value

func (Color) Min

func (a Color) Min(b Color) Color

Min minimums each color value

func (Color) Mul

func (a Color) Mul(b Color) Color

Mul multiplies two colors

func (Color) MulScalar

func (a Color) MulScalar(b float64) Color

MulScalar multiplies based on scalar

func (Color) NRGBA

func (a Color) NRGBA() color.NRGBA

NRGBA returns nrgba color from fauxgl color

func (Color) Opaque

func (a Color) Opaque() Color

Opaque makes a color opaque

func (Color) Pow

func (a Color) Pow(b float64) Color

Pow applies exponent to each value

func (Color) Sub

func (a Color) Sub(b Color) Color

Sub subtracts two colors

func (Color) SubScalar

func (a Color) SubScalar(b float64) Color

SubScalar subtracts based on scalar

type Context

type Context struct {
	Width       int
	Height      int
	Shader      Shader
	ColorBuffer *image.NRGBA
	DepthBuffer []float64
	ClearColor  Color
	ReadDepth   bool
	WriteDepth  bool
	WriteColor  bool
	AlphaBlend  bool
	Wireframe   bool
	FrontFace   Face
	Cull        Cull
	LineWidth   float64
	DepthBias   float64
	// contains filtered or unexported fields
}

func NewContext

func NewContext(width, height int, shader Shader) *Context

func (*Context) ClearColorBuffer

func (dc *Context) ClearColorBuffer()

func (*Context) ClearColorBufferWith

func (dc *Context) ClearColorBufferWith(c Color)

ClearColorBufferWith uses fast memory copy to clear the buffer

func (*Context) ClearDepthBuffer

func (dc *Context) ClearDepthBuffer()

func (*Context) DrawLine

func (dc *Context) DrawLine(l *Line, fromObject *Object)

func (*Context) DrawMesh

func (dc *Context) DrawMesh(mesh *Mesh, fromObject *Object)

func (*Context) DrawObject

func (dc *Context) DrawObject(o *Object)

func (*Context) DrawTriangle

func (dc *Context) DrawTriangle(t *Triangle, fromObject *Object)

func (*Context) Image

func (dc *Context) Image() image.Image

type Cull

type Cull int
const (
	CullNone Cull
	CullFront
	CullBack
)

type Face

type Face int
const (
	FaceCW Face
	FaceCCW
)

type ImageTexture

type ImageTexture struct {
	Width  int
	Height int
	Image  image.Image
}

func (*ImageTexture) BilinearSample

func (t *ImageTexture) BilinearSample(u, v float64) Color

func (*ImageTexture) Sample

func (t *ImageTexture) Sample(u, v float64) Color

type Line

type Line struct {
	V1, V2 Vertex
}

Line f

func ClipLine

func ClipLine(l *Line) *Line

func NewLine

func NewLine(v1, v2 Vertex) *Line

NewLine f

func NewLineForPoints

func NewLineForPoints(p1, p2 Vector) *Line

NewLineForPoints f

func (*Line) BoundingBox

func (l *Line) BoundingBox() Box

BoundingBox f

func (*Line) Transform

func (l *Line) Transform(matrix Matrix)

Transform F

type Matrix

type Matrix struct {
	X00, X01, X02, X03 float64
	X10, X11, X12, X13 float64
	X20, X21, X22, X23 float64
	X30, X31, X32, X33 float64
}

Matrix f

func Frustum

func Frustum(left, right, bottom, top, near, far float64) Matrix

Frustum f

func Identity

func Identity() Matrix

Identity f

func LookAt

func LookAt(eye, center, up Vector) Matrix

LookAt f

func LookAtDirection

func LookAtDirection(forward, up Vector) Matrix

LookAtDirection f

func Orient

func Orient(position, size, up Vector, rotation float64) Matrix

Orient f

func Orthographic

func Orthographic(l, r, b, t, n, f float64) Matrix

Orthographic f

func Perspective

func Perspective(fovy, aspect, near, far float64) Matrix

Perspective f

func Rotate

func Rotate(v Vector, a float64) Matrix

Rotate f

func RotateTo

func RotateTo(a, b Vector) Matrix

RotateTo f

func Scale

func Scale(v Vector) Matrix

Scale f

func Screen

func Screen(w, h int) Matrix

Screen f

func Translate

func Translate(v Vector) Matrix

Translate f

func Viewport

func Viewport(x, y, w, h float64) Matrix

Viewport f

func (Matrix) Determinant

func (a Matrix) Determinant() float64

Determinant f

func (Matrix) Frustum

func (a Matrix) Frustum(l, r, b, t, n, f float64) Matrix

Frustum f

func (Matrix) Inverse

func (a Matrix) Inverse() Matrix

Inverse f

func (Matrix) LookAt

func (a Matrix) LookAt(eye, center, up Vector) Matrix

LookAt

func (Matrix) Mul

func (a Matrix) Mul(b Matrix) Matrix

Mul f

func (Matrix) MulBox

func (a Matrix) MulBox(box Box) Box

MulBox f

func (Matrix) MulDirection

func (a Matrix) MulDirection(b Vector) Vector

MulDirection f

func (Matrix) MulPosition

func (a Matrix) MulPosition(b Vector) Vector

MulPosition f

func (Matrix) MulPositionW

func (a Matrix) MulPositionW(b Vector) VectorW

MulPositionW f

func (Matrix) MulScalar

func (a Matrix) MulScalar(b float64) Matrix

MulScalar f

func (Matrix) Orthographic

func (a Matrix) Orthographic(l, r, b, t, n, f float64) Matrix

Orthographic f

func (Matrix) Perspective

func (a Matrix) Perspective(fovy, aspect, near, far float64) Matrix

Perspective f

func (Matrix) Rotate

func (a Matrix) Rotate(v Vector, f float64) Matrix

Rotate f

func (Matrix) RotateTo

func (a Matrix) RotateTo(b, c Vector) Matrix

RotateTo f

func (Matrix) Scale

func (a Matrix) Scale(v Vector) Matrix

Scale f

func (Matrix) Translate

func (a Matrix) Translate(v Vector) Matrix

Translate f

func (Matrix) Transpose

func (a Matrix) Transpose() Matrix

Transpose f

func (Matrix) Viewport

func (a Matrix) Viewport(x, y, w, h float64) Matrix

Viewport f

type Mesh

type Mesh struct {
	Triangles []*Triangle
	Lines     []*Line
	// contains filtered or unexported fields
}

Mesh f

func LoadMesh

func LoadMesh(path string) (*Mesh, error)

LoadMesh f

func LoadOBJ

func LoadOBJ(path string) (*Mesh, error)

func LoadOBJFromBytes

func LoadOBJFromBytes(b []byte) (*Mesh, error)

func LoadOBJFromReader

func LoadOBJFromReader(r io.Reader) (*Mesh, error)

func NewCone

func NewCone(step int, capped bool) *Mesh

NewCone f

func NewCube

func NewCube() *Mesh

NewCube f

func NewCubeForBox

func NewCubeForBox(box Box) *Mesh

NewCubeForBox f

func NewCubeOutlineForBox

func NewCubeOutlineForBox(box Box) *Mesh

NewCubeOutlineForBox f

func NewCylinder

func NewCylinder(step int, capped bool) *Mesh

NewCylinder f

func NewEmptyMesh

func NewEmptyMesh() *Mesh

NewEmptyMesh returns an empty mesh

func NewIcosahedron

func NewIcosahedron() *Mesh

NewIcosahedron f

func NewLatLngSphere

func NewLatLngSphere(latStep, lngStep int) *Mesh

NewLatLngSphere f

func NewLineMesh

func NewLineMesh(lines []*Line) *Mesh

NewLineMesh returns a mesh with given data

func NewMesh

func NewMesh(triangles []*Triangle, lines []*Line) *Mesh

NewMesh returns a mesh with given data

func NewPlane

func NewPlane() *Mesh

NewPlane f

func NewSphere

func NewSphere(detail int) *Mesh

NewSphere f

func NewTriangleMesh

func NewTriangleMesh(triangles []*Triangle) *Mesh

NewTriangleMesh returns a mesh with given data

func (*Mesh) Add

func (m *Mesh) Add(b *Mesh)

Add f

func (*Mesh) BiUnitCube

func (m *Mesh) BiUnitCube() Matrix

BiUnitCube f

func (*Mesh) BoundingBox

func (m *Mesh) BoundingBox() Box

BoundingBox f

func (*Mesh) Center

func (m *Mesh) Center() Matrix

Center f

func (*Mesh) Copy

func (m *Mesh) Copy() *Mesh

Copy f

func (*Mesh) FitInside

func (m *Mesh) FitInside(box Box, anchor Vector) Matrix

FitInside f

func (*Mesh) MoveTo

func (m *Mesh) MoveTo(position, anchor Vector) Matrix

MoveTo f

func (*Mesh) ReverseWinding

func (m *Mesh) ReverseWinding()

ReverseWinding f

func (*Mesh) Simplify

func (m *Mesh) Simplify(factor float64)

Simplify f

func (*Mesh) SmoothNormals

func (m *Mesh) SmoothNormals()

SmoothNormals f

func (*Mesh) SmoothNormalsThreshold

func (m *Mesh) SmoothNormalsThreshold(radians float64)

SmoothNormalsThreshold f

func (*Mesh) SurfaceArea

func (m *Mesh) SurfaceArea() float64

SurfaceArea f

func (*Mesh) Transform

func (m *Mesh) Transform(matrix Matrix)

Transform f

func (*Mesh) UnitCube

func (m *Mesh) UnitCube() Matrix

UnitCube f

func (*Mesh) Volume

func (m *Mesh) Volume() float64

Volume f

type Object

type Object struct {
	Mesh           *Mesh
	Texture        Texture
	Color          Color
	Matrix         Matrix
	UseVertexColor bool
}

func NewObject

func NewObject(mesh *Mesh) *Object

func NewObjectFromFile

func NewObjectFromFile(path string) (*Object, error)

func NewObjectFromURL

func NewObjectFromURL(url string) *Object

func (*Object) SetColor

func (o *Object) SetColor(c Color)

func (*Object) Transform

func (o *Object) Transform(m Matrix)

type PhongShader

type PhongShader struct {
	Matrix         Matrix
	LightDirection Vector
	CameraPosition Vector
	AmbientColor   Color
	DiffuseColor   Color
	SpecularColor  Color
	SpecularPower  float64
	EnableOutline  bool    // A switch to turn the effect on/off
	OutlineColor   Color   // The color of the outline
	OutlineFactor  float64 // Controls line thickness (lower is thicker)
}

PhongShader implements Phong shading with an optional texture.

func NewPhongShader

func NewPhongShader(matrix Matrix, lightDirection, cameraPosition Vector, ambient Color, diffuse Color) *PhongShader

NewPhongShader f

func (*PhongShader) Fragment

func (shader *PhongShader) Fragment(v Vertex, fromObject *Object) Color

Fragment f

func (*PhongShader) Vertex

func (shader *PhongShader) Vertex(v Vertex) Vertex

Vertex f

type Scene

type Scene struct {
	Context *Context
	Objects []*Object
	Eye     Vector
	Center  Vector
	Up      Vector
}

func NewScene

func NewScene(width, height int, shader Shader) *Scene

func (*Scene) Add

func (s *Scene) Add(o *Object)

func (*Scene) FitObjectsToScene

func (s *Scene) FitObjectsToScene(fovy, aspect, near, far float64)

FitObjectsToScene automatically positions the eye to see all objects.

func (*Scene) GetSafetyClipping

func (s *Scene) GetSafetyClipping() (near, far float64)

func (*Scene) Render

func (s *Scene) Render()

func (*Scene) Save

func (s *Scene) Save(path string) error

type Shader

type Shader interface {
	Vertex(Vertex) Vertex
	Fragment(Vertex, *Object) Color
}

Shader shader interface

type SolidColorShader

type SolidColorShader struct {
	Matrix    Matrix
	Color     Color
	Thickness float64
}

SolidColorShader is a simple shader that renders everything in one color.

func NewSolidColorShader

func NewSolidColorShader(matrix Matrix, color Color, thickness float64) *SolidColorShader

func (*SolidColorShader) Fragment

func (s *SolidColorShader) Fragment(v Vertex, fromObject *Object) Color

func (*SolidColorShader) Vertex

func (s *SolidColorShader) Vertex(v Vertex) Vertex

type Texture

type Texture interface {
	Sample(u, v float64) Color
	BilinearSample(u, v float64) Color
}

func LoadTexture

func LoadTexture(path string) (Texture, error)

func LoadTextureFromURL

func LoadTextureFromURL(url string) Texture

func NewImageTexture

func NewImageTexture(im image.Image) Texture

func TexFromBytes

func TexFromBytes(data []byte) Texture

type ToonShader

type ToonShader struct {
	Matrix         Matrix
	LightDirection Vector
	CameraPosition Vector
	AmbientColor   Color
	DiffuseColor   Color

	// Cel Shading
	LightCutoff float64 // The point at which the light transitions to full shadow (0-1)
	ShadowBands float64 // The number of distinct shadow bands (e.g., 1, 2, 3)

	// Specular
	SpecularColor Color
	Glossiness    float64 // Smoothness of the specular highlight (0-1)

	// Rim Lighting
	RimColor Color
	RimSize  float64 // How much of the edge the rim light should cover (0-1)
}

ToonShader implements cel shading with optional outlining.

func NewToonShader

func NewToonShader(matrix Matrix, lightDir, cameraPosition Vector, ambient, diffuse Color) *ToonShader

func (*ToonShader) Fragment

func (s *ToonShader) Fragment(v Vertex, fromObject *Object) Color

func (*ToonShader) Vertex

func (s *ToonShader) Vertex(v Vertex) Vertex

type Triangle

type Triangle struct {
	V1, V2, V3 Vertex
}

Triangle f

func ClipTriangle

func ClipTriangle(t *Triangle) []*Triangle

func NewTriangle

func NewTriangle(v1, v2, v3 Vertex) *Triangle

NewTriangle f

func NewTriangleForPoints

func NewTriangleForPoints(p1, p2, p3 Vector) *Triangle

NewTriangleForPoints f

func (*Triangle) Area

func (t *Triangle) Area() float64

Area f

func (*Triangle) BoundingBox

func (t *Triangle) BoundingBox() Box

BoundingBox f

func (*Triangle) FixNormals

func (t *Triangle) FixNormals()

FixNormals f

func (*Triangle) IsDegenerate

func (t *Triangle) IsDegenerate() bool

IsDegenerate f

func (*Triangle) Normal

func (t *Triangle) Normal() Vector

Normal f

func (*Triangle) ReverseWinding

func (t *Triangle) ReverseWinding()

ReverseWinding f

func (*Triangle) SetColor

func (t *Triangle) SetColor(c Color)

SetColor set the color of the vertexes

func (*Triangle) Transform

func (t *Triangle) Transform(matrix Matrix)

Transform f

type Vector

type Vector struct {
	X, Y, Z float64
}

Vector f

func InterpolateVectors

func InterpolateVectors(v1, v2, v3 Vector, b VectorW) Vector

InterpolateVectors f

func LatLngToXYZ

func LatLngToXYZ(lat, lng float64) Vector

LatLngToXYZ f

func RandomUnitVector

func RandomUnitVector() Vector

RandomUnitVector f

func V

func V(x, y, z float64) Vector

V f

func (Vector) Abs

func (a Vector) Abs() Vector

Abs f

func (Vector) Add

func (a Vector) Add(b Vector) Vector

Add f

func (Vector) AddScalar

func (a Vector) AddScalar(b float64) Vector

AddScalar f

func (Vector) Ceil

func (a Vector) Ceil() Vector

Ceil f

func (Vector) Cross

func (a Vector) Cross(b Vector) Vector

Cross f

func (Vector) Distance

func (a Vector) Distance(b Vector) float64

Distance f

func (Vector) DistanceSquared

func (a Vector) DistanceSquared(b Vector) float64

DistanceSquared f

func (Vector) Div

func (a Vector) Div(b Vector) Vector

Div f

func (Vector) DivScalar

func (a Vector) DivScalar(b float64) Vector

DivScalar f

func (Vector) Dot

func (a Vector) Dot(b Vector) float64

Dot f

func (Vector) Floor

func (a Vector) Floor() Vector

Floor f

func (Vector) IsDegenerate

func (a Vector) IsDegenerate() bool

IsDegenerate f

func (Vector) Length

func (a Vector) Length() float64

Length f

func (Vector) LengthSquared

func (a Vector) LengthSquared() float64

LengthSquared f

func (Vector) Lerp

func (a Vector) Lerp(b Vector, t float64) Vector

Lerp f

func (Vector) LerpDistance

func (a Vector) LerpDistance(b Vector, d float64) Vector

LerpDistance f

func (Vector) Less

func (a Vector) Less(b Vector) bool

Less f

func (Vector) Max

func (a Vector) Max(b Vector) Vector

Max f

func (Vector) MaxComponent

func (a Vector) MaxComponent() float64

MaxComponent f

func (Vector) Min

func (a Vector) Min(b Vector) Vector

Min f

func (Vector) MinComponent

func (a Vector) MinComponent() float64

MinComponent f

func (Vector) Mod

func (a Vector) Mod(b Vector) Vector

Mod f

func (Vector) Mul

func (a Vector) Mul(b Vector) Vector

Mul f

func (Vector) MulScalar

func (a Vector) MulScalar(b float64) Vector

MulScalar f

func (Vector) Negate

func (a Vector) Negate() Vector

Negate f

func (Vector) Normalize

func (a Vector) Normalize() Vector

Normalize f

func (Vector) Perpendicular

func (a Vector) Perpendicular() Vector

Perpendicular f

func (Vector) PowScalar

func (a Vector) PowScalar(b float64) Vector

PowScalar f

func (Vector) Reflect

func (a Vector) Reflect(n Vector) Vector

Reflect f

func (Vector) Round

func (a Vector) Round() Vector

Round f

func (Vector) RoundPlaces

func (a Vector) RoundPlaces(n int) Vector

RoundPlaces f

func (Vector) SegmentDistance

func (a Vector) SegmentDistance(v Vector, w Vector) float64

SegmentDistance f

func (Vector) Sub

func (a Vector) Sub(b Vector) Vector

Sub f

func (Vector) SubScalar

func (a Vector) SubScalar(b float64) Vector

SubScalar f

func (Vector) VectorW

func (a Vector) VectorW() VectorW

VectorW f

type VectorW

type VectorW struct {
	X, Y, Z, W float64
}

VectorW f

func Barycentric

func Barycentric(p1, p2, p3, p Vector) VectorW

Barycentric f

func InterpolateVectorWs

func InterpolateVectorWs(v1, v2, v3, b VectorW) VectorW

InterpolateVectorWs f

func (VectorW) Add

func (a VectorW) Add(b VectorW) VectorW

Add f

func (VectorW) DivScalar

func (a VectorW) DivScalar(b float64) VectorW

DivScalar f

func (VectorW) Dot

func (a VectorW) Dot(b VectorW) float64

Dot f

func (VectorW) MulScalar

func (a VectorW) MulScalar(b float64) VectorW

MulScalar f

func (VectorW) Outside

func (a VectorW) Outside() bool

Outside f

func (VectorW) Sub

func (a VectorW) Sub(b VectorW) VectorW

Sub f

func (VectorW) Vector

func (a VectorW) Vector() Vector

Vector f

type Vertex

type Vertex struct {
	Position Vector
	Normal   Vector
	Texture  Vector
	Color    Color
	Output   VectorW
}

Vertex f

func InterpolateVertexes

func InterpolateVertexes(v1, v2, v3 Vertex, b VectorW) Vertex

InterpolateVertexes f

func (Vertex) Outside

func (a Vertex) Outside() bool

Outside f

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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