public LinkedSkeletonAnimationSource(string skelName, float scl, SkeletonPtr skelPtr) : this(OgrePINVOKE.new_LinkedSkeletonAnimationSource__SWIG_1(skelName, scl, SkeletonPtr.getCPtr(skelPtr)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public SkeletonPtr(SkeletonPtr r) : this(OgrePINVOKE.new_SkeletonPtr__SWIG_2(SkeletonPtr.getCPtr(r)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #3
0
 public SkeletonInstance(SkeletonPtr masterCopy) : this(OgrePINVOKE.new_SkeletonInstance(SkeletonPtr.getCPtr(masterCopy)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #4
0
 public int Add(SkeletonPtr o)
 {
     lock (allSkeletons)
     {
         return(allSkeletons.Add(((SkeletonPtr)o)));
     }
 }
Exemple #5
0
        public int Add(string pathRelFile)
        {
            SkeletonPtr skel = SkeletonManager.Singleton.Create(pathRelFile, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, true, loader);

            //skel.Load();
            return(Add(skel));
        }
Exemple #6
0
 public void _notifySkeleton(SkeletonPtr pSkel)
 {
     OgrePINVOKE.Mesh__notifySkeleton(swigCPtr, SkeletonPtr.getCPtr(pSkel));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #7
0
        public SkeletonPtr getSkeleton()
        {
            SkeletonPtr ret = new SkeletonPtr(OgrePINVOKE.Mesh_getSkeleton(swigCPtr), false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #8
0
        public SkeletonPtr getByName(string name, string groupName)
        {
            SkeletonPtr ret = new SkeletonPtr(OgrePINVOKE.SkeletonManager_getByName__SWIG_0(swigCPtr, name, groupName), true);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #9
0
        public SkeletonPtr create(string name, string group)
        {
            SkeletonPtr ret = new SkeletonPtr(OgrePINVOKE.SkeletonManager_create__SWIG_3(swigCPtr, name, group), true);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #10
0
        public SkeletonPtr create(string name, string group, bool isManual, ManualResourceLoader loader)
        {
            SkeletonPtr ret = new SkeletonPtr(OgrePINVOKE.SkeletonManager_create__SWIG_1(swigCPtr, name, group, isManual, ManualResourceLoader.getCPtr(loader)), true);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #11
0
 public Boolean Contains(SkeletonPtr a)
 {
     foreach (SkeletonPtr tex in allSkeletons)
     {
         if (tex.Name == a.Name)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #12
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SkeletonPtr obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemple #13
0
        public List <string> SetViewModel(string theModel)
        {
            string nameOnly = Path.GetFileNameWithoutExtension(theModel);
            string filename = Path.GetFileName(theModel);
            string modelDir = Path.GetDirectoryName(theModel);

            AddResourcesDirectory(nameOnly, modelDir);

            //Entity ent = null;
            if (sceneMgr.HasEntity(nameOnly))
            {
                sceneMgr.DestroyEntity(nameOnly);
            }
            ModelEntity = sceneMgr.CreateEntity(nameOnly, filename, nameOnly);

            //SceneNode node = null;
            if (sceneMgr.HasSceneNode(MODEL_NODE))
            {
                sceneMgr.DestroySceneNode(MODEL_NODE);
            }
            ModelSceneNode = sceneMgr.RootSceneNode.CreateChildSceneNode(MODEL_NODE);
            ModelSceneNode.SetInitialState();

            ModelSceneNode.DetachAllObjects();
            ModelSceneNode.AttachObject(ModelEntity);

            // check for material textures
            foreach (var subMesh in ModelEntity.GetMesh().GetSubMeshIterator())
            {
                bool needsReload = false;
                var  matPtr      = (MaterialPtr)MaterialManager.Singleton.GetByName(subMesh.MaterialName);
                if (matPtr != null)
                {
                    foreach (var mtrPass in matPtr.GetTechnique(0).GetPassIterator())
                    {
                        foreach (var mtrTex in mtrPass.GetTextureUnitStateIterator())
                        {
                            if (mtrTex.IsTextureLoadFailing)
                            {
                                mtrTex.SetTextureName(mtrTex.TextureName.Replace(".png", ".dds"));
                                needsReload = true;
                            }
                        }
                    }
                }
                if (needsReload)
                {
                    matPtr.Reload();
                }
            }

            // gather information about wardrobe
            IsWardrobed      = false;
            WardrobeTextures = new string[Enum.GetValues(typeof(Wardrobe)).Length];

            if (ModelEntity.GetMesh().NumSubMeshes > 0)
            {
                foreach (var subMesh in ModelEntity.GetMesh().GetSubMeshIterator())
                {
                    var matPtr = (MaterialPtr)MaterialManager.Singleton.GetByName(subMesh.MaterialName);

                    foreach (Wardrobe suit in Enum.GetValues(typeof(Wardrobe)))
                    {
                        string suitStr = suit.ToString();
                        if (subMesh.MaterialName.IndexOf(suitStr, StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            IsWardrobed = true;
                            string wardrobeTex = "none";
                            foreach (var mtrPass in matPtr.GetTechnique(0).GetPassIterator())
                            {
                                foreach (var mtrTex in mtrPass.GetTextureUnitStateIterator())
                                {
                                    if (!string.IsNullOrEmpty(mtrTex.TextureName))
                                    {
                                        wardrobeTex = mtrTex.TextureName;
                                    }
                                }
                            }

                            WardrobeTextures[(int)suit] = wardrobeTex;
                            break;
                        }
                    }
                }
            }

            //// 2nd pass
            //// check for material wardrobe textures
            //if (ModelEntity.GetMesh().NumSubMeshes > 0)
            //{
            //    foreach (var subMesh in ModelEntity.GetMesh().GetSubMeshIterator())
            //    {
            //        bool needsReload = false;
            //        var matPtr = (MaterialPtr)MaterialManager.Singleton.GetByName(subMesh.MaterialName);
            //        foreach (var mtrPass in matPtr.GetTechnique(0).GetPassIterator())
            //        {
            //            foreach (var mtrTex in mtrPass.GetTextureUnitStateIterator())
            //            {
            //                foreach (var wardrobe in allWadrobe)
            //                {
            //                    if (subMesh.MaterialName.IndexOf(wardrobe, StringComparison.OrdinalIgnoreCase) >= 0)
            //                    {
            //                        var fl = Directory.GetFiles(modelDir, string.Format("*{0}*", wardrobe));
            //                        // get the first that matches
            //                        if (fl.Length > 0)
            //                            mtrTex.SetTextureName(Path.GetFileName(fl[0]));
            //                        needsReload = true;
            //                    }
            //                }
            //            }
            //        }
            //        if (needsReload) matPtr.Reload();
            //    }
            //}
            // check for skeleton and animations
            if (ModelEntity.HasSkeleton)
            {
                foreach (string skltFiles in Directory.GetFiles(modelDir, "*.skeleton"))
                {
                    try
                    {
                        SkeletonPtr            source        = SkeletonManager.Singleton.Load(Path.GetFileName(skltFiles), "General");
                        Skeleton.BoneHandleMap boneHandleMap = new Skeleton.BoneHandleMap();
                        source._buildMapBoneByHandle(source, boneHandleMap);
                        ModelEntity.Skeleton._mergeSkeletonAnimations(source, boneHandleMap);
                        ModelEntity.Skeleton._refreshAnimationState(ModelEntity.AllAnimationStates);
                    }
                    catch
                    {
                    }
                }
                //ModelEntity.DisplaySkeleton = true;
            }

            SetInitialCamera(ModelEntity, ModelSceneNode);

            if (sceneMgr.HasLight("SimpleLight"))
            {
                sceneMgr.DestroyLight("SimpleLight");
            }
            Light light = sceneMgr.CreateLight("SimpleLight");

            sceneMgr.RootSceneNode.AttachObject(light);
            light.DiffuseColour = new ColourValue(1f, 1f, 1f);
            light.Position      = this.camera.Position;
            light.Direction     = this.camera.Direction;

            return(GetAnimationNames(ModelEntity));
        }