List of usage examples for com.badlogic.gdx.math Plane getNormal
public Vector3 getNormal()
From source file:mobi.shad.s3lib.gfx.g3d.simpleobject.ObjectMesh.java
License:Apache License
public void addTrilange(Vector3 p1, Vector3 p2, Vector3 p3, Vector2 t1, Vector2 t2, Vector2 t3, Color c1, Color c2, Color c3) { Plane f1 = new Plane(p1, p3, p2); addVertex(p1.x, p1.y, p1.z, t1.x, t1.y, f1.getNormal().x, f1.getNormal().y, f1.getNormal().z, c1.r, c1.g, c1.b, c1.a);//from w w w .j a v a 2 s .c om addVertex(p2.x, p2.y, p2.z, t2.x, t2.y, f1.getNormal().x, f1.getNormal().y, f1.getNormal().z, c2.r, c2.g, c2.b, c2.a); addVertex(p3.x, p3.y, p3.z, t3.x, t3.y, f1.getNormal().x, f1.getNormal().y, f1.getNormal().z, c3.r, c3.g, c3.b, c3.a); isUpdate = true; }
From source file:mobi.shad.s3lib.gfx.g3d.simpleobject.ObjectMesh.java
License:Apache License
public void addTrilange(Vector3 p1, Vector3 p2, Vector3 p3, Vector2 t1, Vector2 t2, Vector2 t3) { Plane f1 = new Plane(p1, p3, p2); addVertex(p1.x, p1.y, p1.z, t1.x, t1.y, f1.getNormal().x, f1.getNormal().y, f1.getNormal().z, 1.0f, 1.0f, 1.0f, 1.0f);/*from w ww. j a v a 2 s .c o m*/ addVertex(p2.x, p2.y, p2.z, t2.x, t2.y, f1.getNormal().x, f1.getNormal().y, f1.getNormal().z, 1.0f, 1.0f, 1.0f, 1.0f); addVertex(p3.x, p3.y, p3.z, t3.x, t3.y, f1.getNormal().x, f1.getNormal().y, f1.getNormal().z, 1.0f, 1.0f, 1.0f, 1.0f); isUpdate = true; }
From source file:mobi.shad.s3lib.gfx.g3d.simpleobject.ObjectPolyhedron.java
License:Apache License
/** * @param v1/*from w ww .jav a2s .c om*/ * @param v2 * @param v3 * @param detail */ protected static void polyhedronMake(Vertex v1, Vertex v2, Vertex v3, int detail) { if (detail < 1) { com.badlogic.gdx.math.Plane p1 = new com.badlogic.gdx.math.Plane(v1.position, v2.position, v3.position); v1.normal = p1.getNormal(); v2.normal = p1.getNormal(); v3.normal = p1.getNormal(); Vector3 azimut = new Vector3(v1.position); azimut.add(v2.position).add(v3.position).scl(1f / 3f); float azi = polyhedronAzimuth(azimut); v1.uv = polyhedronCorrectUV(v1.uv, v1.position, azi); v2.uv = polyhedronCorrectUV(v2.uv, v2.position, azi); v3.uv = polyhedronCorrectUV(v3.uv, v3.position, azi); mesh.addTrilange(v2, v3, v1); } else { detail--; // // top quadrant // polyhedronMake(v1, polyhedronMidpoint(v1, v2), polyhedronMidpoint(v1, v3), detail); // // left quadrant // polyhedronMake(polyhedronMidpoint(v1, v2), v2, polyhedronMidpoint(v2, v3), detail); // // right quadrant // polyhedronMake(polyhedronMidpoint(v1, v3), polyhedronMidpoint(v2, v3), v3, detail); // // center quadrant // polyhedronMake(polyhedronMidpoint(v1, v3), polyhedronMidpoint(v2, v3), polyhedronMidpoint(v1, v3), detail); } }