gthree

package module
v0.0.0-...-41860a2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: MIT Imports: 5 Imported by: 0

README

Archived

This package has been archived. I now favor developing with syscall/js package over gopherjs due to the near complete support it has for unsafe and other features of the Go language. If you are interested in a maintained, WASM-ready version please look at https://github.com/soypat/three

three

GopherJS bindings for three.js. Still a WIP.

Keep in mind parts of these bindings are 4 years old and were not programmed by me :). I'm working hard-ish to get everything back to speed with the latest version of three.js.

Examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmbientLight

type AmbientLight struct {
	*js.Object

	Position         *Vector3 `js:"position"`
	MatrixAutoUpdate bool     `js:"matrixAutoUpdate"`
}

AmbientLight - a light that gets emitted in a specific direction.

func NewAmbientLight

func NewAmbientLight(color *Color, intensity float64) *AmbientLight

func (*AmbientLight) Add

func (obj *AmbientLight) Add(m Object3D)

func (*AmbientLight) ApplyMatrix4

func (obj *AmbientLight) ApplyMatrix4(matrix *Matrix4)

func (*AmbientLight) GetObjectById

func (obj *AmbientLight) GetObjectById(id int) *js.Object

func (*AmbientLight) Remove

func (obj *AmbientLight) Remove(m *js.Object)

func (*AmbientLight) ToJSON

func (obj *AmbientLight) ToJSON() interface{}

func (*AmbientLight) UpdateMatrix

func (obj *AmbientLight) UpdateMatrix()

type ArrowHeadParameters

type ArrowHeadParameters struct {
	HeadLength float64
	HeadWidth  float64
}

type ArrowHelper

type ArrowHelper struct {
	*js.Object

	Origin Vector3 `js:"position"`
	Line   Line    `js:"line"`
	// Quaternion Quaternion `js:"quaternion"`
	Cone Mesh `js:"cone"`
}

func NewArrowHelper

func NewArrowHelper(params *ArrowHelperParameters) *ArrowHelper

func (*ArrowHelper) Add

func (obj *ArrowHelper) Add(m Object3D)

func (*ArrowHelper) ApplyMatrix4

func (obj *ArrowHelper) ApplyMatrix4(matrix *Matrix4)

func (*ArrowHelper) GetObjectById

func (obj *ArrowHelper) GetObjectById(id int) *js.Object

func (*ArrowHelper) Remove

func (obj *ArrowHelper) Remove(m *js.Object)

func (ArrowHelper) SetColor

func (g ArrowHelper) SetColor(color Color)

func (ArrowHelper) SetDirection

func (g ArrowHelper) SetDirection(dir Vector3)

SetDirection Sets the desired direction. Must be a unit vector.

func (ArrowHelper) SetLength

func (g ArrowHelper) SetLength(length float64, head *ArrowHeadParameters)

func (*ArrowHelper) ToJSON

func (obj *ArrowHelper) ToJSON() interface{}

func (*ArrowHelper) UpdateMatrix

func (obj *ArrowHelper) UpdateMatrix()

type ArrowHelperParameters

type ArrowHelperParameters struct {
	Dir    Vector3
	Origin Vector3
	Length float64
	Color  *Color
	ArrowHeadParameters
}

type AxesHelper

type AxesHelper struct {
	*js.Object

	ID               int             `js:"id"`
	Position         *Vector3        `js:"position"`
	Rotation         *Euler          `js:"rotation"`
	Geometry         *BufferGeometry `js:"geometry"`
	Material         Material        `js:"material"`
	MatrixAutoUpdate bool            `js:"matrixAutoUpdate"`
	RenderOrder      int             `js:"renderOrder"`
	Visible          bool            `js:"visible"`
}

func NewAxesHelper

func NewAxesHelper(size float64) *AxesHelper

func (*AxesHelper) Add

func (obj *AxesHelper) Add(m Object3D)

func (*AxesHelper) ApplyMatrix4

func (obj *AxesHelper) ApplyMatrix4(matrix *Matrix4)

func (AxesHelper) Dispose

func (g AxesHelper) Dispose()

Disposes of the internally-created material and geometry used by this helper.

func (*AxesHelper) GetObjectById

func (obj *AxesHelper) GetObjectById(id int) *js.Object

func (*AxesHelper) Remove

func (obj *AxesHelper) Remove(m *js.Object)

func (AxesHelper) SetColors

func (g AxesHelper) SetColors(xaxis, yaxis, zaxis *Color) AxesHelper

func (*AxesHelper) ToJSON

func (obj *AxesHelper) ToJSON() interface{}

func (*AxesHelper) UpdateMatrix

func (obj *AxesHelper) UpdateMatrix()

type BasicGeometry

type BasicGeometry struct {
	*js.Object
}

BasicGeometry is the basic primitive geometry class. It's a counterpart of three.js' core/Geometry object.

DEPRECATED: Not in documentation at https://threejs.org/docs/index.html.

func NewBasicGeometry

func NewBasicGeometry(params BasicGeometryParams) BasicGeometry

NewBasicGeometry creates a new Basic Geometry.

func (*BasicGeometry) AddFace

func (bg *BasicGeometry) AddFace(a, b, c int)

AddFace adds new Face3 (triangle) to the geometry, specified by its vertice indicies.

func (*BasicGeometry) AddVertex

func (bg *BasicGeometry) AddVertex(x, y, z float64)

AddVertex adds new vertex to the geometry, specified by its coordinates.

func (*BasicGeometry) AddVertices

func (bg *BasicGeometry) AddVertices(v ...Vector3)

AddVertices adds new vertices to the geometry.

func (BasicGeometry) ApplyMatrix4

func (g BasicGeometry) ApplyMatrix4(matrix *Matrix4)

func (BasicGeometry) Center

func (g BasicGeometry) Center()

func (BasicGeometry) ComputeBoundingBox

func (g BasicGeometry) ComputeBoundingBox()

func (BasicGeometry) ComputeBoundingSphere

func (g BasicGeometry) ComputeBoundingSphere()

func (BasicGeometry) ComputeFaceNormals

func (g BasicGeometry) ComputeFaceNormals()

func (BasicGeometry) ComputeFlatVertexNormals

func (g BasicGeometry) ComputeFlatVertexNormals()

func (BasicGeometry) ComputeLineDistances

func (g BasicGeometry) ComputeLineDistances()

func (BasicGeometry) ComputeMorphNormals

func (g BasicGeometry) ComputeMorphNormals()

func (BasicGeometry) ComputeVertexNormals

func (g BasicGeometry) ComputeVertexNormals(areaWeighted bool)

func (BasicGeometry) Copy

func (g BasicGeometry) Copy(source Object3D, recursive bool) *BasicGeometry

func (BasicGeometry) Dispose

func (g BasicGeometry) Dispose()

func (BasicGeometry) FromBufferGeometry

func (g BasicGeometry) FromBufferGeometry(geometry Geometry)

func (BasicGeometry) LookAt

func (g BasicGeometry) LookAt()

func (BasicGeometry) Merge

func (g BasicGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (BasicGeometry) MergeMesh

func (g BasicGeometry) MergeMesh(mesh Mesh)

func (BasicGeometry) MergeVertices

func (g BasicGeometry) MergeVertices()

func (BasicGeometry) Normalize

func (g BasicGeometry) Normalize() BasicGeometry

func (BasicGeometry) RotateX

func (g BasicGeometry) RotateX()

func (BasicGeometry) RotateY

func (g BasicGeometry) RotateY()

func (BasicGeometry) RotateZ

func (g BasicGeometry) RotateZ()

func (BasicGeometry) Scale

func (g BasicGeometry) Scale()

func (BasicGeometry) SortFacesByMaterialIndex

func (g BasicGeometry) SortFacesByMaterialIndex()

func (BasicGeometry) ToJSON

func (g BasicGeometry) ToJSON() interface{}

func (BasicGeometry) Translate

func (g BasicGeometry) Translate()

type BasicGeometryParams

type BasicGeometryParams struct {
}

type BoxGeometry

type BoxGeometry struct {
	*js.Object

	Width          float64 `js:"width"`
	Height         float64 `js:"height"`
	Depth          float64 `js:"depth"`
	WidthSegments  int     `js:"widthSegments"`
	HeightSegments int     `js:"heightSegments"`
	DepthSegments  int     `js:"depthSegments"`
}

BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.

func NewBoxGeometry

func NewBoxGeometry(params *BoxGeometryParameters) BoxGeometry

NewBoxGeometry creates a new BoxGeometry.

func (BoxGeometry) ApplyMatrix4

func (g BoxGeometry) ApplyMatrix4(matrix *Matrix4)

func (BoxGeometry) Center

func (g BoxGeometry) Center()

func (BoxGeometry) ComputeBoundingBox

func (g BoxGeometry) ComputeBoundingBox()

func (BoxGeometry) ComputeBoundingSphere

func (g BoxGeometry) ComputeBoundingSphere()

func (BoxGeometry) ComputeFaceNormals

func (g BoxGeometry) ComputeFaceNormals()

func (BoxGeometry) ComputeFlatVertexNormals

func (g BoxGeometry) ComputeFlatVertexNormals()

func (BoxGeometry) ComputeLineDistances

func (g BoxGeometry) ComputeLineDistances()

func (BoxGeometry) ComputeMorphNormals

func (g BoxGeometry) ComputeMorphNormals()

func (BoxGeometry) ComputeVertexNormals

func (g BoxGeometry) ComputeVertexNormals(areaWeighted bool)

func (BoxGeometry) Copy

func (g BoxGeometry) Copy(source Object3D, recursive bool) *BoxGeometry

func (BoxGeometry) Dispose

func (g BoxGeometry) Dispose()

func (BoxGeometry) FromBufferGeometry

func (g BoxGeometry) FromBufferGeometry(geometry Geometry)

func (BoxGeometry) LookAt

func (g BoxGeometry) LookAt()

func (BoxGeometry) Merge

func (g BoxGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (BoxGeometry) MergeMesh

func (g BoxGeometry) MergeMesh(mesh Mesh)

func (BoxGeometry) MergeVertices

func (g BoxGeometry) MergeVertices()

func (BoxGeometry) Normalize

func (g BoxGeometry) Normalize() BoxGeometry

func (BoxGeometry) RotateX

func (g BoxGeometry) RotateX()

func (BoxGeometry) RotateY

func (g BoxGeometry) RotateY()

func (BoxGeometry) RotateZ

func (g BoxGeometry) RotateZ()

func (BoxGeometry) Scale

func (g BoxGeometry) Scale()

func (BoxGeometry) SortFacesByMaterialIndex

func (g BoxGeometry) SortFacesByMaterialIndex()

func (BoxGeometry) ToJSON

func (g BoxGeometry) ToJSON() interface{}

func (BoxGeometry) Translate

func (g BoxGeometry) Translate()

type BoxGeometryParameters

type BoxGeometryParameters struct {
	Width          float64
	Height         float64
	Depth          float64
	WidthSegments  int
	HeightSegments int
	DepthSegments  int
}

BoxGeometryParameters .

type BufferAttribute

type BufferAttribute struct {
	*js.Object

	Array       []int `js:"array"`
	Count       int   `js:"count"`
	IsDynamic   bool  `js:"dynamic"`
	ItemSize    int   `js:"itemSize"`
	NeedsUpdate bool  `js:"needsUpdate"`
	Normalized  bool  `js:"normalized"`
}

BufferAttribute stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes) associated with a BufferGeometry, which allows for more efficient passing of data to the GPU.

func NewBufferAttribute

func NewBufferAttribute(data []float32, itemSize int) *BufferAttribute

NewBufferAttribute creates a new BufferAttribute

func (BufferAttribute) GetX

func (b BufferAttribute) GetX(i int) float64

func (BufferAttribute) SetXYZ

func (b BufferAttribute) SetXYZ(i int, x, y, z float64)

SetXYZ sets the x, y and z components of the vector at the given index.

type BufferGeometry

type BufferGeometry struct {
	*js.Object

	Vertices   []Vector3        `js:"vertices"`
	Attributes *BufferAttribute `js:"attributes"`
}

BufferGeometry is an efficient representation of mesh, line, or point geometry. Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU. It's a counterpart of three.js' core/BufferGeometry object.

func NewBufferGeometry

func NewBufferGeometry() *BufferGeometry

NewBufferGeometry creates a new Buffer Geometry.

func (*BufferGeometry) AddFace

func (bg *BufferGeometry) AddFace(a, b, c int)

AddFace adds new Face3 (triangle) to the geometry, specified by its vertice indicies.

func (BufferGeometry) ApplyMatrix4

func (g BufferGeometry) ApplyMatrix4(matrix *Matrix4)

func (BufferGeometry) Center

func (g BufferGeometry) Center()

func (BufferGeometry) ComputeBoundingBox

func (g BufferGeometry) ComputeBoundingBox()

func (BufferGeometry) ComputeBoundingSphere

func (g BufferGeometry) ComputeBoundingSphere()

func (BufferGeometry) ComputeFaceNormals

func (g BufferGeometry) ComputeFaceNormals()

func (BufferGeometry) ComputeFlatVertexNormals

func (g BufferGeometry) ComputeFlatVertexNormals()

func (BufferGeometry) ComputeLineDistances

func (g BufferGeometry) ComputeLineDistances()

func (BufferGeometry) ComputeMorphNormals

func (g BufferGeometry) ComputeMorphNormals()

func (BufferGeometry) ComputeVertexNormals

func (g BufferGeometry) ComputeVertexNormals(areaWeighted bool)

func (BufferGeometry) Copy

func (g BufferGeometry) Copy(source Object3D, recursive bool) *BufferGeometry

func (BufferGeometry) Dispose

func (g BufferGeometry) Dispose()

func (BufferGeometry) FromBufferGeometry

func (g BufferGeometry) FromBufferGeometry(geometry Geometry)

func (*BufferGeometry) GetAttribute

func (bg *BufferGeometry) GetAttribute(name string) *BufferAttribute

GetAttribute retruns BufferGeometry's attribute by name (should be added first by AddAttribute call, see threejs docs for explanations.

func (BufferGeometry) LookAt

func (g BufferGeometry) LookAt()

func (BufferGeometry) Merge

func (g BufferGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (BufferGeometry) MergeMesh

func (g BufferGeometry) MergeMesh(mesh Mesh)

func (BufferGeometry) MergeVertices

func (g BufferGeometry) MergeVertices()

func (BufferGeometry) Normalize

func (g BufferGeometry) Normalize() BufferGeometry

func (BufferGeometry) RotateX

func (g BufferGeometry) RotateX()

func (BufferGeometry) RotateY

func (g BufferGeometry) RotateY()

func (BufferGeometry) RotateZ

func (g BufferGeometry) RotateZ()

func (BufferGeometry) Scale

func (g BufferGeometry) Scale()

func (*BufferGeometry) SetAttribute

func (bg *BufferGeometry) SetAttribute(name string, attr *BufferAttribute)

AddAttribute adds a new attribute like 'position' to the BufferGeometry.

func (BufferGeometry) SortFacesByMaterialIndex

func (g BufferGeometry) SortFacesByMaterialIndex()

func (BufferGeometry) ToJSON

func (g BufferGeometry) ToJSON() interface{}

func (BufferGeometry) Translate

func (g BufferGeometry) Translate()

type Camera

type Camera interface {
	// Returns a Vector3 representing the world space direction
	// in which the camera is looking. (Note: A camera looks down its local, negative z-axis).
	GetWorldDirection(target Vector3) Vector3
	// contains filtered or unexported methods
}

type CircleGeometry

type CircleGeometry struct {
	*js.Object

	Radius      float64 `js:"radius"`
	Segments    int     `js:"segments"`
	ThetaStart  float64 `js:"thetaStart"`
	ThetaLength float64 `js:"thetaLength"`
}

func NewCircleGeometry

func NewCircleGeometry(params CircleGeometryParameters) CircleGeometry

NewBoxGeometry creates a new BoxGeometry.

func (CircleGeometry) ApplyMatrix4

func (g CircleGeometry) ApplyMatrix4(matrix *Matrix4)

func (CircleGeometry) Center

func (g CircleGeometry) Center()

func (CircleGeometry) ComputeBoundingBox

func (g CircleGeometry) ComputeBoundingBox()

func (CircleGeometry) ComputeBoundingSphere

func (g CircleGeometry) ComputeBoundingSphere()

func (CircleGeometry) ComputeFaceNormals

func (g CircleGeometry) ComputeFaceNormals()

func (CircleGeometry) ComputeFlatVertexNormals

func (g CircleGeometry) ComputeFlatVertexNormals()

func (CircleGeometry) ComputeLineDistances

func (g CircleGeometry) ComputeLineDistances()

func (CircleGeometry) ComputeMorphNormals

func (g CircleGeometry) ComputeMorphNormals()

func (CircleGeometry) ComputeVertexNormals

func (g CircleGeometry) ComputeVertexNormals(areaWeighted bool)

func (CircleGeometry) Copy

func (g CircleGeometry) Copy(source Object3D, recursive bool) *CircleGeometry

func (CircleGeometry) Dispose

func (g CircleGeometry) Dispose()

func (CircleGeometry) FromBufferGeometry

func (g CircleGeometry) FromBufferGeometry(geometry Geometry)

func (CircleGeometry) LookAt

func (g CircleGeometry) LookAt()

func (CircleGeometry) Merge

func (g CircleGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (CircleGeometry) MergeMesh

func (g CircleGeometry) MergeMesh(mesh Mesh)

func (CircleGeometry) MergeVertices

func (g CircleGeometry) MergeVertices()

func (CircleGeometry) Normalize

func (g CircleGeometry) Normalize() CircleGeometry

func (CircleGeometry) RotateX

func (g CircleGeometry) RotateX()

func (CircleGeometry) RotateY

func (g CircleGeometry) RotateY()

func (CircleGeometry) RotateZ

func (g CircleGeometry) RotateZ()

func (CircleGeometry) Scale

func (g CircleGeometry) Scale()

func (CircleGeometry) SortFacesByMaterialIndex

func (g CircleGeometry) SortFacesByMaterialIndex()

func (CircleGeometry) ToJSON

func (g CircleGeometry) ToJSON() interface{}

func (CircleGeometry) Translate

func (g CircleGeometry) Translate()

type CircleGeometryParameters

type CircleGeometryParameters struct {
	Radius      float64
	Segments    int
	ThetaStart  float64
	ThetaLength float64
}

type Color

type Color struct {
	*js.Object
}

Color - represents a color.

func NewColor

func NewColor(color string) *Color

NewColor returns a new three.Color for the given string. It accepts different string color formats:

three.NewColor("rgb(255, 0, 0)")
three.NewColor("rgb(100%, 0%, 0%)")
three.NewColor("skyblue") // X11 color names (without CamelCase), see three.js source
three.NewColor("hsl(0, 100%, 50%)")

See https://threejs.org/docs/#api/en/math/Color for additional details.

func NewColorHex

func NewColorHex(i int64) *Color

NewColorHex returns a new three.Color for the given hex integer value. Example:

three.NewColorHex(0xff0000)

func NewColorRGB

func NewColorRGB(r, g, b uint8) *Color

NewColorRGB returns a new three.Color for the given RGB values in 0..255 range.

func NewColorRGBFloat

func NewColorRGBFloat(r, g, b float64) *Color

NewColorRGBFloat returns a new three.Color for the given RGB values in 0.0..0.1 range.

type ConeGeometry

type ConeGeometry struct {
	*js.Object

	Radius         float64 `js:"radius"`
	Height         float64 `js:"height"`
	RadialSegments int     `js:"radialSegments"`
	HeightSegments int     `js:"heightSegments"`
	OpenEnded      bool    `js:"openEnded"`
	ThetaStart     float64 `js:"thetaStart"`
	ThetaLength    float64 `js:"thetaLength"`
}

ConeGeometry a class for generating Cone geometries.

func NewConeGeometry

func NewConeGeometry(params *ConeGeometryParameters) ConeGeometry

NewConeGeometry creates a new BoxGeometry. Set ThetaLength to NaN to create empty geometry.

func (ConeGeometry) ApplyMatrix4

func (g ConeGeometry) ApplyMatrix4(matrix *Matrix4)

func (ConeGeometry) Center

func (g ConeGeometry) Center()

func (ConeGeometry) ComputeBoundingBox

func (g ConeGeometry) ComputeBoundingBox()

func (ConeGeometry) ComputeBoundingSphere

func (g ConeGeometry) ComputeBoundingSphere()

func (ConeGeometry) ComputeFaceNormals

func (g ConeGeometry) ComputeFaceNormals()

func (ConeGeometry) ComputeFlatVertexNormals

func (g ConeGeometry) ComputeFlatVertexNormals()

func (ConeGeometry) ComputeLineDistances

func (g ConeGeometry) ComputeLineDistances()

func (ConeGeometry) ComputeMorphNormals

func (g ConeGeometry) ComputeMorphNormals()

func (ConeGeometry) ComputeVertexNormals

func (g ConeGeometry) ComputeVertexNormals(areaWeighted bool)

func (ConeGeometry) Copy

func (g ConeGeometry) Copy(source Object3D, recursive bool) *ConeGeometry

func (ConeGeometry) Dispose

func (g ConeGeometry) Dispose()

func (ConeGeometry) FromBufferGeometry

func (g ConeGeometry) FromBufferGeometry(geometry Geometry)

func (ConeGeometry) LookAt

func (g ConeGeometry) LookAt()

func (ConeGeometry) Merge

func (g ConeGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (ConeGeometry) MergeMesh

func (g ConeGeometry) MergeMesh(mesh Mesh)

func (ConeGeometry) MergeVertices

func (g ConeGeometry) MergeVertices()

func (ConeGeometry) Normalize

func (g ConeGeometry) Normalize() ConeGeometry

func (ConeGeometry) RotateX

func (g ConeGeometry) RotateX()

func (ConeGeometry) RotateY

func (g ConeGeometry) RotateY()

func (ConeGeometry) RotateZ

func (g ConeGeometry) RotateZ()

func (ConeGeometry) Scale

func (g ConeGeometry) Scale()

func (ConeGeometry) SortFacesByMaterialIndex

func (g ConeGeometry) SortFacesByMaterialIndex()

func (ConeGeometry) ToJSON

func (g ConeGeometry) ToJSON() interface{}

func (ConeGeometry) Translate

func (g ConeGeometry) Translate()

type ConeGeometryParameters

type ConeGeometryParameters struct {
	// Radius of the cone base.
	Radius float64
	// Height of the Cone. Default is 1.
	Height float64
	// Number of segmented faces around the circumference of the Cone. Default is 8
	RadialSegments int
	// Number of rows of faces along the height of the Cone. Default is 1.
	HeightSegments int
	// A Boolean indicating whether the ends of the Cone are open or capped. Default is false, meaning capped.
	OpenEnded bool
	// Start angle for first segment, default = 0 (three o'clock position).
	ThetaStart float64
	//  The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete Cone.
	ThetaLength float64
}

ConeGeometryParameters .

type CylinderGeometry

type CylinderGeometry struct {
	*js.Object

	RadiusTop      float64 `js:"radiusTop"`
	RadiusBottom   float64 `js:"radiusBottom"`
	Height         float64 `js:"height"`
	RadialSegments int     `js:"radialSegments"`
	HeightSegments int     `js:"heightSegments"`
	OpenEnded      bool    `js:"openEnded"`
	ThetaStart     float64 `js:"thetaStart"`
	ThetaLength    float64 `js:"thetaLength"`
}

CylinderGeometry a class for generating cylinder geometries.

func NewCylinderGeometry

func NewCylinderGeometry(params *CylinderGeometryParameters) CylinderGeometry

NewCylinderGeometry creates a new BoxGeometry. Set ThetaLength to NaN to create empty geometry.

func (CylinderGeometry) ApplyMatrix4

func (g CylinderGeometry) ApplyMatrix4(matrix *Matrix4)

func (CylinderGeometry) Center

func (g CylinderGeometry) Center()

func (CylinderGeometry) ComputeBoundingBox

func (g CylinderGeometry) ComputeBoundingBox()

func (CylinderGeometry) ComputeBoundingSphere

func (g CylinderGeometry) ComputeBoundingSphere()

func (CylinderGeometry) ComputeFaceNormals

func (g CylinderGeometry) ComputeFaceNormals()

func (CylinderGeometry) ComputeFlatVertexNormals

func (g CylinderGeometry) ComputeFlatVertexNormals()

func (CylinderGeometry) ComputeLineDistances

func (g CylinderGeometry) ComputeLineDistances()

func (CylinderGeometry) ComputeMorphNormals

func (g CylinderGeometry) ComputeMorphNormals()

func (CylinderGeometry) ComputeVertexNormals

func (g CylinderGeometry) ComputeVertexNormals(areaWeighted bool)

func (CylinderGeometry) Copy

func (g CylinderGeometry) Copy(source Object3D, recursive bool) *CylinderGeometry

func (CylinderGeometry) Dispose

func (g CylinderGeometry) Dispose()

func (CylinderGeometry) FromBufferGeometry

func (g CylinderGeometry) FromBufferGeometry(geometry Geometry)

func (CylinderGeometry) LookAt

func (g CylinderGeometry) LookAt()

func (CylinderGeometry) Merge

func (g CylinderGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (CylinderGeometry) MergeMesh

func (g CylinderGeometry) MergeMesh(mesh Mesh)

func (CylinderGeometry) MergeVertices

func (g CylinderGeometry) MergeVertices()

func (CylinderGeometry) Normalize

func (g CylinderGeometry) Normalize() CylinderGeometry

func (CylinderGeometry) RotateX

func (g CylinderGeometry) RotateX()

func (CylinderGeometry) RotateY

func (g CylinderGeometry) RotateY()

func (CylinderGeometry) RotateZ

func (g CylinderGeometry) RotateZ()

func (CylinderGeometry) Scale

func (g CylinderGeometry) Scale()

func (CylinderGeometry) SortFacesByMaterialIndex

func (g CylinderGeometry) SortFacesByMaterialIndex()

func (CylinderGeometry) ToJSON

func (g CylinderGeometry) ToJSON() interface{}

func (CylinderGeometry) Translate

func (g CylinderGeometry) Translate()

type CylinderGeometryParameters

type CylinderGeometryParameters struct {
	RadiusTop float64
	// Radius of the cylinder at the bottom. Default is 1.
	RadiusBottom float64
	// Height of the cylinder. Default is 1.
	Height float64
	// Number of segmented faces around the circumference of the cylinder. Default is 8
	RadialSegments int
	// Number of rows of faces along the height of the cylinder. Default is 1.
	HeightSegments int
	// A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.
	OpenEnded bool
	// Start angle for first segment, default = 0 (three o'clock position).
	ThetaStart float64
	//  The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder.
	ThetaLength float64
}

CylinderGeometryParameters .

type DirectionalLight

type DirectionalLight struct {
	*js.Object

	Position         *Vector3 `js:"position"`
	MatrixAutoUpdate bool     `js:"matrixAutoUpdate"`
}

DirectionalLight - a light that gets emitted in a specific direction.

func NewDirectionalLight

func NewDirectionalLight(color *Color, intensity float64) *DirectionalLight

func (*DirectionalLight) Add

func (obj *DirectionalLight) Add(m Object3D)

func (*DirectionalLight) ApplyMatrix4

func (obj *DirectionalLight) ApplyMatrix4(matrix *Matrix4)

func (*DirectionalLight) GetObjectById

func (obj *DirectionalLight) GetObjectById(id int) *js.Object

func (*DirectionalLight) Remove

func (obj *DirectionalLight) Remove(m *js.Object)

func (*DirectionalLight) ToJSON

func (obj *DirectionalLight) ToJSON() interface{}

func (*DirectionalLight) UpdateMatrix

func (obj *DirectionalLight) UpdateMatrix()

type Euler

type Euler struct {
	*js.Object

	X     float64 `js:"x"`
	Y     float64 `js:"y"`
	Z     float64 `js:"z"`
	Order string  `js:"order"`
}

Euler angles describe a rotational transformation by rotating an object on its various axes in specified amounts per axis, and a specified axis order.

func NewEuler

func NewEuler(x, y, z float64, order string) Euler

Three.js uses intrinsic Tait-Bryan angles. This means that rotations are performed with respect to the local coordinate system. That is, for order 'XYZ', the rotation is first around the local-X axis (which is the same as the world-X axis), then around local-Y (which may now be different from the world Y-axis), then local-Z (which may be different from the world Z-axis).

func (*Euler) Copy

func (e *Euler) Copy(src Euler)

Copy copies value of euler to receiver.

func (Euler) Reorder

func (e Euler) Reorder(newOrder string)

func (*Euler) Set

func (e *Euler) Set(x, y, z float64, order string)

func (*Euler) SetFromQuaternion

func (e *Euler) SetFromQuaternion(q Quaternion, order string)

type Face3

type Face3 struct {
	*js.Object
}

Face3 is a triangular face used in Geometry. These are created automatically for all standard geometry types, however if you are building a custom geometry you will have to create them manually.

func NewFace3

func NewFace3(a, b, c float64) Face3

NewFace3 creates new Face3 object with defaults for normal, color and material.

type Fog

type Fog struct {
	*js.Object

	Color string  `js:"color"`
	Near  float64 `js:"near"`
	Far   float64 `js:"far"`
}

func NewFog

func NewFog(color Color, near float64, far float64) Fog

func (*Fog) Add

func (obj *Fog) Add(m Object3D)

func (*Fog) ApplyMatrix4

func (obj *Fog) ApplyMatrix4(matrix *Matrix4)

func (*Fog) GetObjectById

func (obj *Fog) GetObjectById(id int) *js.Object

func (*Fog) Remove

func (obj *Fog) Remove(m *js.Object)

func (*Fog) ToJSON

func (obj *Fog) ToJSON() interface{}

func (*Fog) UpdateMatrix

func (obj *Fog) UpdateMatrix()

type Geometry

type Geometry interface {
	ApplyMatrix4(matrix *Matrix4)
	RotateX()
	RotateY()
	RotateZ()
	Translate()
	Scale()
	LookAt()
	FromBufferGeometry(geometry Geometry)
	Center()
	// Normalize()
	ComputeFaceNormals()
	ComputeVertexNormals(areaWeighted bool)
	ComputeFlatVertexNormals()
	ComputeMorphNormals()
	ComputeLineDistances()
	ComputeBoundingBox()
	ComputeBoundingSphere()
	Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)
	MergeMesh(mesh Mesh)
	MergeVertices()
	SortFacesByMaterialIndex()
	ToJSON() interface{}
	// Clone()
	// Copy(source Object3D)
	Dispose()
	// contains filtered or unexported methods
}

type Group

type Group struct {
	*js.Object

	ID               int          `js:"id"`
	Position         *Vector3     `js:"position"`
	Rotation         *Euler       `js:"rotation"`
	Children         []*js.Object `js:"children"`
	MatrixAutoUpdate bool         `js:"matrixAutoUpdate"`
	Visible          bool         `js:"visible"`
}

Group is almost identical to an Object3D. Its purpose is to make working with groups of objects syntactically clearer.

func NewGroup

func NewGroup() *Group

func (*Group) Add

func (obj *Group) Add(m Object3D)

func (*Group) ApplyMatrix4

func (obj *Group) ApplyMatrix4(matrix *Matrix4)

func (*Group) GetObjectById

func (obj *Group) GetObjectById(id int) *js.Object

func (*Group) Remove

func (obj *Group) Remove(m *js.Object)

func (*Group) ToJSON

func (obj *Group) ToJSON() interface{}

func (*Group) UpdateMatrix

func (obj *Group) UpdateMatrix()

type Image

type Image struct {
	*js.Object
}

type Line

type Line struct {
	*js.Object

	ID               int             `js:"id"`
	Position         *Vector3        `js:"position"`
	Rotation         *Euler          `js:"rotation"`
	Geometry         *BufferGeometry `js:"geometry"`
	Material         Material        `js:"material"`
	MatrixAutoUpdate bool            `js:"matrixAutoUpdate"`
	RenderOrder      int             `js:"renderOrder"`
}

Line a continuous line.

func NewLine

func NewLine(geom Geometry, material Material) *Line

NewLine creates a new material. If Material is nil, three.js will assign a randomized material to the line o_O.

func (*Line) Add

func (obj *Line) Add(m Object3D)

func (*Line) ApplyMatrix4

func (obj *Line) ApplyMatrix4(matrix *Matrix4)

func (*Line) GetObjectById

func (obj *Line) GetObjectById(id int) *js.Object

func (*Line) Remove

func (obj *Line) Remove(m *js.Object)

func (*Line) ToJSON

func (obj *Line) ToJSON() interface{}

func (*Line) UpdateMatrix

func (obj *Line) UpdateMatrix()

type LineBasicMaterial

type LineBasicMaterial struct {
	*js.Object
}

func NewLineBasicMaterial

func NewLineBasicMaterial(params *MaterialParameters) *LineBasicMaterial

func (LineBasicMaterial) Clone

func (m LineBasicMaterial) Clone()

func (LineBasicMaterial) Copy

func (m LineBasicMaterial) Copy(source Object3D)

func (LineBasicMaterial) Dispose

func (m LineBasicMaterial) Dispose()

func (LineBasicMaterial) OnBeforeCompile

func (m LineBasicMaterial) OnBeforeCompile()

func (LineBasicMaterial) SetValues

func (m LineBasicMaterial) SetValues(values MaterialParameters)

func (LineBasicMaterial) ToJSON

func (m LineBasicMaterial) ToJSON(meta interface{}) interface{}

type LineSegments

type LineSegments struct {
	*js.Object

	ID               int             `js:"id"`
	Position         *Vector3        `js:"position"`
	Rotation         *Euler          `js:"rotation"`
	Geometry         *BufferGeometry `js:"geometry"`
	Material         Material        `js:"material"`
	MatrixAutoUpdate bool            `js:"matrixAutoUpdate"`
	RenderOrder      int             `js:"renderOrder"`
	Visible          bool            `js:"visible"`
}

LineSegments represents series of lines drawn between pairs of vertices.

func NewLineSegments

func NewLineSegments(geom Geometry, material Material) *LineSegments

NewLineSegments creates new line segments

func (*LineSegments) Add

func (obj *LineSegments) Add(m Object3D)

func (*LineSegments) ApplyMatrix4

func (obj *LineSegments) ApplyMatrix4(matrix *Matrix4)

func (*LineSegments) GetObjectById

func (obj *LineSegments) GetObjectById(id int) *js.Object

func (*LineSegments) Remove

func (obj *LineSegments) Remove(m *js.Object)

func (*LineSegments) ToJSON

func (obj *LineSegments) ToJSON() interface{}

func (*LineSegments) UpdateMatrix

func (obj *LineSegments) UpdateMatrix()

type MappingMode

type MappingMode int
const (
	UVMapping MappingMode = iota + 300
	CubeReflectionMapping
	CubeRefractionMapping
	EquirectangularReflectionMapping
	EquirectangularRefractionMapping

	CubeUVReflectionMapping MappingMode = 306
	CubeUVRefractionMapping MappingMode = 307
)

These define the texture's mapping mode. UVMapping is the default, and maps the texture using the mesh's UV coordinates. The rest define environment mapping types.

type Material

type Material interface {
	OnBeforeCompile()
	SetValues(values MaterialParameters)
	ToJSON(meta interface{}) interface{}
	Clone()
	Copy(source Object3D)
	Dispose()
	// contains filtered or unexported methods
}

type MaterialParameters

type MaterialParameters struct {
	*js.Object

	Color       *Color   `js:"color"`
	Shading     Shading  `js:"shading"` // THREE.MeshLambertMaterial: .shading has been removed. Use the boolean .flatShading instead.
	FlatShading bool     `js:"flatShading"`
	Side        Side     `js:"side"`
	Transparent bool     `js:"transparent"`
	Opacity     float64  `js:"opacity"`
	Map         *Texture `js:"map"`
	LineWidth   float64  `js:"linewidth"`

	// Points
	Size float64 `js:"size"`

	BumpMap     *Texture `js:"bumpMap"`
	BumpScale   float64  `js:"bumpScale"`
	SpecularMap *Texture `js:"specularMap"`
	Specular    *Color   `js:"specular"`

	Clearcoat             float64  `js:"clearcoat"`
	ClearcoatMap          *Texture `js:"clearcoatMap"`
	ClearcoatNormalMap    *Texture `js:"clearcoatNormalMap"`
	ClearcoatNormalScale  Vector2  `js:"clearcoatNormalScale"`
	ClearcoatRoughness    float64  `js:"clearcoatRoughness"`
	ClearcoatRoughnessMap *Texture `js:"clearcoatRoughnessMap"`
	// Index of refraction
	IOR               float64  `js:"ior"`
	Reflectivity      float64  `js:"reflectivity"`
	Sheen             float64  `js:"sheen"`
	SheenRoughness    float64  `js:"sheenRoughness"`
	SheenRoughnessMap *Texture `js:"sheenRoughnessMap"`
	SheenColor        *Color   `js:"sheenColor"`
	SheenColorMap     *Texture `js:"sheenColorMap"`
	Transmission      float64  `js:"transmission"`
	TransmissionMap   *Texture `js:"transmissionMap"`
}

func NewMaterialParameters

func NewMaterialParameters() *MaterialParameters

type Matrix4

type Matrix4 struct {
	*js.Object

	// A column-major list of matrix values.
	A *js.Object `js:"A"`
}

Matrix4 - represents a Matrix4.

func NewMatrix4

func NewMatrix4() *Matrix4

func (*Matrix4) Compose

func (m *Matrix4) Compose(position Vector3, q Quaternion, scale Vector3) (this *Matrix4)

Sets this matrix to the transformation composed of position, quaternion and scale.

func (*Matrix4) Decompose

func (m *Matrix4) Decompose(position Vector3, q Quaternion, scale Vector3)

Decomposes this matrix into its position, quaternion and scale components. Note: Not all matrices are decomposable in this way. For example, if an object has a non-uniformly scaled parent, then the object's world matrix may not be decomposable, and this method may not be appropriate.

func (*Matrix4) ExtractBasis

func (m *Matrix4) ExtractBasis(x, y, z Vector3) (this *Matrix4)

Extracts the basis of this matrix into the three axis vectors provided. If this matrix is:

a, b, c, d,
e, f, g, h,
i, j, k, l,
m, n, o, p

then x,y,z will be set:

x = (a, e, i)
y = (b, f, j)
z = (c, g, k)

func (*Matrix4) ExtractRotation

func (m *Matrix4) ExtractRotation(a *Matrix4) (this *Matrix4)

func (*Matrix4) Identity

func (m *Matrix4) Identity() (this *Matrix4)

Resets this matrix to the identity matrix.

func (*Matrix4) Invert

func (m *Matrix4) Invert() (this *Matrix4)

Inverts this matrix, using the analytic method. You can not invert with a determinant of zero. If you attempt this, the method produces a zero matrix instead.

func (*Matrix4) MakeBasis

func (m *Matrix4) MakeBasis(x, y, z Vector3) (this *Matrix4)

Set this to the basis matrix consisting of the three provided basis vectors:

xAxis.x, yAxis.x, zAxis.x, 0,
xAxis.y, yAxis.y, zAxis.y, 0,
xAxis.z, yAxis.z, zAxis.z, 0,
0,       0,       0,       1

func (*Matrix4) MakeRotationFromQuaternion

func (m *Matrix4) MakeRotationFromQuaternion(q Quaternion) (this *Matrix4)

Sets the rotation component of this matrix to the rotation specified by q, as outlined here. The rest of the matrix is set to the identity. So, given q = w + xi + yj + zk, the resulting matrix will be:

1-2y²-2z²    2xy-2zw    2xz+2yw    0
2xy+2zw      1-2x²-2z²  2yz-2xw    0
2xz-2yw      2yz+2xw    1-2x²-2y²  0
0            0          0          1

func (*Matrix4) MakeTranslation

func (m *Matrix4) MakeTranslation(x, y, z float64) (this *Matrix4)

Sets this matrix as a translation transform:

1, 0, 0, x,
0, 1, 0, y,
0, 0, 1, z,
0, 0, 0, 1

type Mesh

type Mesh struct {
	*js.Object

	ID               int      `js:"id"`
	Position         *Vector3 `js:"position"`
	Rotation         *Euler   `js:"rotation"`
	Geometry         Geometry `js:"geometry"`
	Material         Material `js:"material"`
	MatrixAutoUpdate bool     `js:"matrixAutoUpdate"`
}

func NewMesh

func NewMesh(geometry Geometry, material Material) *Mesh

func (*Mesh) Add

func (obj *Mesh) Add(m Object3D)

func (*Mesh) ApplyMatrix4

func (obj *Mesh) ApplyMatrix4(matrix *Matrix4)

func (*Mesh) GetObjectById

func (obj *Mesh) GetObjectById(id int) *js.Object

func (*Mesh) Remove

func (obj *Mesh) Remove(m *js.Object)

func (Mesh) RotateX

func (m Mesh) RotateX()

func (Mesh) SetRotationFromAxisAngle

func (m Mesh) SetRotationFromAxisAngle(axis string, angle float64)

func (*Mesh) ToJSON

func (obj *Mesh) ToJSON() interface{}

func (*Mesh) UpdateMatrix

func (obj *Mesh) UpdateMatrix()

type MeshBasicMaterial

type MeshBasicMaterial struct {
	*js.Object
}

func NewMeshBasicMaterial

func NewMeshBasicMaterial(params *MaterialParameters) *MeshBasicMaterial

func NewMeshPhysicalMaterial

func NewMeshPhysicalMaterial(params *MaterialParameters) *MeshBasicMaterial

func (MeshBasicMaterial) Clone

func (m MeshBasicMaterial) Clone()

func (MeshBasicMaterial) Copy

func (m MeshBasicMaterial) Copy(source Object3D)

func (MeshBasicMaterial) Dispose

func (m MeshBasicMaterial) Dispose()

func (MeshBasicMaterial) OnBeforeCompile

func (m MeshBasicMaterial) OnBeforeCompile()

func (MeshBasicMaterial) SetValues

func (m MeshBasicMaterial) SetValues(values MaterialParameters)

func (MeshBasicMaterial) ToJSON

func (m MeshBasicMaterial) ToJSON(meta interface{}) interface{}

type MeshLambertMaterial

type MeshLambertMaterial struct {
	*js.Object
}

func NewMeshLambertMaterial

func NewMeshLambertMaterial(params *MaterialParameters) *MeshLambertMaterial

func (MeshLambertMaterial) Clone

func (m MeshLambertMaterial) Clone()

func (MeshLambertMaterial) Copy

func (m MeshLambertMaterial) Copy(source Object3D)

func (MeshLambertMaterial) Dispose

func (m MeshLambertMaterial) Dispose()

func (MeshLambertMaterial) OnBeforeCompile

func (m MeshLambertMaterial) OnBeforeCompile()

func (MeshLambertMaterial) SetValues

func (m MeshLambertMaterial) SetValues(values MaterialParameters)

func (MeshLambertMaterial) ToJSON

func (m MeshLambertMaterial) ToJSON(meta interface{}) interface{}

type MeshPhongMaterial

type MeshPhongMaterial struct {
	*js.Object
}

func NewMeshPhongMaterial

func NewMeshPhongMaterial(params *MaterialParameters) *MeshPhongMaterial

func (MeshPhongMaterial) Clone

func (m MeshPhongMaterial) Clone()

func (MeshPhongMaterial) Copy

func (m MeshPhongMaterial) Copy(source Object3D)

func (MeshPhongMaterial) Dispose

func (m MeshPhongMaterial) Dispose()

func (MeshPhongMaterial) OnBeforeCompile

func (m MeshPhongMaterial) OnBeforeCompile()

func (MeshPhongMaterial) SetValues

func (m MeshPhongMaterial) SetValues(values MaterialParameters)

func (MeshPhongMaterial) ToJSON

func (m MeshPhongMaterial) ToJSON(meta interface{}) interface{}

type MeshPhysicalMaterial

type MeshPhysicalMaterial struct {
	*js.Object

	Clearcoat             float64  `js:"clearcoat"`
	ClearcoatMap          *Texture `js:"clearcoatMap"`
	ClearcoatNormalMap    *Texture `js:"clearcoatNormalMap"`
	ClearcoatNormalScale  Vector2  `js:"clearcoatNormalScale"`
	ClearcoatRoughness    float64  `js:"clearcoatRoughness"`
	ClearcoatRoughnessMap *Texture `js:"clearcoatRoughnessMap"`
	// Index of refraction
	IOR               float64  `js:"ior"`
	Reflectivity      float64  `js:"reflectivity"`
	Sheen             float64  `js:"sheen"`
	SheenRoughness    float64  `js:"sheenRoughness"`
	SheenRoughnessMap *Texture `js:"sheenRoughnessMap"`
	SheenColor        *Color   `js:"sheenColor"`
	SheenColorMap     *Texture `js:"sheenColorMap"`
	Transmission      float64  `js:"transmission"`
	TransmissionMap   *Texture `js:"transmissionMap"`
}

func (MeshPhysicalMaterial) Clone

func (m MeshPhysicalMaterial) Clone()

func (MeshPhysicalMaterial) Copy

func (m MeshPhysicalMaterial) Copy(source Object3D)

func (MeshPhysicalMaterial) Dispose

func (m MeshPhysicalMaterial) Dispose()

func (MeshPhysicalMaterial) OnBeforeCompile

func (m MeshPhysicalMaterial) OnBeforeCompile()

func (MeshPhysicalMaterial) SetValues

func (m MeshPhysicalMaterial) SetValues(values MaterialParameters)

func (MeshPhysicalMaterial) ToJSON

func (m MeshPhysicalMaterial) ToJSON(meta interface{}) interface{}

type MinMagFilter

type MinMagFilter int
const (
	NearestFilter MinMagFilter = iota + 1003
	NearestMipmapNearestFilter
	NearestMipmapLinearFilter
	LinearFilter
	LinearMipmapNearestFilter
	LinearMipmapLinearFilter
)

For use with a texture's minFilter (and magfilter) property, these define the texture minifying function that is used whenever the pixel being textured maps to an area greater than one texture element (texel).

type Object3D

type Object3D interface {
	ApplyMatrix4(matrix *Matrix4)
	Add(Object3D)
	Remove(*js.Object)
	ToJSON() interface{}
	GetObjectById(id int) *js.Object
	// Copy(source Object3D, recursive bool)
	UpdateMatrix()
	// contains filtered or unexported methods
}

type PerspectiveCamera

type PerspectiveCamera struct {
	*js.Object
	// Use Set method to set up vector.
	Up               Vector3 `js:"up"`
	Position         Vector3 `js:"position"`
	MatrixAutoUpdate bool    `js:"matrixAutoUpdate"`
	Aspect           float64 `js:"aspect"`
}

func NewPerspectiveCamera

func NewPerspectiveCamera(fov, aspect, near, far float64) PerspectiveCamera

func (PerspectiveCamera) ClearViewOffset

func (c PerspectiveCamera) ClearViewOffset()

func (PerspectiveCamera) Clone

Return a new camera with the same properties as this one.

func (PerspectiveCamera) Copy

func (obj PerspectiveCamera) Copy(src PerspectiveCamera, recursive bool) PerspectiveCamera

Copy the properties from the source camera into this one.

func (PerspectiveCamera) GetEffectiveFOV

func (c PerspectiveCamera) GetEffectiveFOV() float64

func (PerspectiveCamera) GetFilmHeight

func (c PerspectiveCamera) GetFilmHeight() float64

func (PerspectiveCamera) GetFilmWidth

func (c PerspectiveCamera) GetFilmWidth() float64

func (PerspectiveCamera) GetFocalLength

func (c PerspectiveCamera) GetFocalLength() float64

func (PerspectiveCamera) GetWorldDirection

func (obj PerspectiveCamera) GetWorldDirection(target Vector3) Vector3

Returns a Vector3 representing the world space direction in which the camera is looking. (Note: A camera looks down its local, negative z-axis).

func (PerspectiveCamera) LookAt

func (c PerspectiveCamera) LookAt(x, y, z float64)

func (PerspectiveCamera) SetFocalLength

func (c PerspectiveCamera) SetFocalLength(focalLength float64)

func (PerspectiveCamera) SetUp

func (c PerspectiveCamera) SetUp(v Vector3)

SetUp sets the up direction for the camera.

It is the equivalent to c.Up.Set(v.X, v.Y, v.Z)

func (PerspectiveCamera) SetViewOffset

func (c PerspectiveCamera) SetViewOffset(fullWidth, fullHeight, x, y, width, height float64)

func (PerspectiveCamera) ToJSON

func (c PerspectiveCamera) ToJSON(meta interface{}) interface{}

func (PerspectiveCamera) UpdateProjectionMatrix

func (c PerspectiveCamera) UpdateProjectionMatrix()

type PerspectiveCameraPosition

type PerspectiveCameraPosition struct {
	Z int
}

type Points

type Points struct {
	*js.Object

	// ID               int             `js:"id"`
	// Position         *Vector3        `js:"position"`
	Geometry *BufferGeometry `js:"geometry"`
	Material Material        `js:"material"`
}

A class for displaying points. The points are rendered by the WebGLRenderer using gl.POINTS.

func NewPoints

func NewPoints(geom Geometry, material Material) *Points

NewLine creates a new material. If Material is nil, three.js will assign a randomized material to the line o_O.

func (*Points) Add

func (obj *Points) Add(m Object3D)

func (*Points) ApplyMatrix4

func (obj *Points) ApplyMatrix4(matrix *Matrix4)

func (*Points) GetObjectById

func (obj *Points) GetObjectById(id int) *js.Object

func (*Points) Raycast

func (p *Points) Raycast(rc Raycaster, intersects *js.Object)

Get intersections between a casted ray and this Points. Raycaster.intersectObject will call this method.

func (*Points) Remove

func (obj *Points) Remove(m *js.Object)

func (*Points) ToJSON

func (obj *Points) ToJSON() interface{}

func (*Points) UpdateMatrix

func (obj *Points) UpdateMatrix()

type PointsMaterial

type PointsMaterial struct {
	*js.Object
}

func NewPointsMaterial

func NewPointsMaterial(params *MaterialParameters) *PointsMaterial

func (PointsMaterial) Clone

func (m PointsMaterial) Clone()

func (PointsMaterial) Copy

func (m PointsMaterial) Copy(source Object3D)

func (PointsMaterial) Dispose

func (m PointsMaterial) Dispose()

func (PointsMaterial) OnBeforeCompile

func (m PointsMaterial) OnBeforeCompile()

func (PointsMaterial) SetValues

func (m PointsMaterial) SetValues(values MaterialParameters)

func (PointsMaterial) ToJSON

func (m PointsMaterial) ToJSON(meta interface{}) interface{}

type PolarGridHelper

type PolarGridHelper struct {
	*js.Object

	ID               int             `js:"id"`
	Position         *Vector3        `js:"position"`
	Rotation         *Euler          `js:"rotation"`
	Geometry         *BufferGeometry `js:"geometry"`
	Material         Material        `js:"material"`
	MatrixAutoUpdate bool            `js:"matrixAutoUpdate"`
	RenderOrder      int             `js:"renderOrder"`
	Visible          bool            `js:"visible"`
}

func NewPolarGridHelper

func NewPolarGridHelper(params *PolarGridHelperParameters) *PolarGridHelper

func (*PolarGridHelper) Add

func (obj *PolarGridHelper) Add(m Object3D)

func (*PolarGridHelper) ApplyMatrix4

func (obj *PolarGridHelper) ApplyMatrix4(matrix *Matrix4)

func (*PolarGridHelper) GetObjectById

func (obj *PolarGridHelper) GetObjectById(id int) *js.Object

func (*PolarGridHelper) Remove

func (obj *PolarGridHelper) Remove(m *js.Object)

func (*PolarGridHelper) ToJSON

func (obj *PolarGridHelper) ToJSON() interface{}

func (*PolarGridHelper) UpdateMatrix

func (obj *PolarGridHelper) UpdateMatrix()

type PolarGridHelperParameters

type PolarGridHelperParameters struct {
	// The radius of the polar grid. This can be any positive number. Default is 10.
	Radius float64
	// The number of radial lines. This can be any positive integer. Default is 16.
	Radials int
	// The number of circles. This can be any positive integer. Default is 8.
	Circles int
	// The number of line segments used for each circle.
	// This can be any positive integer that is 3 or greater. Default is 64.
	Divisions int
	// The first color used for grid elements.
	Color1 *Color
	// The second color used for grid elements.
	Color2 *Color
}

type Quaternion

type Quaternion struct {
	*js.Object

	X float64 `js:"x"`
	Y float64 `js:"y"`
	Z float64 `js:"z"`
	W float64 `js:"w"`
}

Quaternion - represents a Quaternion.

func NewQuaternion

func NewQuaternion() Quaternion

func (Quaternion) AngleTo

func (q Quaternion) AngleTo(a Quaternion) float64

Returns the angle between this quaternion and quaternion a in radians.

func (Quaternion) Conjugate

func (q Quaternion) Conjugate() Quaternion

Returns the rotational conjugate of this quaternion. The conjugate of a quaternion represents the same rotation in the opposite direction about the rotational axis.

func (Quaternion) Copy

func (q Quaternion) Copy(a Quaternion) Quaternion

func (Quaternion) Dot

func (q Quaternion) Dot(a Quaternion) float64

Calculates the dot product of quaternions a and receiver.

func (Quaternion) Equals

func (q Quaternion) Equals(a Quaternion) bool

Compares the x, y, z and w properties of a to the equivalent properties of this quaternion to determine if they represent the same rotation.

func (Quaternion) Identity

func (q Quaternion) Identity() Quaternion

Sets this quaternion to the identity quaternion; that is, to the quaternion that represents "no rotation".

func (Quaternion) Invert

func (q Quaternion) Invert() Quaternion

Inverts this quaternion - calculates the conjugate. The quaternion is assumed to have unit length.

func (Quaternion) Length

func (q Quaternion) Length() float64

Length Computes the Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector.

func (Quaternion) LengthSq

func (q Quaternion) LengthSq() float64

LengthSq Computes the squared Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector. This can be useful if you are comparing the lengths of two quaternions, as this is a slightly more efficient calculation than length().

func (Quaternion) Multiply

func (q Quaternion) Multiply(a Quaternion) Quaternion

Multiply this quaternion by a.

func (Quaternion) MultiplyQuaternions

func (q Quaternion) MultiplyQuaternions(a, b Quaternion) Quaternion

MultiplyQuaternions Sets this quaternion to a x b. Adapted from the method outlined here http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm

func (Quaternion) Normalize

func (q Quaternion) Normalize() Quaternion

Normalize this quaternion - that is, calculated the quaternion that performs the same rotation as this one, but has length equal to 1.

func (Quaternion) Premultiply

func (q Quaternion) Premultiply(a Quaternion) Quaternion

Premultiply Pre-multiplies this quaternion by a.

func (Quaternion) Random

func (q Quaternion) Random() Quaternion

Random Sets this quaternion to a uniformly random, normalized quaternion.

func (Quaternion) RotateTowards

func (q Quaternion) RotateTowards(a Quaternion, step float64) Quaternion

RotateTowards Rotates this quaternion by a given angular step to the defined quaternion a. The method ensures that the final quaternion will not overshoot a.

func (Quaternion) Set

func (q Quaternion) Set(x, y, z, w float64) Quaternion

Set x, y, z, w properties of this quaternion.

func (Quaternion) SetFromAxisAngle

func (q Quaternion) SetFromAxisAngle(axis Vector3, angle float64) Quaternion

SetFromAxisAngle sets this quaternion from rotation specified by axis and angle. Adapted from the method here http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm Axis is assumed to be normalized, angle is in radians.

func (Quaternion) SetFromEuler

func (q Quaternion) SetFromEuler(euler Euler) Quaternion

SetFromEuler sets this quaternion from the rotation specified by Euler angle.

func (Quaternion) SetFromRotationMatrix

func (q Quaternion) SetFromRotationMatrix(m Matrix4) Quaternion

SetFromRotationMatrix sets this quaternion from rotation component of m. Adapted from the method here: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm m - a Matrix4 of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).

func (Quaternion) SetFromUnitVectors

func (q Quaternion) SetFromUnitVectors(vFrom, vTo Vector3) Quaternion

Sets this quaternion to the rotation required to rotate direction vector vFrom to direction vector vTo. Adapted from the method here: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors vFrom and vTo are assumed to be normalized.

func (Quaternion) Slerp

func (q Quaternion) Slerp(qb Quaternion, t float64) Quaternion

Slerp Handles the spherical linear interpolation between quaternions. t represents the amount of rotation between this quaternion (where t is 0) and qb (where t is 1). This quaternion is set to the result. Also see the static version of the slerp below.

func (Quaternion) SlerpQuaternions

func (q Quaternion) SlerpQuaternions(qa, qb Quaternion, t float64) (this Quaternion)

SlerpQuaternions Performs a spherical linear interpolation between the given quaternions and stores the result in this quaternion.

type Raycaster

type Raycaster struct {
	*js.Object

	Far           float64 `js:"far"`
	Near          float64 `js:"near"`
	LinePrecision float64 `js:"linePrecision"`
}

Raycaster assists with raycasting (used for mouse picking) See https://threejs.org/docs/#api/en/core/Raycaster

func NewRaycaster

func NewRaycaster() *Raycaster

NewRaycaster creates a new raycaster.

func (Raycaster) IntersectObjects

func (r Raycaster) IntersectObjects(objects *js.Object, recursive bool) *js.Object

func (Raycaster) SetFromCamera

func (r Raycaster) SetFromCamera(coords Vector2, camera PerspectiveCamera)

SetFromCamera updates the ray with a new origin and direction. coords - 2D coordinates of the mouse, in normalized device coordinates (NDC)---X and Y components should be between -1 and 1. camera from which the ray should originate TODO(divan): abstract camera away

type Scene

type Scene struct {
	*js.Object

	AutoUpdate bool   `js:"autoUpdate"`
	Background *Color `js:"background"`
}

Scene - Allows you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras.

func NewScene

func NewScene() *Scene

NewScene - Create a new Scene object.

func (*Scene) Add

func (obj *Scene) Add(m Object3D)

func (*Scene) ApplyMatrix4

func (obj *Scene) ApplyMatrix4(matrix *Matrix4)

func (*Scene) GetObjectById

func (obj *Scene) GetObjectById(id int) *js.Object

func (*Scene) Remove

func (obj *Scene) Remove(m *js.Object)

func (*Scene) ToJSON

func (obj *Scene) ToJSON() interface{}

func (*Scene) UpdateMatrix

func (obj *Scene) UpdateMatrix()

type Shading

type Shading float64
const (
	// SmoothShading is the default and linearly interpolates color between vertices.
	SmoothShading Shading = 0

	// FlatShading uses the color of the first vertex for every pixel in a face.
	FlatShading Shading = 1
)

type Side

type Side float64

Side defines which side of faces will be rendered - front, back or both. Default is FrontSide.

const (
	FrontSide  Side = 0
	BackSide   Side = 1
	DoubleSide Side = 2
)

type SphereGeometry

type SphereGeometry struct {
	*js.Object

	Radius float64 `js:"radius"`
	// Segments    int     `js:"segments"` // Not sure if available.
	ThetaStart  float64 `js:"thetaStart"`
	ThetaLength float64 `js:"thetaLength"`
}

func NewSphereGeometry

func NewSphereGeometry(params SphereGeometryParameters) SphereGeometry

NewSphereGeometry creates a new BoxGeometry.

func (SphereGeometry) ApplyMatrix4

func (g SphereGeometry) ApplyMatrix4(matrix *Matrix4)

func (SphereGeometry) Center

func (g SphereGeometry) Center()

func (SphereGeometry) ComputeBoundingBox

func (g SphereGeometry) ComputeBoundingBox()

func (SphereGeometry) ComputeBoundingSphere

func (g SphereGeometry) ComputeBoundingSphere()

func (SphereGeometry) ComputeFaceNormals

func (g SphereGeometry) ComputeFaceNormals()

func (SphereGeometry) ComputeFlatVertexNormals

func (g SphereGeometry) ComputeFlatVertexNormals()

func (SphereGeometry) ComputeLineDistances

func (g SphereGeometry) ComputeLineDistances()

func (SphereGeometry) ComputeMorphNormals

func (g SphereGeometry) ComputeMorphNormals()

func (SphereGeometry) ComputeVertexNormals

func (g SphereGeometry) ComputeVertexNormals(areaWeighted bool)

func (SphereGeometry) Copy

func (g SphereGeometry) Copy(source Object3D, recursive bool) *SphereGeometry

func (SphereGeometry) Dispose

func (g SphereGeometry) Dispose()

func (SphereGeometry) FromBufferGeometry

func (g SphereGeometry) FromBufferGeometry(geometry Geometry)

func (SphereGeometry) LookAt

func (g SphereGeometry) LookAt()

func (SphereGeometry) Merge

func (g SphereGeometry) Merge(geometry Geometry, matrix Matrix4, materialIndexOffset float64)

func (SphereGeometry) MergeMesh

func (g SphereGeometry) MergeMesh(mesh Mesh)

func (SphereGeometry) MergeVertices

func (g SphereGeometry) MergeVertices()

func (SphereGeometry) Normalize

func (g SphereGeometry) Normalize() SphereGeometry

func (SphereGeometry) RotateX

func (g SphereGeometry) RotateX()

func (SphereGeometry) RotateY

func (g SphereGeometry) RotateY()

func (SphereGeometry) RotateZ

func (g SphereGeometry) RotateZ()

func (SphereGeometry) Scale

func (g SphereGeometry) Scale()

func (SphereGeometry) SortFacesByMaterialIndex

func (g SphereGeometry) SortFacesByMaterialIndex()

func (SphereGeometry) ToJSON

func (g SphereGeometry) ToJSON() interface{}

func (SphereGeometry) Translate

func (g SphereGeometry) Translate()

type SphereGeometryParameters

type SphereGeometryParameters struct {
	Radius         float64
	WidthSegments  int
	HeightSegments int
	ThetaStart     float64
	ThetaLength    float64
	PhiStart       float64
	PhiLength      float64
}

type Sprite

type Sprite struct {
	*js.Object

	ID               int             `js:"id"`
	Position         *Vector3        `js:"position"`
	Scale            *Vector3        `js:"scale"`
	Rotation         *Euler          `js:"rotation"`
	Geometry         *BufferGeometry `js:"geometry"`
	Material         Material        `js:"material"`
	MatrixAutoUpdate bool            `js:"matrixAutoUpdate"`
	RenderOrder      int             `js:"renderOrder"`
}

Sprite is a plane that always faces towards the camera, generally with a partially transparent texture applied.

func NewSprite

func NewSprite(material *SpriteMaterial) *Sprite

NewSprite creates a new sprite.

func (*Sprite) Add

func (obj *Sprite) Add(m Object3D)

func (*Sprite) ApplyMatrix4

func (obj *Sprite) ApplyMatrix4(matrix *Matrix4)

func (*Sprite) GetObjectById

func (obj *Sprite) GetObjectById(id int) *js.Object

func (*Sprite) Remove

func (obj *Sprite) Remove(m *js.Object)

func (*Sprite) ToJSON

func (obj *Sprite) ToJSON() interface{}

func (*Sprite) UpdateMatrix

func (obj *Sprite) UpdateMatrix()

type SpriteMaterial

type SpriteMaterial struct {
	*js.Object
}

func NewSpriteMaterial

func NewSpriteMaterial(texture *Texture) *SpriteMaterial

func (SpriteMaterial) Clone

func (m SpriteMaterial) Clone()

func (SpriteMaterial) Copy

func (m SpriteMaterial) Copy(source Object3D)

func (SpriteMaterial) Dispose

func (m SpriteMaterial) Dispose()

func (SpriteMaterial) OnBeforeCompile

func (m SpriteMaterial) OnBeforeCompile()

func (SpriteMaterial) SetValues

func (m SpriteMaterial) SetValues(values MaterialParameters)

func (SpriteMaterial) ToJSON

func (m SpriteMaterial) ToJSON(meta interface{}) interface{}

type TextSprite

type TextSprite struct {
	*js.Object

	Text string

	ID               int             `js:"id"`
	Position         *Vector3        `js:"position"`
	Rotation         *Euler          `js:"rotation"`
	Geometry         *BufferGeometry `js:"geometry"`
	MatrixAutoUpdate bool            `js:"matrixAutoUpdate"`
	RenderOrder      int             `js:"renderOrder"`
	Visible          bool            `js:"visible"`
}

func NewTextSprite

func NewTextSprite(text, align string, textSize int, color *Color) *TextSprite

func (*TextSprite) Add

func (obj *TextSprite) Add(m Object3D)

func (*TextSprite) ApplyMatrix4

func (obj *TextSprite) ApplyMatrix4(matrix *Matrix4)

func (*TextSprite) GetObjectById

func (obj *TextSprite) GetObjectById(id int) *js.Object

func (*TextSprite) Remove

func (obj *TextSprite) Remove(m *js.Object)

func (*TextSprite) ToJSON

func (obj *TextSprite) ToJSON() interface{}

func (*TextSprite) UpdateMatrix

func (obj *TextSprite) UpdateMatrix()

type TextSpriteMaterial

type TextSpriteMaterial struct {
	*js.Object
	Color *Color `js:"color"`
}

type TextSpriteParameters

type TextSpriteParameters struct {
	*js.Object
	TextSize       int                 `js:"textSize"`
	RedrawInterval int                 `js:"redrawInterval"`
	Material       *TextSpriteMaterial `js:"material"`
	Texture        *TextTextureParams  `js:"texture"`
}

type TextTextureParams

type TextTextureParams struct {
	*js.Object
	Text       string `js:"text"`
	FontFamily string `js:"fontFamily"`
	Align      string `js:"align"`
}

type Texture

type Texture struct {
	*js.Object

	Id    int    `js:"id"`
	UUID  string `js:"uuid"`
	Name  string `js:"name"`
	Image *Image `js:"image"`
	// Array of user-specified mipmaps (optional).
	Mipmaps        *js.Object    `js:"mipmaps"`
	WrapS          WrappingMode  `js:"wrapS"`
	WrapT          WrappingMode  `js:"wrapT"`
	MagFilter      MinMagFilter  `js:"magFilter"`
	MinFilter      MinMagFilter  `js:"minFilter"`
	Anisotropy     int           `js:"anisotropy"`
	Format         TextureFormat `js:"format"`
	InternalFormat string        `js:"internalFormat"`
	Type           TextureType   `js:"internalFormat"`
	// How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0.
	Offset Vector2 `js:"offset"`
	// How many times the texture is repeated across the surface, in each direction U and V. If repeat is set greater than 1 in either direction, the
	Repeat Vector2 `js:"repeat"`
	// How much the texture is rotated around the center point, in radians. Positive values are counter-clockwise. Default is 0.
	Rotation float64 `js:"rotation"`
	// The point around which rotation occurs. A value of (0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the lower left.
	Center           Vector2 `js:"center"`
	MatrixAutoUpdate bool    `js:"matrixAutoUpdate"`
	// Matrix Matrix3 `js:"matrix"`
	GenerateMipmaps  bool            `js:"generateMipmaps"`
	PremultiplyAlpha bool            `js:"premultiplyAlpha"`
	FlipY            bool            `js:"flipY"`
	UnpackAlignment  int             `js:"unpackAlignment"`
	Encoding         TextureEncoding `js:"encoding"`
	Version          int             `js:"version"`
	NeedsUpdate      bool            `js:"needsUpdate"`

	UserData *js.Object `js:"userData"`
}

func NewTexture

func NewTexture(params TextureParameters) *Texture

func (*Texture) Clone

func (t *Texture) Clone() *Texture

func (*Texture) Dispose

func (t *Texture) Dispose()

func (*Texture) ToJSON

func (t *Texture) ToJSON() interface{}

func (*Texture) TransformUV

func (t *Texture) TransformUV(uv Vector2) Vector2

func (*Texture) UpdateMatrix

func (t *Texture) UpdateMatrix()

Update the texture's uv-transform .matrix from the texture properties .offset, .repeat, .rotation, and .center.

type TextureEncoding

type TextureEncoding int
const (
	LinearEncoding TextureEncoding = 3000

	GammaEncoding     TextureEncoding = 3007
	RGBEEncoding      TextureEncoding = 3002
	LogLuvEncoding    TextureEncoding = 3003
	RGBM7Encoding     TextureEncoding = 3004
	RGBM16Encoding    TextureEncoding = 3005
	RGBDEncoding      TextureEncoding = 3006
	BasicDepthPacking TextureEncoding = 3200
	RGBADepthPacking  TextureEncoding = 3201
)

LinearEncoding is the default. Values other than this are only valid for a material's map, envMap and emissiveMap.

type TextureFormat

type TextureFormat int
const (
	AlphaFormat          TextureFormat = 1021
	RGBFormat            TextureFormat = 1022
	RGBAFormat           TextureFormat = 1023
	LuminanceFormat      TextureFormat = 1024
	LuminanceAlphaFormat TextureFormat = 1025
	RGBEFormat           TextureFormat = RGBAFormat
	DepthFormat          TextureFormat = 1026
	DepthStencilFormat   TextureFormat = 1027
	RedFormat            TextureFormat = 1028
	RedIntegerFormat     TextureFormat = 1029
	RGFormat             TextureFormat = 1030
	RGIntegerFormat      TextureFormat = 1031
	RGBIntegerFormat     TextureFormat = 1032
	RGBAIntegerFormat    TextureFormat = 1033
)

For use with a texture's format property, these define how elements of a 2d texture, or texels, are read by shaders.

type TextureLoader

type TextureLoader struct {
	*js.Object

	CrossOrigin string `js:"crossOrigin"`
}

TextureLoader loads a texture from file. See https://threejs.org/docs/#api/en/loaders/TextureLoader

func NewTextureLoader

func NewTextureLoader() *TextureLoader

NewTextureLoader creates a new texture loader.

func (*TextureLoader) Load

func (t *TextureLoader) Load(url string, fn func(*Texture)) *Texture

Load loads texture from url image.

type TextureParameters

type TextureParameters struct {
	Image *Image
	// How the image is applied to the object. An object type of THREE.UVMapping is the default, where the U,V coordinates are used to apply the map.
	Mapping MappingMode
	// This defines how the texture is wrapped horizontally and corresponds to U in UV mapping.
	WrapS WrappingMode
	// This defines how the texture is wrapped vertically and corresponds to V in UV mapping.
	WrapT WrappingMode
	// How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them.
	MagFilter MinMagFilter
	// How the texture is sampled when a texel covers less than one pixel. The default is THREE.LinearMipmapLinearFilter, which uses mipmapping and a trilinear filter.
	MinFilter MinMagFilter

	Format TextureFormat
	Type   TextureType
	// The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2
	Anisotropy int
	Encoding   TextureEncoding
}

type TextureType

type TextureType int
const (
	UnsignedByteType      TextureType = 1009
	ByteType              TextureType = 1010
	ShortType             TextureType = 1011
	UnsignedShortType     TextureType = 1012
	IntType               TextureType = 1013
	UnsignedIntType       TextureType = 1014
	FloatType             TextureType = 1015
	HalfFloatType         TextureType = 1016
	UnsignedShort4444Type TextureType = 1017
	UnsignedShort5551Type TextureType = 1018
	UnsignedShort565Type  TextureType = 1019
	UnsignedInt248Type    TextureType = 1020
)

For use with a texture's type property, which must correspond to the correct format. See below for details.

type TrackballControls

type TrackballControls struct {
	*js.Object

	DynamicDampingFactor float64 `js:"dynamicDampingFactor"`
	Enabled              bool    `js:"enabled"`

	// How far you can zoom out. Default is Infinity.
	MaxDistance float64 `js:"maxDistance"`
	// How far you can zoom in. Default is 0.
	MinDistance float64 `js:"minDistance"`
	// This object contains references to the mouse actions used by the controls.
	// * LEFT is assigned with THREE.MOUSE.ROTATE
	// * MIDDLE is assigned with THREE.MOUSE.ZOOM
	// * RIGHT is assigned with THREE.MOUSE.PAN
	MouseButtons *js.Object `js:"mouseButtons"`
	NoPan        bool       `js:"noPan"`
	NoRotate     bool       `js:"noRotate"`
	NoZoom       bool       `js:"noZoom"`
	Camera       Camera     `js:"object"`
	PanSpeed     float64    `js:"panSpeed"`
	RotateSpeed  float64    `js:"rotateSpeed"`
	// Whether or not damping is disabled. Default is false.
	StaticMoving bool    `js:"staticMoving"`
	ZoomSpeed    float64 `js:"zoomSpeed"`
	// This array holds keycodes for controlling interactions.
	// When the first defined key is pressed, all mouse interactions (left, middle, right) performs orbiting.
	// When the second defined key is pressed, all mouse interactions (left, middle, right) performs zooming.
	// When the third defined key is pressed, all mouse interactions (left, middle, right) performs panning.
	// Default is KeyA, KeyS, KeyD which represents A, S, D.
	Keys []string `js:"keys"`
	// WARNING: Not part of documentation. Use to set where zoom-in focuses on.
	Target Vector3 `js:"target"`
	// WARNING: Not part of documentation.
	Target0 Vector3 `js:"target0"`
	// WARNING: Not part of documentation. Current position of camera.
	Position Vector3 `js:"position"`
}

func NewTrackballControls

func NewTrackballControls(camera Camera, domElement *js.Object) TrackballControls

NewTrackballControls instances a TrackballControls. Requires TrackballControls to be added at a global level or on THREE. See https://github.com/turban/webgl-earth for a way of doing this easily using Eberhard Graether's http://egraether.com/ version.

func (TrackballControls) CheckDistances

func (t TrackballControls) CheckDistances()

Ensures the controls stay in the range [minDistance, maxDistance]. Called by update().

func (TrackballControls) Dispose

func (t TrackballControls) Dispose()

Should be called if the controls is no longer required.

func (TrackballControls) HandleResizes

func (t TrackballControls) HandleResizes()

Should be called if the application window is resized.

func (TrackballControls) PanCamera

func (t TrackballControls) PanCamera()

Performs panning if necessary. Called by update().

func (TrackballControls) Reset

func (t TrackballControls) Reset()

Resets the controls to its initial state.

func (TrackballControls) RotateCamera

func (t TrackballControls) RotateCamera()

Rotates the camera if necessary. Called by update().

func (TrackballControls) Update

func (t TrackballControls) Update()

Updates the controls. Usually called in the animation loop.

func (TrackballControls) ZoomCamera

func (t TrackballControls) ZoomCamera()

Performs zooming if necessary. Called by update().

type Vector2

type Vector2 struct {
	*js.Object
	X float64 `js:"x"`
	Y float64 `js:"y"`
}

Vector2 - represents a Vector2.

func NewVector2

func NewVector2(x, y float64) *Vector2

func (Vector2) Coords

func (v Vector2) Coords() (x, y float64)

func (Vector2) DistanceTo

func (v Vector2) DistanceTo(v1 Vector2) float64

func (Vector2) Normalize

func (v Vector2) Normalize() Vector2

func (Vector2) Set

func (v Vector2) Set(x, y float64) Vector2

type Vector3

type Vector3 struct {
	*js.Object
	X float64 `js:"x"`
	Y float64 `js:"y"`
	Z float64 `js:"z"`
}

Vector3 - represents a Vector3.

func NewVector3

func NewVector3(x, y, z float64) Vector3

func (Vector3) Add

func (v Vector3) Add(a Vector3) (this Vector3)

Add a to this vector.

func (Vector3) AddScalar

func (v Vector3) AddScalar(f float64) (this Vector3)

AddScalar Adds the scalar value f to this vector's x, y and z values.

func (Vector3) AddScaledVector

func (v Vector3) AddScaledVector(f float64, a Vector3) (this Vector3)

AddScaledVector Adds the multiple of a and f to this vector. this = f*a

func (Vector3) AngleTo

func (v Vector3) AngleTo(a Vector3) (this Vector3)

AngleTo Returns the angle between this vector and vector a in radians.

func (Vector3) ApplyAxisAngle

func (v Vector3) ApplyAxisAngle(axis Vector3, angle float64) (this Vector3)

ApplyAxisAngle Applies a rotation specified by a normalized axis and an angle to this vector.

func (Vector3) ApplyEuler

func (v Vector3) ApplyEuler(euler Euler) (this Vector3)

ApplyEuler transform to this vector by converting the Euler object to a Quaternion and applying.

func (Vector3) ApplyQuaternion

func (v Vector3) ApplyQuaternion(q Quaternion) (this Vector3)

ApplyQuaternion transform to this vector.

func (Vector3) Ceil

func (v Vector3) Ceil() (this Vector3)

Ceil The x, y and z components of this vector are rounded up to the nearest integer value.

func (Vector3) ClampLength

func (v Vector3) ClampLength(min, max float64) (this Vector3)

ClampLength If this vector's length is greater than the max value, the vector will be scaled down so its length is the max value.

If this vector's length is less than the min value, the vector will be scaled up so its length is the min value.

func (Vector3) ClampScalar

func (v Vector3) ClampScalar(min, max float64) (this Vector3)

ClampScalar clamps individual components of this vector. If this vector's x, y or z values are greater than the max value, they are replaced by the max value.

If this vector's x, y or z values are less than the min value, they are replaced by the min value.

func (Vector3) Coords

func (v Vector3) Coords() (x, y, z float64)

func (Vector3) Cross

func (v Vector3) Cross(a Vector3) (this Vector3)

Cross Sets this vector to cross product of itself and a.

func (Vector3) CrossVectors

func (v Vector3) CrossVectors(a, b Vector3) (this Vector3)

CrossVectors Sets this vector to cross product of a and b.

func (Vector3) DistanceTo

func (v Vector3) DistanceTo(a Vector3) float64

DistanceTo Computes the distance from this vector to v.

func (Vector3) DistanceToSquared

func (v Vector3) DistanceToSquared(a Vector3) float64

DistanceToSquared Computes the squared distance from this vector to v. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate.

func (Vector3) Divide

func (v Vector3) Divide(a Vector3) (this Vector3)

Divide this vector by a.

func (Vector3) DivideScalar

func (v Vector3) DivideScalar(f float64) (this Vector3)

DivideScalar this vector by scalar f.

func (Vector3) Dot

func (v Vector3) Dot(a Vector3) (this Vector3)

Dot Calculate the dot product of this vector and v.

func (Vector3) Equals

func (v Vector3) Equals(a Vector3) (this Vector3)

Equals Returns true if the components of this vector and v are strictly equal; false otherwise.

func (Vector3) Floor

func (v Vector3) Floor() (this Vector3)

Floor The components of this vector are rounded down to the nearest integer value.

func (Vector3) GetComponent

func (v Vector3) GetComponent(idx int) float64

GetComponent gets X value if idx=0. Gets Y if idx=1. Gets Z if idx=2.

func (Vector3) Length

func (v Vector3) Length() float64

Length Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z).

func (Vector3) LengthSq

func (v Vector3) LengthSq() float64

Computes the square of the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.

func (Vector3) Lerp

func (v Vector3) Lerp(f float64, a Vector3) (this Vector3)

Lerp Linearly interpolate between this vector and v, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be a.

func (Vector3) LerpVectors

func (v Vector3) LerpVectors(f float64, a, b Vector3) (this Vector3)

LerpVectors Sets this vector to be the vector linearly interpolated between a and b where alpha is the percent distance along the line connecting the two vectors - alpha = 0 will be a, and alpha = 1 will be b.

func (Vector3) ManhattanDistanceTo

func (v Vector3) ManhattanDistanceTo(a Vector3) float64

ManhattanDistanceTo Computes the manhattan distance from this vector to v. https://en.wikipedia.org/wiki/Taxicab_geometry

func (Vector3) ManhattanLength

func (v Vector3) ManhattanLength() float64

ManhattanLength Computes the Manhattan length of this vector

func (Vector3) Max

func (v Vector3) Max(a Vector3) (this Vector3)

Max If this vector's x, y or z value is less than a's x, y or z value, replace that value with the corresponding max value.

func (Vector3) Min

func (v Vector3) Min(a Vector3) (this Vector3)

Min If this vector's x, y or z value is greater than a's x, y or z value, replace that value with the corresponding min value.

func (Vector3) Multiply

func (v Vector3) Multiply(a Vector3) (this Vector3)

Multiply Multiplies this vector by v.

func (Vector3) MultiplyScalar

func (v Vector3) MultiplyScalar(f float64) (this Vector3)

MultiplyScalar Multiplies this vector by scalar f.

func (Vector3) Negate

func (v Vector3) Negate() (this Vector3)

Negate Inverts this vector - i.e. sets x = -x, y = -y and z = -z.

func (Vector3) Normalize

func (v Vector3) Normalize() Vector3

Normalize Convert this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but length 1.

func (Vector3) Random

func (v Vector3) Random() Vector3

Random Sets each component of this vector to a pseudo-random value between 0 and 1, excluding 1.

func (Vector3) RandomDirection

func (v Vector3) RandomDirection() Vector3

RandomDirection Sets this vector to a uniformly random point on a unit sphere.

func (Vector3) Set

func (v Vector3) Set(x, y, z float64) Vector3

func (Vector3) SetComponent

func (v Vector3) SetComponent(idx int, f float64)

SetComponent sets idx component to f. idx of X is 0. idx of Y is 1. idx of Z is 2.

func (Vector3) SetLength

func (v Vector3) SetLength(f float64) Vector3

SetLength Set this vector to a vector with the same direction as this one, but length l.

func (Vector3) SetX

func (v Vector3) SetX(x float64) Vector3

func (Vector3) SetY

func (v Vector3) SetY(y float64) Vector3

func (Vector3) SetZ

func (v Vector3) SetZ(z float64) Vector3

func (Vector3) Sub

func (v Vector3) Sub(a Vector3) Vector3

Sub Subtracts v from this vector.

func (Vector3) SubVectors

func (v Vector3) SubVectors(a, b Vector3) Vector3

SubVectors Sets this vector to a - b.

type WebGLRenderer

type WebGLRenderer struct {
	*js.Object
}

The WebGLRenderer displays your beautifully crafted scenes using WebGL.

func NewWebGLRenderer

func NewWebGLRenderer() WebGLRenderer

WebGLRenderer creates an WebGLRenderer instance.

func (WebGLRenderer) Render

func (r WebGLRenderer) Render(scene *Scene, camera PerspectiveCamera)

func (WebGLRenderer) SetPixelRatio

func (r WebGLRenderer) SetPixelRatio(ratio float64)

func (WebGLRenderer) SetSize

func (r WebGLRenderer) SetSize(w float64, h float64, updateStyle bool)

WebGLRenderer creates an WebGLRenderer instance.

type WrappingMode

type WrappingMode int
const (
	RepeatWrapping WrappingMode = iota + 1000
	ClampToEdgeWrapping
	MirroredRepeatWrapping
)

These define the texture's wrapS and wrapT properties, which define horizontal and vertical texture wrapping.

Source Files

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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