Beispiel #1
0
  public EntityRenderer(StaticShader shader, Matrix4f projectionMatrix) {
    this.shader = shader;

    shader.start();
    shader.loadProjectionMatrix(
        projectionMatrix); // this projection matrix can be loaded at "masterrenderer" but highly
                           // doubt it will be needed later
    shader.stop();
  }
Beispiel #2
0
 private void prepareInstance(Entity entity) {
   Matrix4f transformationMatrix =
       Maths.createTransformationMatrix(
           entity.getPosition(),
           entity.getRotX(),
           entity.getRotY(),
           entity.getRotZ(),
           entity.getScale());
   shader.loadTransformationMatrix(transformationMatrix);
 }
Beispiel #3
0
  private void prepareTexturedModel(TexturedModel model) {
    RawModel rawModel = model.getModel();
    GL30.glBindVertexArray(rawModel.getVaoID());
    GL20.glEnableVertexAttribArray(0); // vertices array
    GL20.glEnableVertexAttribArray(1); // textures array
    GL20.glEnableVertexAttribArray(2); // normals array

    { // Load Texture and shine
      ModelTexture texture = model.getTexture();
      shader.loadShineVariables(texture.getShineDamper(), texture.getReflectivity());

      GL13.glActiveTexture(GL13.GL_TEXTURE0);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getTextureID());
    }
  }