Package eu.webtoolkit.jwt
Class WebGLUtils
java.lang.Object
eu.webtoolkit.jwt.WebGLUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic javax.vecmath.GVector
add
(javax.vecmath.GVector v1, javax.vecmath.GVector v2) static javax.vecmath.GVector
cross
(javax.vecmath.GVector v1, javax.vecmath.GVector v2) static void
frustum
(javax.vecmath.Matrix4f M, double left, double right, double bottom, double top, double near, double far) Construct a perspective projection matrix This function constructs a perspective projection where the camera is located in the origin.static void
lookAt
(javax.vecmath.Matrix4f T, double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) Apply a transformation to position a camera (eyeX, eyeY, eyeZ) is the position of the camera.static javax.vecmath.GVector
multiply
(javax.vecmath.GVector v, double scalar) static javax.vecmath.GVector
multiply
(javax.vecmath.Matrix4f M, javax.vecmath.GVector v) static javax.vecmath.Matrix4f
multiply
(javax.vecmath.Matrix4f m1, javax.vecmath.Matrix4f m2) static ByteBuffer
newByteBuffer
(int capacity) static javax.vecmath.GVector
normalize
(javax.vecmath.GVector v) static void
ortho
(javax.vecmath.Matrix4f M, double left, double right, double bottom, double top, double nearPlane, double farPlane) Create an orhtographic projection matrix for use in OpenGL Create an orthographic projection matrix.static void
perspective
(javax.vecmath.Matrix4f M, double angle, double aspect, double nearPlane, double farPlane) Construct a perspective projection matrix for use in OpenGL The camera is located in the origin and look in the direction of the negative Z axis.static void
renderfv
(StringWriter js, ByteBuffer buffer, eu.webtoolkit.jwt.JsArrayType arrayType) static void
renderfv
(StringWriter js, FloatBuffer buffer, eu.webtoolkit.jwt.JsArrayType arrayType) static void
renderfv
(StringWriter js, javax.vecmath.Matrix3f t, eu.webtoolkit.jwt.JsArrayType arrayType) static void
rotate
(javax.vecmath.Matrix4f m, double angle, double x, double y, double z) static WMemoryResource
static void
scale
(javax.vecmath.Matrix4f m, float scaling) static javax.vecmath.GVector
subtract
(javax.vecmath.GVector v1, javax.vecmath.GVector v2) static void
translate
(javax.vecmath.Matrix4f m, double x, double y, double z) static javax.vecmath.Matrix3f
transpose
(javax.vecmath.Matrix3f m) static javax.vecmath.Matrix4f
transpose
(javax.vecmath.Matrix4f m) static javax.vecmath.GVector
vec4ToVec3
(javax.vecmath.GVector v)
-
Constructor Details
-
WebGLUtils
public WebGLUtils()
-
-
Method Details
-
newByteBuffer
-
renderfv
public static void renderfv(StringWriter js, javax.vecmath.Matrix3f t, eu.webtoolkit.jwt.JsArrayType arrayType) -
renderfv
public static void renderfv(StringWriter js, FloatBuffer buffer, eu.webtoolkit.jwt.JsArrayType arrayType) -
renderfv
public static void renderfv(StringWriter js, ByteBuffer buffer, eu.webtoolkit.jwt.JsArrayType arrayType) -
rpdToMemResource
-
transpose
public static javax.vecmath.Matrix3f transpose(javax.vecmath.Matrix3f m) -
transpose
public static javax.vecmath.Matrix4f transpose(javax.vecmath.Matrix4f m) -
translate
public static void translate(javax.vecmath.Matrix4f m, double x, double y, double z) -
rotate
public static void rotate(javax.vecmath.Matrix4f m, double angle, double x, double y, double z) -
scale
public static void scale(javax.vecmath.Matrix4f m, float scaling) -
lookAt
public static void lookAt(javax.vecmath.Matrix4f T, double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) Apply a transformation to position a camera (eyeX, eyeY, eyeZ) is the position of the camera. The camera looks at (centerX, centerY, centerZ). (upX, upY, upZ) is a vector that is the direction of the up vector. This method applies a rotation and translation transformation to the current matrix so that the given eye becomes (0, 0, 0), the center point is on the negative Z axis, and the up vector lies in the X=0 plane, with its Y component in the positive Y axis direction. The up vector must not be parallel to the line between eye and center. The vectors will be normalized and are not required to be perpendicular. If the lookat transformation matrix is M, and the current value of the Matrix4f matrix is T, the resulting matrix after lookAt returns will be T * M. -
frustum
public static void frustum(javax.vecmath.Matrix4f M, double left, double right, double bottom, double top, double near, double far) Construct a perspective projection matrix This function constructs a perspective projection where the camera is located in the origin. The visible volume is determined by whatever that is visible when looking from the origin through the rectangular 'window' defined by the coordinates (l, b, n) and (r, t, n) (parallel to the XY plane). The zone is further delimited by the near and the far clipping planes. The perspective matrix (P) is right-multiplied with the current transformation matrix (M): M * P. Usually, you will want M to be the identity matrix when using this method. -
ortho
public static void ortho(javax.vecmath.Matrix4f M, double left, double right, double bottom, double top, double nearPlane, double farPlane) Create an orhtographic projection matrix for use in OpenGL Create an orthographic projection matrix. The given left, right, bottom, top, near and far points will be linearly mapped to the OpenGL unit cube ((1,1,1) to (-1,-1,-1)). The orthographic matrix (O) is right-multiplied with the current transformation matrix (M): M * O. Usually, you will want M to be the identity matrix when using this method. -
perspective
public static void perspective(javax.vecmath.Matrix4f M, double angle, double aspect, double nearPlane, double farPlane) Construct a perspective projection matrix for use in OpenGL The camera is located in the origin and look in the direction of the negative Z axis. Angle is the vertical view angle, in degrees. Aspect is the aspect ratio of the viewport, and near and far are the distances of the front and rear clipping plane from the camera. The perspective matrix (P) is right-multiplied with the current transformation matrix (M): M * P. Usually, you will want M to be the identity matrix when using this method. -
subtract
public static javax.vecmath.GVector subtract(javax.vecmath.GVector v1, javax.vecmath.GVector v2) -
add
public static javax.vecmath.GVector add(javax.vecmath.GVector v1, javax.vecmath.GVector v2) -
multiply
public static javax.vecmath.Matrix4f multiply(javax.vecmath.Matrix4f m1, javax.vecmath.Matrix4f m2) -
multiply
public static javax.vecmath.GVector multiply(javax.vecmath.GVector v, double scalar) -
multiply
public static javax.vecmath.GVector multiply(javax.vecmath.Matrix4f M, javax.vecmath.GVector v) -
normalize
public static javax.vecmath.GVector normalize(javax.vecmath.GVector v) -
cross
public static javax.vecmath.GVector cross(javax.vecmath.GVector v1, javax.vecmath.GVector v2) -
vec4ToVec3
public static javax.vecmath.GVector vec4ToVec3(javax.vecmath.GVector v)
-