three

package module
v0.0.0-...-d0405b5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: MIT Imports: 4 Imported by: 6

README

three

GopherJS bindings for three.js. Still a WIP.

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"`
}

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) ApplyMatrix

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

func (*AmbientLight) ToJSON

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

type BasicGeometry

type BasicGeometry struct {
	*js.Object
}

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

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) AddVertice

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

AddVertice adds new vertice to the geometry, specified by its coordinates.

func (BasicGeometry) ApplyMatrix

func (g BasicGeometry) ApplyMatrix(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  float64 `js:"widthSegments"`
	HeightSegments float64 `js:"heightSegments"`
	DepthSegments  float64 `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) ApplyMatrix

func (g BoxGeometry) ApplyMatrix(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  float64
	HeightSegments float64
	DepthSegments  float64
}

BoxGeometryParameters .

type CircleGeometry

type CircleGeometry struct {
	*js.Object

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

func NewCircleGeometry

func NewCircleGeometry(params CircleGeometryParameters) CircleGeometry

NewBoxGeometry creates a new BoxGeometry.

func (CircleGeometry) ApplyMatrix

func (g CircleGeometry) ApplyMatrix(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    float64
	ThetaStart  float64
	ThetaLength float64
}

type Color

type Color struct {
	*js.Object
}

Color - represents a color.

func NewColor

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

type DirectionalLight

type DirectionalLight struct {
	*js.Object

	Position *Vector3 `js:"position"`
}

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) ApplyMatrix

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

func (*DirectionalLight) ToJSON

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

type Euler

type Euler struct {
	*js.Object

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

Euler - represents a Euler.

func NewEuler

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

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) ApplyMatrix

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

func (*Fog) ToJSON

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

type Geometry

type Geometry interface {
	ApplyMatrix(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

	Position *Vector3 `js:"position"`
	Rotation *Euler   `js:"rotation"`
}

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) ApplyMatrix

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

func (*Group) ToJSON

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

type Line

type Line struct {
	*js.Object
}

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) ApplyMatrix

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

func (*Line) ToJSON

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

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 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"`
	Side    Side    `js:"side"`
}

func NewMaterialParameters

func NewMaterialParameters() *MaterialParameters

type Matrix4

type Matrix4 struct {
	*js.Object
}

Matrix4 - represents a Matrix4.

func NewMatrix4

func NewMatrix4(x, y, z float64) Matrix4

type Mesh

type Mesh struct {
	*js.Object

	Position *Vector3 `js:"position"`
	Rotation *Euler   `js:"rotation"`
}

func NewMesh

func NewMesh(geometry Geometry, material Material) *Mesh

func (*Mesh) Add

func (obj *Mesh) Add(m Object3D)

func (*Mesh) ApplyMatrix

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

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{}

type MeshBasicMaterial

type MeshBasicMaterial struct {
	*js.Object
}

func NewMeshBasicMaterial

func NewMeshBasicMaterial(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 Object3D

type Object3D interface {
	ApplyMatrix(matrix *Matrix4)
	Add(m Object3D)
	ToJSON() interface{}
	// contains filtered or unexported methods
}

type PerspectiveCamera

type PerspectiveCamera struct {
	*js.Object

	Position Vector3 `js:"position"`
}

func NewPerspectiveCamera

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

func (PerspectiveCamera) ClearViewOffset

func (c PerspectiveCamera) ClearViewOffset()

func (PerspectiveCamera) Copy

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) SetFocalLength

func (c PerspectiveCamera) SetFocalLength(focalLength float64)

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 Quaternion

type Quaternion struct {
	*js.Object
}

Quaternion - represents a Quaternion.

func NewQuaternion

func NewQuaternion() Quaternion

type Scene

type Scene struct {
	*js.Object
}

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) ApplyMatrix

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

func (*Scene) ToJSON

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

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 Vector3

type Vector3 struct {
	*js.Object
}

Vector3 - represents a Vector3.

func NewVector3

func NewVector3(x, y, z float64) Vector3

func (Vector3) Normalize

func (v Vector3) Normalize() Vector3

func (Vector3) Set

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

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.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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