Search in sources :

Example 1 with CullHint

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

the class Roof method setAnnotationsVisible.

@Override
public void setAnnotationsVisible(final boolean visible) {
    super.setAnnotationsVisible(visible);
    final CullHint cull = visible ? CullHint.Inherit : CullHint.Always;
    if (roofPartsRoot != null) {
        for (final Spatial roofPart : roofPartsRoot.getChildren()) {
            if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
                ((Node) roofPart).getChild(1).getSceneHints().setCullHint(cull);
                ((Node) roofPart).getChild(2).getSceneHints().setCullHint(cull);
            }
        }
    }
}
Also used : Spatial(com.ardor3d.scenegraph.Spatial) Node(com.ardor3d.scenegraph.Node) CullHint(com.ardor3d.scenegraph.hint.CullHint)

Example 2 with CullHint

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

the class Wall method drawMesh.

@Override
protected void drawMesh() {
    final boolean drawable = isDrawable();
    final CullHint drawableSolidWall = drawable && type == SOLID_WALL ? CullHint.Inherit : CullHint.Always;
    mesh.getSceneHints().setCullHint(drawableSolidWall);
    outlineMesh.getSceneHints().setCullHint(drawableSolidWall);
    final CullHint drawableSolidNoneFrozenWall = drawable && type == SOLID_WALL ? CullHint.Inherit : CullHint.Always;
    backMesh.getSceneHints().setCullHint(drawableSolidNoneFrozenWall);
    surroundMesh.getSceneHints().setCullHint(drawableSolidNoneFrozenWall);
    windowsSurroundMesh.getSceneHints().setCullHint(drawableSolidNoneFrozenWall);
    if (!drawable) {
        return;
    }
    computeNormalAndXYTransform();
    wallAndWindowsPoints = computeWallAndWindowPolygon(false);
    stretchToRoof(wallAndWindowsPoints.get(0));
    switch(type) {
        case EMPTY:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Always);
            rails.getSceneHints().setCullHint(CullHint.Always);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            break;
        case VERTICAL_EDGES_ONLY:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Inherit);
            rails.getSceneHints().setCullHint(CullHint.Always);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            drawVerticalEdges(columnRadius);
            break;
        case COLUMNS_ONLY:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Inherit);
            rails.getSceneHints().setCullHint(CullHint.Always);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            drawColumns(10);
            break;
        case RAILS_ONLY:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Always);
            rails.getSceneHints().setCullHint(CullHint.Inherit);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            drawRails(1, false);
            break;
        case COLUMNS_RAILS:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Inherit);
            rails.getSceneHints().setCullHint(CullHint.Inherit);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            drawColumns(10);
            drawRails(1, false);
            break;
        case FENCE:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Always);
            rails.getSceneHints().setCullHint(CullHint.Inherit);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            drawRails(1, true);
            break;
        case STEEL_FRAME:
            outlineMesh.getSceneHints().setCullHint(CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Inherit);
            rails.getSceneHints().setCullHint(CullHint.Always);
            steelFrame.getSceneHints().setCullHint(CullHint.Inherit);
            drawVerticalEdges(1);
            drawSteelFrame(0.25, 10);
            break;
        default:
            outlineMesh.getSceneHints().setCullHint(drawable && !hideOutline ? CullHint.Inherit : CullHint.Always);
            columns.getSceneHints().setCullHint(CullHint.Always);
            rails.getSceneHints().setCullHint(CullHint.Always);
            steelFrame.getSceneHints().setCullHint(CullHint.Always);
            if (Scene.getInstance().isDrawThickness() && isShortWall) {
                final Vector3 dir = getAbsPoint(2).subtract(getAbsPoint(0), null).normalizeLocal();
                if (neighbors[0] != null && neighbors[0].getNeighborOf(this).isFirstPointInserted()) {
                    if (isPerpendicularToNeighbor(0)) {
                        reduceBackMeshWidth(wallAndWindowsPoints.get(0), dir, 0);
                    }
                }
                if (neighbors[1] != null && neighbors[1].getNeighborOf(this).isFirstPointInserted()) {
                    dir.normalizeLocal().negateLocal();
                    if (isPerpendicularToNeighbor(1)) {
                        reduceBackMeshWidth(wallAndWindowsPoints.get(0), dir, 1);
                    }
                }
            }
            drawOutline(wallAndWindowsPoints);
            if (isDrawBackMesh()) {
                drawBackMesh(computeWallAndWindowPolygon(true));
            } else {
                backMesh.getSceneHints().setCullHint(CullHint.Always);
            }
            drawSurroundMesh(thicknessNormal);
            drawWindowsSurroundMesh(thicknessNormal);
    }
    drawPolygon(wallAndWindowsPoints, mesh, true, true, true);
    drawPolygon(wallAndWindowsPoints, invisibleMesh, false, false, false);
    CollisionTreeManager.INSTANCE.removeCollisionTree(mesh);
    CollisionTreeManager.INSTANCE.removeCollisionTree(invisibleMesh);
    root.updateWorldBound(true);
}
Also used : ReadOnlyVector3(com.ardor3d.math.type.ReadOnlyVector3) Vector3(com.ardor3d.math.Vector3) CullHint(com.ardor3d.scenegraph.hint.CullHint)

Example 3 with CullHint

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

the class HousePart method setAnnotationsVisible.

public void setAnnotationsVisible(final boolean visible) {
    final CullHint cull = visible ? CullHint.Inherit : CullHint.Always;
    sizeAnnotRoot.getSceneHints().setCullHint(cull);
    angleAnnotRoot.getSceneHints().setCullHint(cull);
}
Also used : CullHint(com.ardor3d.scenegraph.hint.CullHint)

Aggregations

CullHint (com.ardor3d.scenegraph.hint.CullHint)3 Vector3 (com.ardor3d.math.Vector3)1 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)1 Node (com.ardor3d.scenegraph.Node)1 Spatial (com.ardor3d.scenegraph.Spatial)1