private void fixTerrainFrustum(double x, double y, double z) { this.debugFixedClippingHelper = new ClippingHelperImpl(); ((ClippingHelperImpl)this.debugFixedClippingHelper).init(); Matrix4f matrix4f = new Matrix4f(this.debugFixedClippingHelper.modelviewMatrix); matrix4f.transpose(); Matrix4f matrix4f1 = new Matrix4f(this.debugFixedClippingHelper.projectionMatrix); matrix4f1.transpose(); Matrix4f matrix4f2 = new Matrix4f(); Matrix4f.mul(matrix4f1, matrix4f, matrix4f2); matrix4f2.invert(); this.debugTerrainFrustumPosition.field_181059_a = x; this.debugTerrainFrustumPosition.field_181060_b = y; this.debugTerrainFrustumPosition.field_181061_c = z; this.debugTerrainMatrix[0] = new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[1] = new Vector4f(1.0F, -1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[2] = new Vector4f(1.0F, 1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[3] = new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[4] = new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F); this.debugTerrainMatrix[5] = new Vector4f(1.0F, -1.0F, 1.0F, 1.0F); this.debugTerrainMatrix[6] = new Vector4f(1.0F, 1.0F, 1.0F, 1.0F); this.debugTerrainMatrix[7] = new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F); for (int i = 0; i < 8; ++i) { Matrix4f.transform(matrix4f2, this.debugTerrainMatrix[i], this.debugTerrainMatrix[i]); this.debugTerrainMatrix[i].x /= this.debugTerrainMatrix[i].w; this.debugTerrainMatrix[i].y /= this.debugTerrainMatrix[i].w; this.debugTerrainMatrix[i].z /= this.debugTerrainMatrix[i].w; this.debugTerrainMatrix[i].w = 1.0F; } }
private void fixTerrainFrustum(double x, double y, double z) { this.debugFixedClippingHelper = new ClippingHelperImpl(); ((ClippingHelperImpl)this.debugFixedClippingHelper).init(); Matrix4f matrix4f = new Matrix4f(this.debugFixedClippingHelper.modelviewMatrix); matrix4f.transpose(); Matrix4f matrix4f1 = new Matrix4f(this.debugFixedClippingHelper.projectionMatrix); matrix4f1.transpose(); Matrix4f matrix4f2 = new Matrix4f(); Matrix4f.mul(matrix4f1, matrix4f, matrix4f2); matrix4f2.invert(); this.debugTerrainFrustumPosition.x = x; this.debugTerrainFrustumPosition.y = y; this.debugTerrainFrustumPosition.z = z; this.debugTerrainMatrix[0] = new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[1] = new Vector4f(1.0F, -1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[2] = new Vector4f(1.0F, 1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[3] = new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F); this.debugTerrainMatrix[4] = new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F); this.debugTerrainMatrix[5] = new Vector4f(1.0F, -1.0F, 1.0F, 1.0F); this.debugTerrainMatrix[6] = new Vector4f(1.0F, 1.0F, 1.0F, 1.0F); this.debugTerrainMatrix[7] = new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F); for (int i = 0; i < 8; ++i) { Matrix4f.transform(matrix4f2, this.debugTerrainMatrix[i], this.debugTerrainMatrix[i]); this.debugTerrainMatrix[i].x /= this.debugTerrainMatrix[i].w; this.debugTerrainMatrix[i].y /= this.debugTerrainMatrix[i].w; this.debugTerrainMatrix[i].z /= this.debugTerrainMatrix[i].w; this.debugTerrainMatrix[i].w = 1.0F; } }