예제 #1
0
  public BlueShell(GL2 gl, Scene scene, Vehicle car, float trajectory) {
    super(gl, scene, car, trajectory);

    if (shellList == -1) {
      shellList = gl.glGenLists(1);
      gl.glNewList(shellList, GL2.GL_COMPILE);
      displayWildcardObject(gl, SHELL_FACES, textures);
      gl.glEndList();

      spikeNode = new SceneNode(spike_model);
      spikeNode.setRenderMode(RenderMode.COLOR);

      noiseSampler = TextureLoader.load(gl, "tex/blast_noise.png");

      float[] blastColor = RGB.INDIGO;

      blastLight = new Light(gl, new Vec3(), blastColor, blastColor, blastColor);

      blastLight.setConstantAttenuation(0.5f);
      blastLight.setLinearAttenuation(0.001f);
      blastLight.setQuadraticAttenuation(0.001f);
      blastLight.enableAttenuation = true;
      blastLight.disable(gl);
    }

    generator = new ParticleGenerator();

    boundColor = RGB.toRGBA(RGB.INDIGO, BOUND_ALPHA);
  }
예제 #2
0
  @Override
  public void render(GL2 gl, float trajectory) {
    if (!dead) {
      gl.glPushMatrix();
      {
        gl.glTranslatef(bound.c.x, bound.c.y, bound.c.z);
        gl.glRotatef(rotation, 0, -1, 0);
        gl.glScalef(1.5f, 1.5f, 1.5f);

        Shader shader = Shader.getLightModel("texture");
        if (shader != null) shader.enable(gl);

        gl.glCallList(shellList);

        spikeNode.render(gl);
        rimNode.render(gl);
      }
      gl.glPopMatrix();

      Shader.disable(gl);
    } else if (!blast.isEmpty() && !Scene.shadowMode) {
      boolean useHDR = BloomStrobe.isEnabled();

      if (Scene.reflectMode) BloomStrobe.end(gl);

      if (Scene.singleton.enableBloom) renderBlast(gl);
      else BlastParticle.renderList(gl, blast);

      if (useHDR) BloomStrobe.begin(gl);

      Shader.disable(gl);
    }

    if (blastDuration <= 1) blastLight.disable(gl);
    else blastLight.enable(gl);
  }