Java Code Examples for org.lwjgl.util.vector.Vector3f#setZ()
The following examples show how to use
org.lwjgl.util.vector.Vector3f#setZ() .
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: LinearEmitter.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
protected LinearEmitter(World world, Vector3f position, float offset_z, float emitter_radius, float emitter_height, int num_particles, float particles_per_second, Vector3f velocity, Vector3f acceleration, Vector4f color, Vector4f delta_color, Vector3f particle_radius, Vector3f growth_rate, float energy, float friction, int src_blend_func, int dst_blend_func, TextureKey[] textures, SpriteKey[] sprite_renderers, int types, AnimationManager manager) { super(world, position, src_blend_func, dst_blend_func, textures, sprite_renderers, types, manager); this.offset_z = offset_z; this.emitter_radius = emitter_radius; this.emitter_height = emitter_height; this.num_particles = num_particles; this.particles_per_second = particles_per_second; this.velocity = velocity; this.acceleration = acceleration; this.color = color; this.delta_color = delta_color; this.particle_radius = particle_radius; this.growth_rate = growth_rate; this.energy = energy; this.friction = friction; random = new Random((long)(position.getX() * position.getY() * position.getZ())); position.setZ(position.getZ() + offset_z); register(); }
Example 2
Source File: Arc.java From ldparteditor with MIT License | 4 votes |
private Matrix4f makeRotationDir(Vector3f direction) { final Vector3f direction2 = new Vector3f(); Matrix4f arrowRotation = new Matrix4f(); direction.normalise(); // Calculate point from hesse normal plane int rank = 0; if (Math.abs(direction.x) < EPSILON) rank++; if (Math.abs(direction.y) < EPSILON) rank++; if (Math.abs(direction.z) < EPSILON) rank++; if (rank == 1) { if (Math.abs(direction.x) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON) direction2.set(0f, 1f, 0f); else if (Math.abs(direction.z) < EPSILON) direction2.set(0f, 0f, 1f); } else if (rank == 2) { if (Math.abs(direction.x) < EPSILON && Math.abs(direction.y) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.x) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(0f, 1f, 0f); } else { direction2.setX(0f); direction2.setY(direction.y * 10f); direction2.setZ(-direction.y * 10f / direction.z); ; } final Vector3f xbase; final Vector3f ybase = new Vector3f(direction); final Vector3f zbase; xbase = Vector3f.cross(direction2, direction, null); zbase = Vector3f.cross(direction, xbase, null); xbase.normalise(); zbase.normalise(); arrowRotation.m00 = xbase.x; arrowRotation.m10 = ybase.x; arrowRotation.m20 = zbase.x; arrowRotation.m01 = xbase.y; arrowRotation.m11 = ybase.y; arrowRotation.m21 = zbase.y; arrowRotation.m02 = xbase.z; arrowRotation.m12 = ybase.z; arrowRotation.m22 = zbase.z; arrowRotation.m33 = 1f; return arrowRotation; }
Example 3
Source File: ArcInv.java From ldparteditor with MIT License | 4 votes |
private Matrix4f makeRotationDir(Vector3f direction) { final Vector3f direction2 = new Vector3f(); Matrix4f arrowRotation = new Matrix4f(); direction.normalise(); // Calculate point from hesse normal plane int rank = 0; if (Math.abs(direction.x) < EPSILON) rank++; if (Math.abs(direction.y) < EPSILON) rank++; if (Math.abs(direction.z) < EPSILON) rank++; if (rank == 1) { if (Math.abs(direction.x) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON) direction2.set(0f, 1f, 0f); else if (Math.abs(direction.z) < EPSILON) direction2.set(0f, 0f, 1f); } else if (rank == 2) { if (Math.abs(direction.x) < EPSILON && Math.abs(direction.y) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.x) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(0f, 1f, 0f); } else { direction2.setX(0f); direction2.setY(direction.y * 10f); direction2.setZ(-direction.y * 10f / direction.z); ; } final Vector3f xbase; final Vector3f ybase = new Vector3f(direction); final Vector3f zbase; xbase = Vector3f.cross(direction2, direction, null); zbase = Vector3f.cross(direction, xbase, null); xbase.normalise(); zbase.normalise(); arrowRotation.m00 = xbase.x; arrowRotation.m10 = ybase.x; arrowRotation.m20 = zbase.x; arrowRotation.m01 = xbase.y; arrowRotation.m11 = ybase.y; arrowRotation.m21 = zbase.y; arrowRotation.m02 = xbase.z; arrowRotation.m12 = ybase.z; arrowRotation.m22 = zbase.z; arrowRotation.m33 = 1f; return arrowRotation; }
Example 4
Source File: Circle.java From ldparteditor with MIT License | 4 votes |
private Matrix4f makeRotationDir(Vector3f direction) { final Vector3f direction2 = new Vector3f(); Matrix4f arrowRotation = new Matrix4f(); direction.normalise(); // Calculate point from hesse normal plane int rank = 0; if (Math.abs(direction.x) < EPSILON) rank++; if (Math.abs(direction.y) < EPSILON) rank++; if (Math.abs(direction.z) < EPSILON) rank++; if (rank == 1) { if (Math.abs(direction.x) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON) direction2.set(0f, 1f, 0f); else if (Math.abs(direction.z) < EPSILON) direction2.set(0f, 0f, 1f); } else if (rank == 2) { if (Math.abs(direction.x) < EPSILON && Math.abs(direction.y) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.x) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(0f, 1f, 0f); } else { direction2.setX(0f); direction2.setY(direction.y * 10f); direction2.setZ(-direction.y * 10f / direction.z); ; } final Vector3f xbase; final Vector3f ybase = new Vector3f(direction); final Vector3f zbase; xbase = Vector3f.cross(direction2, direction, null); zbase = Vector3f.cross(direction, xbase, null); xbase.normalise(); zbase.normalise(); arrowRotation.m00 = xbase.x; arrowRotation.m10 = ybase.x; arrowRotation.m20 = zbase.x; arrowRotation.m01 = xbase.y; arrowRotation.m11 = ybase.y; arrowRotation.m21 = zbase.y; arrowRotation.m02 = xbase.z; arrowRotation.m12 = ybase.z; arrowRotation.m22 = zbase.z; arrowRotation.m33 = 1f; return arrowRotation; }
Example 5
Source File: Arrow.java From ldparteditor with MIT License | 4 votes |
private Matrix4f makeRotationDir(Vector3f direction) { final Vector3f direction2 = new Vector3f(); Matrix4f arrowRotation = new Matrix4f(); direction.normalise(); // Calculate point from hesse normal plane int rank = 0; if (Math.abs(direction.x) < EPSILON) rank++; if (Math.abs(direction.y) < EPSILON) rank++; if (Math.abs(direction.z) < EPSILON) rank++; if (rank == 1) { if (Math.abs(direction.x) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON) direction2.set(0f, 1f, 0f); else if (Math.abs(direction.z) < EPSILON) direction2.set(0f, 0f, 1f); } else if (rank == 2) { if (Math.abs(direction.x) < EPSILON && Math.abs(direction.y) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.x) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(0f, 1f, 0f); } else { direction2.setX(0f); direction2.setY(direction.y * 10f); direction2.setZ(-direction.y * 10f / direction.z); ; } final Vector3f xbase; final Vector3f ybase = new Vector3f(direction); final Vector3f zbase; xbase = Vector3f.cross(direction2, direction, null); zbase = Vector3f.cross(direction, xbase, null); xbase.normalise(); zbase.normalise(); arrowRotation.m00 = xbase.x; arrowRotation.m10 = ybase.x; arrowRotation.m20 = zbase.x; arrowRotation.m01 = xbase.y; arrowRotation.m11 = ybase.y; arrowRotation.m21 = zbase.y; arrowRotation.m02 = xbase.z; arrowRotation.m12 = ybase.z; arrowRotation.m22 = zbase.z; arrowRotation.m33 = 1f; return arrowRotation; }
Example 6
Source File: ArrowBlunt.java From ldparteditor with MIT License | 4 votes |
private Matrix4f makeRotationDir(Vector3f direction) { final Vector3f direction2 = new Vector3f(); Matrix4f arrowRotation = new Matrix4f(); direction.normalise(); // Calculate point from hesse normal plane int rank = 0; if (Math.abs(direction.x) < EPSILON) rank++; if (Math.abs(direction.y) < EPSILON) rank++; if (Math.abs(direction.z) < EPSILON) rank++; if (rank == 1) { if (Math.abs(direction.x) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON) direction2.set(0f, 1f, 0f); else if (Math.abs(direction.z) < EPSILON) direction2.set(0f, 0f, 1f); } else if (rank == 2) { if (Math.abs(direction.x) < EPSILON && Math.abs(direction.y) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.x) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(1f, 0f, 0f); else if (Math.abs(direction.y) < EPSILON && Math.abs(direction.z) < EPSILON) direction2.set(0f, 1f, 0f); } else { direction2.setX(0f); direction2.setY(direction.y * 10f); direction2.setZ(-direction.y * 10f / direction.z); ; } final Vector3f xbase; final Vector3f ybase = new Vector3f(direction); final Vector3f zbase; xbase = Vector3f.cross(direction2, direction, null); zbase = Vector3f.cross(direction, xbase, null); xbase.normalise(); zbase.normalise(); arrowRotation.m00 = xbase.x; arrowRotation.m10 = ybase.x; arrowRotation.m20 = zbase.x; arrowRotation.m01 = xbase.y; arrowRotation.m11 = ybase.y; arrowRotation.m21 = zbase.y; arrowRotation.m02 = xbase.z; arrowRotation.m12 = ybase.z; arrowRotation.m22 = zbase.z; arrowRotation.m33 = 1f; return arrowRotation; }