Пример #1
0
  /** R_RenderView r_newrefdef must be set before the first call */
  void R_RenderView(refdef_t fd) {

    if (r_norefresh.value != 0.0f) return;

    r_newrefdef = fd;

    // included by cwei
    if (r_newrefdef == null) {
      Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null");
    }

    if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0)
      Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel");

    if (r_speeds.value != 0.0f) {
      c_brush_polys = 0;
      c_alias_polys = 0;
    }

    R_PushDlights();

    if (gl_finish.value != 0.0f) GL11.glFinish();

    R_SetupFrame();

    R_SetFrustum();

    R_SetupGL();

    R_MarkLeaves(); // done here so we know if we're in water

    R_DrawWorld();

    R_DrawEntitiesOnList();

    R_RenderDlights();

    R_DrawParticles();

    R_DrawAlphaSurfaces();

    R_Flash();

    if (r_speeds.value != 0.0f) {
      VID.Printf(
          Defines.PRINT_ALL,
          "%4i wpoly %4i epoly %i tex %i lmaps\n",
          new Vargs(4)
              .add(c_brush_polys)
              .add(c_alias_polys)
              .add(c_visible_textures)
              .add(c_visible_lightmaps));
    }
  }
Пример #2
0
  /** Runs thinking code for this frame if necessary. */
  public static boolean SV_RunThink(edict_t ent) {
    float thinktime;

    thinktime = ent.nextthink;
    if (thinktime <= 0) return true;
    if (thinktime > GameBase.level.time + 0.001) return true;

    ent.nextthink = 0;

    if (ent.think == null) Com.Error(Defines.ERR_FATAL, "NULL ent.think");

    ent.think.think(ent);

    return false;
  }
Пример #3
0
  /** R_DrawEntitiesOnList */
  void R_DrawEntitiesOnList() {
    if (r_drawentities.value == 0.0f) return;

    // draw non-transparent first
    int i;
    for (i = 0; i < r_newrefdef.num_entities; i++) {
      currententity = r_newrefdef.entities[i];
      if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) continue; // solid

      if ((currententity.flags & Defines.RF_BEAM) != 0) {
        R_DrawBeam(currententity);
      } else {
        currentmodel = currententity.model;
        if (currentmodel == null) {
          R_DrawNullModel();
          continue;
        }
        switch (currentmodel.type) {
          case mod_alias:
            R_DrawAliasModel(currententity);
            break;
          case mod_brush:
            R_DrawBrushModel(currententity);
            break;
          case mod_sprite:
            R_DrawSpriteModel(currententity);
            break;
          default:
            Com.Error(Defines.ERR_DROP, "Bad modeltype");
            break;
        }
      }
    }
    // draw transparent entities
    // we could sort these if it ever becomes a problem...
    GL11.glDepthMask(false); // no z writes
    for (i = 0; i < r_newrefdef.num_entities; i++) {
      currententity = r_newrefdef.entities[i];
      if ((currententity.flags & Defines.RF_TRANSLUCENT) == 0) continue; // solid

      if ((currententity.flags & Defines.RF_BEAM) != 0) {
        R_DrawBeam(currententity);
      } else {
        currentmodel = currententity.model;

        if (currentmodel == null) {
          R_DrawNullModel();
          continue;
        }
        switch (currentmodel.type) {
          case mod_alias:
            R_DrawAliasModel(currententity);
            break;
          case mod_brush:
            R_DrawBrushModel(currententity);
            break;
          case mod_sprite:
            R_DrawSpriteModel(currententity);
            break;
          default:
            Com.Error(Defines.ERR_DROP, "Bad modeltype");
            break;
        }
      }
    }
    GL11.glDepthMask(true); // back to writing
  }