List of usage examples for com.badlogic.gdx.graphics.g3d.utils AnimationController AnimationController
public AnimationController(final ModelInstance target)
From source file:br.com.raphaelbruno.game.zombieinvaders.vr.model.GameObject.java
License:Apache License
public GameObject(ScreenBase context, Model model, BoundingBox bounds) { super(model); this.context = context; this.customBounds = bounds; this.bounds = this.customBounds != null ? this.customBounds : new BoundingBox(); this.center = new Vector3(); this.enabled = true; updateBox();/*from w w w .j av a2 s. c o m*/ this.animations = new AnimationController(this); this.blending = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); for (Material item : materials) { item.set(new DepthTestAttribute(GL20.GL_LEQUAL, 0.01f, 25f, true)); item.set(FloatAttribute.createAlphaTest(0.01f)); item.set(blending); } }
From source file:com.bladecoder.engine.model.Sprite3DRenderer.java
License:Apache License
private void retrieveSource(String source) { ModelCacheEntry entry = sourceCache.get(source); if (entry == null || entry.refCounter < 1) { loadSource(source);/*from ww w . j a va 2s. c o m*/ EngineAssetManager.getInstance().finishLoading(); entry = sourceCache.get(source); } if (entry.modelInstance == null) { Model model3d = EngineAssetManager.getInstance().getModel3D(source); entry.modelInstance = new ModelInstance(model3d); entry.controller = new AnimationController(entry.modelInstance); entry.camera3d = getCamera(entry.modelInstance); } }
From source file:com.github.fauu.helix.displayable.AreaDisplayable.java
License:Open Source License
public AreaDisplayable(Model model) { instance = new ModelInstance(model); animationController = new AnimationController(instance); instance.transform.rotate(new Vector3(1, 0, 0), 90); for (Material material : instance.materials) { TextureAttribute ta = (TextureAttribute) material.get(TextureAttribute.Diffuse); ta.textureDescription.magFilter = Texture.TextureFilter.Nearest; ta.textureDescription.minFilter = Texture.TextureFilter.Nearest; material.set(ta);/*from w w w. j a va2 s .co m*/ material.set(ColorAttribute.createDiffuse(Color.WHITE)); BlendingAttribute ba = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); material.set(ba); } }
From source file:com.mygdx.game.objects.HumanCharacter.java
License:Apache License
public HumanCharacter(Model model, String name, Vector3 location, Vector3 rotation, Vector3 scale, btCollisionShape shape, float mass, short belongsToFlag, short collidesWithFlag, boolean callback, boolean noDeactivate, Array<BlenderEmpty> ragdollEmpties, String armatureNodeId) { super(model, name, location, rotation, scale, shape, mass, belongsToFlag, collidesWithFlag, callback, noDeactivate, ragdollEmpties, armatureNodeId, new HumanSteerSettings()); // Create path follower followPathSteerer = new FollowPathSteerer(this); // Create the animation controllers animations = new AnimationController(modelInstance); // Create animation listeners for states that need one stateAnimationListeners = new EnumMap<HumanState, AnimationListener>(HumanState.class); stateAnimationListeners.put(HumanState.THROW, new AnimationListener()); // Create the state machine stateMachine = new DefaultStateMachine<HumanCharacter, HumanState>(this); // Set the steering variables associated with default move state (walking) stateMachine.changeState(moveState); // Then make the character idle stateMachine.changeState(moveState.idleState); }
From source file:com.zombie.game.actors.SteeringActor.java
License:Apache License
public void setModelInstance(ModelInstance modelInstance) { this.modelInstance = modelInstance; this.transform = modelInstance.transform.val; for (Material m : modelInstance.materials) { m.set(new IntAttribute(IntAttribute.CullFace, GL20.GL_NONE)); m.set(new FloatAttribute(FloatAttribute.AlphaTest, 0.5f)); m.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)); }// ww w. j a v a 2 s. co m //Get animations if any if (modelInstance.animations.size > 0) { animationController = new AnimationController(modelInstance); animationController.allowSameAnimation = true; animationController.animate(modelInstance.animations.get(0).id, -1, 1f, this, 1f); } }
From source file:org.bladecoder.bladeengine.model.Sprite3DRenderer.java
License:Apache License
private void retrieveSource(String source) { ModelCacheEntry entry = modelCache.get(source); if (entry == null || entry.refCounter < 1) { loadSource(source);/*from www . j av a2 s.c o m*/ EngineAssetManager.getInstance().finishLoading(); entry = modelCache.get(source); } if (entry.modelInstance == null) { Model model3d = EngineAssetManager.getInstance().getModel3D(source); entry.modelInstance = new ModelInstance(model3d); entry.controller = new AnimationController(entry.modelInstance); entry.camera3d = getCamera(entry.modelInstance); } }
From source file:ve.ucv.ciens.ccg.nxtar.components.AnimationComponent.java
License:Apache License
public AnimationComponent(ModelInstance instance, int next, boolean loop) throws IllegalArgumentException { if (instance == null) throw new IllegalArgumentException("Instance is null."); else if (next > instance.animations.size) throw new IllegalArgumentException("Next is greater than the number of animations for this model."); controller = new AnimationController(instance); collisionController = null;/*from w ww . j ava2s . c om*/ animationsIds = new LinkedList<String>(); current = -1; this.next = next; this.loop = loop; for (int i = 0; i < instance.animations.size; i++) { animationsIds.add(instance.animations.get(i).id); } }
From source file:ve.ucv.ciens.ccg.nxtar.components.AnimationComponent.java
License:Apache License
public AnimationComponent(ModelInstance instance, int next, boolean loop, ModelInstance collisionInstance) throws IllegalArgumentException { this(instance, next, loop); if (instance.animations.size != collisionInstance.animations.size) throw new IllegalArgumentException( "Animation number doesn't match between render model and collision model."); for (int i = 0; i < instance.animations.size; i++) { if (!instance.animations.get(i).id.contentEquals(collisionInstance.animations.get(i).id)) throw new IllegalArgumentException( "Animations don't match between render model and collision model."); }/* www .jav a 2s .co m*/ collisionController = new AnimationController(collisionInstance); }