Example #1
0
 public RenderState(
     Player local_player,
     LandscapeRenderer renderer,
     SpriteSorter sprite_sorter,
     RenderQueues render_queues,
     Picker picker,
     Selection selection) {
   this.local_player = local_player;
   this.landscape_renderer = renderer;
   this.selection = selection;
   this.picker = picker;
   this.sprite_sorter = sprite_sorter;
   this.render_queues = render_queues;
   ShadowListKey key =
       render_queues.registerRespondRenderer(
           new GeneratorRing(
               LandscapeTargetRespond.SIZE,
               new float[][] {{0.40f, 0f}, {0.41f, 1f}, {0.48f, 1f}, {0.49f, 0f}}));
   this.target_respond_renderer = (TargetRespondRenderer) render_queues.getShadowRenderer(key);
   this.default_shadow_renderer =
       (SelectableShadowRenderer)
           render_queues.getShadowRenderer(
               render_queues.registerSelectableShadowList(RacesResources.DEFAULT_SHADOW_DESC));
   this.render_state_cache =
       new RenderStateCache(
           new RenderStateFactory() {
             public final Object create() {
               return new ElementRenderState(RenderState.this);
             }
           });
 }
Example #2
0
 private void visitSelectable(
     ModelVisitor visitor,
     Selectable selectable,
     float z_offset,
     float selection_radius,
     float selection_height) {
   boolean in_view =
       !picking
           || (selectable.isEnabled()
               && (visible_override
                   || pickingInFrustum(
                       selectable,
                       camera.getFrustum(),
                       z_offset,
                       selection_radius,
                       selection_height)));
   if (in_view) {
     Player owner = selectable.getOwnerNoCheck();
     boolean point_on_map =
         !local_player.isEnemy(owner)
             || (!owner.teamHasBuilding()
                 && PeerHub.getFreeQuitTimeLeft(local_player.getWorld()) < 0f);
     ModelState state = getCachedState(visitor, selectable, z_offset);
     int sort_status = addToRenderList(state, point_on_map);
     if (!picking && selectable.isEnabled() && sort_status == SpriteSorter.DETAIL_POLYGON) {
       SelectableShadowRenderer shadow_renderer =
           (SelectableShadowRenderer)
               render_queues.getShadowRenderer(
                   selectable.getTemplate().getSelectableShadowRenderer());
       if (isHovered(selectable) || isSelected(selectable)) {
         shadow_renderer.addToSelectionList(state);
       } else {
         shadow_renderer.addToShadowList(state);
       }
     }
   }
 }