Class WGLWidget.JavaScriptMatrix4x4
- Enclosing class:
- WGLWidget
public static class WGLWidget.JavaScriptMatrix4x4
extends java.lang.Object
A JavaScriptMatrix has methods that make it possible to do client-side calculations on matrices.
Using a WGLWidget.JavaScriptMatrix4x4
, GL parameters can be modified without communication
with the server. The value of the WGLWidget.JavaScriptMatrix4x4
is updated server-side whenever
an event is sent to the server.
Important: only the getJsRef()
of the
return value from a call to WGLWidget::createJavaScriptMatrix() is a variable name that can be
used in custom JavaScript to modify a matrix from external scripts. The getJsRef()
of return values of operations refer to
unnamed temporary objects - rvalues in C++-lingo.
The WGLWidget.JavaScriptMatrix4x4
is represented in JavaScript as an array of 16 elements.
This array represents the values of the matrix in column-major order. It is either a
Float32Array or a plain JavaScript array.
-
Constructor Summary
Constructors Constructor Description JavaScriptMatrix4x4()
Creates a temporarily invalidWGLWidget.JavaScriptMatrix4x4
. -
Method Summary
Modifier and Type Method Description WGLWidget.JavaScriptMatrix4x4
clone()
int
getId()
java.lang.String
getJsRef()
Returns the JavaScript reference to thisWGLWidget.JavaScriptMatrix4x4
.javax.vecmath.Matrix4f
getValue()
Returns the current server-side value.boolean
hasContext()
Returns whether thisWGLWidget.JavaScriptMatrix4x4
has been assigned to aWGLWidget
.WGLWidget.JavaScriptMatrix4x4
inverted()
boolean
isInitialized()
Returns whether thisWGLWidget.JavaScriptMatrix4x4
has been initialized.WGLWidget.JavaScriptMatrix4x4
multiply(javax.vecmath.Matrix4f m)
WGLWidget.JavaScriptMatrix4x4
transposed()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JavaScriptMatrix4x4
public JavaScriptMatrix4x4()Creates a temporarily invalidWGLWidget.JavaScriptMatrix4x4
.Should be added to a WGLWidget with
WGLWidget#addJavaScriptMatrix4()
, and initialized withWGLWidget#initJavaScriptMatrix4()
.
-
-
Method Details
-
getId
public int getId() -
isInitialized
public boolean isInitialized()Returns whether thisWGLWidget.JavaScriptMatrix4x4
has been initialized. -
hasContext
public boolean hasContext()Returns whether thisWGLWidget.JavaScriptMatrix4x4
has been assigned to aWGLWidget
. -
getJsRef
public java.lang.String getJsRef()Returns the JavaScript reference to thisWGLWidget.JavaScriptMatrix4x4
.In order to get a valid JavaScript reference, this matrix should have been added to a
WGLWidget
. -
getValue
public javax.vecmath.Matrix4f getValue()Returns the current server-side value.Client-side changes to the
WGLWidget.JavaScriptMatrix4x4
are automatically synchronized. -
inverted
-
transposed
-
multiply
-
clone
- Overrides:
clone
in classjava.lang.Object
-