Package libshapedraw.primitive

Examples of libshapedraw.primitive.Vector3


    private ReadonlyVector3 getPlayerCoords() {
        if (curPlayer == null) {
            return Vector3.ZEROS;
        }
        float partialTick = getPartialTick();
        return new Vector3(
                // obf: Entity.prevPosX, Entity.posX
                curPlayer.prevPosX + partialTick*(curPlayer.posX - curPlayer.prevPosX),
                // obf: Entity.prevPosY, Entity.posY
                curPlayer.prevPosY + partialTick*(curPlayer.posY - curPlayer.prevPosY),
                // obf: Entity.prevPosZ, Entity.posZ
View Full Code Here


    @Override
    public void load() {
        libShapeDraw = new LibShapeDraw().verifyInitialized();

        MyShape myShape = new MyShape(
                new Vector3(20, 63, 20),
                Color.INDIGO.copy().setAlpha(0.75));
        libShapeDraw.addShape(myShape);

        // Even though the Shape is custom-built it works like any other Shape.
        // We can add transforms, animations, etc.
View Full Code Here

    public void load() {
        libShapeDraw.verifyInitialized();

        // Set up a wireframe cone pointing downward
        GLUCylinder shape = new GLUCylinder(
                new Vector3(14, 93, 0),
                Color.HOT_PINK.copy(),
                Color.HOT_PINK.copy().scaleAlpha(XrayShape.SECONDARY_ALPHA),
                2.5F, Float.MIN_NORMAL, 5.0F);
        shape.setSlices(12).setStacks(8).setWireframe(true, 3.0F);
        Vector3 vector = new Vector3();
        shape.addTransform(new ShapeTranslate(vector));
        shape.addTransform(new ShapeRotate(90.0, Axis.X)); // upright
        libShapeDraw.addShape(shape);

        // Animate it with a custom Timeline, using a Sine ease. This makes
        // the animation start out fast, then slow down at the end of each
        // cycle.
        //
        // The final effect is a big pink arrow-like shape, dramatically
        // pointing at a specific block.
        Timeline timeline = new Timeline(vector);
        timeline.addPropertyToInterpolate("y", vector.getY(), vector.getY() - 30.0);
        timeline.setEase(new Sine());
        timeline.setDuration(3500);
        timeline.playLoop(RepeatBehavior.LOOP);
    }
View Full Code Here

        createColorShiftingShape();
        createResizingShape();
    }

    private void createRotatingShape() {
        GLUSphere sphere = new GLUSphere(new Vector3(8, 63, 0),
                Color.DODGER_BLUE.copy(),
                Color.DODGER_BLUE.copy().setAlpha(0.25),
                1.0F);
        sphere.setSlices(8).setStacks(8).setWireframe(true, 3.0F);
        ShapeRotate rotate = new ShapeRotate(0.0, Axis.Y);
View Full Code Here

        origin = Vector3.ZEROS.copy();
        for (int[] pairs : LINE_DATA) {
            ArrayList<ReadonlyVector3> vec = new ArrayList<ReadonlyVector3>(pairs.length / 2);
            for (int i = 0; i < pairs.length; i += 2) {
                vec.add(new Vector3(pairs[i]*SCALE, pairs[i+1]*SCALE, 0));
            }
            libShapeDraw.addShape(
                    new WireframeLines(origin, vec)
                    .setLineStyle(lineStyle)
                    .addTransform(shapeRotate));
View Full Code Here

        return ReadonlyVector3.class;
    }

    @Override
    public ReadonlyVector3 interpolate(ReadonlyVector3 from, ReadonlyVector3 to, float timelinePosition) {
        return new Vector3(
                blend(from.getX(), to.getX(), timelinePosition),
                blend(from.getY(), to.getY(), timelinePosition),
                blend(from.getZ(), to.getZ(), timelinePosition));
    }
View Full Code Here

        int expectedCount = counter.getCountRender() + (expectedToRender ? 1 : 0);
        render(hideGui);
        assertEquals(expectedCount, counter.getCountRender());
    }
    private void render(boolean hideGui) {
        LSDController.getInstance().render(new Vector3(0,0,0), hideGui);
    }
View Full Code Here

    public void testEventListenersFire() {
        MockLSDEventListener counter = new MockLSDEventListener();
        counter.assertCountsEqual(0, 0, 0);

        // ensure listener doesn't receive events if not registered
        LSDController.getInstance().respawn(new Vector3(0,0,0), true, true);
        LSDController.getInstance().gameTick(new Vector3(0,0,0));
        LSDController.getInstance().render(new Vector3(0,0,0), false);
        counter.assertCountsEqual(0, 0, 0);

        // register listener and ensure events are received
        lib.addEventListener(counter);

        LSDController.getInstance().respawn(new Vector3(0,0,0), true, true);
        counter.assertCountsEqual(1, 0, 0);
        LSDController.getInstance().gameTick(new Vector3(0,0,0));
        counter.assertCountsEqual(1, 1, 0);
        LSDController.getInstance().render(new Vector3(0,0,0), false);
        counter.assertCountsEqual(1, 1, 1);
    }
View Full Code Here

    public void testEventListenersFireMultiple() {
        MockLSDEventListener counter0 = new MockLSDEventListener();
        MockLSDEventListener counter1 = new MockLSDEventListener();
        MockLSDEventListener counter2 = new MockLSDEventListener();
        lib.addEventListener(counter0).addEventListener(counter1).addEventListener(counter2);
        LSDController.getInstance().respawn(new Vector3(0,0,0), true, true);
        counter0.assertCountsEqual(1, 0, 0);
        counter1.assertCountsEqual(1, 0, 0);
        counter2.assertCountsEqual(1, 0, 0);
        LSDController.getInstance().gameTick(new Vector3(0,0,0));
        counter0.assertCountsEqual(1, 1, 0);
        counter1.assertCountsEqual(1, 1, 0);
        counter2.assertCountsEqual(1, 1, 0);
        LSDController.getInstance().render(new Vector3(0,0,0), false);
        counter0.assertCountsEqual(1, 1, 1);
        counter1.assertCountsEqual(1, 1, 1);
        counter2.assertCountsEqual(1, 1, 1);
    }
View Full Code Here

        setRelativeToOrigin(false);
        setPointA(a);
        setPointB(b);
    }
    public WireframeLine(double ax, double ay, double az, double bx, double by, double bz) {
        this(new Vector3(ax, ay, az), new Vector3(bx, by, bz));
    }
View Full Code Here

TOP

Related Classes of libshapedraw.primitive.Vector3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.