Package com.ardor3d.math

Examples of com.ardor3d.math.Vector3


        textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off);

        //final double infoStartY = camera.getHeight();
        for (int i = 0; i < infoText.length; i++) {
            infoText[i] = BasicText.createDefaultTextLabel("Text", "", 16);
            infoText[i].setTranslation(new Vector3(10, + i * 20, 0));
            textNodes.attachChild(infoText[i]);
            infoText[i].setText(" ");
        }
        textNodes.updateGeometricState(0.0);
    }
View Full Code Here


       
       //addStaticModel(  NÉV ,new Vector3( HELYZET ), SKÁLA, FORGATÁS);
       //- HELYZET: x,y,z  - y tengely van felfelé
       //- FORGATÁS: null helyett lehet: new Quaternion(x,y,z,1); x,y,z közül az egyik lehet 1;
                                             
       addStaticModel("colladamodels/lighthouse/kopu/models/model.dae",new Vector3(-20.0, 0.0, 200.0), 1.0, null);
       //addStaticModel("colladamodels/dinos/diplodocus/models/Diplodocus.dae",new Vector3(-55, -5, 290), .005, null);
      
       //Quaternion q = new Quaternion();
       //q.fromEulerAngles(0,Math.PI,Math.PI/2);
       //addStaticModel("colladamodels/buildings/archline_splash_building/archline_splash_building.dae",new Vector3(20.0, 5.0, 0.0),0.1,q);
View Full Code Here

    protected void initExample() {

        UIComponent.setUseTransparency(true);

        // Add a spinning 3D box to show behind UI.
        final Box box = new Box("Box", new Vector3(0, 0, 0), 5, 5, 5);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, 0, -15));
        box.addController(new SpatialController<Box>() {
            private final Matrix3 rotate = new Matrix3();
            private double angle = 0;
            private final Vector3 axis = new Vector3(1, 1, 0.5f).normalizeLocal();

            public void update(final double time, final Box caller) {
                angle += time * 50;
                angle %= 360;
                rotate.fromAngleNormalAxis(angle * MathUtils.DEG_TO_RAD, axis);
View Full Code Here

    @Inject
    Physics physics;

    public void onEvent(Event event) {
        if (event instanceof Init) {
            Box floor = new Box("Floor", new Vector3(), width, 1, height);
            floor.setTranslation(0, -30, 0);
           // floor.setRandomColors();
            floor.setSolidColor(ColorRGBA.GREEN);
            nodes.attachToParent(NodeRepository.ROOT_NODE,floor);
            nodes.getNode(NodeRepository.ROOT_NODE).updateGeometricState(0);
View Full Code Here

    }

    @Override
    public Vector3 getAsWorldCoords(DetailLevel level) {
        double scale = VoxelWorld.BLOCK_SIZE*level.getScale();
        return new Vector3(x*scale, 0, z*scale);
    }
View Full Code Here

        return 0;
    }
       
    @Override
    public boolean isInBlock(ReadOnlyVector3 positionInWorldCoords, DetailLevel level) {
        Vector3 blockCornerInWorldCoords = getAsWorldCoords(level);
       
        if (positionInWorldCoords.getX() < blockCornerInWorldCoords.getX()
                || positionInWorldCoords.getZ() < blockCornerInWorldCoords.getZ() )
           
        return false;
       
        double blockSize = VoxelWorld.BLOCK_SIZE * level.getScale();
      
        if (positionInWorldCoords.getX() >= blockCornerInWorldCoords.getX() + blockSize
                || positionInWorldCoords.getZ() >= blockCornerInWorldCoords.getZ() + blockSize)
        return false;
       
        return true;
    }
View Full Code Here

        MeshData meshData = mesh.getMeshData();
        int numOfLeafs = foliagePositions.size();
              
        Vector3[] points = new Vector3[8];
        for (int i = 0; i<8; i++)
            points[i] = new Vector3();
       
       
        FloatBuffer vertexBuffer = BufferUtils.createVector3Buffer(numOfLeafs*8);
        FloatBuffer textureCoordBuffer = BufferUtils.createVector2Buffer(numOfLeafs*8);
        IntBuffer indexBuffer = BufferUtils.createIntBuffer(numOfLeafs * 12);
 
View Full Code Here

        Mesh mesh = new Mesh();
        MeshData meshData = mesh.getMeshData();
       
        int numOfSegments = 6;
       
        Vector3 point1 = new Vector3();
        Vector3 point2 = new Vector3();
        Vector3 normal = new Vector3();
       
        FloatBuffer vertexBuffer = BufferUtils.createVector3Buffer(numOfNonVoxelBranches * numOfSegments * 2);
        FloatBuffer textureCoordBuffer = BufferUtils.createVector2Buffer(numOfNonVoxelBranches * numOfSegments * 2);
        IntBuffer indexBuffer = BufferUtils.createIntBuffer(numOfNonVoxelBranches * (numOfSegments + 1) * 2);
        FloatBuffer normalBuffer = BufferUtils.createVector3Buffer(numOfNonVoxelBranches * numOfSegments * 2);
             
        for (int i = 0; i<branches.size(); i++) {
            Branch branch = branches.get(i);
            FszMatrix4 transform = branch.getTransform();
            double startRadius = branch.getStartRadius();
            double endRadius = branch.getEndRadius();
            double length = branch.getLength();
           
            int ii = i* numOfSegments * 2;
            Vector3 startPoint = branch.getStartPoint();

            for (int s = 0; s<numOfSegments; s++) {
                double angle = s * Math.PI * 2 /numOfSegments ;
                float texCoordX = s/(float)numOfSegments;
               
View Full Code Here

    private int voxelCounter;

    private Voxel addVoxel(int x, int y, int z) {
        if (x>=0 && y>=0 && z>=0 && x<voxelArraySize && y<voxelArraySize && z<voxelArraySize) {
            Voxel voxel = voxels[x][y][z];
            Vector3 vertexPosition = new Vector3(crossingPoint).multiplyLocal(levelScale).addLocal(basePosition);
            Vector4 material = new Vector4(x/32.0f,y/32.0f,z/32.0f,1.0);
            if (voxel == null) {              
                voxels[x][y][z] = new Voxel(vertexPosition,material,voxelCounter);
                voxelCounter++;
            } else {
View Full Code Here

    }

    public Vector3 computeVoxelNormal(int x, int y, int z, ReadOnlyVector3 position) {
       
        Vector3 local = new Vector3(position);
        local.subtractLocal(basePosition);
        local.divideLocal(pool.getLevel().getScale());
        try {
            float d000 = densities[x][y][z];
            float d100 = densities[x + 1][y][z];
            float d010 = densities[x][y + 1][z];
            float d110 = densities[x + 1][y + 1][z];
            float d001 = densities[x][y][z + 1];
            float d101 = densities[x + 1][y][z + 1];
            float d011 = densities[x][y + 1][z + 1];
            float d111 = densities[x + 1][y + 1][z + 1];

            double sx1 = local.getX() - x;
            double sx0 = 1.0 - sx1;
            double sy1 = local.getY() - y;
            double sy0 = 1.0 - sy1;
            double sz1 = local.getZ() - z;
            double sz0 = 1.0 - sz1;

            double dx0 = (d100 - d000) * sy0 + (d110 - d010) * sy1;
            double dx1 = (d101 - d001) * sy0 + (d111 - d011) * sy1;
            double dx = dx0 * sz0 + dx1 * sz1;

            double dy0 = (d010 - d000) * sz0 + (d011 - d001) * sz1;
            double dy1 = (d110 - d100) * sz0 + (d111 - d101) * sz1;
            double dy = dy0 * sx0 + dy1 * sx1;

            double dz0 = (d001 - d000) * sx0 + (d101 - d100) * sx1;
            double dz1 = (d011 - d010) * sx0 + (d111 - d110) * sx1;
            double dz = dz0 * sy0 + dz1 * sy1;

            Vector3 normal = new Vector3(-dx, -dy, -dz);
            normal.normalizeLocal();
            return normal;
        } catch (Exception ex) {
            VoxelWorld.logger.log(Level.SEVERE,"NORMÁLGENERÁLÁSI HIBA");
            return new Vector3(0,1,0);
        }
    }
View Full Code Here

TOP

Related Classes of com.ardor3d.math.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.