Classes | Methods |
---|---|
new UIControls()
Factory Manager for predefined UIControls
- you can manage all your UI control logic within your shader implementation
and not to touch this class at all, but here you will find some most common
or some advanced controls ready to use, simple and powerful
- registering an IComponent implementation (or an UiElement) in the factory results in its support
among all the shaders (given the GLSL type, result of sample(...) matches).
- UiElements are objects to create simple controls quickly and get rid of code duplicity,
for more info @see WebGLModule.UIControls.register()
Methods
(static) build(context, name, params, defaultParams, accepts, requiredParams, interactivityEnabled) → {WebGLModule.UIControls.IControl}
Build UI control object based on given parameters
Parameters:
Name | Type | Default | Description |
---|---|---|---|
context |
WebGLModule.VisualizationLayer | owner of the control | |
name |
string | name used for the layer, should be unique among different context types | |
params |
object | * | parameters passed to the control (defined by the control) or set as default value if not object | |
defaultParams |
object | default parameters that the shader might leverage above defaults of the control itself | |
accepts |
function | required GLSL type of the control predicate, for compatibility typechecking | |
requiredParams |
object | parameters that override anything sent by user or present by defaultParams | |
interactivityEnabled |
boolean | true | must be false if HTML nodes are not managed |
Returns:
(static) getUiClass(id) → {WebGLModule.UIControls.IControl}
Get an element used to create advanced controls, if you want
an implementation of simple controls, use build(...) to instantiate
Parameters:
Name | Type | Description |
---|---|---|
id |
string | type of the control |
Returns:
(static) getUiElement(id) → {*}
Get an element used to create simple controls, if you want
an implementation of the controls themselves (IControl), use build(...) to instantiate
Parameters:
Name | Type | Description |
---|---|---|
id |
string | type of the control |
Returns:
(static) register(type, uiElement)
Register simple UI element by providing necessary object
implementation:
{ defaults: function() {...}, // object with all default values for all supported parameters
html: function(uniqueId, params, css="") {...}, //how the HTML UI controls look like
glUniformFunName: function() {...}, //what function webGL uses to pass this attribute to GPU
decode: function(fromValue) {...}, //parse value obtained from HTML controls into something
gl[glUniformFunName()](...) can pass to GPU
glType: //what's the type of this parameter wrt. GLSL: int? vec3?
Parameters:
Name | Type | Description |
---|---|---|
type |
the identifier under which is this control used: lookup made against params.type | |
uiElement |
the object to register, fulfilling the above-described contract |
(static) registerClass(type, cls)
Register class as a UI control
Parameters:
Name | Type | Description |
---|---|---|
type |
string | unique control name / identifier |
cls |
WebGLModule.UIControls.IControl | to register, implementation class of the controls |
(static) types() → {Array.<string>}
Get all available control types
Returns:
array of available control types