예제 #1
0
  @Override
  public void doRender(Entity entity, double x, double y, double z, float a, float b) {
    EntityRippleMark mark = (EntityRippleMark) entity;
    long dt = GameTimer.getTime() - mark.creationTime;

    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);

    for (int i = 0; i < timeOffsets.length; ++i) {
      GL11.glPushMatrix();

      long mod = (dt - timeOffsets[i]) % CYCLE;
      float size = getSize(mod);

      GL11.glTranslatef(0, getHeight(mod), 0);
      GL11.glScalef(size, 1, size);
      material.color = mark.color.copy();
      material.color.a *= getAlpha(mod);
      mesh.draw(material);

      GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
예제 #2
0
 public RippleMarkRender() {
   mesh = new Mesh();
   mesh.setVertices(
       new double[][] {
         {-.5, 0, -.5},
         {.5, 0, -.5},
         {.5, 0, .5},
         {-.5, 0, .5}
       });
   mesh.setUVs(
       new double[][] {
         {0, 0},
         {0, 1},
         {1, 1},
         {1, 0}
       });
   mesh.setQuads(new int[] {0, 1, 2, 3});
   material = new SimpleMaterial(Resources.getTexture("effects/ripple"));
   material.ignoreLight = true;
 }