SkinningData skinningData; // Skinning Data #endregion Fields #region Constructors /// <summary> /// ModelGeo with animation /// </summary> /// <param name="Go"></param> /// <param name="modelResource"></param> /// <param name="AniClip"></param> public ModelGeoAnim(GameObject Go, string modelResource, string AniClip) : base(Go, modelResource) { // Look up our custom skinning information. skinningData = mModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("Model '" + modelResource + "' does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); AnimationClip clip = skinningData.AnimationClips[AniClip]; animationPlayer.StartClip(clip); //boneTransforms = new Matrix[skinningData.BindPose.Count]; //animationPlayer.GetBoneTransforms().CopyTo(boneTransforms, 0); //mMatBones = animationPlayer.GetBoneTransforms(); BoneTransformTemp = new Matrix[skinningData.BindPose.Count]; animationPlayer.Update(new TimeSpan(0, 0, 0), true, mMatWorld); InitBoundingSpheres(); UpdateBoundingBox(); }
public SpawnVortex(Vector3 pos, Vector3 rot, Game1 game) : base() { this.pos = pos; this.rot = rot; this.game = game; model = ModelLibrary.vortex; tex = game.Content.Load<Texture2D>(@"Models/Enemies/SpawnPoint/spiraltest"); scale = new Vector3(0.8f,0.8f,0.7f); SkinningData skinningData = ModelLibrary.vortex.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animPlayer = new AnimationPlayer(skinningData); animClip = skinningData.AnimationClips["Take 001"]; animPlayer.StartClip(animClip); SetupEffects(); sb = new SpriteBatch(game.GraphicsDevice); targ1 = new RenderTarget2D(game.GraphicsDevice, 1024, 1024); targ2 = new RenderTarget2D(game.GraphicsDevice, 1024, 1024); texPos = Vector2.Zero; }
public StageData(int stageNumber) { // Reading of the data model this.LoadStage(stageNumber); this.active = false; // Initialization of each value this.pos = Vector3.Zero; this.scale = Vector3.One; this.rotation = Vector3.Zero; // Is not the first animation this.isPlayAnimation = false; // Get skinning data model SkinningData skinningData = Model_Stage.Tag as SkinningData; // Creating animation player animationPlayer = new AnimationPlayer(skinningData); // Set of animation AnimationClip clip = skinningData.AnimationClips["Take 001"]; animationPlayer.StartClip(clip); shadow = new Shadows(); shadow.Initialize(); }
public Vector3 Translation = new Vector3(0, 0, 0); //current position on the screen #endregion Fields #region Constructors public GraphicObjectBones(Model currentModelInput) { currentModel = currentModelInput; // Look up our custom skinning information. skinningData = currentModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); }
public void SkinningSetting(string startPose) { mSkinningData = Model.Tag as SkinningData; if (mSkinningData == null) { throw new InvalidOperationException("This model does not contain a SkinningData tag."); } AnimationPlayer = new AnimationPlayer(mSkinningData); AnimationSpeed = 0.04f; AnimationClip clip = mSkinningData.AnimationClips[startPose]; AnimationPlayer.StartClip(clip); mTemppose = startPose; }
/// <summary> /// Creates a new AnimatedModel instance based on the given model, which: /// a) already has to be loaded /// </summary> /// <param name="model"></param> public AnimatedModel(Model model) { this.model = model; skinningData = model.Tag as SkinningData; if (skinningData == null) { throw new InvalidOperationException("Model contains no animation data! Did you use the SkinnedModelProcessor?"); } player = new AnimationPlayer(skinningData); }
public SkinnedModel(GraphicFactory factory, String Name) : base(factory, Name) { // Look up our custom skinning information. SkinningData = this.model.Tag as SkinningData; if (SkinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. AnimationPlayer = new AnimationPlayer(SkinningData); }
public Dancer(AnimatedModelInstance modelInstance) { _modelInstance = modelInstance; _animationPlayer = new AnimationPlayer(AnimationManager.Instance.GetAnimationData()); Position = Vector3.Zero; Forward = Vector3.UnitZ; Up = Vector3.UnitY; _worldMatrix = Matrix.CreateWorld(Position, Forward, Up); _dancerBehavior = new IdleDancerBehavior(this); _modelInstance.SkinTransforms = _animationPlayer.GetSkinTransforms(); }
public void SetAnimation(Model model, string takeName) { // Look up our custom skinning information. skinningData = model.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); //set initial clip SetClip(takeName); }
public bool Init() { if (Initialized) { return true; } if (Model == null) { return false; } SkinningData = Model.Tag as SkinningData; if (SkinningData == null) throw new InvalidOperationException ("このモデルのTagにはSkinningDataが設定されていません。\n" + "プロセッサにSkinnedModelProcessorを指定してください"); if (SkinningData.AnimationClips.Count == 0) throw new InvalidOperationException ("このモデルにはAnimationClipが存在しません。"); AnimationPlayer = new AnimationPlayer(SkinningData); MotionNames.AddRange(SkinningData.AnimationClips.Keys); // 適当に最初のモーションを再生 foreach (var clip in SkinningData.AnimationClips) { AnimationPlayer.StartClip(clip.Value); CurrentMotionName = clip.Key; break; } BoneTransforms = new QuatTransform[SkinningData.BindPose.Count]; int width = AnimationPlayer.GetSkinRotations().Length; int height = 1; RotationTexture = new FlipTexture2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4); TranslationTexture = new FlipTexture2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4); Initialized = true; return true; }
/// <summary> /// /// </summary> /// <param name="initModel">初期表示モデル</param> /// <param name="models">アニメーションを持つモデルの辞書(モデルは一つのアニメーションしか持てないため)</param> protected AnimationModel(Model initModel, Dictionary<String, Model> models) { currentModel = initModel; this.models = models; // モデルの読み込み // スキニングデータ SkinningData skinningData = currentModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException("This model does not contain a SkinningData tag."); // アニメーションプレイヤーの初期化 animationPlayer = new AnimationPlayer(skinningData); // クリップ集の取得 clips = skinningData.AnimationClips; }
public AnimatedModelEntity(Model model) { this.model = model; this.size = Vector3.One; this.speed = 0.1f; skinning_data = model.Tag as SkinningData; if (skinning_data == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); animation_player = new AnimationPlayer(skinning_data); StartDefaultClip(); }
public SkinnedModel(Model model, List<Keys> lstkeys, Vector3 position, Vector3 rotation, Vector3 scale) { this.model = model; this.lstKeys = lstkeys; this.position = position; this.rotation = rotation; this.scale = scale; this.skinningData = model.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); animationPlayer = new AnimationPlayer(skinningData); bones = animationPlayer.GetSkinTransforms(); }
// Load Content public static void LoadContent(ContentManager content) { model = content.Load<Model>("Model\\dude"); skinData = model.Tag as SkinningData; if(skinData == null) { throw new InvalidOperationException("This model does not contain a SkinningData tag"); } player = new AnimationPlayer(skinData); clip = skinData.AnimationClips["Take 001"]; player.StartClip(clip); random = new Random(); }
public AnimatedEntity(Vector3 pos, String modelName, ContentManager cm, BoundingBox bound) : base(pos, modelName, cm, bound) { // Look up our custom skinning information. SkinningData skinningData = model.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); AnimationClip clip = skinningData.AnimationClips["Take 001"/*Name der Animation*/]; animationPlayer.StartClip(clip); }
public AnimatedModel(Model model) { this.Model = model; // Look up our custom skinning information. SkinningData skinningData = model.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. AnimationPlayer = new AnimationPlayer(skinningData); AnimationClip clip = skinningData.AnimationClips["Take 001"]; AnimationPlayer.StartClip(clip); AnimationPlayer.Update(TimeSpan.Zero, true, Matrix.Identity); }
public Fish() { this.model = Resources.fish_model; this.size = Vector3.One; this.speed = 2; this.max_speed = (float)rand.NextDouble()*2 + 0.5f; this.time = new TimeSpan(); skinning_data = model.Tag as SkinningData; if (skinning_data == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); animation_player = new AnimationPlayer(skinning_data); StartDefaultClip(); Update(0); }
/// <summary> /// Loads content for this demo. /// </summary> protected override void LoadContent() { sky = Game.Content.Load<Sky>("sky"); dude = Game.Content.Load<Model>("dude"); // Look up our custom skinning information. SkinningData skinningData = dude.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); AnimationClip clip = skinningData.AnimationClips["Take 001"]; animationPlayer.StartClip(clip); }
public My3DModel(ContentManager content, string modelName) { // TODO: Complete member initialization this._Model = content.Load<Model>(modelName); SkinningData MySkiningData = this._Model.Tag as SkinningData; if (MySkiningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); this._AnimationPlayer = new AnimationPlayer(MySkiningData); this._ListAnimation = MySkiningData.AnimationClips; this._Bones = this._AnimationPlayer.GetSkinTransforms(); //this._AnimationPlayer.StartClip(this._ListAnimation["G_Idle"]); }
public AnimatedFBX(ContentManager cm, string name) { model = cm.Load<Model>(name); player = null; SkinningData skinningData = model.Tag as SkinningData; if (skinningData == null) return; if (skinningData.AnimationClips.Values.Count == 0) return; player = new AnimationPlayer(skinningData); foreach (AnimationClip clip in skinningData.AnimationClips.Values) { player.StartClip(clip); break; } }
public Octopus() { this.model = Resources.octopus_model; this.size = Vector3.One; this.speed = 1; this.rotation.Z = MathHelper.PiOver2; this.max_speed = 0.5f; this.time = new TimeSpan(); skinning_data = model.Tag as SkinningData; if (skinning_data == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); animation_player = new AnimationPlayer(skinning_data); StartDefaultClip(); Update(0); }
public static void DrawModelAnim(Model mod, Matrix world, AnimationPlayer anim) { Matrix[] bones = anim.GetSkinTransforms(); foreach (ModelMesh mesh in mod.Meshes) { foreach (SkinnedEffect effect in mesh.Effects) { effect.SetBoneTransforms(bones); effect.View = GameCore.Camera.getView(); effect.Projection = GameCore.Camera.getProj(); effect.EnableDefaultLighting(); effect.SpecularColor = new Vector3(0.25f); effect.SpecularPower = 16; } mesh.Draw(); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="contentManager"></param> /// <param name="assetName"></param> /// <param name="startPosition"></param> /// <param name="orient"></param> /// <param name="scale"></param> /// <param name="maze"></param> public AnimationModel(ContentManager contentManager, string assetName,Point startPosition, Orientation orient, Vector3 scale, Maze maze) : base(contentManager, null, startPosition, orient,scale, maze) { // モデルの読み込み model = contentManager.Load<Model>(assetName); // スキニングデータ SkinningData skinningData = model.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException("This model does not contain a SkinningData tag."); // アニメーションプレイヤーの初期化 animationPlayer = new AnimationPlayer(skinningData); // クリップ集の取得 clips = skinningData.AnimationClips; //ダメージカウンターの初期化 DamegedFlag = false; damegeCounter = 0; dColor = 0.8f; }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { // Load the model. currentModel = Content.Load<Model>("InfectedDruggie"); // Look up our custom skinning information. SkinningData skinningData = currentModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); //AnimationClip clip = skinningData.AnimationClips["Take 001"]; //animationPlayer.RegisteredEvents["Fall"].Add("FireFrame", new AnimationPlayer.EventCallBack(OnFire)); // animations = new AnimationClip[3]; //animations[0] = new AnimationClip[skinningData.AnimationClips]; fpos = skinningData.AnimationClips["Fpos"]; idle = skinningData.AnimationClips["Idle"]; idle2 = skinningData.AnimationClips["Idle2"]; run = skinningData.AnimationClips["Run"]; attack = skinningData.AnimationClips["Attack"]; die = skinningData.AnimationClips["Die"]; /* animations[0] = idle; animations[1] = jump; animations[3] = fall; */ // start with idle animation animationPlayer.StartClip(run, true); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); c = new Camera(this); Components.Add(c); // Load model m = Content.Load<Model>("pet_hippo"); // Load textures into an array textures[0] = Content.Load<Texture2D>("hippo_blueeyes_default"); textures[1] = Content.Load<Texture2D>("hippo_blueeyes_pink"); textures[2] = Content.Load<Texture2D>("hippo_blueeyes_blue"); textures[3] = Content.Load<Texture2D>("hippo_blueeyes_camo"); skinningData = m.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); // Set clip to an animation track as written in the .fbx file clip = skinningData.AnimationClips["Dance"]; // initialize animation animationPlayer.StartClip(clip); animating = true; }
public Animation(string name, SkinningData data) { Name = name; SkinningData = data; AnimationPlayer = CreateAnimationPlayer(); }
public Animation(string name, Stream file) { Name = name; SkinningData = LoadSkinningData(file); AnimationPlayer = CreateAnimationPlayer(); }
public void UpdateBoneTransforms(TimeSpan time, bool relativeToCurrentTime) { bool flag; if (CurrentClip == null) { throw new InvalidOperationException("AnimationPlayer.Update was called before StartClip"); } bool count = !relativeToCurrentTime; if (!count) { time = time + CurrentTime; while (true) { count = time >= CurrentClip.Duration; if (!count) { break; } time = time - CurrentClip.Duration; } } if (time < TimeSpan.Zero) { flag = false; } else { flag = !(time >= CurrentClip.Duration); } count = flag; if (!count) { throw new ArgumentOutOfRangeException("time"); } count = !(time < CurrentTime); if (!count) { mCurrentKeyframe = 0; mSkinningDataValue.BindPose.CopyTo(mBoneTransforms, 0); } CurrentTime = time; IList <Keyframe> keyframes = CurrentClip.Keyframes; while (true) { count = mCurrentKeyframe < keyframes.Count; if (!count) { break; } Keyframe item = keyframes[mCurrentKeyframe]; count = !(item.Time > CurrentTime); if (count) { mBoneTransforms[item.Bone] = item.Transform; AnimationPlayer animationPlayer = this; animationPlayer.mCurrentKeyframe = animationPlayer.mCurrentKeyframe + 1; } else { break; } } }
/// <summary> /// アニメーションの開始(今のモデルと同じ指定なら初期化されることはない) /// </summary> /// <param name="clipName">クリップ名</param> protected void AnimationStart(string modelName, string clipName) { Model newModel; if (!models.TryGetValue(modelName, out newModel)) { throw new InvalidOperationException("Invaid Model date."); } if (currentModel != newModel) { currentModel = newModel; // スキニングデータ SkinningData skinningData = currentModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException("This model does not contain a SkinningData tag."); // アニメーションプレイヤーの変更 animationPlayer = new AnimationPlayer(skinningData); //アニメーションを開始 clips = skinningData.AnimationClips; } animationPlayer.StartClip(clips[clipName]); }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { // Load the model. currentModel = Content.Load<Model>("dude"); table = Content.Load<Model>("table"); chair = Content.Load<Model>("chair"); chair2 = Content.Load<Model>("chair"); // Look up our custom skinning information. SkinningData skinningData = currentModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData); AnimationClip clip = skinningData.AnimationClips["walky"]; animationPlayer.StartClip(clip); }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { // Load the model. currentModel = game.Content.Load<Model>("VisualisationModels/manrigged"); // Look up our custom skinning information. SkinningData skinningData = currentModel.Tag as SkinningData; if (skinningData == null) throw new InvalidOperationException ("This model does not contain a SkinningData tag."); // Create an animation player, and start decoding an animation clip. animationPlayer = new AnimationPlayer(skinningData, currentModel); AnimationClip clip = skinningData.AnimationClips["Take 001"]; animationPlayer.StartClip(clip, startFrame); }