Plask v4 Reference Documentation


AVPlayer

Clipboard

gl.MagicProgram

Mat3

Mat4

NSOpenGLContext

NSOpenGLContext
activeTexture
attachShader
beginTransformFeedback
bindAttribLocation
bindBuffer
bindBufferBase
bindBufferRange
bindFramebuffer
bindRenderbuffer
bindTexture
bindTransformFeedback
bindVertexArray
blendColor
blendEquation
blendEquationSeparate
blendFunc
blendFuncSeparate
blit
blitFramebuffer
bufferData
bufferSubData
checkFramebufferStatus
clear
clearColor
clearDepth
clearStencil
colorMask
compileShader
compressedTexImage2D
createBuffer
createFramebuffer
createProgram
createRenderbuffer
createShader
createSyphonClient
createSyphonServer
createTexture
createTransformFeedback
createVertexArray
cullFace
deleteBuffer
deleteFramebuffer
deleteProgram
deleteRenderbuffer
deleteShader
deleteTexture
deleteTransformFeedback
deleteVertexArray
depthFunc
depthMask
depthRange
detachShader
disable
disableVertexAttribArray
drawArrays
drawArraysInstanced
drawBuffers
drawElements
drawElementsInstanced
drawRangeElements
drawSkCanvas
enable
enableVertexAttribArray
endTransformFeedback
finish
flush
framebufferRenderbuffer
framebufferTexture2D
frontFace
generateMipmap
getActiveAttrib
getActiveUniform
getAttachedShaders
getAttribLocation
getBufferParameter
getBufferSubData
getError
getExtension
getFramebufferAttachmentParameter
getParameter
getProgramInfoLog
getProgramParameter
getShaderInfoLog
getShaderParameter
getShaderSource
getSupportedExtensions
getTexParameter
getTransformFeedbackVarying
getUniform
getUniformLocation
hint
isBuffer
isEnabled
isFramebuffer
isProgram
isRenderbuffer
isShader
isTexture
isTransformFeedback
isVertexArray
lineWidth
linkProgram
makeCurrentContext
pauseTransformFeedback
pixelStorei
polygonOffset
popAllState
pushAllState
readPixels
renderbufferStorage
renderbufferStorageMultisample
resetSkiaContext
resumeTransformFeedback
sampleCoverage
scissor
setSwapInterval
shaderSource
shaderSourceRaw
stencilFunc
stencilFuncSeparate
stencilMask
stencilMaskSeparate
stencilOp
stencilOpSeparate
texImage2D
texImage2DSkCanvasB
texParameterf
texParameteri
texSubImage2D
transformFeedbackVaryings
uniform1f
uniform1fv
uniform1i
uniform1iv
uniform2f
uniform2fv
uniform2i
uniform2iv
uniform3f
uniform3fv
uniform3i
uniform3iv
uniform4f
uniform4fv
uniform4i
uniform4iv
uniformMatrix2fv
uniformMatrix3fv
uniformMatrix4fv
useProgram
validateProgram
vertexAttrib1f
vertexAttrib2f
vertexAttrib3f
vertexAttrib4f
vertexAttribDivisor
vertexAttribPointer
viewport
writeImage

NSWindow

SkCanvas

SkPaint

SkPath

Vec2

Vec3

Vec4

plask

AVPlayer

AVPlayer

new AVPlayer(NSOpenGLContext? gl)

Create a new instance of an AVPlayer. For video playback a gl context must be specified for the creation of textures. For audio only playback the context argument can be omitted.

appendFile[AVPlayer]

void appendFile(string path)

Add a file to the playlist.

appendURL[AVPlayer]

void appendURL(string url)

Add a URL to the playlist.

currentDuration[AVPlayer]

float currentDuration()

currentFrameTexture[AVPlayer]

object currentFrameTexture()

currentLoadedTimeRanges[AVPlayer]

float[ ] currentLoadedTimeRanges()

currentTime[AVPlayer]

float currentTime()

error[AVPlayer]

int error()

play[AVPlayer]

void play()

playNext[AVPlayer]

void playNext()

Play the next entry in the playlist.

prerollAtRate[AVPlayer]

bool prerollAtRate(float rate)

rate[AVPlayer]

float rate()

Return the current playback rate.

removeAll[AVPlayer]

void removeAll()

Remove all entries from the playlist.

seekToTime[AVPlayer]

void seekToTime(float secs)

setLoops[AVPlayer]

void setLoops(bool loops)

Set whether or not the playlist loops.

setRate[AVPlayer]

void setRate(float rate)

Set the current playback rate.

setVolume[AVPlayer]

void setVolume(float vol)

Set the audio volume.

status[AVPlayer]

string status()

volume[AVPlayer]

float volume()

Return the current audio volume setting.

Clipboard

getString

static string getString()

Returns the string value from the current general clipboard.

setData

static bool setData(ArrayBuffer data, string datatype)

Sets the data value for datatype in the current general clipboard. Returns true on success.

setString

static bool setString(string str)

Sets the string value for the current general clipboard. Returns true on success.

gl.MagicProgram

MagicProgram

new MagicProgram(gl, program)

Create a MagicProgram object, which is a wrapper around a GLSL program to make it easier to access uniforms and attribs.

createFromBasename

static MagicProgram createFromBasename(gl, directory, base, opts)

Create a new MagicProgram from the vertex shader source in file base.vshader and the fragment shader source in file base.fshader in the directory directory.

// Creates a magic program from myshader.vshader and myshader.fshader in
// the same directory as the running source JavaScript file.
var mp = MagicProgram.createFromBasename(gl, __dirname, 'myshader');

createFromFiles

static MagicProgram createFromFiles(gl, vfilename, ffilename, opts)

Create a new MagicProgram from the vertex shader source in file vfilename and the fragment shader source in file ffilename.

If opts is supplied and opts.watch is true, the files will be watched for changes and automatically reloaded with a success or failure message printed to the console.

createFromStrings

static MagicProgram createFromStrings(gl, string vstr, string fstr)

Create a new MagicProgram from the vertex shader source string vstr and the fragment shader source string fstr.

relink

use

Mat3

Mat3

new Mat3()

Constructs an identity matrix.

Mat3 represents an 3x3 matrix. The elements are, using mathematical notation numbered starting from 1 as aij, where i is the row and j is the column:

a11 a12 a13
a21 a22 a23
a31 a32 a33

Almost all operations are multiplies to the current matrix, and happen in place. You can use dup to return a copy. Most operations return this to support chaining.

It is common to use toFloat32Array to get a Float32Array in OpenGL (column major) memory ordering. NOTE: The code tries to be explicit about whether things are row major or column major, but remember that GLSL works in column major ordering, and this code generally uses row major ordering.

adjoint

this adjoint()

Reference: http://en.wikipedia.org/wiki/Adjugate_matrix

debugString

determinant

float determinant()

dup

Mat3 dup()

Return a new copy of the matrix.

invert

this invert()

Invert the matrix. The matrix must be invertible.

inverted

Mat3 inverted()

Return an inverted matrix. The matrix must be invertible.

mul

this mul(Mat3 b)

Matrix multiply this = this * b

mul2

this mul2(Mat3 a, Mat3 b)

Matrix multiply this = a * b

mulVec2

Vec2 mulVec2(Vec2 v)

Multiply Vec2 v by the current matrix, returning a Vec2 of this * v. Ignores perspective (only applies scale and translation).

mulVec2p

Vec2 mulVec2p(Vec2 v)

Multiply Vec2 v by the current matrix and perform a perspective divide. Implies that the missing z component of v would be 1.

mulVec3

Vec3 mulVec3(Vec3 v)

Multiply Vec3 v by the current matrix, returning a Vec3 of this * v.

negate

this negate()

pmapQuadQuad

this pmapQuadQuad(x0, y0, x1, y1, x2, y2, x3, y3,
                  u0, v0, u1, v1, u2, v2, u3, v3)

Overwrite this with a matrix that maps from (x0,y0) .. (x3,y3) to (u0,v0) .. (u3,v3). NOTE: This is sensitive to the coordinate ordering, they should follow the pattern as pmapSquareQuad.

Reference: Paul Heckbert "Fundamentals of Texture Mapping and Image Warping"

pmapSquareQuad

this pmapSquareQuad(x0, y0, x1, y1, x2, y2, x3, y3)

Find mapping between (0, 0), (1, 0), (1, 1), (0, 1) to (x0,y0) .. (x3, y3).

reset

this reset()

Reset to the identity matrix.

set3x3r

this set3x3r(a11, a12, a13, a21, a22, a23, a31, a32, a33)

Set the full 9 elements of the 3x3 matrix, arguments in row major order. The elements are specified in row major order.

toFloat32Array

Float32Array toFloat32Array()

Return a Float32Array in suitable column major order for WebGL.

transpose

this transpose()

Transpose the matrix, rows become columns and columns become rows.

Mat4

Mat4

new Mat4()

Constructs an identity matrix.

Mat4 represents an 4x4 matrix. The elements are, using mathematical notation numbered starting from 1 as aij, where i is the row and j is the column:

a11 a12 a13 a14
a21 a22 a23 a24
a31 a32 a33 a34
a41 a42 a43 a44

Almost all operations are multiplies to the current matrix, and happen in place. You can use dup to return a copy. Most operations return this to support chaining.

It is common to use toFloat32Array to get a Float32Array in OpenGL (column major) memory ordering. NOTE: The code tries to be explicit about whether things are row major or column major, but remember that GLSL works in column major ordering, and this code generally uses row major ordering.

debugString

dup

Mat4 dup()

Return a new copy of the matrix.

frustum

this frustum(l, r, b, t, n, f)

Multiply by a frustum matrix computed from left, right, bottom, top, near, and far.

invert

this invert()

Invert the matrix. The matrix must be invertible.

inverted

Mat4 inverted()

Return an inverted matrix. The matrix must be invertible.

lookAt

this lookAt(ex, ey, ez, cx, cy, cz, ux, uy, uz)

Multiply by a look at matrix, computed from the eye, center, and up points.

mul

this mul(b)

Matrix multiply this = this * b

mul2

this mul2(a, b)

Matrix multiply this = a * b

mul4x4r

this mul4x4r(b11, b12, b13, b14, b21, b22, b23, b24,
             b31, b32, b33, b34, b41, b42, b43, b44)

Multiply the current matrix by 16 elements that would compose a Mat4 object, but saving on creating the object. this = this * b. The elements are specified in row major order.

mulVec3

Vec3 mulVec3(Vec3 v)

Multiply Vec3 v by the current matrix, returning a Vec3 of this * v.

mulVec3p

Vec3 mulVec3p(Vec3 v)

Multiply Vec3 v by the current matrix, returning a Vec3 of this * v. Performs the perspective divide by w.

mulVec4

Vec4 mulVec4(Vec4 v)

Multiply Vec4 v by the current matrix, returning a Vec4 of this * v.

ortho

this ortho(l, r, b, t, n, f)

Multiply by a orthographic matrix, computed from the clipping planes.

perspective

this perspective(fovy, aspect, znear, zfar)

Multiply by a perspective matrix, computed from the field of view, aspect ratio, and the z near and far planes.

reset

this reset()

Reset to the identity matrix.

rotate

this rotate(theta, x, y, z)

IN RADIANS, not in degrees like OpenGL. Rotate about x, y, z. The caller must supply x, y, z as a unit vector.

scale

this scale(x, y, z)

Multiply by a scale of x, y, and z.

set4x4c

this set4x4c(a11, a21, a31, a41, a12, a22, a32, a42,
             a13, a23, a33, a43, a14, a24, a34, a44)

Set the full 16 elements of the 4x4 matrix, arguments in column major order.

set4x4r

this set4x4r(a11, a12, a13, a14, a21, a22, a23, a24,
             a31, a32, a33, a34, a41, a42, a43, a44)

Set the full 16 elements of the 4x4 matrix, arguments in row major order.

toFloat32Array

Float32Array toFloat32Array()

Return a Float32Array in suitable column major order for WebGL.

translate

this translate(x, y, z)

Multiply by a translation of x, y, and z.

transpose

this transpose()

Transpose the matrix, rows become columns and columns become rows.

NSOpenGLContext

NSOpenGLContext

activeTexture[WebGL 1.0]

void activeTexture(GLenum texture)

attachShader[WebGL 1.0]

void attachShader(WebGLProgram program, WebGLShader shader)

beginTransformFeedback[WebGL 2.0]

void beginTransformFeedback(GLenum primitiveMode)

bindAttribLocation[WebGL 1.0]

void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name)

bindBuffer[WebGL 1.0]

void bindBuffer(GLenum target, WebGLBuffer buffer)

bindBufferBase[WebGL 2.0]

void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer)

bindBufferRange[WebGL 2.0]

void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer,
                     GLintptr offset, GLsizeiptr size)

bindFramebuffer[WebGL 1.0]

void bindFramebuffer(GLenum target, WebGLFramebuffer framebuffer)

bindRenderbuffer[WebGL 1.0]

void bindRenderbuffer(GLenum target, WebGLRenderbuffer renderbuffer)

bindTexture[WebGL 1.0]

void bindTexture(GLenum target, WebGLTexture texture)

bindTransformFeedback

void bindTransformFeedback (GLenum target, WebGLTransformFeedback? transformFeedback)

bindVertexArray[WebGL 2.0]

void bindVertexArray(WebGLVertexArrayObject? vertexArray)

blendColor[WebGL 1.0]

void blendColor(GLclampf red, GLclampf green,
                GLclampf blue, GLclampf alpha)

blendEquation[WebGL 1.0]

void blendEquation(GLenum mode)

blendEquationSeparate[WebGL 1.0]

void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)

blendFunc[WebGL 1.0]

void blendFunc(GLenum sfactor, GLenum dfactor)

blendFuncSeparate[WebGL 1.0]

void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
                       GLenum srcAlpha, GLenum dstAlpha)

blit

blitFramebuffer[WebGL 2.0]

void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
                     GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
                     GLbitfield mask, GLenum filter)

bufferData[WebGL 1.0]

void bufferData(GLenum target, GLsizei size, GLenum usage)
void bufferData(GLenum target, ArrayBufferView data, GLenum usage)
void bufferData(GLenum target, ArrayBuffer data, GLenum usage)

bufferSubData[WebGL 1.0]

void bufferSubData(GLenum target, GLsizeiptr offset, ArrayBufferView data)
void bufferSubData(GLenum target, GLsizeiptr offset, ArrayBuffer data)

checkFramebufferStatus[WebGL 1.0]

GLenum checkFramebufferStatus(GLenum target)

clear[WebGL 1.0]

void clear(GLbitfield mask)

clearColor[WebGL 1.0]

void clearColor(GLclampf red, GLclampf green,
                GLclampf blue, GLclampf alpha)

clearDepth[WebGL 1.0]

void clearDepth(GLclampf depth)

clearStencil[WebGL 1.0]

void clearStencil(GLint s)

colorMask[WebGL 1.0]

void colorMask(GLboolean red, GLboolean green,
               GLboolean blue, GLboolean alpha)

compileShader[WebGL 1.0]

void compileShader(WebGLShader shader)

compressedTexImage2D[WebGL 1.0]

void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
                          GLsizei width, GLsizei height, GLint border,
                          ArrayBufferView data)

createBuffer[WebGL 1.0]

WebGLBuffer createBuffer()

createFramebuffer[WebGL 1.0]

WebGLFramebuffer createFramebuffer()

createProgram[WebGL 1.0]

WebGLProgram createProgram()

createRenderbuffer[WebGL 1.0]

WebGLRenderbuffer createRenderbuffer()

createShader[WebGL 1.0]

WebGLShader createShader(GLenum type)

createSyphonClient

createSyphonServer

createTexture[WebGL 1.0]

WebGLTexture createTexture()

createTransformFeedback[WebGL 2.0]

WebGLTransformFeedback? createTransformFeedback()

createVertexArray[WebGL 2.0]

WebGLVertexArrayObject? createVertexArray()

cullFace[WebGL 1.0]

void cullFace(GLenum mode)

deleteBuffer[WebGL 1.0]

void deleteBuffer(WebGLBuffer buffer)

deleteFramebuffer[WebGL 1.0]

void deleteFramebuffer(WebGLFramebuffer framebuffer)

deleteProgram[WebGL 1.0]

void deleteProgram(WebGLProgram program)

deleteRenderbuffer[WebGL 1.0]

void deleteRenderbuffer(WebGLRenderbuffer renderbuffer)

deleteShader[WebGL 1.0]

void deleteShader(WebGLShader shader)

deleteTexture[WebGL 1.0]

void deleteTexture(WebGLTexture texture)

deleteTransformFeedback[WebGL 2.0]

void deleteTransformFeedback(WebGLTransformFeedback? vertexArray)

deleteVertexArray[WebGL 2.0]

void deleteVertexArray(WebGLVertexArrayObject? vertexArray)

depthFunc[WebGL 1.0]

void depthFunc(GLenum func)

depthMask[WebGL 1.0]

void depthMask(GLboolean flag)

depthRange[WebGL 1.0]

void depthRange(GLclampf zNear, GLclampf zFar)

detachShader[WebGL 1.0]

void detachShader(WebGLProgram program, WebGLShader shader)

disable[WebGL 1.0]

void disable(GLenum cap)

disableVertexAttribArray[WebGL 1.0]

void disableVertexAttribArray(GLuint index)

drawArrays[WebGL 1.0]

void drawArrays(GLenum mode, GLint first, GLsizei count)

drawArraysInstanced[WebGL 2.0]

void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)

drawBuffers[WebGL 2.0]

void DrawBuffersARB(sizei n, const enum *bufs);

drawElements[WebGL 1.0]

void drawElements(GLenum mode, GLsizei count,
                  GLenum type, GLsizeiptr offset)

drawElementsInstanced[WebGL 2.0]

void drawElementsInstanced(GLenum mode, GLsizei count,
                           GLenum type, GLintptr offset,
                           GLsizei instanceCount)

drawRangeElements[WebGL 2.0]

void drawRangeElements(GLenum mode,
                       GLuint start, GLuint end,
                       GLsizei count, GLenum type, GLintptr offset)

drawSkCanvas

enable[WebGL 1.0]

void enable(GLenum cap)

enableVertexAttribArray[WebGL 1.0]

void enableVertexAttribArray(GLuint index)

endTransformFeedback[WebGL 2.0]

void endTransformFeedback()

finish[WebGL 1.0]

void finish()

flush[WebGL 1.0]

void flush()

framebufferRenderbuffer[WebGL 1.0]

void framebufferRenderbuffer(GLenum target, GLenum attachment,
                             GLenum renderbuffertarget,
                             WebGLRenderbuffer renderbuffer)

framebufferTexture2D[WebGL 1.0]

void framebufferTexture2D(GLenum target, GLenum attachment,
                          GLenum textarget, WebGLTexture texture,
                          GLint level)

frontFace[WebGL 1.0]

void frontFace(GLenum mode)

generateMipmap[WebGL 1.0]

void generateMipmap(GLenum target)

getActiveAttrib[WebGL 1.0]

WebGLActiveInfo getActiveAttrib(WebGLProgram program, GLuint index)

getActiveUniform[WebGL 1.0]

WebGLActiveInfo getActiveUniform(WebGLProgram program, GLuint index)

getAttachedShaders[WebGL 1.0]

WebGLShader[ ] getAttachedShaders(WebGLProgram program)

getAttribLocation[WebGL 1.0]

GLint getAttribLocation(WebGLProgram program, DOMString name)

getBufferParameter[WebGL 1.0]

any getBufferParameter(GLenum target, GLenum pname)

getBufferSubData[WebGL 2.0]

void getBufferSubData(GLenum target, GLintptr offset, ArrayBuffer? returnedData)

getError[WebGL 1.0]

GLenum getError()

getExtension[WebGL 1.0]

object? getExtension(DOMString name)

getFramebufferAttachmentParameter[WebGL 1.0]

any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
                                      GLenum pname)

getParameter[WebGL 1.0]

any getParameter(GLenum pname)

getProgramInfoLog[WebGL 1.0]

DOMString getProgramInfoLog(WebGLProgram program)

getProgramParameter[WebGL 1.0]

any getProgramParameter(WebGLProgram program, GLenum pname)

getShaderInfoLog[WebGL 1.0]

DOMString getShaderInfoLog(WebGLShader shader)

getShaderParameter[WebGL 1.0]

any getShaderParameter(WebGLShader shader, GLenum pname)

getShaderSource[WebGL 1.0]

DOMString getShaderSource(WebGLShader shader)

getSupportedExtensions[WebGL 1.0]

sequence<DOMString>? getSupportedExtensions()

getTexParameter[WebGL 1.0]

any getTexParameter(GLenum target, GLenum pname)

getTransformFeedbackVarying[WebGL 2.0]

WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram? program, GLuint index)

getUniform[WebGL 1.0]

any getUniform(WebGLProgram program, WebGLUniformLocation location)

getUniformLocation[WebGL 1.0]

WebGLUniformLocation getUniformLocation(WebGLProgram program,
                                        DOMString name)

hint[WebGL 1.0]

void hint(GLenum target, GLenum mode)

isBuffer[WebGL 1.0]

GLboolean isBuffer(WebGLBuffer buffer)

isEnabled[WebGL 1.0]

GLboolean isEnabled(GLenum cap)

isFramebuffer[WebGL 1.0]

GLboolean isFramebuffer(WebGLFramebuffer framebuffer)

isProgram[WebGL 1.0]

GLboolean isProgram(WebGLProgram program)

isRenderbuffer[WebGL 1.0]

GLboolean isRenderbuffer(WebGLRenderbuffer renderbuffer)

isShader[WebGL 1.0]

GLboolean isShader(WebGLShader shader)

isTexture[WebGL 1.0]

GLboolean isTexture(WebGLTexture texture)

isTransformFeedback[WebGL 2.0]

GLboolean isTransformFeedback(WebGLTransformFeedback? vertexArray)

isVertexArray[WebGL 2.0]

GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray)

lineWidth[WebGL 1.0]

void lineWidth(GLfloat width)

linkProgram[WebGL 1.0]

void linkProgram(WebGLProgram program)

makeCurrentContext

pauseTransformFeedback[WebGL 2.0]

void pauseTransformFeedback()

pixelStorei[WebGL 1.0]

void pixelStorei(GLenum pname, GLint param)

polygonOffset[WebGL 1.0]

void polygonOffset(GLfloat factor, GLfloat units)

popAllState

pushAllState

readPixels[WebGL 1.0]

void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
                GLenum format, GLenum type, ArrayBufferView pixels)

renderbufferStorage[WebGL 1.0]

void renderbufferStorage(GLenum target, GLenum internalformat,
                         GLsizei width, GLsizei height)

renderbufferStorageMultisample[WebGL 2.0]

void renderbufferStorageMultisample(GLenum target, GLsizei samples,
                                    GLenum internalformat,
                                    GLsizei width, GLsizei height)

resetSkiaContext

resumeTransformFeedback[WebGL 2.0]

void resumeTransformFeedback()

sampleCoverage[WebGL 1.0]

void sampleCoverage(GLclampf value, GLboolean invert)

scissor[WebGL 1.0]

void scissor(GLint x, GLint y, GLsizei width, GLsizei height)

setSwapInterval

void setSwapInterval(int interval)

Sets the swap interval, aka vsync. Ex: 1 for vsync and 0 for no sync. This will normally be handled for you by the simpleWindow vsync setting.

shaderSource[WebGL 1.0]

void shaderSource(WebGLShader shader, DOMString source)

shaderSourceRaw

void shaderSourceRaw(WebGLShader shader, DOMString source)

stencilFunc[WebGL 1.0]

void stencilFunc(GLenum func, GLint ref, GLuint mask)

stencilFuncSeparate[WebGL 1.0]

void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)

stencilMask[WebGL 1.0]

void stencilMask(GLuint mask)

stencilMaskSeparate[WebGL 1.0]

void stencilMaskSeparate(GLenum face, GLuint mask)

stencilOp[WebGL 1.0]

void stencilOp(GLenum fail, GLenum zfail, GLenum zpass)

stencilOpSeparate[WebGL 1.0]

void stencilOpSeparate(GLenum face, GLenum fail,
                       GLenum zfail, GLenum zpass)

texImage2D[WebGL 1.0]

void texImage2D(GLenum target, GLint level, GLenum internalformat,
                GLsizei width, GLsizei height, GLint border,
                GLenum format, GLenum type, ArrayBufferView pixels)
void texImage2D(GLenum target, GLint level, GLenum internalformat,
                GLenum format, GLenum type, ImageData pixels)
void texImage2D(GLenum target, GLint level, GLenum internalformat,
                GLenum format, GLenum type, HTMLImageElement image)
void texImage2D(GLenum target, GLint level, GLenum internalformat,
                GLenum format, GLenum type, HTMLCanvasElement canvas)
void texImage2D(GLenum target, GLint level, GLenum internalformat,
                GLenum format, GLenum type, HTMLVideoElement video)

texImage2DSkCanvasB

texParameterf[WebGL 1.0]

void texParameterf(GLenum target, GLenum pname, GLfloat param)

texParameteri[WebGL 1.0]

void texParameteri(GLenum target, GLenum pname, GLint param)

texSubImage2D[WebGL 1.0]

transformFeedbackVaryings[WebGL 2.0]

void transformFeedbackVaryings(WebGLProgram? program,
                               sequence<DOMString> varyings,
                               GLenum bufferMode)

uniform1f[WebGL 1.0]

void uniform1f(WebGLUniformLocation location, GLfloat x)

uniform1fv[WebGL 1.0]

void uniform1fv(WebGLUniformLocation location, Float32Array v)
void uniform1fv(WebGLUniformLocation location, sequence v)

uniform1i[WebGL 1.0]

void uniform1i(WebGLUniformLocation location, GLint x)

uniform1iv[WebGL 1.0]

void uniform1iv(WebGLUniformLocation location, Int32Array v)
void uniform1iv(WebGLUniformLocation location, sequence v)

uniform2f[WebGL 1.0]

void uniform2f(WebGLUniformLocation location, GLfloat x, GLfloat y)

uniform2fv[WebGL 1.0]

void uniform2fv(WebGLUniformLocation location, Float32Array v)
void uniform2fv(WebGLUniformLocation location, sequence v)

uniform2i[WebGL 1.0]

void uniform2i(WebGLUniformLocation location, GLint x, GLint y)

uniform2iv[WebGL 1.0]

void uniform2iv(WebGLUniformLocation location, Int32Array v)
void uniform2iv(WebGLUniformLocation location, sequence v)

uniform3f[WebGL 1.0]

void uniform3f(WebGLUniformLocation location, GLfloat x, GLfloat y,
               GLfloat z)

uniform3fv[WebGL 1.0]

void uniform3fv(WebGLUniformLocation location, Float32Array v)
void uniform3fv(WebGLUniformLocation location, sequence v)

uniform3i[WebGL 1.0]

void uniform3i(WebGLUniformLocation location, GLint x, GLint y, GLint z)

uniform3iv[WebGL 1.0]

void uniform3iv(WebGLUniformLocation location, Int32Array v)
void uniform3iv(WebGLUniformLocation location, sequence v)

uniform4f[WebGL 1.0]

void uniform4f(WebGLUniformLocation location, GLfloat x, GLfloat y,
               GLfloat z, GLfloat w)

uniform4fv[WebGL 1.0]

void uniform4fv(WebGLUniformLocation location, Float32Array v)
void uniform4fv(WebGLUniformLocation location, sequence v)

uniform4i[WebGL 1.0]

void uniform4i(WebGLUniformLocation location, GLint x, GLint y,
               GLint z, GLint w)

uniform4iv[WebGL 1.0]

void uniform4iv(WebGLUniformLocation location, Int32Array v)
void uniform4iv(WebGLUniformLocation location, sequence v)

uniformMatrix2fv[WebGL 1.0]

void uniformMatrix2fv(WebGLUniformLocation location, GLboolean transpose,
                      Float32Array value)
void uniformMatrix2fv(WebGLUniformLocation location, GLboolean transpose,
                      sequence value)

uniformMatrix3fv[WebGL 1.0]

void uniformMatrix3fv(WebGLUniformLocation location, GLboolean transpose,
                      Float32Array value)
void uniformMatrix3fv(WebGLUniformLocation location, GLboolean transpose,
                      sequence value)

uniformMatrix4fv[WebGL 1.0]

void uniformMatrix4fv(WebGLUniformLocation location, GLboolean transpose,
                      Float32Array value)
void uniformMatrix4fv(WebGLUniformLocation location, GLboolean transpose,
                      sequence value)

useProgram[WebGL 1.0]

void useProgram(WebGLProgram program)

validateProgram[WebGL 1.0]

void validateProgram(WebGLProgram program)

vertexAttrib1f[WebGL 1.0]

void vertexAttrib1f(GLuint indx, GLfloat x)
void vertexAttrib1fv(GLuint indx, Float32Array values)
void vertexAttrib1fv(GLuint indx, sequence values)

vertexAttrib2f[WebGL 1.0]

void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
void vertexAttrib2fv(GLuint indx, Float32Array values)
void vertexAttrib2fv(GLuint indx, sequence values)

vertexAttrib3f[WebGL 1.0]

void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
void vertexAttrib3fv(GLuint indx, Float32Array values)
void vertexAttrib3fv(GLuint indx, sequence values)

vertexAttrib4f[WebGL 1.0]

void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y,
                    GLfloat z, GLfloat w)
void vertexAttrib4fv(GLuint indx, Float32Array values)
void vertexAttrib4fv(GLuint indx, sequence values)

vertexAttribDivisor[WebGL 2.0]

void vertexAttribDivisor(GLuint index, GLuint divisor)

vertexAttribPointer[WebGL 1.0]

void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
                         GLboolean normalized, GLsizei stride,
                         GLsizeiptr offset)

viewport[WebGL 1.0]

void viewport(GLint x, GLint y, GLsizei width, GLsizei height)

writeImage

void writeImage(filetype, filename, opts)

NSWindow

NSWindow

associateMouse

void associateMouse(bool connted)

Sets whether the mouse and the mouse cursor are connected (whether moving the mouse moves the cursor).

center

void center()

Position the window in the center of the screen.

getClipboardString

static string getClipboardString()

Returns the string value from the current general clipboard.

hide

void hide()

Hide the window.

hideCursor

void hideCursor()

Hide the cursor.

popCursor

void popCursor(string name)

Pop the cursor from the top of the cursor stack.

pushCursor

void pushCursor(string name)

Sets the cursor to name using the cursor stack.

screenSize

object screenSize()

Returns an object {width: float, height: float} of the screen size of the main screen the window is currently on.

screensInfo

object[ ] screensInfo()

Returns an array of objects representing info about each screen. The objects have {id: int, width: float, height: float, highdpi: float}.

setClipboardData

static bool setClipboardData(TypedArray data, string datatype)

Sets the data value for datatype in the current general clipboard. Returns true on success.

setClipboardString

static bool setClipboardString(str)

Sets the string value for the current general clipboard. Returns true on success.

setCursor

void setCursor(string name)

Sets the cursor to name.

setCursorPosition

void setCursorPosition(float x, float y)

Set the cursor position (within the main display).

setEventCallback

You should only really call this once, it's a pretty raw function.

setFrameTopLeftPoint

setFullscreen

void setFullscreen(bool fullscreen)

Switches the window in and out of "fullscreen". Fullscreen means that the window is borderless and on a higher window level.

setTitle

void setTitle(string title)

Sets the title shown in the frame at the top of the window.

show

void show()

Un-hide the window.

unhideCursor

void unhideCursor()

Un-hide the cursor.

warpCursorPosition

void warpCursorPosition(float x, float y)

Set the cursor position (in global display coordinate space), without generating any events.

SkCanvas

create

static SkCanvas create(width, height)

Create a bitmap SkCanvas with the specified size.

createForPDF

static SkCanvas createForPDF(filename, page_width, page_height, content_width, content_height)

Create a new vector-mode SkCanvas that can be written to a PDF with writePDF.

createFromImage

static SkCanvas createFromImage(filename)

Create a bitmap SkCanvas with the size/pixels from an image filename.

createFromImageData

static SkCanvas createFromImageData(data)

Create a bitmap SkCanvas with the size/pixels from an image data.

SkCanvas

clear

void clear(r, g, b, a)

Sets the entire canvas to a uniform color.

clipPath

void clipPath(path)

Set the clipping path to the SkPath object path. Setting the clipping path will prevent any pixels to be drawn outside of this path.

The save() and restore() functions are the best way to manage or reset the clipping path.

clipRect

void clipRect(left, top, right, bottom)

Set the clipping path to the rectangle of the upper-left and bottom-right corners specified. Setting the clipping path will prevent any pixels to be drawn outside of this path.

The save() and restore() functions are the best way to manage or reset the clipping path.

concatMatrix

void concatMatrix(a, b, c, d, e, f, g, h, i)

Preconcat the current matrix with the specified matrix.

drawCanvas

void drawCanvas(paint, source, dst_left, dst_top, dst_right, dst_bottom, src_left, src_top, src_right, src_bottom)

Draw one canvas on to another canvas. The paint object controls settings involved in the drawing, such as anti-aliasing. The source parameter is the source canvas to be drawn from. The first four parameters define the rectangle within the destination canvas that the image will be drawn. The last four parameters specify the rectangle within the source image. This allows for drawing portions of the source image, scaling, etc.

The last four parameters are optional, and will default to the entire source image (0, 0, source.width, source.height).

var img = plask.SkCanvas.createFromImage('tex.png');  // Size 100x150.
// Draw the texture image scaled 2x larger.
canvas.drawCanvas(paint, img,
                  0, 0, 200, 300,  // Draw at (0, 0) size 200x300.
                  0, 0, 100, 150)  // Draw the entire source image.

drawCircle

void drawCircle(paint, x, y, radius)

Draw a circle centered at (x, y) of radius radius.

drawColor

void drawColor(r, g, b, a, blendmode)

Fill the entire canvas with a solid color. If blendmode is not specified, it defaults to SrcOver, which will blend with anything already on the canvas.

Use eraseColor() when you do not need any alpha blending.

drawLine

void drawLine(paint, x0, y0, x1, y1)

Draw a line between (x0, y0) and (x1, y1).

drawPaint

void drawPaint(paint)

Fill the entire canvas with a solid color, specified by the paint's color and blending mode.

drawPath

void drawPath(paint, path)

Draw an SkPath. The path will be stroked or filled depending on the paint's style (see SkPaint#setStyle).

drawPoints

void drawPoints(paint, mode, points)

An optimized drawing path for many points, lines, or polygons with many points. The mode parameter is one of kPointsPointMode, kLinesPointMode, or kPolygonPointMode. The points parameter is an array of points, in the form of [x0, y0, x1, y1, ...].

drawRect

void drawRect(paint, left, top, right, bottom)

Draw a rectangle specified by the upper-left and bottom-right corners.

drawRoundRect

void drawRoundRect(paint, left, top, right, bottom, xradius, yradius)

Draw a rectangle with rounded corners of radius xradius and yradius.

drawText

void drawText(paint, str, x, y)

Draw the string str with the bottom left corner starting at (x, y).

drawTextOnPathHV

void drawTextOnPathHV(paint, path, str, hoffset, voffset)

Draw the string str along the path path, starting along the path at hoffset and above or below the path by voffset.

flush

void flush()

Flushes any pending operations to the underlying surface, for example when using a GPU backed canvas. Normally this will be called for you at the appropriate place before drawing, so it is unlikely to call it directly.

resetMatrix

void resetMatrix()

Reset the transform matrix to the identity.

restore

void restore()

Restore the transform matrix from the matrix stack.

rotate

void rotate(degrees)

Rotate the canvas by degrees degrees (not radians).

save

void save()

Save the transform matrix to the matrix stack.

saveLayer

scale

void scale(x, y)

Scale the canvas by x and y.

setMatrix

void setMatrix(a, b, c, d, e, f, g, h, i)

Sets the the 3x3 homogeneous transformation matrix:

|a b c|
|d e f|
|g h i|

skew

void skew(x, y)

Skew the canvas by x and y.

translate

void translate(x, y)

Translate the canvas by x and y.

writeImage

void writeImage(typestr, filename)

Write the current contents of the canvas as an image named filename. The typestr parameter selects the image format. Currently only 'png' is supported.

writePDF

void writePDF()

Write the contents of a vector-mode SkCanvas (created with createForPDF) to the filename supplied when created with createForPDF.

The canvas is no longer usable after a call to writePDF. A PDF can only be written once and no further calls can be made on the canvas.

SkPaint

SkPaint

clearPathEffect

void clearPathEffect()

Clear any path effect.

clearShader

void clearShader()

getFillPath

getFilterLevel

int getFilterLevel()

Get the filtering level (quality vs performance) for scaled images.

getFlags

void getFlags()

Return the paint flags.

getFontMetrics

getStrokeCap

int getStrokeCap()

Return the current stroke cap.

getStrokeJoin

int getStrokeJoin()

Returns the current stroke join setting.

getStrokeMiter

float getStrokeMiter()

Returns the current stroke miter setting.

getStrokeWidth

void getStrokeWidth()

Return the current stroke width.

getStyle

void getStyle()

Return the current style.

getTextPath

void getTextPath(text, x, y, path)

measureText

float measureText(string text)

Measure the x-advance for the string text using the current paint settings.

measureTextBounds

float[ ] measureTextBounds(string text)

Returns an array of the bounds [left, top, right, bottom] for text.

reset

void reset()

Reset the paint to the default settings.

setAlpha

void setAlpha(float a)

Set the alpha of the paint color, leaving rgb unchanged.

setAntiAlias

void setAntiAlias(bool aa)

setAutohinted

void setAutohinted(bool autohint)

setColor

void setColor(r, g, b, a)

Set the paint color, values are integers in the range of 0 to 255.

setColorHSV

void setColorHSV(h, s, v, a)

Set the paint color from HSV values, the HSV values are floating point, hue from 0 to 360, and saturation and value from 0 to 1. The alpha value is an integer in the range of 0 to 255.

setDashPathEffect

setDevKernText

void setDevKernText(bool devkern)

setDiscretePathEffect

setDither

void setDither(bool dither)

setFakeBoldText

void setFakeBoldText(bool fakebold)

setFill

void setFill()

Sets the current paint style to fill.

setFillAndStroke

void setFillAndStroke()

Sets the current paint style to fill and stroke.

setFilterLevel

void setFilterLevel(int level)

Set the filtering level (quality vs performance) for scaled images.

// kNoneFilterLevel
// kLowFilterLevel
// kMediumFilterLevel
// kHighFilterLevel

setFlags

void setFlags(flags)

Set the paint flags, such as whether to perform anti-aliasing.

// The follow flags are supported.  They should be OR'd together to set
// multiple settings.
//   kAntiAliasFlag
//   kFilterBitmapFlag
//   kDitherFlag
//   kUnderlineTextFlag
//   kStrikeThruTextFlag
//   kFakeBoldTextFlag
//   kLinearTextFlag
//   kSubpixelTextFlag
//   kDevKernTextFlag

paint.setFlags(paint.kAntiAliasFlag | paint.kFilterBitmapFlag);

setFontFamily

void setFontFamily(family)

Set the text font family.

setFontFamilyPostScript

setLCDRenderText

void setLCDRenderText(bool lcd)

setLinearGradientShader

void setLinearGradientShader(x0, y0, x1, y1, float[ ] colorpositions)

setRadialGradientShader

void setRadialGradientShader(x, y, radius, float[ ] colorpositions)

setStrikeThruText

void setStrikeThruText(bool strike)

setStroke

void setStroke()

Sets the current paint style to stroke.

setStrokeCap

void setStrokeCap(int cap)

Set the stroke cap.

// The follow caps are supported:
//   kButtCap
//   kRoundCap
//   kSquareCap
//   kDefaultCap

paint.setStrokeCape(paint.kRoundCap);

setStrokeJoin

void setStrokeJoin(int join)

setStrokeMiter

float setStrokeMiter(float miter)

setStrokeWidth

void setStrokeWidth(width)

Set the current stroke width to the floating point value width. A width of 0 causes Skia to draw in a special 'hairline' stroking mode.

setStyle

void setStyle(style)

Set the paint style, for example whether to stroke, fill, or both.

// The follow styles are supported:
//   kFillStyle
//   kStrokeStyle
//   kStrokeAndFillStyle

paint.setStyle(paint.kStrokeStyle);

setSubpixelText

void setSubpixelText(bool subpixel)

setTextSize

void setTextSize(size)

Set the text size.

setUnderlineText

void setUnderlineText(bool underline)

setXfermodeMode

void setXfermodeMode(mode)

Set the alpha blending (porter duff transfer) mode.

// The following blending modes are supported:
//   kClearMode
//   kSrcMode
//   kDstMode
//   kSrcOverMode
//   kDstOverMode
//   kSrcInMode
//   kDstInMode
//   kSrcOutMode
//   kDstOutMode
//   kSrcATopMode
//   kDstATopMode
//   kXorMode
//   kPlusMode
//   kMultiplyMode
//   kScreenMode
//   kOverlayMode
//   kDarkenMode
//   kLightenMode
//   kColorDodgeMode
//   kColorBurnMode
//   kHardLightMode
//   kSoftLightMode
//   kDifferenceMode
//   kExclusionMode

paint.setXfermodeMode(paint.kPlusMode);  // Additive blending.

SkPath

SkPath

void SkPath(SkPath? path_to_copy)

Construct a new path object, optionally based off of an existing path.

addCircle

addOval

addRect

arcTo

void arcTo(float x0, float y0, float x1, float y1,
           float startAngle, float sweepAngle, float forceMoveto)

Create an arc inside the rectangle (x0, y0) (x1, y1), sweeping clockwise from startAngle by the amount sweepAngle (in degrees).

arct

void arct(float x0, float y0, float x1, float y1, float radius);

Like HTML5 arcTo, specified by tangents and radius.

close

void close()

Close the path, connecting the path to the beginning.

contains

bool contains(float x, float y)

Returns true of (x, y) is contained in the path, taking the winding on the path into account.

cubicTo

void cubicTo(c0x, c0y, c1x, c1y, ex, ey)

A cubic bezier curve with control points (c0x, c0y) and (c1x, c1y) and endpoint (ex, ey).

fromSVGString

bool fromSVGString(string svgpath)

Sets the path from an SVG path data representation. Returns true on success.

getBounds

float[ ] getBounds()

Returns an array of [left, top, right, bottom], the bounding rectangle of the path.

getFillType

int getFillType()

getPoints

float[] getPoints()

getVerbs

float[] getVerbs()

lineTo

void lineTo(x, y)

Line to (x, y).

moveTo

void moveTo(x, y)

Move to (x, y).

offset

void offset(x, y)

Offset the path by (x, y).

op

bool op(SkPath one, SkPath two, int pathop)

Sets the path to the result of the operation pathop on one and two.

quadTo

void quadTo(cx, cy, ex, ey)

A quadratic bezier curve with control point (cx, cy) and endpoint (ex, ey).

rLineTo

void rLineTo(rx, ry)

Similar to lineTo(), except rx and ry are relative to the previous point.

reset

void reset()

Reset the path to an empty path.

rewind

void rewind()

Reset the path to an empty path, but keeping the internal memory previously allocated for the point storage.

setFillType

void setFillType(int)

simplify

bool simplify(SkPath one)

Sets the path to the result of simplifying one.

toSVGString

string toSVGString()

Returns the path as a SVG path data representation.

transform

void transform(a, b, c, d, e, f, g, h, i)

Transforms the path by the 3x3 homogeneous transformation matrix:

|a b c|
|d e f|
|g h i|

Vec2

Vec2

new Vec2(x, y)

Constructs a 2d vector (x, y).

add

this add(Vec2 b)

Add a Vec2, this = this + b.

add2

this add2(Vec2 a, Vec2 b)

Add two Vec2s, this = a + b.

added

Vec2 added(Vec2 b)

Add a Vec2, returning the result as a new Vec2.

debugString

det

Vec2 det(Vec2 b)

Returns the scalar value of the determinant det(a, b). This is often referred to as the 2D cross product, which is not defined for 2D, so this is an extension to 2D by taking the z component of the 3d cross product: x . This is also the "Perp Dot Product", equivalent to perped().dot(b)

dist

float dist(Vec2 b)

Distance to Vec2 b.

distSquared

float distSquared(Vec2 b)

Squared Distance to Vec2 b.

dot

float dot(Vec2 b)

Returns the dot product, this . b.

dup

Vec2 dup()

Return a new copy of the vector.

length

float length()

Magnitude (length).

lengthSquared

float lengthSquared()

Magnitude squared.

lerp

this lerp(Vec2 b, float t)

Interpolate between this and another Vec2 b, based on t.

lerped

Vec2 lerped(Vec2 b, float t)

mul

this mul(Vec2 b)

Multiply by another Vec2, this = this * b.

mul2

this mul2(Vec2 a, Vec2 b)

Multiply two Vec2s, this = a * b.

mulled

Vec2 mulled(Vec2 b)

negate

this negate()

negated

Vec2 negated()

normalize

this normalize()

Normalize, scaling so the magnitude is 1. Invalid for a zero vector.

normalized

Vec2 normalized()

perp

this perp()

Make perpendicular (rotated 90 degrees ccw) in place: this = thisâź‚

perped

Vec2 perped()

Return a new perpendicular vector (rotated 90 degrees ccw).

reflect

this reflect(Vec2 n)

Reflect a vector about the normal n. The vectors should both be unit.

reflected

Vec2 reflected(Vec2 n)

rotate

this rotate(float theta)

Rotate around the origin by theta radians (counter-clockwise).

rotated

Vec2 rotated(float theta)

scale

this scale(float s)

Multiply by a scalar.

scaled

Vec2 scaled(float s)

set

this set(float x, float y)

setVec2

this setVec2(Vec2 v)

sub

this sub(Vec2 b)

Subtract another Vec2, this = this - b.

sub2

this sub2(Vec2 a, Vec2 b)

Subtract two Vec2s, this = a - b.

subbed

Vec2 subbed(Vec2 b)

Vec3

Vec3

new Vec3(x, y, z)

A class representing a 3 dimensional point and/or vector. There isn't a good reason to differentiate between the two, and you often want to change how you think about the same set of values. So there is only "vector".

The class is designed without accessors or individual mutators, you should access the x, y, and z values directly on the object.

Almost all of the core operations happen in place, writing to the current object. If you want a copy, you can call dup. For convenience, many operations have a passed-tense version that returns a new object. Most methods return this to support chaining.

add

this add(Vec3 b)

Add a Vec3, this = this + b.

add2

this add2(Vec3 a, Vec3 b)

Add two Vec3s, this = a + b.

added

Vec3 added(Vec3 b)

cross

this cross(Vec3 b)

Cross product, this = this x b.

cross2

this cross2(Vec3 a, Vec3 b)

Cross product, this = a x b.

debugString

dist

float dist(Vec3 b)

Distance to Vec3 b.

distSquared

float distSquared(Vec3 b)

Squared Distance to Vec3 b.

dot

float dot(Vec3 b)

Returns the dot product, this . b.

dup

Vec3 dup()

Return a new copy of the vector.

length

float length()

Magnitude (length).

lengthSquared

float lengthSquared()

Magnitude squared.

lerp

this lerp(Vec3 b, float t)

Interpolate between this and another Vec3 b, based on t.

lerped

Vec3 lerped(Vec3 b, float t)

mul

this mul(Vec3 b)

Multiply by another Vec3, this = this * b.

mul2

this mul2(Vec3 a, Vec3 b)

Multiply two Vec3s, this = a * b.

mulled

Vec3 mulled(Vec3 b)

normalize

this normalize()

Normalize, scaling so the magnitude is 1. Invalid for a zero vector.

normalized

Vec3 normalized()

scale

this scale(float s)

Multiply by a scalar.

scaled

Vec3 scaled(float s)

set

this set(x, y, z)

setVec3

this setVec3(Vec3 v)

sub

this sub(Vec3 b)

Subtract another Vec3, this = this - b.

sub2

this sub2(Vec3 a, Vec3 b)

Subtract two Vec3s, this = a - b.

subbed

Vec3 subbed(Vec3 b)

Vec4

Vec4

new Vec4(x, y, z, w)

dup

Vec4 dup()

Return a new copy of the vector.

scale

this scale(float s)

Multiply by a scalar.

scaled

Vec4 scaled(float s)

set

this set(x, y, z, w)

setVec4

this setVec4(Vec4 v)

toVec3

Vec3 toVec3()

Return a new vector of (x, y, z), dropping w.

plask

clamp

float clamp(float v, float vmin, float vmax)

GLSL clamp. Keep the value v in the range vmin .. vmax.

clamp01

float clamp01(float v)

Convenient for clamp(v, 0, 1).

clamp11

float clamp11(float v)

Convenient for clamp(v, -1, 1).

fract

float fract(float x)

Like GLSL fract(), returns x - floor(x). NOTE, for negative numbers, this is a positive value, ex fract(-1.3) == 0.7.

fract2

float fract2(float x)

Returns the part of the number to the right of the radix point. For negative numbers, this is a positive value, ex fract(-1.25) == 0.25

fract3

float fract3(float x)

Returns the signed part of the number to the right of the radix point. For negative numbers, this is a negative value, ex fract(-1.25) == -0.25

lerp

float lerp(float a, float b, float t)

Linear interpolation on the line along points (0, a) and (1, b). The position t is the x coordinate, where 0 is a and 1 is b.

max

float max(float a, float b)

min

float min(float a, float b)

smootherstep

float smootherstep(edge0, edge1, x)

Ken Perlin's "smoother" step function, with zero 1st and 2nd derivatives at the endpoints (whereas smoothstep has a 2nd derivative of +/- 6). This is also for example used by Patel and Taylor in smooth simulation noise.

smoothstep

float smoothstep(edge0, edge1, x)

GLSL smoothstep. NOTE: Undefined if edge0 == edge1.