wcommon

package
v0.0.0-...-be50a85 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertGoSliceToJsTypedArray

func ConvertGoSliceToJsTypedArray(a interface{}) js.Value

func GetRGBAFromString

func GetRGBAFromString(s string) [4]float32

func ParseHexColor

func ParseHexColor(s string) [4]float32

func ShowArrayInfo

func ShowArrayInfo(desc string, iv interface{})

Types

type Constants

type Constants struct {
	ARRAY_BUFFER         js.Value //
	BLEND                js.Value // for gl.enable(gl.BLEND)
	BYTE                 js.Value //
	CLAMP_TO_EDGE        js.Value // for gl.texParameteri()
	COLOR_BUFFER_BIT     js.Value //
	COMPILE_STATUS       js.Value //
	DEPTH_BUFFER_BIT     js.Value //
	DEPTH_TEST           js.Value //
	ELEMENT_ARRAY_BUFFER js.Value //
	FLOAT                js.Value //
	FRAGMENT_SHADER      js.Value //
	LEQUAL               js.Value //
	LINEAR               js.Value // for gl.texParameteri()
	LINES                js.Value //
	LINK_STATUS          js.Value //
	NEAREST              js.Value // for gl.texParameteri()
	ONE                  js.Value // for gl.blendFunc()
	ONE_MINUS_SRC_ALPHA  js.Value // for gl.blendFunc()
	POINTS               js.Value //
	RGBA                 js.Value //
	SRC_ALPHA            js.Value // for gl.blendFunc()
	STATIC_DRAW          js.Value //
	TEXTURE_2D           js.Value // for gl.texParameteri()
	TEXTURE0             js.Value //
	TEXTURE1             js.Value //
	TEXTURE_MIN_FILTER   js.Value // for gl.texParameteri()
	TEXTURE_WRAP_S       js.Value // for gl.texParameteri()
	TEXTURE_WRAP_T       js.Value // for gl.texParameteri()
	TRIANGLES            js.Value //
	UNSIGNED_BYTE        js.Value //
	UNSIGNED_INT         js.Value //
	UNSIGNED_SHORT       js.Value //
	VERTEX_SHADER        js.Value //
}

func (*Constants) LoadFromContext

func (self *Constants) LoadFromContext(context js.Value)

type Geometry

type Geometry interface {
	IsDataBufferReady() bool
	IsWebGLBufferReady() bool
	BuildWebGLBuffers(wctx *WebGLContext, for_points bool, for_lines bool, for_faces bool)
	GetWebGLBuffer(draw_mode int) (js.Value, int, [4]int)
	ShowInfo()
}

type Material

type Material struct {
	// contains filtered or unexported fields
}

func NewMaterial

func NewMaterial(wctx *WebGLContext, source string) *Material

func NewMaterial_AlphabetTexture

func NewMaterial_AlphabetTexture(wctx *WebGLContext, fontsize int, color string, outlined bool) *Material

func NewMaterial_GlowTexture

func NewMaterial_GlowTexture(wctx *WebGLContext, color string) *Material

func (*Material) GetAlaphabetCharacterIndex

func (self *Material) GetAlaphabetCharacterIndex(c rune) int

func (*Material) GetAlaphabetCharacterWH

func (self *Material) GetAlaphabetCharacterWH(scale float32) [2]float32

func (*Material) GetAlaphabetLength

func (self *Material) GetAlaphabetLength() int

func (*Material) GetAlaphabetPosesForLabel

func (self *Material) GetAlaphabetPosesForLabel(label_text string) *SceneObjectPoses

func (*Material) GetDrawModeColor

func (self *Material) GetDrawModeColor(draw_mode int) [4]float32

func (*Material) GetTexture

func (self *Material) GetTexture() js.Value

func (*Material) GetTextureWH

func (self *Material) GetTextureWH() [2]int

func (*Material) IsTextureLoading

func (self *Material) IsTextureLoading() bool

func (*Material) IsTextureReady

func (self *Material) IsTextureReady() bool

func (*Material) LoadTexture

func (self *Material) LoadTexture(path string) *Material

func (*Material) SetColorForDrawMode

func (self *Material) SetColorForDrawMode(draw_mode int, color string) *Material

func (*Material) SetDrawModeColor

func (self *Material) SetDrawModeColor(draw_mode int, color [4]float32) *Material

func (*Material) ShowInfo

func (self *Material) ShowInfo()

type SceneObjectPoses

type SceneObjectPoses struct {
	Size        int       //
	Count       int       //
	DataBuffer  []float32 //
	WebGLBuffer js.Value  //
}

func NewSceneObjectPoses

func NewSceneObjectPoses(size int, count int, data []float32) *SceneObjectPoses

func (*SceneObjectPoses) BuildWebGLBuffer

func (self *SceneObjectPoses) BuildWebGLBuffer(wctx *WebGLContext)

func (*SceneObjectPoses) IsWebGLBufferReady

func (self *SceneObjectPoses) IsWebGLBufferReady() bool

func (*SceneObjectPoses) SetPose

func (self *SceneObjectPoses) SetPose(index int, offset int, values ...float32) bool

func (*SceneObjectPoses) ShowInfo

func (self *SceneObjectPoses) ShowInfo()

type Shader

type Shader struct {
	// contains filtered or unexported fields
}

func NewShader

func NewShader(wctx *WebGLContext, vertex_shader string, fragment_shader string) (*Shader, error)

func (*Shader) CheckBindings

func (self *Shader) CheckBindings()

func (*Shader) GetAttributeBindings

func (self *Shader) GetAttributeBindings() map[string]map[string]interface{}

func (*Shader) GetShaderProgram

func (self *Shader) GetShaderProgram() js.Value

func (*Shader) GetUniformBindings

func (self *Shader) GetUniformBindings() map[string]map[string]interface{}

func (*Shader) SetBindingForAttribute

func (self *Shader) SetBindingForAttribute(name string, dtype string, autobinding string)

func (*Shader) SetBindingForUniform

func (self *Shader) SetBindingForUniform(name string, dtype string, option interface{})

func (*Shader) ShowInfo

func (self *Shader) ShowInfo()

type WebGLContext

type WebGLContext struct {
	// contains filtered or unexported fields
}

func NewWebGLContext

func NewWebGLContext(canvas_id string) (*WebGLContext, error)

func (*WebGLContext) GetCanvas

func (self *WebGLContext) GetCanvas() js.Value

func (*WebGLContext) GetConstants

func (self *WebGLContext) GetConstants() *Constants

func (*WebGLContext) GetContext

func (self *WebGLContext) GetContext() js.Value

func (*WebGLContext) GetExtension

func (self *WebGLContext) GetExtension(extname string) js.Value

func (*WebGLContext) GetWH

func (self *WebGLContext) GetWH() [2]int

func (*WebGLContext) IsExtensionReady

func (self *WebGLContext) IsExtensionReady(extname string) bool

func (*WebGLContext) RegisterEventHandlerForClick

func (self *WebGLContext) RegisterEventHandlerForClick(handler func(canvasxy [2]int, keystat [4]bool))

func (*WebGLContext) RegisterEventHandlerForDoubleClick

func (self *WebGLContext) RegisterEventHandlerForDoubleClick(handler func(canvasxy [2]int, keystat [4]bool))

func (*WebGLContext) RegisterEventHandlerForMouseDrag

func (self *WebGLContext) RegisterEventHandlerForMouseDrag(handler func(canvasxy [2]int, dxy [2]int, keystat [4]bool))

func (*WebGLContext) RegisterEventHandlerForMouseOver

func (self *WebGLContext) RegisterEventHandlerForMouseOver(handler func(canvasxy [2]int, keystat [4]bool))

func (*WebGLContext) RegisterEventHandlerForMouseWheel

func (self *WebGLContext) RegisterEventHandlerForMouseWheel(handler func(canvasxy [2]int, scale float32, keystat [4]bool))

func (*WebGLContext) RegisterEventHandlerForWindowResize

func (self *WebGLContext) RegisterEventHandlerForWindowResize(handler func(w int, h int))

func (*WebGLContext) SetupAnimationFrame

func (self *WebGLContext) SetupAnimationFrame(draw_handler func(canvas js.Value))

func (*WebGLContext) SetupEventHandlers

func (self *WebGLContext) SetupEventHandlers()

func (*WebGLContext) SetupExtension

func (self *WebGLContext) SetupExtension(extname string)

func (*WebGLContext) ShowInfo

func (self *WebGLContext) ShowInfo()

Jump to

Keyboard shortcuts

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