示例#1
0
        public override bool Load()
        {
            if (IsLoaded)
            {
                return(true);
            }

            if (!Parent.Load())
            {
                return(false);
            }

            this.handle = MogitorsRoot.Instance.SceneManager.CreateCamera(Name);

            this.handle.SetPosition(this.position.x, this.position.y, this.position.z);
            this.handle.Orientation      = this.orientation;
            this.handle.NearClipDistance = this.clipDistance.x;
            this.handle.FarClipDistance  = this.clipDistance.y;
            this.handle.FOVy             = new Mogre.Radian(this.fov);

            Parent.Node.AttachObject(this.handle);

            IsLoaded = true;

            RegisterForPostSceneUpdates();

            return(true);
        }
示例#2
0
 /** Delegated to by ParticleTechnique::_notifyCurrentCamera */
 public void _notifyCurrentCamera(Mogre.Camera cam)
 {
     if (cam == null)
     {
         throw new ArgumentNullException("cam cannot be null!");
     }
     ParticleRenderer__notifyCurrentCamera(nativePtr, (IntPtr)cam.NativePtr);
 }
示例#3
0
 public float GetSquaredViewDepth(Mogre.Camera cam)
 {
     if (cam == null)
     {
         throw new ArgumentNullException("cam cannot be null!");
     }
     return(BoxSet_GetSquaredViewDepth(nativePtr, (IntPtr)cam.NativePtr));
 }
        public bool InitializeSound(Mogre.Camera listener)
        {
            _listener = new FSLListener(listener);
            if (_initSound)
			    return true;

	        if (!FreeSL.fslInit(FreeSL.FSL_SOUND_SYSTEM.FSL_SS_DIRECTSOUND3D)) //Change if desire
			    return false;
            
	        _initSound = true;
	        return true;
        }
示例#5
0
        /// <summary>
        /// Initializes the sound system.
        /// </summary>
        /// <param name="soundSystem">Enumeration of FSL_SOUND_SYSTEM to use.</param>
        /// <param name="listener">Camera to use as a listener for 3D sound.</param>
        /// <returns></returns>
        public bool InitializeSound(FSL_SOUND_SYSTEM soundSystem, Mogre.Camera listener)
        {
            _listener = new Listener(listener);
            GetListener().ZFlipped = true;

            if (_initSound)
            {
                return(true);
            }

            if (!FreeSL.fslInit(soundSystem))     //Change if you desire
            {
                return(false);
            }

            FreeSL.fslSetAutoUpdate(true);
            _initSound = true;
            return(true);
        }
示例#6
0
        public override bool UnLoad()
        {
            if (!IsLoaded)
            {
                return(true);
            }

            UnLoadAllChildren();

            DestroyBoundingBox();

            if (this.handle != null)
            {
                this.handle.ParentSceneNode.DetachObject(this.handle);
                this.handle.SceneManager.DestroyCamera(this.handle);
                this.handle = null;
            }

            IsLoaded = false;
            return(true);
        }
示例#7
0
 internal Listener()
 {
     _renderable = null;
 }
示例#8
0
 /// <summary>
 /// Sets the listener used by the sound manager for 3D sound calculations.
 /// </summary>
 public void SetListener(Mogre.Camera listener)
 {
     _listener = new Listener(listener);
 }
示例#9
0
 public void _notifyCurrentCamera(Mogre.Camera cam)
 {
     BoxSet__notifyCurrentCamera(nativePtr, (IntPtr)cam.NativePtr);
 }
示例#10
0
        public override bool UnLoad()
        {
            if (!IsLoaded)
                return true;

            UnLoadAllChildren();

            DestroyBoundingBox();

            if (this.handle != null)
            {
                this.handle.ParentSceneNode.DetachObject(this.handle);
                this.handle.SceneManager.DestroyCamera(this.handle);
                this.handle = null;
            }

            IsLoaded = false;
            return true;
        }
示例#11
0
 public FSLListener()
 {
     _renderable = null;
 }
示例#12
0
 public void SetListener(Mogre.Camera renderable)
 {
     _renderable = renderable;
 }
示例#13
0
 public FSLListener(Mogre.Camera renderable)
 {
     _renderable = renderable;
 }
示例#14
0
 public SceneUpdatedEventArgs(Mogre.SceneManager sceneMngr, Mogre.Camera camera, Mogre.RenderTarget renderTarget)
 {
     this.sceneMngr    = sceneMngr;
     this.camera       = camera;
     this.renderTarget = renderTarget;
 }
示例#15
0
        private void CreateImages(ObservableCollection <IconTextItem> retlist, bool skipCached)
        {
            retlist.Clear();

            Mogre.TexturePtr texture = Mogre.TextureManager.Singleton.CreateManual("EntityTex",
                                                                                   Mogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, Mogre.TextureType.TEX_TYPE_2D,
                                                                                   256, 256, 0, Mogre.PixelFormat.PF_A8R8G8B8, (int)Mogre.TextureUsage.TU_RENDERTARGET);

            Mogre.RenderTexture rttTex   = texture.GetBuffer().GetRenderTarget();
            Mogre.SceneManager  sceneMgr = Mogre.Root.Singleton.CreateSceneManager("OctreeSceneManager", "EntityTexMgr");

            Mogre.Light dir1 = sceneMgr.CreateLight("DisplayLight");
            dir1.SetDirection(-1, -1, -1);
            dir1.SetDiffuseColour(1, 1, 1);
            dir1.Type = Mogre.Light.LightTypes.LT_DIRECTIONAL;

            Mogre.Camera RTTCam = sceneMgr.CreateCamera("EntityCam");
            RTTCam.NearClipDistance = 0.01F;
            RTTCam.FarClipDistance  = 0;
            RTTCam.AspectRatio      = 1;
            RTTCam.FOVy             = new Mogre.Radian(new Mogre.Degree(90));
            RTTCam.Position         = new Mogre.Vector3(0, 0, 1);
            RTTCam.LookAt(0, 0, 0);

            Mogre.Viewport v = rttTex.AddViewport(RTTCam);
            v.SetClearEveryFrame(true);
            v.BackgroundColour = new Mogre.ColourValue(0, 0, 0, 0);

            Mogre.StringVector list = Mogre.ResourceGroupManager.Singleton.FindResourceNames("ProjectResources", "*.mesh", false);

            IDictionary <string, string> entities = new Dictionary <string, string>(list.Count);

            foreach (string addstr in list)
            {
                if (entities.Values.Contains(addstr) == false)
                {
                    entities.Add(addstr, addstr);
                }
            }

            foreach (KeyValuePair <string, string> ite in entities)
            {
                string addstr     = ite.Key;
                string addstrFile = MogitorsSystem.Instance.CombinePath(MogitorsRoot.Instance.ProjectOptions.ProjectDir, addstr + ".png");

                if (!skipCached || !System.IO.File.Exists(addstrFile))
                {
                    Mogre.Entity entity = sceneMgr.CreateEntity("scbDisplay", addstr);
                    sceneMgr.RootSceneNode.AttachObject(entity);

                    Mogre.Vector3 vSize   = entity.BoundingBox.HalfSize;
                    Mogre.Vector3 vCenter = entity.BoundingBox.Center;

                    vSize += new Mogre.Vector3(vSize.z, vSize.z, vSize.z);

                    float maxsize = Math.Max(Math.Max(vSize.x, vSize.y), vSize.z);

                    vSize = new Mogre.Vector3(0, 0, maxsize * 1.1f) + vCenter;

                    RTTCam.SetPosition(vSize.x, vSize.y, vSize.z);
                    RTTCam.LookAt(vCenter.x, vCenter.y, vCenter.z);

                    rttTex.Update();
                    rttTex.WriteContentsToFile(addstrFile);

                    entity.ParentSceneNode.DetachObject(entity);
                    sceneMgr.DestroyEntity(entity);
                }

                retlist.Add(new IconTextItem(addstr.Remove(addstr.Length - 5, 5), addstrFile));
            }

            rttTex.RemoveAllViewports();
            Mogre.Root.Singleton.DestroySceneManager(sceneMgr);
            Mogre.Root.Singleton.DetachRenderTarget(rttTex.Name);
            Mogre.TextureManager.Singleton.Unload(texture.Name);
            Mogre.TextureManager.Singleton.Remove(texture.Name);

            list = null;
        }
示例#16
0
 internal Listener(Mogre.Camera renderable)
 {
     _renderable = renderable;
 }
 public SceneUpdatedEventArgs(Mogre.SceneManager sceneMngr, Mogre.Camera camera, Mogre.RenderTarget renderTarget)
 {
     this.sceneMngr = sceneMngr;
     this.camera = camera;
     this.renderTarget = renderTarget;
 }
示例#18
0
        public override bool Load()
        {
            if (IsLoaded)
                return true;

            if (!Parent.Load())
                return false;

            this.handle = MogitorsRoot.Instance.SceneManager.CreateCamera(Name);

            this.handle.SetPosition(this.position.x, this.position.y, this.position.z);
            this.handle.Orientation = this.orientation;
            this.handle.NearClipDistance = this.clipDistance.x;
            this.handle.FarClipDistance = this.clipDistance.y;
            this.handle.FOVy = new Mogre.Radian(this.fov);

            Parent.Node.AttachObject(this.handle);

            IsLoaded = true;

            RegisterForPostSceneUpdates();

            return true;
        }