Java Code Examples for org.lwjgl.util.vector.Matrix4f#store()
The following examples show how to use
org.lwjgl.util.vector.Matrix4f#store() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GUIRoot.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
protected final void displayChangedNotify(int width, int height) { //Reset The Current Viewport And Perspective Transformation setDim(width, height); if (width != 0) { float scale = getUnitsPerPixel(Globals.GUI_Z); Matrix4f m1 = new Matrix4f(); m1.setIdentity(); Matrix4f m2 = new Matrix4f(); m2.setIdentity(); Matrix4f m3 = new Matrix4f(); m1.scale(new Vector3f(scale, scale, scale)); m2.translate(new Vector3f(0f, 0f, -Globals.GUI_Z)); Matrix4f.mul(m2, m1, m3); m2.load(m3); m3.setIdentity(); m3.translate(new Vector3f(-width/2f, -height/2f, 0f)); Matrix4f.mul(m2, m3, m1); m1.store(matrix_buf); matrix_buf.rewind(); } for (int i = 0; i < delegate_stack.size(); i++) { ((CameraDelegate)delegate_stack.get(i)).displayChanged(width, height); } }
Example 2
Source File: TransformProvider.java From OpenModsLib with MIT License | 6 votes |
public Transformation(Orientation orientation) { final javax.vecmath.Matrix4f originalMatrix = new javax.vecmath.Matrix4f(); originalMatrix.set(orientation.getLocalToWorldMatrix()); asMatrix = TRSRTransformation.toLwjgl(originalMatrix); asBuffer = BufferUtils.createFloatBuffer(16); asMatrix.store(asBuffer); asBuffer.rewind(); asInverseMatrix = new Matrix4f(); Matrix4f.invert(asMatrix, asInverseMatrix); asInverseBuffer = BufferUtils.createFloatBuffer(16); asInverseMatrix.store(asInverseBuffer); asInverseBuffer.rewind(); }
Example 3
Source File: PGData1.java From ldparteditor with MIT License | 5 votes |
/** * SLOWER, FOR PRIMITIVE CHOOSER ONLY, uses no cache, uses no bounding box! * * @param tMatrix * @param lines * @param name * @param shortName * @param depth * @param det * @param pMatrix * @param hotMap * @param firstRef */ public PGData1(Matrix4f tMatrix, List<String> lines, int depth, boolean det, Matrix4f pMatrix, Set<String> alreadyParsed, HashMap<PGTimestamp, PGTimestamp> hotMap) { depth++; if (depth < 16) { this.depth = depth; negativeDeterminant = det; this.productMatrix = new Matrix4f(pMatrix); this.localMatrix = new Matrix4f(tMatrix); matrix = BufferUtils.createFloatBuffer(16); tMatrix.store(matrix); matrix.position(0); matrix2 = BufferUtils.createFloatBuffer(16); Matrix4f tMatrix2 = new Matrix4f(tMatrix); tMatrix2.m30 = -tMatrix2.m30; tMatrix2.store(matrix2); matrix2.position(0); PGData anchorData = myGData; for (String line : lines) { if (isNotBlank(line)) { PGData gdata = CompositePrimitive.parseLine(line, depth, pMatrix, alreadyParsed, hotMap); if (gdata != null) { anchorData.setNext(gdata); anchorData = gdata; } } } } else { this.depth = depth; this.matrix = null; this.matrix2 = null; this.productMatrix = null; this.localMatrix = null; this.negativeDeterminant = false; } }
Example 4
Source File: GLMatrixStack.java From ldparteditor with MIT License | 5 votes |
public void clear() { stack.clear(); final Matrix4f ID = new Matrix4f(); Matrix4f.setIdentity(ID); final FloatBuffer ID_buf = BufferUtils.createFloatBuffer(16); ID.store(ID_buf); ID_buf.position(0); currentMatrix = ID; int model = shader.getUniformLocation("model" ); //$NON-NLS-1$ GL20.glUniformMatrix4fv(model, false, ID_buf); }
Example 5
Source File: GLMatrixStack.java From ldparteditor with MIT License | 5 votes |
public void glLoadIdentity() { final Matrix4f ID = new Matrix4f(); Matrix4f.setIdentity(ID); final FloatBuffer ID_buf = BufferUtils.createFloatBuffer(16); ID.store(ID_buf); ID_buf.position(0); currentMatrix = ID; int model = shader.getUniformLocation("model" ); //$NON-NLS-1$ GL20.glUniformMatrix4fv(model, false, ID_buf); int view = shader.getUniformLocation("view" ); //$NON-NLS-1$ GL20.glUniformMatrix4fv(view, false, ID_buf); }
Example 6
Source File: GLMatrixStack.java From ldparteditor with MIT License | 5 votes |
public void glLoadMatrix(Matrix4f m) { final FloatBuffer m_buf = BufferUtils.createFloatBuffer(16); m.store(m_buf); m_buf.position(0); currentMatrix = m; int model = shader.getUniformLocation("model" ); //$NON-NLS-1$ GL20.glUniformMatrix4fv(model, false, m_buf); }
Example 7
Source File: LwjglRasteriser.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setProjectionMatrix(Matrix4f matrix) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); FloatBuffer buffer = BufferUtils.createFloatBuffer(16); matrix.store(buffer); buffer.flip(); GL11.glLoadMatrix(buffer); }
Example 8
Source File: LwjglRasteriser.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setCameraMatrix(Matrix4f matrix, Vector3f lookAt, Vector3f eye, Vector3f up) { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); FloatBuffer buffer = BufferUtils.createFloatBuffer(16); matrix.store(buffer); buffer.flip(); GL11.glLoadMatrix(buffer); }
Example 9
Source File: UniformMatrix.java From LowPolyWater with The Unlicense | 4 votes |
public void loadMatrix(Matrix4f matrix){ matrix.store(matrixBuffer); matrixBuffer.flip(); GL20.glUniformMatrix4(super.getLocation(), false, matrixBuffer); }
Example 10
Source File: UniformMatrix.java From OpenGL-Animation with The Unlicense | 4 votes |
public void loadMatrix(Matrix4f matrix){ matrix.store(matrixBuffer); matrixBuffer.flip(); GL20.glUniformMatrix4(super.getLocation(), false, matrixBuffer); }
Example 11
Source File: OpenGLUtils.java From OpenModsLib with MIT License | 4 votes |
public static synchronized void loadMatrix(Matrix4f transform) { transform.store(matrixBuffer); matrixBuffer.flip(); GL11.glMultMatrix(matrixBuffer); }