Package org.lwjgl.util.vector

Examples of org.lwjgl.util.vector.Vector2f


          break;
      }

      System.out.println("OK");

      quadPosition = new Vector2f(100f, 100f);
      quadVelocity = new Vector2f(1.0f, 1.0f);

      texScaleX = TEXTURE_SIZE / (float)mode.getWidth();
          texScaleY = TEXTURE_SIZE / (float)mode.getHeight();
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here


      //find displaymode
      switchMode();
      // start of in windowed mode
      Display.create();
      glInit();
      quadPosition = new Vector2f(100f, 100f);
      quadVelocity = new Vector2f(1.0f, 1.0f);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      glInit();
      initPbuffer();

      Keyboard.create();

      quadPosition = new Vector2f(100f, 100f);
      quadVelocity = new Vector2f(1.0f, 1.0f);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

                if (face.hasNormals()) {
                    Vector3f n1 = m.getNormals().get(face.getNormalIndices()[0] - 1);
                    glNormal3f(n1.x, n1.y, n1.z);
                }
                if (face.hasTextureCoordinates()) {
                    Vector2f t1 = m.getTextureCoordinates().get(face.getTextureCoordinateIndices()[0] - 1);
                    glTexCoord2f(t1.x, t1.y);
                }
                Vector3f v1 = m.getVertices().get(face.getVertexIndices()[0] - 1);
                glVertex3f(v1.x, v1.y, v1.z);
                if (face.hasNormals()) {
                    Vector3f n2 = m.getNormals().get(face.getNormalIndices()[1] - 1);
                    glNormal3f(n2.x, n2.y, n2.z);
                }
                if (face.hasTextureCoordinates()) {
                    Vector2f t2 = m.getTextureCoordinates().get(face.getTextureCoordinateIndices()[1] - 1);
                    glTexCoord2f(t2.x, t2.y);
                }
                Vector3f v2 = m.getVertices().get(face.getVertexIndices()[1] - 1);
                glVertex3f(v2.x, v2.y, v2.z);
                if (face.hasNormals()) {
                    Vector3f n3 = m.getNormals().get(face.getNormalIndices()[2] - 1);
                    glNormal3f(n3.x, n3.y, n3.z);
                }
                if (face.hasTextureCoordinates()) {
                    Vector2f t3 = m.getTextureCoordinates().get(face.getTextureCoordinateIndices()[2] - 1);
                    glTexCoord2f(t3.x, t3.y);
                }
                Vector3f v3 = m.getVertices().get(face.getVertexIndices()[2] - 1);
                glVertex3f(v3.x, v3.y, v3.z);
            }
View Full Code Here

                m.getNormals().add(new Vector3f(x, y, z));
            } else if (line.startsWith("vt ")) {
                String[] xyz = line.split(" ");
                float s = Float.valueOf(xyz[1]);
                float t = Float.valueOf(xyz[2]);
                m.getTextureCoordinates().add(new Vector2f(s, t));
            } else if (line.startsWith("f ")) {
                String[] faceIndices = line.split(" ");
                int[] vertexIndicesArray = {Integer.parseInt(faceIndices[1].split("/")[0]),
                        Integer.parseInt(faceIndices[2].split("/")[0]), Integer.parseInt(faceIndices[3].split("/")[0])};
                int[] textureCoordinateIndicesArray = {-1, -1, -1};
View Full Code Here

    this.height = height;
  }

  public Vector2f[] getVertices() {
    return new Vector2f[] {
        new Vector2f(x, y),
        new Vector2f(x, y + height),
        new Vector2f(x + width, y + height),
        new Vector2f(x + width, y)
    };
  }
View Full Code Here

      glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

      for (Block block : blocks) {
        Vector2f[] vertices = block.getVertices();
        for (int i = 0; i < vertices.length; i++) {
          Vector2f currentVertex = vertices[i];
          Vector2f nextVertex = vertices[(i + 1) % vertices.length];
          Vector2f edge = Vector2f.sub(nextVertex, currentVertex, null);
          Vector2f normal = new Vector2f(edge.getY(), -edge.getX());
          Vector2f lightToCurrent = Vector2f.sub(currentVertex, light.location, null);
          if (Vector2f.dot(normal, lightToCurrent) > 0) {
            Vector2f point1 = Vector2f.add(currentVertex, (Vector2f) Vector2f.sub(currentVertex, light.location, null).scale(800), null);
            Vector2f point2 = Vector2f.add(nextVertex, (Vector2f) Vector2f.sub(nextVertex, light.location, null).scale(800), null);
            glBegin(GL_QUADS); {
              glVertex2f(currentVertex.getX(), currentVertex.getY());
              glVertex2f(point1.getX(), point1.getY());
              glVertex2f(point2.getX(), point2.getY());
              glVertex2f(nextVertex.getX(), nextVertex.getY());
            } glEnd();
          }
        }
      }
View Full Code Here

  private void setUpObjects() {
    int lightCount = 5 + (int) (Math.random() * 1);
    int blockCount = 5 + (int) (Math.random() * 1);

    for (int i = 1; i <= lightCount; i++) {
      Vector2f location = new Vector2f((float) Math.random() * width, (float) Math.random() * height);
      lights.add(new Light(location, (float) Math.random() * 10, (float) Math.random() * 10, (float) Math.random() * 10));
    }

    for (int i = 1; i <= blockCount; i++) {
      int width = 50;
View Full Code Here

  private void initialize() {
    try {
      //find displaymode
      switchMode();

      quadPosition = new Vector2f(100f, 100f);
      quadVelocity = new Vector2f(1.0f, 1.0f);

      reinit();
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

    int index = blocks.indexOf(block);
    if (index < 0)
      throw new IllegalArgumentException(block + " is not part of this face.");

    Vector2f blockFirstCorner = getFirstCorner(block);
    Vector2f blockSecondCorner = getSecondCorner(block);

    // adjust corner of block to remove if at one end of the face
    if (blocks.size() == 1) {
      faces.remove(this);
    } else if (index == 0) {
View Full Code Here

TOP

Related Classes of org.lwjgl.util.vector.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.