public Drawable2D(Vector2f pos, Vertex vertices[], int indices[]) {

    float x = pos.getX();
    float y = pos.getY();

    // this.mesh = new Mesh();
    // this.mesh.addVertices(vertices, indices);

    transform = new Transform();
    transform.getPos().set(-1f + (2 * x * W_UNIT), -1f + (2 * y * H_UNIT), 0f);
  }
Beispiel #2
0
  public void updateUniforms(Transform transform, Material material) {
    Matrix4f worldMatrix = transform.getTransformation();
    Matrix4f projectedMatrix =
        getRenderingEngine().getMainCamera().getViewProjection().mul(worldMatrix);
    material.getTexture().bind();

    setUniform("model", worldMatrix);
    setUniform("MVP", projectedMatrix);

    setUniformf("specularIntensity", material.getSpecularIntensity());
    setUniformf("specularPower", material.getSpecularPower());

    setUniform("eyePos", getRenderingEngine().getMainCamera().getPos());
    setUniformSpotLight("spotLight", (SpotLight) getRenderingEngine().getActiveLight());
  }