Package com.jme3.math

Examples of com.jme3.math.Vector2f


        temp_normal = vertices[v_index].subtract(vertices[v_index + 1]).cross(vertices[v_index + 1].subtract(vertices[v_index + 2])).normalize();
        if (outsideView)
          temp_normal = temp_normal.negate();
        normals[v_index] = normals[v_index + 1] = normals[v_index + 2] = normals[v_index + 3] = temp_normal;

        texCoord[v_index] = new Vector2f(0, 0);
        texCoord[v_index + 1] = new Vector2f(0, 1);
        texCoord[v_index + 2] = new Vector2f(1, 1);
        texCoord[v_index + 3] = new Vector2f(1, 0);

        if (outsideView) {
          indexes[i_index] = v_index;
          indexes[i_index + 1] = v_index + 3;
          indexes[i_index + 2] = v_index + 1;
          indexes[i_index + 3] = v_index + 1;
          indexes[i_index + 4] = v_index + 3;
          indexes[i_index + 5] = v_index + 2;
        }
        else {
          indexes[i_index] = v_index;
          indexes[i_index + 1] = v_index + 1;
          indexes[i_index + 2] = v_index + 2;
          indexes[i_index + 3] = v_index + 2;
          indexes[i_index + 4] = v_index + 3;
          indexes[i_index + 5] = v_index;
        }

        i_index += 6;
        v_index += 4;
      }
    }

    // Calculate vertices and determine indexes for the top tier.
    for (int i = 0; i < radialSamples; i++) {
      vertices[v_index] = World.toCartesian(azimuth[i], elevation[elevation.length - 2], radius);
      vertices[v_index + 1] = new Vector3f(0, radius, 0);
      vertices[v_index + 2] = World.toCartesian(azimuth[i + 1], elevation[elevation.length - 2], radius);

      temp_normal = vertices[v_index].subtract(vertices[v_index + 1]).cross(vertices[v_index + 1].subtract(vertices[v_index + 2])).normalize();
      if (outsideView)
        temp_normal = temp_normal.negate();
      normals[v_index] = normals[v_index + 1] = normals[v_index + 2] = temp_normal;

      texCoord[v_index] = new Vector2f(0, 0);
      texCoord[v_index] = new Vector2f(0.5f, 1);
      texCoord[v_index] = new Vector2f(1, 0);

      if (outsideView) {
        indexes[i_index] = v_index;
        indexes[i_index + 1] = v_index + 2;
        indexes[i_index + 2] = v_index + 1;
View Full Code Here


    public static Vector2f getFovFar(Camera c, float fovAngle) {
        float w = c.getWidth();
        float h = c.getHeight();
        float fovH = 2f * FastMath.tan(fovAngle / 2) * c.getFrustumFar();
        float fovW = fovH * (w / h);
        return new Vector2f(fovW, fovH);
    }
View Full Code Here

        for (int i = 0; i < (vertList.size() / 3); i++) {
            vertices[i] =
                    new Vector3f(vertList.get(i * 3), vertList.get((i * 3) + 1),
                                 vertList.get((i * 3) + 2));
            texCoords[i] = new Vector2f(vertices[i].x / (xDim + 1), 1 - (vertices[i].z / (zDim + 1)));
            normals[i] = normList.get(i).normalize();
        }

        for (int i = 0; i < indexList.size(); i++)
            indexes[i] = indexList.get(i);
View Full Code Here

            vertices[i] =
                    new Vector3f(vertList.get(i * 3), vertList.get((i * 3) + 1),
                                 vertList.get((i * 3) + 2));
            // System.out.println("v " + i + " " + vertices[i]);
            texCoords[i] =
                    new Vector2f(vertices[i].x / xBound[1], 1 - (vertices[i].z
                            / zBound[1]));
            // texCoords[i] = new Vector2f(vertices[i].x / 1024, 1 - vertices[i].z /
            // 1024);

            normals[i] = normList.get(i).normalize();
View Full Code Here

    public ModelPosition(){
  this(0,0,0, 0,0,0);
    }
    public ModelPosition(float x, float y, float z,
       float rotx, float roty, float rotz){
  location = new Vector3f(x,y,z);
  rotation = new Vector3f(rotx,roty,rotz);
    }
View Full Code Here

        // calc the y-axis
        float y = 1.5f-base.y*0.072f;
        //1.412 = 0
        //0.207 = 18

        rightEye.move(new Vector3f(xR,y,0.932f));
        leftEye.move(new Vector3f( xL, y, 0.932f ));

        head.attachChild(leftEye);
        head.attachChild(rightEye);
        return true;
    }
View Full Code Here

    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
        geom.setMaterial(mat);

        rootNode.attachChild(geom);
    }
View Full Code Here

    /**
    @Override
     **/
    public void simpleInitApp(){
       
  Node node = new Node("My Root node");
  //Box b = new Box("MyBox",new Vector3f(0,0,0),new Vector3f(1,1,1));
  //rootNode.attachChild(b);

  AvatarXMLParser parser = new AvatarXMLParser();
  Avatar avatar = parser.getAvatarFromFile("art/mii/defaultBoy.xml");
  System.out.println(avatar);

  Avatar3DLoader loader = new Avatar3DLoader();
  Model model = loader.loadModel(avatar);

  // remove default light to see the colors
  //rootNode.setLightCombineMode(Spatial.LightCombineMode.Off);
        /*
  // Create a point light
  PointLight l = new PointLight();
  // Give it a location
  l.setLocation(new Vector3f(0, 10, 5));
  // Make it a red light
  //l.setDiffuse(ColorRGBA.red.clone());
  // Enable it
  l.setEnabled(true);
  // Create a LightState to put my light in
  LightState ls = display.getRenderer().createLightState();
  // Attach the light
  ls.attach(l);
  node.setRenderState(ls);
        */


  node.attachChild(model.root);
  rootNode.attachChild(node);

  //lightState.detachAll();
    }
View Full Code Here

    public Node shirt;
    public Node skin;

// ============= Constructors ============== //
    public Model(){
  root = new Node("Model");
    }
View Full Code Here

        app.start();
    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
View Full Code Here

TOP

Related Classes of com.jme3.math.Vector2f

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.