Package com.ardor3d.math.type

Examples of com.ardor3d.math.type.ReadOnlyVector3


        final double currSize = values[VAL_CURRENT_SIZE];

        if (type == ParticleSystem.ParticleType.GeomMesh || type == ParticleSystem.ParticleType.Point) {
            ; // nothing to do
        } else if (cam != null && parent.isCameraFacing()) {
            final ReadOnlyVector3 camUp = cam.getUp();
            final ReadOnlyVector3 camLeft = cam.getLeft();
            final ReadOnlyVector3 camDir = cam.getDirection();
            if (parent.isVelocityAligned()) {
                bbX.set(_velocity).normalizeLocal().multiplyLocal(currSize);
                camDir.cross(bbX, bbY).normalizeLocal().multiplyLocal(currSize);
            } else if (orient == 0) {
                bbX.set(camLeft).multiplyLocal(currSize);
                bbY.set(camUp).multiplyLocal(currSize);
            } else {
                final double cA = MathUtils.cos(orient) * currSize;
                final double sA = MathUtils.sin(orient) * currSize;
                bbX.set(camLeft).multiplyLocal(cA).addLocal(camUp.getX() * sA, camUp.getY() * sA, camUp.getZ() * sA);
                bbY.set(camLeft).multiplyLocal(-sA).addLocal(camUp.getX() * cA, camUp.getY() * cA, camUp.getZ() * cA);
            }
        } else {
            final ReadOnlyVector3 left = parent.getFacingLeftVector();
            final ReadOnlyVector3 up = parent.getFacingUpVector();

            if (parent.isVelocityAligned()) {
                bbX.set(_velocity).normalizeLocal().multiplyLocal(currSize);
                up.cross(bbX, bbY).normalizeLocal().multiplyLocal(currSize);
            } else if (orient == 0) {
                bbX.set(left).multiplyLocal(currSize);
                bbY.set(up).multiplyLocal(currSize);
            } else {
                final double cA = MathUtils.cos(orient) * currSize;
                final double sA = MathUtils.sin(orient) * currSize;
                bbX.set(left).multiplyLocal(cA).addLocal(up.getX() * sA, up.getY() * sA, up.getZ() * sA);
                bbY.set(left).multiplyLocal(-sA).addLocal(up.getX() * cA, up.getY() * cA, up.getZ() * cA);
            }
        }

        final Vector3 tempVec3 = Vector3.fetchTempInstance();
        final FloatBuffer vertexBuffer = parent.getParticleGeometry().getMeshData().getVertexBuffer();
        switch (type) {
            case Quad: {
                _position.subtract(bbX, tempVec3).subtractLocal(bbY);
                BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 0);

                _position.subtract(bbX, tempVec3).addLocal(bbY);
                BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 1);

                _position.add(bbX, tempVec3).addLocal(bbY);
                BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 2);

                _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++) {
View Full Code Here


     *
     * @param sceneBounds
     *            the scene bounds
     */
    public void pack(final BoundingVolume sceneBounds) {
        final ReadOnlyVector3 center = sceneBounds.getCenter();
        for (int i = 0; i < _corners.length; i++) {
            _corners[i].set(center);
        }

        if (sceneBounds instanceof BoundingBox) {
View Full Code Here

        }
        frustumBoundingSphere.computeFromPoints(frustumBoundingBuffer);

        final Camera shadowCam = _shadowMapRenderer.getCamera();

        final ReadOnlyVector3 center = frustumBoundingSphere.getCenter();
        final double radius = frustumBoundingSphere.getRadius();

        Vector3 direction = new Vector3();
        final DirectionalLight dl = (DirectionalLight) _light;
        direction = direction.set(dl.getDirection());
View Full Code Here

TOP

Related Classes of com.ardor3d.math.type.ReadOnlyVector3

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.