Search in sources :

Example 1 with Face3i

use of org.jwildfire.create.eden.base.Face3i in project JWildfire by thargor6.

the class MeshBuilder method buildPart.

@Override
public void buildPart(StringBuilder pTarget) {
    if (mesh != null && mesh.getPoints().size() > 0 && mesh.getFaces().size() > 0) {
        pTarget.append("object {\n");
        if (!shader.isEmpty())
            pTarget.append("  shader " + shader.toSceneStringPart() + "\n");
        transform.buildPart(pTarget);
        pTarget.append("  type generic-mesh\n");
        if (!name.isEmpty())
            pTarget.append("  name " + name.toSceneStringPart() + "\n");
        pTarget.append("  points " + mesh.getPoints().size() + "\n");
        for (Point3f point : mesh.getPoints()) {
            pTarget.append("    " + point.getX() + " " + point.getY() + " " + point.getZ() + "\n");
        }
        pTarget.append("  triangles " + mesh.getFaces().size() + "\n");
        for (Face3i face : mesh.getFaces()) {
            pTarget.append("    " + face.getA() + " " + face.getC() + " " + face.getB() + "\n");
        }
        pTarget.append("  normals none\n");
        pTarget.append("  uvs none\n");
        pTarget.append("}\n");
    }
}
Also used : Point3f(org.jwildfire.create.eden.base.Point3f) Face3i(org.jwildfire.create.eden.base.Face3i)

Example 2 with Face3i

use of org.jwildfire.create.eden.base.Face3i in project JWildfire by thargor6.

the class FilterKernelVisualisation3dRenderer method addCube.

private void addCube(Scene pScene, double pX, double pY, double pWidth, double pHeight, double pZ, Color pColor) {
    Mesh mesh = pScene.addMesh();
    List<Point3f> pPoints = mesh.getPoints();
    List<Face3i> pFaces = mesh.getFaces();
    double z0 = 0;
    int idx0 = pPoints.size();
    // top points
    pPoints.add(new Point3f(pX, pY, pZ));
    pPoints.add(new Point3f(pX, pY + pHeight, pZ));
    pPoints.add(new Point3f(pX + pWidth, pY + pHeight, pZ));
    pPoints.add(new Point3f(pX + pWidth, pY, pZ));
    // top 0 1 3/3 1 2
    pFaces.add(new Face3i(idx0, idx0 + 1, idx0 + 3));
    pFaces.add(new Face3i(idx0 + 3, idx0 + 1, idx0 + 2));
    // bottom points
    pPoints.add(new Point3f(pX, pY, z0));
    pPoints.add(new Point3f(pX, pY + pHeight, z0));
    pPoints.add(new Point3f(pX + pWidth, pY + pHeight, z0));
    pPoints.add(new Point3f(pX + pWidth, pY, z0));
    // front 1 5 2/2 5 6
    pFaces.add(new Face3i(idx0 + 1, idx0 + 5, idx0 + 2));
    pFaces.add(new Face3i(idx0 + 2, idx0 + 5, idx0 + 6));
    // right 2 6 3/3 6 7
    pFaces.add(new Face3i(idx0 + 2, idx0 + 6, idx0 + 3));
    pFaces.add(new Face3i(idx0 + 3, idx0 + 6, idx0 + 7));
    // back 3 7 0/0 7 4
    pFaces.add(new Face3i(idx0 + 3, idx0 + 7, idx0));
    pFaces.add(new Face3i(idx0, idx0 + 7, idx0 + 4));
    // left 0 4 1/1 4 5
    pFaces.add(new Face3i(idx0, idx0 + 4, idx0 + 1));
    pFaces.add(new Face3i(idx0 + 1, idx0 + 4, idx0 + 5));
}
Also used : Point3f(org.jwildfire.create.eden.base.Point3f) Mesh(org.jwildfire.create.eden.scene.primitive.Mesh) Face3i(org.jwildfire.create.eden.base.Face3i)

Aggregations

Face3i (org.jwildfire.create.eden.base.Face3i)2 Point3f (org.jwildfire.create.eden.base.Point3f)2 Mesh (org.jwildfire.create.eden.scene.primitive.Mesh)1