public void readExternal(ObjectInput in) throws IOException { super.readExternal(in); curr = in.readInt(); mats = new Matrix3fStack[curr]; for (int i = 0; i < curr; i++) { Matrix3f m = new Matrix3f(); m.readExternal(in); mats[i] = m; } }
public void swap(Matrix3f m1, Matrix3f m2) { float tmp; tmp = m1.m00(); m1._m00(m2.m00()); m2._m00(tmp); tmp = m1.m01(); m1._m01(m2.m01()); m2._m01(tmp); tmp = m1.m02(); m1._m02(m2.m02()); m2._m02(tmp); tmp = m1.m10(); m1._m10(m2.m10()); m2._m10(tmp); tmp = m1.m11(); m1._m11(m2.m11()); m2._m11(tmp); tmp = m1.m12(); m1._m12(m2.m12()); m2._m12(tmp); tmp = m1.m20(); m1._m20(m2.m20()); m2._m20(tmp); tmp = m1.m21(); m1._m21(m2.m21()); m2._m21(tmp); tmp = m1.m22(); m1._m22(m2.m22()); m2._m22(tmp); }
/** * Create a new {@link Matrix3fStack} of the given size. * <p> * Initially the stack pointer is at zero and the current matrix is set to identity. * * @param stackSize * the size of the stack. This must be at least 1, in which case the {@link Matrix3fStack} simply only consists of <code>this</code> * {@link Matrix3f} */ public Matrix3fStack(int stackSize) { if (stackSize < 1) { throw new IllegalArgumentException("stackSize must be >= 1"); //$NON-NLS-1$ } mats = new Matrix3f[stackSize - 1]; // Allocate all matrices up front to keep the promise of being "allocation-free" for (int i = 0; i < mats.length; i++) { mats[i] = new Matrix3f(); } }
public void get(Matrix3f m, long srcAddr) { for (int i = 0; i < 4; i++) { putLong(m, Matrix3f_m00 + (i << 3), UNSAFE.getLong(null, srcAddr + (i << 3))); } m._m22(UNSAFE.getFloat(null, srcAddr+32)); }
/** * Create a new {@link Matrix3fStack} of the given size. * <p> * Initially the stack pointer is at zero and the current matrix is set to identity. * * @param stackSize * the size of the stack. This must be at least 1, in which case the {@link Matrix3fStack} simply only consists of <code>this</code> * {@link Matrix3f} */ public Matrix3fStack(int stackSize) { if (stackSize < 1) { throw new IllegalArgumentException("stackSize must be >= 1"); //$NON-NLS-1$ } mats = new Matrix3f[stackSize - 1]; // Allocate all matrices up front to keep the promise of being "allocation-free" for (int i = 0; i < mats.length; i++) { mats[i] = new Matrix3f(); } }
public void get(Matrix3f m, long srcAddr) { for (int i = 0; i < 4; i++) { putLong(m, Matrix3f_m00 + (i << 3), UNSAFE.getLong(null, srcAddr + (i << 3))); } m._m22(UNSAFE.getFloat(null, srcAddr+32)); }
public void readExternal(ObjectInput in) throws IOException { super.readExternal(in); curr = in.readInt(); mats = new Matrix3fStack[curr]; for (int i = 0; i < curr; i++) { Matrix3f m = new Matrix3f(); m.readExternal(in); mats[i] = m; } }
private void renderParticles(Window window, Camera camera, Scene scene) { particlesShaderProgram.bind(); particlesShaderProgram.setUniform("texture_sampler", 0); Matrix4f projectionMatrix = transformation.getProjectionMatrix(); particlesShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f viewMatrix = transformation.getViewMatrix(); IParticleEmitter[] emitters = scene.getParticleEmitters(); int numEmitters = emitters != null ? emitters.length : 0; glDepthMask(false); glBlendFunc(GL_SRC_ALPHA, GL_ONE); Matrix3f aux = new Matrix3f(); for (int i = 0; i < numEmitters; i++) { IParticleEmitter emitter = emitters[i]; InstancedMesh mesh = (InstancedMesh)emitter.getBaseParticle().getMesh(); Texture text = mesh.getMaterial().getTexture(); particlesShaderProgram.setUniform("numCols", text.getNumCols()); particlesShaderProgram.setUniform("numRows", text.getNumRows()); mesh.renderListInstanced(emitter.getParticles(), true, transformation, viewMatrix, null); } glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthMask(true); particlesShaderProgram.unbind(); }
public void swap(Matrix3f m1, Matrix3f m2) { float tmp; tmp = m1.m00(); m1._m00(m2.m00()); m2._m00(tmp); tmp = m1.m01(); m1._m01(m2.m01()); m2._m01(tmp); tmp = m1.m02(); m1._m02(m2.m02()); m2._m02(tmp); tmp = m1.m10(); m1._m10(m2.m10()); m2._m10(tmp); tmp = m1.m11(); m1._m11(m2.m11()); m2._m11(tmp); tmp = m1.m12(); m1._m12(m2.m12()); m2._m12(tmp); tmp = m1.m20(); m1._m20(m2.m20()); m2._m20(tmp); tmp = m1.m21(); m1._m21(m2.m21()); m2._m21(tmp); tmp = m1.m22(); m1._m22(m2.m22()); m2._m22(tmp); }
public void get(Matrix3f m, int offset, FloatBuffer src) { m._m00(src.get(offset)); m._m01(src.get(offset+1)); m._m02(src.get(offset+2)); m._m10(src.get(offset+3)); m._m11(src.get(offset+4)); m._m12(src.get(offset+5)); m._m20(src.get(offset+6)); m._m21(src.get(offset+7)); m._m22(src.get(offset+8)); }