Search in sources :

Example 51 with Spatial

use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.

the class Roof method init.

@Override
protected void init() {
    super.init();
    if (Util.isZero(uValue)) {
        uValue = 0.15;
    }
    if (Util.isZero(overhangLength)) {
        overhangLength = 2;
    }
    if (Util.isZero(volumetricHeatCapacity)) {
        volumetricHeatCapacity = 0.5;
    }
    orgCenters = new HashMap<Node, ReadOnlyVector3>();
    wallNormals = new ArrayList<ReadOnlyVector3>();
    walls = new ArrayList<Wall>();
    roofPartPrintVerticalMap = new HashMap<Spatial, Boolean>();
    dashPointsCache = new HashMap<Mesh, List<ReadOnlyVector3>>();
    roofPartsRoot = new Node("Roof Meshes Root");
    root.attachChild(roofPartsRoot);
    mesh = new Mesh("Roof");
    mesh.setModelBound(null);
    getEditPointShape(0).setDefaultColor(ColorRGBA.CYAN);
    // cleanup
    if (gableEditPointToWallMap != null) {
        for (final List<Wall> wallList : gableEditPointToWallMap.values()) {
            final Iterator<Wall> walls = wallList.iterator();
            while (walls.hasNext()) {
                if (Scene.getInstance().getParts().indexOf(walls.next()) == -1) {
                    walls.remove();
                }
            }
        }
    }
}
Also used : Node(com.ardor3d.scenegraph.Node) Mesh(com.ardor3d.scenegraph.Mesh) ReadOnlyVector3(com.ardor3d.math.type.ReadOnlyVector3) Spatial(com.ardor3d.scenegraph.Spatial) List(java.util.List) ArrayList(java.util.ArrayList)

Example 52 with Spatial

use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.

the class Roof method addPrintMeshes.

@Override
public void addPrintMeshes(final List<Mesh> list) {
    for (final Spatial roofPart : roofPartsRoot.getChildren()) {
        if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
            final Mesh mesh = (Mesh) ((Node) roofPart).getChild(REAL_MESH_INDEX);
            addPrintMesh(list, mesh);
        }
    }
}
Also used : Spatial(com.ardor3d.scenegraph.Spatial) Mesh(com.ardor3d.scenegraph.Mesh)

Example 53 with Spatial

use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.

the class Roof method updateDashLinesColor.

public void updateDashLinesColor() {
    for (final Spatial roofPart : roofPartsRoot.getChildren()) {
        if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
            final Node roofPartNode = (Node) roofPart;
            final Mesh dashLinesMesh = (Mesh) roofPartNode.getChild(5);
            dashLinesMesh.setDefaultColor(ColorRGBA.RED);
        }
    }
}
Also used : Spatial(com.ardor3d.scenegraph.Spatial) Node(com.ardor3d.scenegraph.Node) Mesh(com.ardor3d.scenegraph.Mesh)

Example 54 with Spatial

use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.

the class Roof method drawAnnotations.

@Override
public void drawAnnotations() {
    if (container == null) {
        return;
    }
    for (final Spatial roofPart : roofPartsRoot.getChildren()) {
        if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
            int annotCounter = 0, angleAnnotCounter = 0;
            final Node roofPartNode = (Node) roofPart;
            final FloatBuffer buf = ((Mesh) roofPartNode.getChild(0)).getMeshData().getVertexBuffer();
            final ArrayList<ReadOnlyVector3> convexHull = MeshLib.computeOutline(buf);
            final ReadOnlyVector3 normal = (ReadOnlyVector3) roofPart.getUserData();
            final int n = convexHull.size();
            for (int i = 0; i < n; i++) {
                final ReadOnlyVector3 p1 = convexHull.get(i);
                final ReadOnlyVector3 p2 = convexHull.get((i + 1) % n);
                final ReadOnlyVector3 p3 = convexHull.get((i + 2) % n);
                // Size annotation
                final ReadOnlyVector3 center = p1.add(p2, null).addLocal(p3).multiplyLocal(1.0 / 3.0);
                final SizeAnnotation sizeAnnot = fetchSizeAnnot(annotCounter++, (Node) roofPartNode.getChild(1));
                final boolean drawAnnotationsInside = Scene.isDrawAnnotationsInside();
                sizeAnnot.setRange(p2, p3, center, normal, false, Align.Center, true, true, drawAnnotationsInside);
                sizeAnnot.setLineWidth(original == null ? 1f : 2f);
                if (drawAnnotationsInside) {
                    sizeAnnot.setColor(ColorRGBA.WHITE);
                } else {
                    sizeAnnot.setColor(ColorRGBA.BLACK);
                }
                // Angle annotations
                final AngleAnnotation angleAnnot = fetchAngleAnnot(angleAnnotCounter++, (Node) roofPartNode.getChild(2));
                angleAnnot.setLineWidth(original == null ? 1f : 2f);
                angleAnnot.setRange(p2, p1, p3, normal);
            }
        }
    }
}
Also used : ReadOnlyVector3(com.ardor3d.math.type.ReadOnlyVector3) Spatial(com.ardor3d.scenegraph.Spatial) Node(com.ardor3d.scenegraph.Node) FloatBuffer(java.nio.FloatBuffer) AngleAnnotation(org.concord.energy3d.shapes.AngleAnnotation) SizeAnnotation(org.concord.energy3d.shapes.SizeAnnotation) CullHint(com.ardor3d.scenegraph.hint.CullHint) TPoint(org.poly2tri.triangulation.point.TPoint) TriangulationPoint(org.poly2tri.triangulation.TriangulationPoint) PolygonPoint(org.poly2tri.geometry.polygon.PolygonPoint)

Example 55 with Spatial

use of com.ardor3d.scenegraph.Spatial in project energy3d by concord-consortium.

the class ParabolicTrough method addPrintMeshes.

@Override
public void addPrintMeshes(final List<Mesh> list) {
    addPrintMesh(list, reflectorBack);
    addPrintMesh(list, absorber);
    addPrintMesh(list, absorberCore);
    addPrintMesh(list, absorberEnd1);
    addPrintMesh(list, absorberEnd1Core);
    addPrintMesh(list, absorberEnd2);
    addPrintMesh(list, absorberEnd2Core);
    for (final Spatial mesh : modulesRoot.getChildren()) {
        addPrintMesh(list, (Mesh) mesh);
    }
}
Also used : Spatial(com.ardor3d.scenegraph.Spatial)

Aggregations

Spatial (com.ardor3d.scenegraph.Spatial)57 Mesh (com.ardor3d.scenegraph.Mesh)36 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)33 Node (com.ardor3d.scenegraph.Node)26 CullHint (com.ardor3d.scenegraph.hint.CullHint)26 Vector3 (com.ardor3d.math.Vector3)24 TPoint (org.poly2tri.triangulation.point.TPoint)18 PickResults (com.ardor3d.intersection.PickResults)15 PrimitivePickResults (com.ardor3d.intersection.PrimitivePickResults)15 Ray3 (com.ardor3d.math.Ray3)15 Point (org.poly2tri.geometry.primitives.Point)14 FloatBuffer (java.nio.FloatBuffer)13 ArrayList (java.util.ArrayList)12 HousePart (org.concord.energy3d.model.HousePart)12 CancellationException (java.util.concurrent.CancellationException)10 Foundation (org.concord.energy3d.model.Foundation)10 Roof (org.concord.energy3d.model.Roof)9 Calendar (java.util.Calendar)7 UserData (org.concord.energy3d.model.UserData)6 Window (org.concord.energy3d.model.Window)6