示例#1
0
 private void createLight(Mogre.SceneManager sm)
 {
     ambient                = sm.CreateLight("menuAmbient");
     ambient.Type           = Mogre.Light.LightTypes.LT_DIRECTIONAL;
     ambient.Position       = new Vector3(0, 2000, 0);
     ambient.Direction      = new Vector3(-0.8365f, -1, 0.5867f);
     ambient.DiffuseColour  = new Mogre.ColourValue(0.99f, 0.95f, 0.9f);
     ambient.SpecularColour = Mogre.ColourValue.White;
     ambient.CastShadows    = true;
     sm.RootSceneNode.AttachObject(ambient);
 }
示例#2
0
 public bool PreRender(Mogre.SceneManager sm, Mogre.RenderSystem rsys)
 {
     if (sm == null)
     {
         throw new ArgumentNullException("sm cannot be null!");
     }
     if (rsys == null)
     {
         throw new ArgumentNullException("rsys cannot be null!");
     }
     return(BoxSet_PreRender(nativePtr, (IntPtr)sm.NativePtr, (IntPtr)rsys.NativePtr));
 }
示例#3
0
 public void PostRender(Mogre.SceneManager sm, Mogre.RenderSystem rsys)
 {
     if (sm == null)
     {
         throw new ArgumentNullException("sm cannot be null!");
     }
     if (rsys == null)
     {
         throw new ArgumentNullException("rsys cannot be null!");
     }
     SphereSet_PostRender(nativePtr, (IntPtr)sm.NativePtr, (IntPtr)rsys.NativePtr);
 }
示例#4
0
        public override bool UnLoad()
        {
            if (!IsLoaded)
            {
                return(true);
            }

            UnLoadAllChildren();
            DestroyBoundingBox();

            if (this.handle != null)
            {
                Mogre.Root.Singleton.DestroySceneManager(this.handle);
                this.handle = null;
            }

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

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

            this.handle = Mogre.Root.Singleton.CreateSceneManager(SceneMangerType, Name);
            if (this.skyBoxActive)
            {
                this.handle.SetSkyBox(this.skyBoxActive, this.skyBoxMaterial, this.skyBoxDistance);
            }

            this.handle.SetFog(this.fogMode, this.fogColour, this.fogDensity, this.fogStart, this.fogEnd);
            this.handle.AmbientLight = this.ambient;

            IsLoaded = true;
            return(true);
        }
 public SceneUpdatedEventArgs(Mogre.SceneManager sceneMngr, Mogre.Camera camera, Mogre.RenderTarget renderTarget)
 {
     this.sceneMngr = sceneMngr;
     this.camera = camera;
     this.renderTarget = renderTarget;
 }
示例#7
0
        public override bool UnLoad()
        {
            if (!IsLoaded)
                return true;

            UnLoadAllChildren();
            DestroyBoundingBox();

            if (this.handle != null)
            {
                Mogre.Root.Singleton.DestroySceneManager(this.handle);
                this.handle = null;
            }

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

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

            this.handle = Mogre.Root.Singleton.CreateSceneManager(SceneMangerType, Name);
            if (this.skyBoxActive)
                this.handle.SetSkyBox(this.skyBoxActive, this.skyBoxMaterial, this.skyBoxDistance);

            this.handle.SetFog(this.fogMode, this.fogColour, this.fogDensity, this.fogStart, this.fogEnd);
            this.handle.AmbientLight = this.ambient;

            IsLoaded = true;
            return true;
        }
示例#9
0
 public SceneUpdatedEventArgs(Mogre.SceneManager sceneMngr, Mogre.Camera camera, Mogre.RenderTarget renderTarget)
 {
     this.sceneMngr    = sceneMngr;
     this.camera       = camera;
     this.renderTarget = renderTarget;
 }
示例#10
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;
        }