Search in sources :

Example 1 with BoundingBox

use of com.ardor3d.bounding.BoundingBox in project energy3d by concord-consortium.

the class Door method init.

@Override
protected void init() {
    super.init();
    if (Util.isZero(uValue)) {
        uValue = 2;
    }
    if (Util.isZero(volumetricHeatCapacity)) {
        volumetricHeatCapacity = 0.5;
    }
    mesh = new Mesh("Door");
    mesh.getMeshData().setIndexMode(IndexMode.TriangleStrip);
    mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
    mesh.getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(4));
    mesh.getMeshData().setTextureBuffer(BufferUtils.createVector2Buffer(4), 0);
    updateTextureAndColor();
    mesh.setModelBound(new BoundingBox());
    mesh.setUserData(new UserData(this));
    root.attachChild(mesh);
    outlineMesh = new Line("Door (Outline)");
    outlineMesh.setLineWidth(2);
    outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(6 + 2 * 4));
    outlineMesh.setDefaultColor(ColorRGBA.BLACK);
    outlineMesh.setModelBound(new BoundingBox());
    Util.disablePickShadowLight(outlineMesh);
    root.attachChild(outlineMesh);
}
Also used : Line(com.ardor3d.scenegraph.Line) BoundingBox(com.ardor3d.bounding.BoundingBox) Mesh(com.ardor3d.scenegraph.Mesh)

Example 2 with BoundingBox

use of com.ardor3d.bounding.BoundingBox in project energy3d by concord-consortium.

the class Floor method init.

@Override
protected void init() {
    super.init();
    mesh = new Mesh("Floor");
    root.attachChild(mesh);
    mesh.getMeshData().setIndexMode(IndexMode.TriangleStrip);
    mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
    mesh.setModelBound(new BoundingBox());
    mesh.setRenderState(offsetState);
    outlineMesh = new Line("Floor (Outline)");
    outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8));
    outlineMesh.setDefaultColor(ColorRGBA.BLACK);
    outlineMesh.setModelBound(new BoundingBox());
    Util.disablePickShadowLight(outlineMesh);
    /* no need to attach because floor outline is only need in print preview */
    updateTextureAndColor();
    mesh.setUserData(new UserData(this));
}
Also used : Line(com.ardor3d.scenegraph.Line) BoundingBox(com.ardor3d.bounding.BoundingBox) Mesh(com.ardor3d.scenegraph.Mesh)

Example 3 with BoundingBox

use of com.ardor3d.bounding.BoundingBox in project energy3d by concord-consortium.

the class HousePart method addNewEditPointShape.

private void addNewEditPointShape(final int i) {
    final Sphere pointShape = new Sphere("Point", Vector3.ZERO, 8, 8, this instanceof SolarCollector ? 0.05 : 0.1);
    pointShape.setUserData(new UserData(this, i, true));
    // important
    pointShape.updateModelBound();
    pointShape.setVisible(false);
    pointShape.getSceneHints().setLightCombineMode(LightCombineMode.Off);
    pointShape.getSceneHints().setCastsShadows(false);
    pointShape.setModelBound(new BoundingBox());
    pointsRoot.attachChild(pointShape);
}
Also used : Sphere(com.ardor3d.scenegraph.shape.Sphere) BoundingBox(com.ardor3d.bounding.BoundingBox)

Example 4 with BoundingBox

use of com.ardor3d.bounding.BoundingBox in project energy3d by concord-consortium.

the class Human method init.

@Override
protected void init() {
    super.init();
    final double h;
    final double w;
    switch(humanType) {
        case JANE:
            w = 2.5;
            h = 8;
            break;
        case JENI:
            w = 3;
            h = 9;
            break;
        case JILL:
            w = 3;
            h = 8;
            break;
        case JACK:
            w = 2.8;
            h = 9;
            break;
        case JOHN:
            w = 4;
            h = 10;
            break;
        case JOSE:
            w = 8;
            h = 8;
            break;
        default:
            w = 2.5;
            h = 8;
    }
    mesh = new Quad("Human Quad", w, h);
    mesh.setModelBound(new BoundingBox());
    mesh.updateModelBound();
    mesh.setRotation(new Matrix3().fromAngles(Math.PI / 2, 0, 0));
    // stand on the ground by default
    translate(w, h, feetHeight);
    mesh.setUserData(new UserData(this, 0, true));
    final BlendState bs = new BlendState();
    bs.setEnabled(true);
    bs.setBlendEnabled(false);
    bs.setTestEnabled(true);
    bs.setTestFunction(TestFunction.GreaterThan);
    bs.setReference(0.7f);
    mesh.setRenderState(bs);
    mesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
    billboard = new BillboardNode("Billboard");
    billboard.setAlignment(BillboardAlignment.AxialZ);
    billboard.attachChild(mesh);
    root.attachChild(billboard);
    updateTextureAndColor();
}
Also used : Quad(com.ardor3d.scenegraph.shape.Quad) BoundingBox(com.ardor3d.bounding.BoundingBox) BillboardNode(com.ardor3d.scenegraph.extension.BillboardNode) BlendState(com.ardor3d.renderer.state.BlendState) Matrix3(com.ardor3d.math.Matrix3)

Example 5 with BoundingBox

use of com.ardor3d.bounding.BoundingBox in project energy3d by concord-consortium.

the class FresnelReflector method addPole.

private void addPole(final Vector3 position, final double poleHeight, final double baseZ) {
    final Cylinder pole = new Cylinder("Pole Cylinder", 2, detailed ? 10 : 2, 10, 0);
    pole.setRadius(0.6);
    pole.setRenderState(offsetState);
    // slightly shorter so that the pole won't penetrate the surface of the reflector
    pole.setHeight(poleHeight - 0.5 * pole.getRadius());
    pole.setModelBound(new BoundingBox());
    pole.updateModelBound();
    position.setZ(baseZ + pole.getHeight() / 2);
    pole.setTranslation(position);
    modulesRoot.attachChild(pole);
}
Also used : Cylinder(com.ardor3d.scenegraph.shape.Cylinder) BoundingBox(com.ardor3d.bounding.BoundingBox) OrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox)

Aggregations

BoundingBox (com.ardor3d.bounding.BoundingBox)23 Line (com.ardor3d.scenegraph.Line)12 Mesh (com.ardor3d.scenegraph.Mesh)10 OrientedBoundingBox (com.ardor3d.bounding.OrientedBoundingBox)8 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)8 Cylinder (com.ardor3d.scenegraph.shape.Cylinder)7 ColorRGBA (com.ardor3d.math.ColorRGBA)6 Vector3 (com.ardor3d.math.Vector3)6 CullHint (com.ardor3d.scenegraph.hint.CullHint)6 BMText (com.ardor3d.ui.text.BMText)6 FloatBuffer (java.nio.FloatBuffer)6 BlendState (com.ardor3d.renderer.state.BlendState)5 Node (com.ardor3d.scenegraph.Node)5 ArrayList (java.util.ArrayList)4 Matrix3 (com.ardor3d.math.Matrix3)3 Box (com.ardor3d.scenegraph.shape.Box)3 ReadOnlyColorRGBA (com.ardor3d.math.type.ReadOnlyColorRGBA)2 OffsetState (com.ardor3d.renderer.state.OffsetState)2 BillboardNode (com.ardor3d.scenegraph.extension.BillboardNode)2 Quad (com.ardor3d.scenegraph.shape.Quad)2