Home Reference Source

Function

Static Public Summary
public

Anim(cfg: *)

Keyframed interpolated animation.

public
public

Framebuffer(_cgl: Context, _w: Number, _h: Number, options: Object)

a framebuffer

public

Framebuffer2(cgl: *, w: *, h: *, options: *): *

public

Geometry(name: String): *

a geometry contains all information about a mesh, vertices, texturecoordinates etc.

public
public

Key(obj: *)

public

Link(scene: Object)

public

LoadingStatus(patch: *)

LoadingStatus class, manages asynchronous loading jobs

public

Marker(_cgl: *)

public
public

Mesh(_cgl: Context, __geom: Geometry, _options: Number): *

webgl renderable 3d object

public

Op(): *

public

Port(___op: *, name: *, type: *, uiAttribs: *): *

data is coming into and out of ops through input and output ports

public

Preprocessor(source: string, baseDirOrIncludes: string | Object.<string,string>=, preserveLineNumbers: boolean)

Constructs a new Preprocessor.

public

Shader(_cgl: *, _name: *, _op: *)

public

Texture(__cgl: Context, options: Object)

A Texture

public

TextureEffect(cgl: *, options: *)

public

Timer()

Measuring time

public

todo: old...

public

WireCube(cgl: *)

public

WirePoint(cgl: *)

public

ajax(url: *, cb: *, method: *, post: *, contenttype: *, jsonP: *, headers: *, options: *)

make an ajax request

public

ajaxSync(url: *, cb: *, method: *, post: *, contenttype: *)

public

b64decTypedArray(base64: *): *

public

b64encTypesArray(arraybuffer: *): *

public

basename(url: String): String

return the filename part of a url without extension

public

cacheBust(url: String): String

append a unique/random parameter to a url, so the browser is forced to reload the file, even if its cached

public

clamp(value: Number, min: Number, max: Number): *

clamp number / make sure its between min/max

public

cleanJson(obj: *): *

public

copyArray(src: Array, dst: Array): Array

copy the content of an array

public

easeCubicIn(t: *): *

public

easeCubicInOut(t: *): *

public

easeCubicOut(t: *): *

public

easeExpoIn(t: *): *

public

easeExpoInOut(t: *): *

public

easeExpoOut(t: *): *

public

escapeHTML(string: *): *

public
public

filename(url: String): String

return the filename part of a url

public
public
public
public
public

getShortOpName(fullname: string): *

get op shortname: only last part of fullname and without version

public
public

keyCodeToName(keyCode: *): *

public

output a stacktrace to the console

public

map(x: Number, _oldMin: Number, _oldMax: Number, _newMin: Number, _newMax: Number, _easing: Number): Number

map a value in a range to a value in another range

public

now(): *

current time in milliseconds

public

request(options: *)

public

shuffleArray(array: Array | Float32Array): Array | Float32Array

randomize order of an array

public

simpleId(): *

public

smoothStep(perc: Number): Number

smoothStep a value

public

smootherStep(perc: Number): Number

smootherstep a value

Static Public

public Anim(cfg: *) source

import {Anim} from './core/anim.js'

Keyframed interpolated animation.

Available Easings: CONSTANTS.ANIM.EASING_LINEAR CONSTANTS.ANIM.EASING_ABSOLUTE CONSTANTS.ANIM.EASING_SMOOTHSTEP CONSTANTS.ANIM.EASING_SMOOTHERSTEP CONSTANTS.ANIM.EASING_CUBICSPLINE

CONSTANTS.ANIM.EASING_CUBIC_IN CONSTANTS.ANIM.EASING_CUBIC_OUT CONSTANTS.ANIM.EASING_CUBIC_INOUT

CONSTANTS.ANIM.EASING_EXPO_IN CONSTANTS.ANIM.EASING_EXPO_OUT CONSTANTS.ANIM.EASING_EXPO_INOUT

CONSTANTS.ANIM.EASING_SIN_IN CONSTANTS.ANIM.EASING_SIN_OUT CONSTANTS.ANIM.EASING_SIN_INOUT

CONSTANTS.ANIM.EASING_BACK_IN CONSTANTS.ANIM.EASING_BACK_OUT CONSTANTS.ANIM.EASING_BACK_INOUT

CONSTANTS.ANIM.EASING_ELASTIC_IN CONSTANTS.ANIM.EASING_ELASTIC_OUT

CONSTANTS.ANIM.EASING_BOUNCE_IN CONSTANTS.ANIM.EASING_BOUNCE_OUT

CONSTANTS.ANIM.EASING_QUART_IN CONSTANTS.ANIM.EASING_QUART_OUT CONSTANTS.ANIM.EASING_QUART_INOUT

CONSTANTS.ANIM.EASING_QUINT_IN CONSTANTS.ANIM.EASING_QUINT_OUT CONSTANTS.ANIM.EASING_QUINT_INOUT

Params:

NameTypeAttributeDescription
cfg *

Example:

var anim=new CABLES.Anim();
anim.setValue(0,0);  // set value 0 at 0 seconds
anim.setValue(10,1); // set value 1 at 10 seconds
anim.getValue(5);    // get value at 5 seconds - this returns 0.5

public EventTarget() source

import {EventTarget} from './core/eventtarget.js'

public Framebuffer(_cgl: Context, _w: Number, _h: Number, options: Object) source

import {Framebuffer} from './core/cgl/cgl_framebuffer.js'

a framebuffer

Params:

NameTypeAttributeDescription
_cgl Context

cgl

_w Number

width

_h Number

height

options Object

public Framebuffer2(cgl: *, w: *, h: *, options: *): * source

import {Framebuffer2} from './core/cgl/cgl_framebuffer2.js'

Params:

NameTypeAttributeDescription
cgl *
w *
h *
options *

Return:

*

public Geometry(name: String): * source

import {Geometry} from './core/cg/cg_geom.js'

a geometry contains all information about a mesh, vertices, texturecoordinates etc. etc.

Params:

NameTypeAttributeDescription
name String

Return:

*

Example:

// create a triangle with all attributes
const geom=new Geometry("triangle"),

geom.vertices = [
     0.0,           sizeH.get(),  0.0,
    -sizeW.get(),  -sizeH.get(),  0.0,
     sizeW.get(),  -sizeH.get(),  0.0 ];

geom.vertexNormals = [
     0.0,  0.0,  1.0,
     0.0,  0.0,  1.0,
     0.0,  0.0,  1.0 ];

geom.tangents = [
    1,0,0,
    1,0,0,
    1,0,0 ];

geom.biTangents = [
    0,1,0,
    0,1,0,
    0,1,0 ];

geom.texCoords = [
     0.5,  0.0,
     1.0,  1.0,
     0.0,  1.0, ];

geom.verticesIndices = [
    0, 1, 2 ];

public Instancing() source

import {Instancing} from './core/instancing.js'

public Key(obj: *) source

import {Key} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
obj *
import {Link} from './core/core_link.js'

Params:

NameTypeAttributeDescription
scene Object

The patch object

public LoadingStatus(patch: *) source

import {LoadingStatus} from './core/loadingstatus.js'

LoadingStatus class, manages asynchronous loading jobs

Params:

NameTypeAttributeDescription
patch *

public Marker(_cgl: *) source

import {Marker} from './core/cgl/cgl_marker.js'

Params:

NameTypeAttributeDescription
_cgl *

public MatrixStack() source

import {MatrixStack} from './core/cg/cg_matrixstack.js'

public Mesh(_cgl: Context, __geom: Geometry, _options: Number): * source

import {Mesh} from './core/cgl/cgl_mesh.js'

webgl renderable 3d object

Params:

NameTypeAttributeDescription
_cgl Context

cgl

__geom Geometry

geometry

_options Number

glPrimitive

Return:

*

Example:

const cgl=this._cgl
const mesh=new CGL.Mesh(cgl, geometry);

function render()
{
  mesh.render(cgl.getShader());
}

public Op(): * source

import {Op} from './core/core_op.js'

Return:

*

public Port(___op: *, name: *, type: *, uiAttribs: *): * source

import {Port} from './core/core_port.js'

data is coming into and out of ops through input and output ports

Params:

NameTypeAttributeDescription
___op *
name *
type *
uiAttribs *

Return:

*

Example:

const myPort=op.inString("String Port");

public Preprocessor(source: string, baseDirOrIncludes: string | Object.<string,string>=, preserveLineNumbers: boolean) source

import Preprocessor from './core/cg/preproc.js'

Constructs a new Preprocessor.

Params:

NameTypeAttributeDescription
source string

Source to process

baseDirOrIncludes string | Object.<string,string>=

Source base directory used for includes (node.js only) or an object containing all the included sources by filename. Defaults to the current working directory.

preserveLineNumbers boolean

When removing blocks of code, replace the block with blank lines so that line numbers are preserved, as long as #include is not used

public Shader(_cgl: *, _name: *, _op: *) source

import {Shader} from './core/cgl/cgl_shader.js'

Params:

NameTypeAttributeDescription
_cgl *
_name *
_op *

Example:

var shader=new CGL.Shader(cgl,'MinimalMaterial');
shader.setSource(attachments.shader_vert,attachments.shader_frag);

public Texture(__cgl: Context, options: Object) source

import {Texture} from './core/cgl/cgl_texture.js'

A Texture

Params:

NameTypeAttributeDescription
__cgl Context

cgl

options Object

Example:

// generate a 256x256 pixel texture of random colors
const size=256;
const data = new Uint8Array(size*size*4);

for(var x=0;x<size*size*4;x++) data[ x*4+3]=255;

const tex=new CGL.Texture(cgl);
tex.initFromData(data,size,size,CGL.Texture.FILTER_NEAREST,CGL.Texture.WRAP_REPEAT);

public TextureEffect(cgl: *, options: *) source

import {TextureEffect} from './core/cgl/cgl_textureeffect.js'

Params:

NameTypeAttributeDescription
cgl *
options *

public Timer() source

import {Timer} from './core/timer.js'

Measuring time

public Variable() source

import {Variable} from './core/sessionvar.js'

todo: old... remove this from ops...

public WireCube(cgl: *) source

import {WireCube} from './core/cgl/cgl_marker.js'

Params:

NameTypeAttributeDescription
cgl *

public WirePoint(cgl: *) source

import {WirePoint} from './core/cgl/cgl_marker.js'

Params:

NameTypeAttributeDescription
cgl *

public ajax(url: *, cb: *, method: *, post: *, contenttype: *, jsonP: *, headers: *, options: *) source

import {ajax} from './core/utils.js'

make an ajax request

Params:

NameTypeAttributeDescription
url *
cb *
method *
post *
contenttype *
jsonP *
headers *
options *

public ajaxSync(url: *, cb: *, method: *, post: *, contenttype: *) source

import {ajaxSync} from './core/utils.js'

Params:

NameTypeAttributeDescription
url *
cb *
method *
post *
contenttype *

public b64decTypedArray(base64: *): * source

import {b64decTypedArray} from './core/base64.js'

Params:

NameTypeAttributeDescription
base64 *

Return:

*

public b64encTypesArray(arraybuffer: *): * source

import {b64encTypesArray} from './core/base64.js'

Params:

NameTypeAttributeDescription
arraybuffer *

Return:

*

public basename(url: String): String source

import {basename} from './core/utils.js'

return the filename part of a url without extension

Params:

NameTypeAttributeDescription
url String

Return:

String

just the filename

public cacheBust(url: String): String source

import {cacheBust} from './core/utils.js'

append a unique/random parameter to a url, so the browser is forced to reload the file, even if its cached

Params:

NameTypeAttributeDescription
url String

The url to append the cachebuster parameter to.

Return:

String

url with cachebuster parameter

public clamp(value: Number, min: Number, max: Number): * source

import {clamp} from './core/utils.js'

clamp number / make sure its between min/max

Params:

NameTypeAttributeDescription
value Number

value to be mapped

min Number

minimum value

max Number

maximum value

Return:

*

public cleanJson(obj: *): * source

import {cleanJson} from './core/utils.js'

Params:

NameTypeAttributeDescription
obj *

Return:

*

public copyArray(src: Array, dst: Array): Array source

import {copyArray} from './core/utils.js'

copy the content of an array

Params:

NameTypeAttributeDescription
src Array

sourceArray

dst Array

optional

Return:

Array

dst

public easeCubicIn(t: *): * source

import {easeCubicIn} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
t *

Return:

*

public easeCubicInOut(t: *): * source

import {easeCubicInOut} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
t *

Return:

*

public easeCubicOut(t: *): * source

import {easeCubicOut} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
t *

Return:

*

public easeExpoIn(t: *): * source

import {easeExpoIn} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
t *

Return:

*

public easeExpoInOut(t: *): * source

import {easeExpoInOut} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
t *

Return:

*

public easeExpoOut(t: *): * source

import {easeExpoOut} from './core/anim_key.js'

Params:

NameTypeAttributeDescription
t *

Return:

*

public escapeHTML(string: *): * source

import {escapeHTML} from './core/cgl/cgl_utils.js'

Params:

NameTypeAttributeDescription
string *

Return:

*

public extendMeshWithFeedback(Mesh: *) source

import {extendMeshWithFeedback} from './core/cgl/cgl_mesh_feedback.js'

Params:

NameTypeAttributeDescription
Mesh *

public filename(url: String): String source

import {filename} from './core/utils.js'

return the filename part of a url

Params:

NameTypeAttributeDescription
url String

Return:

String

just the filename

public getBlurPassFragmentShader(): string source

import {getBlurPassFragmentShader} from './libs/cgl/light/createshaders.js'

Return:

string

public getBlurPassVertexShader(): string source

import {getBlurPassVertexShader} from './libs/cgl/light/createshaders.js'

Return:

string

public getShadowPassFragmentShader(): string source

import {getShadowPassFragmentShader} from './libs/cgl/light/createshaders.js'

Return:

string

public getShadowPassVertexShader(): string source

import {getShadowPassVertexShader} from './libs/cgl/light/createshaders.js'

Return:

string

public getShortOpName(fullname: string): * source

import {getShortOpName} from './core/utils.js'

get op shortname: only last part of fullname and without version

Params:

NameTypeAttributeDescription
fullname string

full op name

Return:

*

public internalNow(): * source

import {internalNow} from './core/timer.js'

Return:

*

public keyCodeToName(keyCode: *): * source

import {keyCodeToName} from './core/utils.js'

Params:

NameTypeAttributeDescription
keyCode *

Return:

*

public logStack() source

import {logStack} from './core/utils.js'

output a stacktrace to the console

public map(x: Number, _oldMin: Number, _oldMax: Number, _newMin: Number, _newMax: Number, _easing: Number): Number source

import {map} from './core/utils.js'

map a value in a range to a value in another range

Params:

NameTypeAttributeDescription
x Number

value to be mapped

_oldMin Number

old range minimum value

_oldMax Number

old range maximum value

_newMin Number

new range minimum value

_newMax Number

new range maximum value

_easing Number

Return:

Number

mapped value

public now(): * source

import {now} from './core/timer.js'

current time in milliseconds

Return:

*

public request(options: *) source

import {request} from './core/utils.js'

Params:

NameTypeAttributeDescription
options *

public shuffleArray(array: Array | Float32Array): Array | Float32Array source

import {shuffleArray} from './core/utils.js'

randomize order of an array

Params:

NameTypeAttributeDescription
array Array | Float32Array

{Array} original

Return:

Array | Float32Array

shuffled array

public simpleId(): * source

import {simpleId} from './core/utils.js'

Return:

*

public smoothStep(perc: Number): Number source

import {smoothStep} from './core/utils.js'

smoothStep a value

Params:

NameTypeAttributeDescription
perc Number

value value to be smoothed [0-1]

Return:

Number

smoothed value

public smootherStep(perc: Number): Number source

import {smootherStep} from './core/utils.js'

smootherstep a value

Params:

NameTypeAttributeDescription
perc Number

value to be smoothed [0-1]

Return:

Number

smoothed value