Java Code Examples for org.lwjgl.util.vector.Vector3f#scale()
The following examples show how to use
org.lwjgl.util.vector.Vector3f#scale() .
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: BillboardPainter.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
private final static void initClipPlane(int clip_enum, int face_index, int vertex_index1, int vertex_index2, short[] indices, float[] face_tex_coords, float handedness) { float u1 = getElement(face_index, vertex_index1, 0, 2, indices, face_tex_coords); float v1 = getElement(face_index, vertex_index1, 1, 2, indices, face_tex_coords); float u2 = getElement(face_index, vertex_index2, 0, 2, indices, face_tex_coords); float v2 = getElement(face_index, vertex_index2, 1, 2, indices, face_tex_coords); Vector3f vec1 = new Vector3f(0f, 0f, 1f); Vector3f vec2 = new Vector3f(u2 - u1, v2 - v1, 0); Vector3f vec3 = new Vector3f(); Vector3f.cross(vec1, vec2, vec3); vec3.scale(handedness); vec3.normalise(); vec1.set(u1, v1, 0f); float d = -Vector3f.dot(vec3, vec1); plane_buf.put(0, vec3.x).put(1, vec3.y).put(2, vec3.z).put(3, d); GL11.glClipPlane(clip_enum, plane_buf); }
Example 2
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 3
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 4
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 5
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 6
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 7
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 8
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 9
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 10
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 11
Source File: FaceBakery.java From The-5zig-Mod with MIT License | 5 votes |
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 12
Source File: World.java From tectonicus with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void draw(Camera camera, final boolean showSky, final boolean genAlphaMask) { // Find visible chunks ArrayList<ChunkCoord> visible = findVisible(camera); // Sort back to front Collections.sort(visible, new BackToFrontSorter(camera)); // Clear the alpha buffer if (genAlphaMask) { rasteriser.enableColourWriting(false, true); rasteriser.enableDepthTest(false); rasteriser.enableBlending(false); rasteriser.beginShape(PrimativeType.Quads); { if (genAlphaMask) rasteriser.colour(0, 0, 0, 0); else rasteriser.colour(0, 0, 0, 1); Vector3f[] quad = camera.getClearQuad(); Vector3f offset = new Vector3f(camera.getForward()); offset.scale(+0.20f); // Ugh. Arbitrary fudge factor because camera.getClearQuad doesn't seem to quite work for perspective camera for (Vector3f v : quad) { v.x += offset.x; v.y += offset.y; v.z += offset.z; } rasteriser.vertex(quad[0].x, quad[0].y, quad[0].z); rasteriser.vertex(quad[1].x, quad[1].y, quad[1].z); rasteriser.vertex(quad[2].x, quad[2].y, quad[2].z); rasteriser.vertex(quad[3].x, quad[3].y, quad[3].z); } rasteriser.endShape(); rasteriser.enableDepthTest(true); rasteriser.enableColourWriting(true, false); } // Skybox first if (showSky) { Geometry skybox = lightStyle == LightStyle.Night ? nightSkybox : daySkybox; skybox.drawSolidSurfaces(camera.getEyePosition().x, camera.getEyePosition().y, camera.getEyePosition().z); rasteriser.clearDepthBuffer(); } // Now the chunks in batches ArrayList<ChunkCoord> toProcess = new ArrayList<ChunkCoord>(visible); while (!toProcess.isEmpty()) { ArrayList<ChunkCoord> batch = new ArrayList<ChunkCoord>(); final int nextBatchSize = Math.min(BATCH_SIZE, toProcess.size()); for (int i=0; i<nextBatchSize; i++) { batch.add( toProcess.remove(0) ); } draw(camera, batch, genAlphaMask); } }