Java Code Examples for org.lwjgl.util.vector.Vector3f#add()

The following examples show how to use org.lwjgl.util.vector.Vector3f#add() . 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: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bpb blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 2
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bgj var1) {
	if (var1 != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (var1.b) {
			case a:
				Matrix4f.rotate(var1.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(var1.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(var1.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (var1.d) {
			if (Math.abs(var1.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(var1.a), var2, var3);
	}
}
 
Example 3
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bof blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 4
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, brg blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 5
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bvq blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 6
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bgj var1) {
	if (var1 != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (var1.b) {
			case a:
				Matrix4f.rotate(var1.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(var1.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(var1.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (var1.d) {
			if (Math.abs(var1.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(var1.a), var2, var3);
	}
}
 
Example 7
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bre blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 8
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bpb blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 9
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, boi blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 10
Source File: FaceBakery.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
private void a(Vector3f vector, bvs blockPartRotation) {
	if (blockPartRotation != null) {
		Matrix4f var2 = this.a();
		Vector3f var3 = new Vector3f(0.0F, 0.0F, 0.0F);
		switch (blockPartRotation.b) {
			case a:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), var2, var2);
				var3.set(0.0F, 1.0F, 1.0F);
				break;
			case b:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), var2, var2);
				var3.set(1.0F, 0.0F, 1.0F);
				break;
			case c:
				Matrix4f.rotate(blockPartRotation.c * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), var2, var2);
				var3.set(1.0F, 1.0F, 0.0F);
		}

		if (blockPartRotation.d) {
			if (Math.abs(blockPartRotation.c) == 22.5F) {
				var3.scale(fieldA);
			} else {
				var3.scale(fieldB);
			}

			Vector3f.add(var3, new Vector3f(1.0F, 1.0F, 1.0F), var3);
		} else {
			var3.set(1.0F, 1.0F, 1.0F);
		}

		this.a(vector, new Vector3f(blockPartRotation.a), var2, var3);
	}
}
 
Example 11
Source File: Colour.java    From LowPolyWater with The Unlicense 5 votes vote down vote up
public static Colour add(Colour colour1, Colour colour2, Colour dest) {
	if (dest == null) {
		return new Colour(Vector3f.add(colour1.col, colour2.col, null));
	} else {
		Vector3f.add(colour1.col, colour2.col, dest.col);
		return dest;
	}
}
 
Example 12
Source File: Vertex.java    From OpenGL-Animation with The Unlicense 5 votes vote down vote up
public void averageTangents(){
	if(tangents.isEmpty()){
		return;
	}
	for(Vector3f tangent : tangents){
		Vector3f.add(averagedTangent, tangent, averagedTangent);
	}
	averagedTangent.normalise();
}
 
Example 13
Source File: Frustum.java    From tectonicus with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public Vector3f[] getClearQuad(Vector3f eye, Vector3f right, Vector3f up)
{
	Vector3f[] result = new Vector3f[4];
	
	result[0] = new Vector3f(eye);
	result[1] = new Vector3f(eye);
	result[2] = new Vector3f(eye);
	result[3] = new Vector3f(eye);
	
	final float rightScale = getVisibleWorldWidth();
	Vector3f rightScaled = new Vector3f(right.x * rightScale, right.y * rightScale, right.z * rightScale);
	
	final float upScale = getVisibleWorldHeight();
	Vector3f upScaled = new Vector3f(up.x * upScale, up.y * upScale, up.z * upScale);
	
	Vector3f.add(result[0], upScaled, result[0]);
	Vector3f.sub(result[0], rightScaled, result[0]);
	
	Vector3f.add(result[1], upScaled, result[1]);
	Vector3f.add(result[1], rightScaled, result[1]);
	
	Vector3f.sub(result[2], upScaled, result[2]);
	Vector3f.add(result[2], rightScaled, result[2]);
	
	Vector3f.sub(result[3], upScaled, result[3]);
	Vector3f.sub(result[3], rightScaled, result[3]);
	
	return result;
}
 
Example 14
Source File: GData4.java    From ldparteditor with MIT License 4 votes vote down vote up
/**
 * FOR Cut, Copy, Paste and TEXMAP ONLY!
 *
 * @param v1
 * @param v2
 * @param v3
 * @param v4
 * @param xn
 * @param yn
 * @param zn
 * @param parent
 * @param c
 */
public GData4(Vertex v1, Vertex v2, Vertex v3, Vertex v4, GData1 parent, GColour c) {

    super(parent);
    this.colourNumber = c.getColourNumber();
    this.r = c.getR();
    this.g = c.getG();
    this.b = c.getB();
    this.a = c.getA();
    this.x1 = v1.x;
    this.y1 = v1.y;
    this.z1 = v1.z;
    this.x2 = v2.x;
    this.y2 = v2.y;
    this.z2 = v2.z;
    this.x3 = v3.x;
    this.y3 = v3.y;
    this.z3 = v3.z;
    this.x4 = v4.x;
    this.y4 = v4.y;
    this.z4 = v4.z;
    this.X1 = v1.X;
    this.Y1 = v1.Y;
    this.Z1 = v1.Z;
    this.X2 = v2.X;
    this.Y2 = v2.Y;
    this.Z2 = v2.Z;
    this.X3 = v3.X;
    this.Y3 = v3.Y;
    this.Z3 = v3.Z;
    this.X4 = v4.X;
    this.Y4 = v4.Y;
    this.Z4 = v4.Z;
    final Vector3f[] normals = new Vector3f[] { new Vector3f(), new Vector3f(), new Vector3f(), new Vector3f() };
    {
        final Vector3f[] lineVectors = new Vector3f[] { new Vector3f(), new Vector3f(), new Vector3f(), new Vector3f() };
        Vector3f.sub(new Vector3f(v2.x, v2.y, v2.z), new Vector3f(v1.x, v1.y, v1.z), lineVectors[0]);
        Vector3f.sub(new Vector3f(v3.x, v3.y, v3.z), new Vector3f(v2.x, v2.y, v2.z), lineVectors[1]);
        Vector3f.sub(new Vector3f(v4.x, v4.y, v4.z), new Vector3f(v3.x, v3.y, v3.z), lineVectors[2]);
        Vector3f.sub(new Vector3f(v1.x, v1.y, v1.z), new Vector3f(v4.x, v4.y, v4.z), lineVectors[3]);
        Vector3f.cross(lineVectors[0], lineVectors[1], normals[0]);
        Vector3f.cross(lineVectors[1], lineVectors[2], normals[1]);
        Vector3f.cross(lineVectors[2], lineVectors[3], normals[2]);
        Vector3f.cross(lineVectors[3], lineVectors[0], normals[3]);
    }
    Vector3f normal = new Vector3f();
    for (int i = 0; i < 4; i++) {
        Vector3f.add(normals[i], normal, normal);
    }
    this.xn = -normal.x;
    this.yn = -normal.y;
    this.zn = -normal.z;

}
 
Example 15
Source File: GData4.java    From ldparteditor with MIT License 4 votes vote down vote up
public GData4(final int colourNumber, float r, float g, float b, float a, Vertex v1, Vertex v2, Vertex v3, Vertex v4, GData1 parent, DatFile datFile) {

        super(parent);
        this.colourNumber = colourNumber;
        this.r = r;
        this.g = g;
        this.b = b;
        this.a = a;
        this.x1 = v1.x;
        this.y1 = v1.y;
        this.z1 = v1.z;
        this.x2 = v2.x;
        this.y2 = v2.y;
        this.z2 = v2.z;
        this.x3 = v3.x;
        this.y3 = v3.y;
        this.z3 = v3.z;
        this.x4 = v4.x;
        this.y4 = v4.y;
        this.z4 = v4.z;
        this.X1 = v1.X;
        this.Y1 = v1.Y;
        this.Z1 = v1.Z;
        this.X2 = v2.X;
        this.Y2 = v2.Y;
        this.Z2 = v2.Z;
        this.X3 = v3.X;
        this.Y3 = v3.Y;
        this.Z3 = v3.Z;
        this.X4 = v4.X;
        this.Y4 = v4.Y;
        this.Z4 = v4.Z;
        final Vector3f[] normals = new Vector3f[] { new Vector3f(), new Vector3f(), new Vector3f(), new Vector3f() };
        {
            final Vector3f[] lineVectors = new Vector3f[] { new Vector3f(), new Vector3f(), new Vector3f(), new Vector3f() };
            Vector3f.sub(new Vector3f(v2.x, v2.y, v2.z), new Vector3f(v1.x, v1.y, v1.z), lineVectors[0]);
            Vector3f.sub(new Vector3f(v3.x, v3.y, v3.z), new Vector3f(v2.x, v2.y, v2.z), lineVectors[1]);
            Vector3f.sub(new Vector3f(v4.x, v4.y, v4.z), new Vector3f(v3.x, v3.y, v3.z), lineVectors[2]);
            Vector3f.sub(new Vector3f(v1.x, v1.y, v1.z), new Vector3f(v4.x, v4.y, v4.z), lineVectors[3]);
            Vector3f.cross(lineVectors[0], lineVectors[1], normals[0]);
            Vector3f.cross(lineVectors[1], lineVectors[2], normals[1]);
            Vector3f.cross(lineVectors[2], lineVectors[3], normals[2]);
            Vector3f.cross(lineVectors[3], lineVectors[0], normals[3]);
        }
        Vector3f normal = new Vector3f();
        for (int i = 0; i < 4; i++) {
            Vector3f.add(normals[i], normal, normal);
        }
        this.xn = -normal.x;
        this.yn = -normal.y;
        this.zn = -normal.z;
        datFile.getVertexManager().add(this);
    }