Package com.ardor3d.math

Examples of com.ardor3d.math.Quaternion


        skybox.setTexture(Skybox.Face.South, south);
        skybox.setTexture(Skybox.Face.East, east);
        skybox.setTexture(Skybox.Face.Up, up);
        skybox.setTexture(Skybox.Face.Down, down);

        skybox.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
        return skybox;
    }
View Full Code Here


        // add a head rotator
        final int headJoint = pose.getSkeleton().findJointByName("Bip01_Head");
        final ManagedTransformSource headSource = (ManagedTransformSource) manager.findAnimationLayer("head")
                .getSteadyState("head_rotate").getSourceTree();
        _root.addController(new SpatialController<Node>() {
            private final Quaternion headRotation = new Quaternion();

            public void update(final double time, final Node caller) {
                // update the head's position
                if (headCheck != null && headCheck.isSelected()) {
                    double angle = _timer.getTimeInSeconds();
                    // range 0 to 180 degrees
                    angle %= MathUtils.PI;
                    // range -90 to 90 degrees
                    angle -= MathUtils.HALF_PI;
                    // range is now 0 to 90 degrees, reflected
                    angle = Math.abs(angle);
                    // range is now -45 to 45 degrees
                    angle -= MathUtils.HALF_PI / 2.0;

                    headRotation.fromAngleAxis(angle, Vector3.UNIT_X);
                    headSource.setJointRotation(headJoint, headRotation);
                }
            }
        });
View Full Code Here

            final SkeletonPose pose = skinData.getPose();

            final double time = timer.getTimeInSeconds();

            // Neck
            final Quaternion q = Quaternion.fetchTempInstance();
            final double vv = (time % (LOOP_TIME * 2d)) / LOOP_TIME - 1d;
            final double v = (vv > 0) ? vv : -vv;
            q.fromAngleAxis(v * 60 * MathUtils.DEG_TO_RAD - 30 * MathUtils.DEG_TO_RAD, Vector3.UNIT_Z);
            targetJoint(pose, 13, q);

            q.fromAngleAxis(v * 5 * MathUtils.DEG_TO_RAD - 35 * MathUtils.DEG_TO_RAD, Vector3.UNIT_X);
            q.fromAngleAxis(v * 75 * MathUtils.DEG_TO_RAD, Vector3.UNIT_X);

            Quaternion.releaseTempInstance(q);

            p.setLocation(Math.sin(time) * 5, Math.cos(time) * 5 + 10, 5);
            if (updateLight) {
View Full Code Here

                _position.add(bbX, tempVec3).subtractLocal(bbY);
                BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 3);
                break;
            }
            case GeomMesh: {
                final Quaternion tempQuat = Quaternion.fetchTempInstance();
                final ReadOnlyVector3 norm = triModel.getNormal();
                if (orient != 0) {
                    tempQuat.fromAngleNormalAxis(orient, norm);
                }

                for (int x = 0; x < 3; x++) {
                    if (orient != 0) {
                        tempQuat.apply(triModel.get(x), tempVec3);
                    } else {
                        tempVec3.set(triModel.get(x));
                    }
                    tempVec3.multiplyLocal(currSize).addLocal(_position);
                    BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + x);
View Full Code Here

            // determine
            final double texelSizeW = (2 * radius) / _shadowMapRenderer.getWidth();
            final double texelSizeH = (2 * radius) / _shadowMapRenderer.getHeight();

            // build a Quaternion from camera axes to move
            final Quaternion q = Quaternion.fetchTempInstance();
            q.fromAxes(shadowCam.getLeft(), shadowCam.getUp(), shadowCam.getDirection());

            // invert to calculate in light space
            final Vector3 lightSpace = q.invert(null).apply(tmpVec, Vector3.fetchTempInstance());

            // snap to nearest texel
            lightSpace.setX(lightSpace.getX() - (lightSpace.getX() % texelSizeW));
            lightSpace.setY(lightSpace.getY() - (lightSpace.getY() % texelSizeH));

            // convert back
            q.apply(lightSpace, tmpVec);
            Vector3.releaseTempInstance(lightSpace);

            Quaternion.releaseTempInstance(q);
        }

View Full Code Here

TOP

Related Classes of com.ardor3d.math.Quaternion

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.