// Path: core/src/com/github/fauu/helix/component/DisplayableComponent.java
// public class DisplayableComponent extends Component {
// 
//   private Displayable displayable;
//   
//   public DisplayableComponent() { }
//   
//   public DisplayableComponent(Displayable displayable) {
//     this();
// 
//     set(displayable);
//   }
//   
//   public Displayable get() {
//     return displayable;
//   }
//   
//   public void set(Displayable displayable) {
//     this.displayable = displayable;
//   }
// 
// }
// 
// Path: core/src/com/github/fauu/helix/displayable/Displayable.java
// public abstract class Displayable { }
// 
// Path: core/src/com/github/fauu/helix/displayable/ModelDisplayable.java
// public abstract class ModelDisplayable extends Displayable
//                                        implements RenderableProvider {
// 
//   protected ModelInstance instance;
// 
//   protected AnimationController animationController;
// 
//   public AnimationController getAnimationController() {
//     return animationController;
//   }
// 
//   public boolean animateIfAnimationExists(String id) {
//     for (Animation animation : instance.animations) {
//       if (animation.id.equalsIgnoreCase(id)) {
//         animationController.setAnimation(id);
// 
//         return true;
//       }
//     }
// 
//     return false;
//   }
// 
//   public void updateTranslation(Vector3 translation) {
//     instance.transform.setToTranslation(translation);
//   }
// 
//   public void updateOpacity(float opacity) {
//     for (Material material : instance.materials) {
//       BlendingAttribute ba
//           = (BlendingAttribute) material.get(BlendingAttribute.Type);
// 
//       ba.opacity = opacity;
//     }
//   }
// 
// }


import com.artemis.Aspect;
import com.artemis.ComponentMapper;
import com.artemis.Entity;
import com.artemis.annotations.Wire;
import com.artemis.systems.EntityProcessingSystem;
import com.badlogic.gdx.Gdx;
import com.github.fauu.helix.component.DisplayableComponent;
import com.github.fauu.helix.displayable.Displayable;
import com.github.fauu.helix.displayable.ModelDisplayable;
/*
 * Copyright (C) 2014-2016 Helix Engine Developers
 * (http://github.com/fauu/HelixEngine)
 *
 * This software is licensed under the GNU General Public License
 * (version 3 or later). See the COPYING file in this distribution.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this software. If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Piotr Grabowski <fau999@gmail.com>
 */

package com.github.fauu.helix.system;


// TODO: Cache animation controllers
public class AnimationProcessingSystem extends EntityProcessingSystem {

  @Wire
  private ComponentMapper<DisplayableComponent> displayableMapper;

  public AnimationProcessingSystem() {
    super(Aspect.getAspectForAll(DisplayableComponent.class));
  }

  @Override
  protected void process(Entity e) {
// Path: core/src/com/github/fauu/helix/component/DisplayableComponent.java
// public class DisplayableComponent extends Component {
// 
//   private Displayable displayable;
//   
//   public DisplayableComponent() { }
//   
//   public DisplayableComponent(Displayable displayable) {
//     this();
// 
//     set(displayable);
//   }
//   
//   public Displayable get() {
//     return displayable;
//   }
//   
//   public void set(Displayable displayable) {
//     this.displayable = displayable;
//   }
// 
// }
// 
// Path: core/src/com/github/fauu/helix/displayable/Displayable.java
// public abstract class Displayable { }
// 
// Path: core/src/com/github/fauu/helix/displayable/ModelDisplayable.java
// public abstract class ModelDisplayable extends Displayable
//                                        implements RenderableProvider {
// 
//   protected ModelInstance instance;
// 
//   protected AnimationController animationController;
// 
//   public AnimationController getAnimationController() {
//     return animationController;
//   }
// 
//   public boolean animateIfAnimationExists(String id) {
//     for (Animation animation : instance.animations) {
//       if (animation.id.equalsIgnoreCase(id)) {
//         animationController.setAnimation(id);
// 
//         return true;
//       }
//     }
// 
//     return false;
//   }
// 
//   public void updateTranslation(Vector3 translation) {
//     instance.transform.setToTranslation(translation);
//   }
// 
//   public void updateOpacity(float opacity) {
//     for (Material material : instance.materials) {
//       BlendingAttribute ba
//           = (BlendingAttribute) material.get(BlendingAttribute.Type);
// 
//       ba.opacity = opacity;
//     }
//   }
// 
// }


// Path: core/src/com/github/fauu/helix/system/AnimationProcessingSystem.java
import com.artemis.Aspect;
import com.artemis.ComponentMapper;
import com.artemis.Entity;
import com.artemis.annotations.Wire;
import com.artemis.systems.EntityProcessingSystem;
import com.badlogic.gdx.Gdx;
import com.github.fauu.helix.component.DisplayableComponent;
import com.github.fauu.helix.displayable.Displayable;
import com.github.fauu.helix.displayable.ModelDisplayable;

/*
 * Copyright (C) 2014-2016 Helix Engine Developers
 * (http://github.com/fauu/HelixEngine)
 *
 * This software is licensed under the GNU General Public License
 * (version 3 or later). See the COPYING file in this distribution.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this software. If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Piotr Grabowski <fau999@gmail.com>
 */

package com.github.fauu.helix.system;


// TODO: Cache animation controllers
public class AnimationProcessingSystem extends EntityProcessingSystem {

  @Wire
  private ComponentMapper<DisplayableComponent> displayableMapper;

  public AnimationProcessingSystem() {
    super(Aspect.getAspectForAll(DisplayableComponent.class));
  }

  @Override
  protected void process(Entity e) {
    Displayable displayable = displayableMapper.get(e).get();