Search in sources :

Example 1 with Cylinder

use of com.ardor3d.scenegraph.shape.Cylinder 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)

Example 2 with Cylinder

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

the class Rack method addPole.

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

Example 3 with Cylinder

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

the class Mirror method init.

@Override
protected void init() {
    super.init();
    if (Util.isZero(mirrorWidth)) {
        mirrorWidth = 5;
    }
    if (Util.isZero(mirrorHeight)) {
        mirrorHeight = 3;
    }
    if (Util.isZero(reflectance)) {
        reflectance = 0.9;
    }
    if (Util.isZero(opticalEfficiency)) {
        opticalEfficiency = 1;
    }
    if (Util.isZero(baseHeight)) {
        baseHeight = 10;
    }
    if (heliostatTarget != null) {
        // FIXME: Somehow the target, when copied, doesn't point to the right object. This is not a prefect solution, but it fixes the problem.
        final HousePart hp = Scene.getInstance().getPart(heliostatTarget.getId());
        if (hp instanceof Foundation) {
            heliostatTarget = (Foundation) hp;
        } else {
            heliostatTarget = null;
        }
    }
    mesh = new Mesh("Reflecting Mirror");
    mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(6));
    mesh.getMeshData().setTextureBuffer(BufferUtils.createVector2Buffer(6), 0);
    mesh.setModelBound(new OrientedBoundingBox());
    mesh.setUserData(new UserData(this));
    root.attachChild(mesh);
    surround = new Box("Mirror (Surround)");
    surround.setModelBound(new OrientedBoundingBox());
    final OffsetState offset = new OffsetState();
    offset.setFactor(1);
    offset.setUnits(1);
    surround.setRenderState(offset);
    root.attachChild(surround);
    outlineMesh = new Line("Mirror (Outline)");
    outlineMesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(8));
    outlineMesh.setDefaultColor(ColorRGBA.BLACK);
    outlineMesh.setModelBound(new OrientedBoundingBox());
    root.attachChild(outlineMesh);
    // if there are many mirrors, reduce the solution of post
    post = new Cylinder("Post Cylinder", 2, Scene.getInstance().getAllHeliostats().size() < 200 ? 10 : 2, 10, 0);
    post.setRadius(0.6);
    post.setDefaultColor(ColorRGBA.WHITE);
    post.setRenderState(offsetState);
    post.setModelBound(new BoundingBox());
    post.updateModelBound();
    root.attachChild(post);
    lightBeams = new Line("Light Beams");
    lightBeams.setLineWidth(1f);
    lightBeams.setStipplePattern((short) 0xffff);
    lightBeams.setModelBound(null);
    // final BlendState blendState = new BlendState();
    // blendState.setBlendEnabled(true);
    // lightBeams.setRenderState(blendState);
    // lightBeams.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
    Util.disablePickShadowLight(lightBeams);
    lightBeams.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4));
    lightBeams.setDefaultColor(new ColorRGBA(1f, 1f, 1f, 1f));
    root.attachChild(lightBeams);
    label = new BMText("Label", "# " + id, FontManager.getInstance().getPartNumberFont(), Align.Center, Justify.Center);
    Util.initHousePartLabel(label);
    label.setFontScale(0.5);
    label.setVisible(false);
    root.attachChild(label);
    updateTextureAndColor();
}
Also used : Line(com.ardor3d.scenegraph.Line) Cylinder(com.ardor3d.scenegraph.shape.Cylinder) OrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox) ColorRGBA(com.ardor3d.math.ColorRGBA) BoundingBox(com.ardor3d.bounding.BoundingBox) OrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox) Mesh(com.ardor3d.scenegraph.Mesh) BoundingBox(com.ardor3d.bounding.BoundingBox) Box(com.ardor3d.scenegraph.shape.Box) OrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox) BMText(com.ardor3d.ui.text.BMText) OffsetState(com.ardor3d.renderer.state.OffsetState)

Example 4 with Cylinder

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

the class ParabolicDish method addPrintMeshes.

@Override
public void addPrintMeshes(final List<Mesh> list) {
    // addPrintMesh(list, dish);
    addPrintMesh(list, dishBack);
    addPrintMesh(list, post);
    addPrintMesh(list, duct);
    addPrintMesh(list, receiver);
    for (final Cylinder mesh : tripod) {
        addPrintMesh(list, mesh);
    }
}
Also used : Cylinder(com.ardor3d.scenegraph.shape.Cylinder)

Example 5 with Cylinder

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

the class ParabolicDish method init.

@Override
protected void init() {
    super.init();
    if (Util.isZero(copyLayoutGap)) {
        // FIXME: Why is a transient member evaluated to zero?
        copyLayoutGap = 0.2;
    }
    if (Util.isZero(rimRadius)) {
        rimRadius = 3;
    }
    if (Util.isZero(focalLength)) {
        focalLength = 2;
    }
    if (Util.isZero(reflectance)) {
        reflectance = 0.9;
    }
    if (Util.isZero(absorptance)) {
        absorptance = 0.95;
    }
    if (Util.isZero(opticalEfficiency)) {
        opticalEfficiency = 0.7;
    }
    if (Util.isZero(thermalEfficiency)) {
        thermalEfficiency = 0.3;
    }
    if (Util.isZero(nRadialSections)) {
        nRadialSections = 32;
    }
    if (Util.isZero(nAxialSections)) {
        nAxialSections = 32;
    }
    if (Util.isZero(nrib)) {
        nrib = 6;
    }
    detailed = Scene.getInstance().countParts(getClass()) < 500;
    final double annotationScale = Scene.getInstance().getAnnotationScale();
    mesh = new Paraboloid("Paraboloid", rimRadius / annotationScale, 2.0 * Math.sqrt(focalLength / annotationScale), nAxialSections, nRadialSections);
    mesh.setDefaultColor(SKY_BLUE);
    mesh.setModelBound(new OrientedBoundingBox());
    mesh.setUserData(new UserData(this));
    CullState cullState = new CullState();
    cullState.setCullFace(Face.Front);
    mesh.setRenderState(cullState);
    root.attachChild(mesh);
    dish = (Paraboloid) mesh;
    dishBack = mesh.makeCopy(true);
    dishBack.clearRenderState(StateType.Texture);
    dishBack.setDefaultColor(ColorRGBA.LIGHT_GRAY);
    cullState = new CullState();
    cullState.setCullFace(Face.None);
    dishBack.setRenderState(cullState);
    root.attachChild(dishBack);
    // if there are many dishes, reduce the solution of post
    post = new Cylinder("Post Cylinder", 2, detailed ? 10 : 2, 10, 0);
    post.setDefaultColor(ColorRGBA.WHITE);
    post.setRadius(0.6);
    post.setRenderState(offsetState);
    post.setModelBound(new BoundingBox());
    post.updateModelBound();
    root.attachChild(post);
    // if there are many mirrors, reduce the solution of post
    duct = new Cylinder("Duct Cylinder", 2, detailed ? 10 : 2, 10, 0);
    duct.setDefaultColor(ColorRGBA.WHITE);
    duct.setRadius(0.6);
    duct.setRenderState(offsetState);
    duct.setModelBound(new BoundingBox());
    duct.updateModelBound();
    root.attachChild(duct);
    final ColorRGBA receiverColor = new ColorRGBA(0.9f, 0.9f, 0.95f, 1);
    // if there are many mirrors, reduce the solution of post
    receiver = new Cylinder("Receiver Cylinder", 2, detailed ? 10 : 2, 10, 0, true);
    receiver.setDefaultColor(receiverColor);
    receiver.setRadius(2);
    receiver.setHeight(3);
    receiver.setRenderState(offsetState);
    receiver.setModelBound(new BoundingBox());
    receiver.updateModelBound();
    root.attachChild(receiver);
    outlines = new Line("Parabolic Dish (Outline)");
    outlines.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(2 * (dish.getRSamples() + 1)));
    outlines.setDefaultColor(ColorRGBA.BLACK);
    outlines.setModelBound(new OrientedBoundingBox());
    outlines.setLineWidth(1f);
    outlines.setStipplePattern((short) 0xffff);
    Util.disablePickShadowLight(outlines);
    root.attachChild(outlines);
    tripod = new Cylinder[3];
    for (int i = 0; i < 3; i++) {
        // if there are many mirrors, reduce the solution of post
        tripod[i] = new Cylinder("Tripod Cylinder " + i, 2, detailed ? 10 : 2, 10, 0);
        tripod[i].setDefaultColor(receiverColor);
        tripod[i].setRadius(0.2);
        tripod[i].setRenderState(offsetState);
        tripod[i].setModelBound(new BoundingBox());
        tripod[i].updateModelBound();
    }
    lightBeams = new Line("Light Beams");
    lightBeams.setLineWidth(1f);
    lightBeams.setStipplePattern((short) 0xffff);
    lightBeams.setModelBound(null);
    Util.disablePickShadowLight(lightBeams);
    lightBeams.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(2));
    lightBeams.setDefaultColor(new ColorRGBA(1f, 1f, 1f, 1f));
    root.attachChild(lightBeams);
    label = new BMText("Label", "#" + id, FontManager.getInstance().getPartNumberFont(), Align.Center, Justify.Center);
    Util.initHousePartLabel(label);
    label.setFontScale(0.5);
    label.setVisible(false);
    root.attachChild(label);
    updateTextureAndColor();
    setStructureType(structureType);
    if (!points.isEmpty()) {
        oldDishCenter = points.get(0).clone();
    }
}
Also used : Line(com.ardor3d.scenegraph.Line) Cylinder(com.ardor3d.scenegraph.shape.Cylinder) OrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox) ColorRGBA(com.ardor3d.math.ColorRGBA) BoundingBox(com.ardor3d.bounding.BoundingBox) OrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox) CullState(com.ardor3d.renderer.state.CullState) BMText(com.ardor3d.ui.text.BMText)

Aggregations

Cylinder (com.ardor3d.scenegraph.shape.Cylinder)9 BoundingBox (com.ardor3d.bounding.BoundingBox)7 OrientedBoundingBox (com.ardor3d.bounding.OrientedBoundingBox)7 ColorRGBA (com.ardor3d.math.ColorRGBA)4 Line (com.ardor3d.scenegraph.Line)4 BMText (com.ardor3d.ui.text.BMText)4 BlendState (com.ardor3d.renderer.state.BlendState)3 Node (com.ardor3d.scenegraph.Node)3 ReadOnlyColorRGBA (com.ardor3d.math.type.ReadOnlyColorRGBA)2 CullState (com.ardor3d.renderer.state.CullState)2 Mesh (com.ardor3d.scenegraph.Mesh)2 CullHint (com.ardor3d.scenegraph.hint.CullHint)2 BoundingSphere (com.ardor3d.bounding.BoundingSphere)1 Matrix3 (com.ardor3d.math.Matrix3)1 Vector3 (com.ardor3d.math.Vector3)1 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)1 OffsetState (com.ardor3d.renderer.state.OffsetState)1 MeshData (com.ardor3d.scenegraph.MeshData)1 BillboardNode (com.ardor3d.scenegraph.extension.BillboardNode)1 Box (com.ardor3d.scenegraph.shape.Box)1