/// <summary>
		///    Create the specified type of GpuProgram.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="type"></param>
		/// <returns></returns>
		protected override Resource _create( string name, ulong handle, string group, bool isManual,
		                                     IManualResourceLoader loader, NameValuePairList createParams )
		{
			if ( createParams == null ||
			     ( createParams.ContainsKey( "syntax" ) == false || createParams.ContainsKey( "type" ) == false ) )
			{
				throw new Exception( "You must supply 'syntax' and 'type' parameters" );
			}

			string syntaxCode = createParams[ "syntax" ];
			string type = createParams[ "type" ];

			// if there is none, this syntax code must not be supported
			// just return the base GL program since it won't be doing anything anyway
			if ( this.factories[ syntaxCode ] == null )
			{
				return new GLGpuProgram( this, name, handle, group, isManual, loader );
			}

			GpuProgramType gpt;
			if ( type == "vertex_program" )
			{
				gpt = GpuProgramType.Vertex;
			}
			else
			{
				gpt = GpuProgramType.Fragment;
			}

			return ( (IOpenGLGpuProgramFactory)this.factories[ syntaxCode ] ).Create( this, name, handle, group, isManual, loader,
			                                                                          gpt,
			                                                                          syntaxCode );
		}
        /*
		public D3DTextureManager(D3D.Direct3D manager, D3D.Device device)
		{
           
		}
         */
         

		protected override Resource _create( string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, NameValuePairList createParams )
		{
            // temporary hack
            manager = D3DRenderSystem.Direct3D9;
            device = D3DRenderSystem.ActiveD3D9Device;
			return new D3DTexture( this, name, handle, group, isManual, loader, this.device, this.manager );
		}
                    ///<summary>
                    ///拷贝构造函数
                    ///</summary>
                    ///<param name="other">索引对象</param>
                    ///<returns></returns>
                    public SqlIndex(EarthView.World.Core.Database.SqlIndex other) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list       = new NameValuePairList();
                        BasePtr           valueother = new BasePtr(other);

                        list.Add("other", valueother.PtrVal);
                        Create("CSqlIndex", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                    ///<summary>
                    ///构造函数
                    ///</summary>
                    ///<param name="cursorName">游标名</param>
                    ///<returns></returns>
                    public SqlIndex(string cursorName) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list            = new NameValuePairList();
                        BasePtr           valuecursorName = new BasePtr(cursorName);

                        list.Add("cursorName", valuecursorName.PtrVal);
                        Create("CSqlIndex", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                    ///<summary>
                    ///构造函数
                    /// </summary>
                    /// <param name="driverType">驱动名</param>
                    ///<returns></returns>
                    public Sqlstandardization(string driverType) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list            = new NameValuePairList();
                        BasePtr           valuedriverType = new BasePtr(driverType);

                        list.Add("driverType", valuedriverType.PtrVal);
                        Create("CSqlstandardization", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                    /// <summary>
                    /// 构造函数
                    /// </summary>
                    /// <param name="pxy">地图控件代理</param>
                    /// <returns></returns>
                    public MapEagleEye(EarthView.World.Spatial2D.Controls.MapControlAgent ref_pxy) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list         = new NameValuePairList();
                        BasePtr           valueref_pxy = new BasePtr(ref_pxy);

                        list.Add("ref_pxy", valueref_pxy.PtrVal);
                        Create("CMapEagleEye", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                    /// <summary>
                    /// 构造函数
                    /// </summary>
                    /// <param name="param">显示器参数</param>
                    /// <returns></returns>
                    public ColorSpaceConvert(EarthView.World.Spatial.Display.MonitorParameter param) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list       = new NameValuePairList();
                        BasePtr           valueparam = new BasePtr(param);

                        list.Add("param", valueparam.PtrVal);
                        Create("CColorSpaceConvert", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
        public SimCameraManager Init(State state)
        {
            state.CameraManager = this;
            var misc = new NameValuePairList();
            misc["externalWindowHandle"] = state.MainWindow.Handle.ToString();
            RenderWindow = state.Root.CreateRenderWindow("Autumn main RenderWindow", 0, 0, false, misc);

            CreateCamera(state);

            return this;
        }
Exemple #9
0
                    /// <summary>
                    /// 构造函数
                    /// </summary>
                    /// <param name=""></param>
                    /// <returns></returns>
                    public LayoutSublineRender(EarthView.World.Layout.Controls.LayoutControl pControl) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list          = new NameValuePairList();
                        BasePtr           valuepControl = new BasePtr(pControl);

                        list.Add("pControl", valuepControl.PtrVal);
                        Create("CLayoutSublineRender", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
Exemple #10
0
                public WriteLocker(EarthView.World.Core.ReadWriteLock pWriteLocker) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list = new NameValuePairList();
                    BasePtr           valuepWriteLocker = new BasePtr(pWriteLocker);

                    list.Add("pWriteLocker", valuepWriteLocker.PtrVal);
                    Create("CWriteLocker", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
Exemple #11
0
    /// <summary>
    ///
    /// </summary>
    /// <param name=""></param>
    /// <returns></returns>
    public Ftpclient(string remotepath) : base(CreatedWhenConstruct.CWC_NotToCreate)
    {
        NameValuePairList list            = new NameValuePairList();
        BasePtr           valueremotepath = new BasePtr(remotepath);

        list.Add("remotepath", valueremotepath.PtrVal);
        Create("FTPClient", list);
        RegisterCallBack();
        this.needDispose = true;
        GlobalTraceInfoMap.Put(this);
    }
        //update->query
        #region updateQuery

        public int UpdateQuery(string desgId, string designation, string description)
        {
            string            updateQuery         = "UPDATE designationT SET deignation ='" + designation + "',description ='" + description + "' WHERE desgId='" + desgId + "'";
            NameValuePairList nameValuePairObject = new NameValuePairList();

            nameValuePairObject.Add(new NameValuePair("@designation", designation));
            nameValuePairObject.Add(new NameValuePair("@description", description));
            int status = obj.updateQ(updateQuery, nameValuePairObject);

            return(status);
        }
                /// <summary>
                /// 默认构造函数
                /// </summary>
                /// <param name=></param>
                /// <returns></returns>
                public LatticeFontCache(byte[] filePath) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list          = new NameValuePairList();
                    BasePtr           valuefilePath = new BasePtr(filePath);

                    list.Add("filePath", valuefilePath.PtrVal);
                    Create("CLatticeFontCache", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
Exemple #14
0
                    /// <summary>
                    /// 构造函数
                    /// </summary>
                    /// <param name="url">数据源配置字符串</param>
                    /// <returns></returns>
                    public DataSourceUrl(string url) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list     = new NameValuePairList();
                        BasePtr           valueurl = new BasePtr(url);

                        list.Add("url", valueurl.PtrVal);
                        Create("CDataSourceUrl", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
    /// <summary>
    /// 默认构造函数
    /// </summary>
    public LinestringTrackingItemWrapper(EarthView.World.Spatial2D.Controls.MapControl ref_mapcontrol) : base(CreatedWhenConstruct.CWC_NotToCreate)
    {
        NameValuePairList list = new NameValuePairList();
        BasePtr           valueref_mapcontrol = new BasePtr(ref_mapcontrol);

        list.Add("ref_mapcontrol", valueref_mapcontrol.PtrVal);
        Create("CLinestringTrackingItemWrapper", list);
        RegisterCallBack();
        this.needDispose = true;
        GlobalTraceInfoMap.Put(this);
    }
Exemple #16
0
                public LatticeTextBox(EarthView.World.Graphic.ColourValue color) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list       = new NameValuePairList();
                    BasePtr           valuecolor = new BasePtr(color);

                    list.Add("color", valuecolor.PtrVal);
                    Create("CLatticeTextBox", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
Exemple #17
0
                    /// <summary>
                    /// 构造函数
                    /// </summary>
                    /// <param name="type">事件类型</param>
                    /// <returns></returns>
                    public MapOperationEvent(ushort type) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list      = new NameValuePairList();
                        BasePtr           valuetype = new BasePtr(type);

                        list.Add("type", valuetype.PtrVal);
                        Create("CMapOperationEvent", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                    /// <summary>
                    /// 构造函数
                    /// </summary>
                    ///<param "moonTextureName">材质名称</param>
                    ///<returns></returns>
                    public Moon(string moonTextureName) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list = new NameValuePairList();
                        BasePtr           valuemoonTextureName = new BasePtr(moonTextureName);

                        list.Add("moonTextureName", valuemoonTextureName.PtrVal);
                        Create("CMoon", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
Exemple #19
0
                public LatticeTextBox(uint argb) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list      = new NameValuePairList();
                    BasePtr           valueargb = new BasePtr(argb);

                    list.Add("argb", valueargb.PtrVal);
                    Create("CLatticeTextBox", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
                    public MaterialResourceCache(string group) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list       = new NameValuePairList();
                        BasePtr           valuegroup = new BasePtr(group);

                        list.Add("group", valuegroup.PtrVal);
                        Create("CMaterialResourceCache", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
Exemple #21
0
                /// <summary>
                /// 拷贝构造函数
                /// </summary>
                /// <param name="tileReference">拷贝对象</param>
                /// <returns></returns>
                public TileRule(EarthView.World.Spatial.TileRule tileRule) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list          = new NameValuePairList();
                    BasePtr           valuetileRule = new BasePtr(tileRule);

                    list.Add("tileRule", valuetileRule.PtrVal);
                    Create("CTileRule", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
                    ///<summary>
                    ///构造函数
                    ///</summary>
                    /// <param name="eModel">数学模型</param>
                    public Rectification(EarthView.World.Spatial2D.GeoCorretion.RECTIFYMODELTYPE eModel) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list        = new NameValuePairList();
                        BasePtr           valueeModel = new BasePtr(eModel);

                        list.Add("eModel", valueeModel.PtrVal);
                        Create("CRectification", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                    /// <summary>
                    /// 复制构造函数
                    /// </summary>
                    /// <param name="obj">包围盒对象</param>
                    /// <returns></returns>
                    public RotatedEnvelope(ref EarthView.World.Spatial.Geometry.RotatedEnvelope obj) : base(CreatedWhenConstruct.CWC_NotToCreate)
                    {
                        NameValuePairList list     = new NameValuePairList();
                        BasePtr           valueobj = new BasePtr(obj);

                        list.Add("obj", valueobj.PtrVal);
                        Create("CRotatedEnvelope", list);
                        RegisterCallBack();
                        this.needDispose = true;
                        GlobalTraceInfoMap.Put(this);
                    }
                /// <summary>
                /// 与外部传进来的互斥体指针进行绑定
                /// </summary>
                /// <param name="mutex">外部的互斥体指针</param>
                /// <returns></returns>
                public MutexLocker(EarthView.World.Core.Mutex mutex) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list       = new NameValuePairList();
                    BasePtr           valuemutex = new BasePtr(mutex);

                    list.Add("mutex", valuemutex.PtrVal);
                    Create("CMutexLocker", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
Exemple #25
0
                public RaySceneQueryResultSimple(EarthView.World.Graphic.RaySceneQueryResult pParentRaySceneQueryResult) : base(CreatedWhenConstruct.CWC_NotToCreate)
                {
                    NameValuePairList list = new NameValuePairList();
                    BasePtr           valuepParentRaySceneQueryResult = new BasePtr(pParentRaySceneQueryResult);

                    list.Add("pParentRaySceneQueryResult", valuepParentRaySceneQueryResult.PtrVal);
                    Create("RaySceneQueryResultSimple", list);
                    RegisterCallBack();
                    this.needDispose = true;
                    GlobalTraceInfoMap.Put(this);
                }
Exemple #26
0
        //department
        public int department_update(string department)
        {
            string InsertQuery = "Insert into department(demp_name) Values(@demp_name)";

            NameValuePairList nameValuePairObject = new NameValuePairList();

            nameValuePairObject.Add(new NameValuePair("@demp_name", department));

            int Status = obj.InsertUpdateOrDelete(InsertQuery, nameValuePairObject);

            return(Status);
        }
Exemple #27
0
        //update_division_department_designation

        //division
        public int division_update(string division)
        {
            string InsertQuery = "Insert into division(div_name) Values(@div_name)";

            NameValuePairList nameValuePairObject = new NameValuePairList();

            nameValuePairObject.Add(new NameValuePair("@div_name", division));

            int Status = obj.InsertUpdateOrDelete(InsertQuery, nameValuePairObject);

            return(Status);
        }
Exemple #28
0
        public override NativeWindowPair createWindow(string name, uint w, uint h, NameValuePairList miscParams)
        {
            miscParams["externalWindowHandle"] = ExternalWindowHandle.ToString();
            miscParams["vsync"]         = "False";
            miscParams["FSAA"]          = "2";
            miscParams["Multithreaded"] = "true";

            NativeWindowPair nwp = base.createWindow(name, w, h, miscParams);

            nwp.render.setAutoUpdated(false);
            return(nwp);
        }
Exemple #29
0
        public int DELworkExp(string empid)
        {
            string delQuery = "DELETE FROM workExp WHERE empId='" + empid + "'";

            NameValuePairList nameValuePairObject = new NameValuePairList();

            nameValuePairObject.Add(new NameValuePair("@empId", empid));

            int status = obj.InsertUpdateOrDelete(delQuery, nameValuePairObject);

            return(status);
        }
Exemple #30
0
        public SimCameraManager Init(State state)
        {
            state.CameraManager = this;
            var misc = new NameValuePairList();

            misc["externalWindowHandle"] = state.MainWindow.Handle.ToString();
            RenderWindow = state.Root.CreateRenderWindow("Autumn main RenderWindow", 0, 0, false, misc);

            CreateCamera(state);

            return(this);
        }
					///<summary>
					///构造函数
					///</summary>
					///<param name="driverText">驱动错误文本</param>
					///<param name="databaseText">数据库错误文本</param>
					///<returns></returns>
					public SqlError(string driverText, string databaseText) : base(CreatedWhenConstruct.CWC_NotToCreate)
					{
						NameValuePairList list = new NameValuePairList();
						BasePtr valuedriverText = new BasePtr(driverText);
						list.Add("driverText", valuedriverText.PtrVal);
						BasePtr valuedatabaseText = new BasePtr(databaseText);
						list.Add("databaseText", valuedatabaseText.PtrVal);
						Create("CSqlError", list);
						RegisterCallBack();
						this.needDispose = true;
						GlobalTraceInfoMap.Put(this);
					}
        //early-stage
        #region deleteQuery
        public int DeleteRecord(string deptid)
        {
            string delQuery = "DELETE FROM department WHERE depId='" + deptid + "'";

            NameValuePairList nameValuePairObject = new NameValuePairList();

            nameValuePairObject.Add(new NameValuePair("@depId", deptid));

            int status = obj.InsertUpdateOrDelete(delQuery, nameValuePairObject);

            return(status);
        }
Exemple #33
0
        public void Init()
        {
            // Create root object
             mRoot = new Root();

             // Define Resources
             ConfigFile cf = new ConfigFile();
             cf.Load("resources.cfg", "\t:=", true);
             ConfigFile.SectionIterator seci = cf.GetSectionIterator();
             String secName, typeName, archName;

             while (seci.MoveNext())
             {
            secName = seci.CurrentKey;
            ConfigFile.SettingsMultiMap settings = seci.Current;
            foreach (KeyValuePair<string, string> pair in settings)
            {
               typeName = pair.Key;
               archName = pair.Value;
               ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
            }
             }

             // Setup RenderSystem
             RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
             // or use "OpenGL Rendering Subsystem"
             mRoot.RenderSystem = rs;
             rs.SetConfigOption("Full Screen", "No");
             rs.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

             // Create Render Window
             mRoot.Initialise(false, "Main Ogre Window");
             NameValuePairList misc = new NameValuePairList();
             misc["externalWindowHandle"] = Handle.ToString();
             mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

             // Init resources
             TextureManager.Singleton.DefaultNumMipmaps = 5;
             ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

             // Create a Simple Scene
             SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
             Camera cam = mgr.CreateCamera("Camera");
             cam.AutoAspectRatio = true;
             mWindow.AddViewport(cam);

             Entity ent = mgr.CreateEntity("ninja", "ninja.mesh");
             mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

             cam.Position = new Vector3(0, 200, -400);
             cam.LookAt(ent.BoundingBox.Center);
        }
        public int DepartmentUpdate(string depName, string description, string empLead, string parentDept, string deptId)
        {
            string            updateQuery         = "UPDATE department SET depName='" + depName + "',description='" + description + "',dLeadEmp='" + empLead + "',parentDept='" + parentDept + "' WHERE deptId='" + deptId + "'";
            NameValuePairList nameValuePairObject = new NameValuePairList();

            nameValuePairObject.Add(new NameValuePair("@depName", depName));
            nameValuePairObject.Add(new NameValuePair("@description", description));
            nameValuePairObject.Add(new NameValuePair("@dLeadEmp", empLead));
            nameValuePairObject.Add(new NameValuePair("@parentDept", parentDept));
            int status = obj.InsertUpdateOrDelete(updateQuery, nameValuePairObject);

            return(status);
        }
		protected override Resource _create( string name, ResourceHandle handle, string group, bool isManual, IManualResourceLoader loader, NameValuePairList createParams )
		{
			if ( !createParams.ContainsKey( "type" ) )
			{
				throw new Exception( "You must supply a 'type' parameter." );
			}

			if ( createParams[ "type" ] == "vertex_program" )
			{
				return new D3DVertexProgram( this, name, handle, group, isManual, loader, device );
			}
			else
			{
				return new D3DFragmentProgram( this, name, handle, group, isManual, loader, device );
			}
		}
Exemple #36
0
        public void InitMogre()
        {
            root = new Root();
            #if DEBUG
            root.LoadPlugin("RenderSystem_Direct3D9_d");
            #else
            root.LoadPlugin("RenderSystem_Direct3D9");
            #endif

            bool foundit = false;
            foreach (RenderSystem rs in root.GetAvailableRenderers())
            {
                root.RenderSystem = rs;
                String rname = root.RenderSystem.Name;
                if (rname == "Direct3D9 Rendering Subsystem")
                {
                    foundit = true;
                    break;
                }
            }

            if (!foundit)
                return; //we didn't find it... Raise exception?

            //we found it, we might as well use it!
            root.RenderSystem.SetConfigOption("Full Screen", "No");
            root.RenderSystem.SetConfigOption("Video Mode",
                String.Format("{0} x {1} @ 32-bit colour", windowSize.Width, windowSize.Height));

            root.Initialise(false);

            // other plugins
            #if DEBUG
            root.LoadPlugin("Plugin_CgProgramManager_d");
            root.LoadPlugin("Plugin_OctreeSceneManager_d");

            #else
            root.LoadPlugin("Plugin_CgProgramManager");
            root.LoadPlugin("Plugin_OctreeSceneManager");
            #endif

            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = hWnd.ToString();
            window = root.CreateRenderWindow("Simple Mogre Form Window", 0, 0, false, misc);

            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
            sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

            camera = sceneMgr.CreateCamera("SimpleCamera");
            camera.NearClipDistance = 0.1f;
            camera.AutoAspectRatio = true;

            viewport = window.AddViewport(camera);
            viewport.BackgroundColour = new ColourValue(0.25f, 0.25f, 0.25f, 1.0f);

            root.FrameStarted += new FrameListener.FrameStartedHandler(MogreFrameStarted);
        }
        public void CreateRenderWindow(string handle)
        {
            // var form = new Form1();
            CreateCamera();

            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = handle;
            m_RenderWindow = m_Root.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

            Viewport viewport = m_RenderWindow.AddViewport(m_Camera);
            viewport.BackgroundColour = ColourValue.Black;
            m_Camera.AspectRatio = (double)viewport.ActualWidth / (double)viewport.ActualHeight;
        }
        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            NameValuePairList misc = new NameValuePairList();
            misc["parentWindowHandle"] = hwndParent.Handle.ToString();
            m_RenderWindow = m_Root.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);
            CreateCamera();
            Viewport viewport = m_RenderWindow.AddViewport(m_Camera);
            viewport.BackgroundColour = ColourValue.Black;
            m_Camera.AspectRatio = (double)viewport.ActualWidth / (double)viewport.ActualHeight;

            int windowHandle;
            m_RenderWindow.GetCustomAttribute("WINDOW", out windowHandle);

            return new HandleRef(this, new IntPtr(windowHandle));
        }
 protected virtual void CreateRenderWindow(IntPtr handle)
 {
     this.mRoot.Initialise(false, "Main Ogre Window");
     NameValuePairList miscParams = new NameValuePairList();
     if (handle != IntPtr.Zero)
     {
         miscParams["externalWindowHandle"] = handle.ToString();
         this.mWindow = this.mRoot.CreateRenderWindow("Autumn main RenderWindow", 800, 600, false, miscParams);
     }
     else
     {
         this.mWindow = this.mRoot.CreateRenderWindow("Autumn main RenderWindow", 800, 600, false);
     }
 }
 /// <summary>
 /// Creates the input handler for this class.  If you wish to create your own input handler,
 /// override this function and set it up.
 /// </summary>
 //protected virtual void CreateInputHandler()
 //{
 //    new DefaultInputHandler(this);
 //}
 /// <summary>
 /// Creates the render window for this class.
 /// If you override this function, you must set the RenderWindow property.  Example:
 ///   this.RenderWindow = this.Root.CreateRenderWindow(...);
 /// </summary>
 /// <param name="handle">The window handle to render ogre in.</param>
 protected virtual void CreateRenderWindow(IntPtr handle)
 {
     mRoot.Initialise(false, "Main Ogre Window");
     if (handle != IntPtr.Zero)
     {
         NameValuePairList misc = new NameValuePairList();
         misc["externalWindowHandle"] = handle.ToString();
         // misc["FSAA"] = "4";        // anti aliasing factor (0, 2, 4 ...)
         // misc["vsync"] = "true";    // by Ogre default: false
         //Width = (int)SETTINGS_WIDTH;
         //Height = (int)SETTINGS_HEIGHT;
         mWindow = mRoot.CreateRenderWindow("Autumn main RenderWindow", SETTINGS_WIDTH, SETTINGS_HEIGHT, false, misc);
         this.FormBorderStyle = FormBorderStyle.Sizable;
     }
     else
     {
         mWindow = mRoot.CreateRenderWindow("Autumn main RenderWindow", SETTINGS_WIDTH, SETTINGS_HEIGHT, false);
     }
 }
        public void Init(String handle)
        {
            try
            {
                // Create root object
                mRoot = new Root();

                // Define Resources
                ConfigFile cf = new ConfigFile();
                cf.Load("./resources.cfg", "\t:=", true);
                ConfigFile.SectionIterator seci = cf.GetSectionIterator();
                String secName, typeName, archName;

                while (seci.MoveNext())
                {
                    secName = seci.CurrentKey;
                    ConfigFile.SettingsMultiMap settings = seci.Current;
                    foreach (KeyValuePair<string, string> pair in settings)
                    {
                        typeName = pair.Key;
                        archName = pair.Value;
                        ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                    }
                }

                //Load the resources from resources.cfg and selected tab (_ConfigurationPaths)
                //LoadResourceLocations(_ConfigurationPaths);

                //example of manual add: _FileSystemPaths.Add("../../Media/models");
                foreach (string foo in _ConfigurationPaths)
                {
                    AddResourceLocation(foo);
                }

                // Setup RenderSystem
                mRSys = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                //mRSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem");

                // or use "OpenGL Rendering Subsystem"
                mRoot.RenderSystem = mRSys;

                mRSys.SetConfigOption("Full Screen", "No");
                mRSys.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

                // Create Render Window
                mRoot.Initialise(false, "Main Ogre Window");
                NameValuePairList misc = new NameValuePairList();
                misc["externalWindowHandle"] = handle;
                misc["FSAA"] = "4";
                // misc["VSync"] = "True"; //not sure how to enable vsync to remove those warnings in Ogre.log
                mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

                // Init resources
                MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);
                TextureManager.Singleton.DefaultNumMipmaps = 5;
                ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

                // Create a Simple Scene
                //SceneNode node = null;
                // mMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "SceneManager");
                mMgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE, "SceneManager");

                mMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f);

                mCamera = mMgr.CreateCamera("Camera");
                mWindow.AddViewport(mCamera);

                mCamera.AutoAspectRatio = true;
                mCamera.Viewport.SetClearEveryFrame(false);

                //Entity ent = mMgr.CreateEntity(displayMesh, displayMesh);

                //ent.SetMaterialName(displayMaterial);
                //node = mMgr.RootSceneNode.CreateChildSceneNode(displayMesh + "node");
                //node.AttachObject(ent);

                mCamera.Position = new Vector3(0, 0, 0);
                //mCamera.Position = new Vector3(0, 0, -400);
                mCamera.LookAt(0, 0, 1);

                //Create a single point light source
                Light light2 = mMgr.CreateLight("MainLight");
                light2.Position = new Vector3(0, 10, -25);
                light2.Type = Light.LightTypes.LT_POINT;
                light2.SetDiffuseColour(1.0f, 1.0f, 1.0f);
                light2.SetSpecularColour(0.1f, 0.1f, 0.1f);

                mWindow.WindowMovedOrResized();

                IsInitialized = true;

                // Create the camera's top node (which will only handle position).
                cameraNode = mMgr.RootSceneNode.CreateChildSceneNode();
                cameraNode.Position = new Vector3(0, 0, 0);

                //cameraNode = mMgr->getRootSceneNode()->createChildSceneNode();
                //cameraNode->setPosition(0, 0, 500);

                // Create the camera's yaw node as a child of camera's top node.
                cameraYawNode = cameraNode.CreateChildSceneNode();

                // Create the camera's pitch node as a child of camera's yaw node.
                cameraPitchNode = cameraYawNode.CreateChildSceneNode();

                // Create the camera's roll node as a child of camera's pitch node
                // and attach the camera to it.
                cameraRollNode = cameraPitchNode.CreateChildSceneNode();
                cameraRollNode.AttachObject(mCamera);

                mRaySceneQuery = mMgr.CreateRayQuery(new Ray());
            }
            catch (Exception ex)
            {
                Console.WriteLine("[Error,OgreForm.cs]: " + ex.Message + "," + ex.StackTrace);
            }
        }
Exemple #42
0
        public void InitRenderer()
        {
            try
            {
                OgreRoot = new Root();

                {	//Load config file data
                    ConfigFile cf = new ConfigFile();
                    cf.Load("./resources.cfg", "\t:=", true);
                    ConfigFile.SectionIterator seci = cf.GetSectionIterator();
                    String secName, typeName, archName;

                    while (seci.MoveNext())
                    {
                        secName = seci.CurrentKey;
                        ConfigFile.SettingsMultiMap settings = seci.Current;
                        foreach (KeyValuePair<String, String> pair in settings)
                        {
                            typeName = pair.Key;
                            archName = pair.Value;
                            ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                        }
                    }
                }

                OgreRenderSystem = OgreRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                OgreRenderSystem.SetConfigOption("Full Screen", "No");
                OgreRenderSystem.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

                OgreRoot.RenderSystem = OgreRenderSystem;
                OgreRoot.Initialise(false, "Main Ogre Window");

                NameValuePairList misc = new NameValuePairList();
                misc["externalWindowHandle"] = RenderPanel.Handle.ToString();
                misc["FSAA"] = "4";
                OgreRenderWindow = OgreRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

                OgreRenderWindow.IsActive = true;
                OgreRenderWindow.IsAutoUpdated = true;

                MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC);

                //Trigger background resource load
                StartResourceThread();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error during renderer initialization:" + ex.Message + "," + ex.StackTrace);
            }
        }
Exemple #43
0
        public override void ProcessParameters(NameValuePairList parameters)
        {
            NameValuePairList.Iterator ni;

            if ((ni = parameters.Find("Name")) != parameters.End())
                this.name = ni.Value;

            if ((ni = parameters.Find("Position")) != parameters.End())
                this.position = StringConverter.ParseVector3(ni.Value);

            if ((ni = parameters.Find("Orientation")) != parameters.End())
                this.orientation = StringConverter.ParseQuaternion(ni.Value);

            if ((ni = parameters.Find("Direction")) != parameters.End())
                this.direction = StringConverter.ParseVector3(ni.Value);

            if ((ni = parameters.Find("LightType")) != parameters.End())
                this.lightType = (Light.LightTypes)Enum.Parse(typeof(Light.LightTypes), ni.Value);

            if ((ni = parameters.Find("Diffuse")) != parameters.End())
                this.diffuse = StringConverter.ParseColourValue(ni.Value);

            if ((ni = parameters.Find("Specular")) != parameters.End())
                this.specular = StringConverter.ParseColourValue(ni.Value);

            if ((ni = parameters.Find("LightRange")) != parameters.End())
                this.range = StringConverter.ParseVector3(ni.Value);

            if ((ni = parameters.Find("Attenuation")) != parameters.End())
                this.attenuation = MogreX.StringConverter.ParseVector4(ni.Value);

            if ((ni = parameters.Find("Power")) != parameters.End())
                this.power = StringConverter.ParseReal(ni.Value);

            if ((ni = parameters.Find("CastShadows")) != parameters.End())
                this.castShadows = StringConverter.ParseBool(ni.Value);
        }
Exemple #44
0
 public override void GetObjectProperties(NameValuePairList retList)
 {
     retList.Clear();
     retList["Name"] = Name;
     retList["LightType"] = LightType.ToString();
     retList["Position"] = StringConverter.ToString(Position);
     retList["Direction"] = StringConverter.ToString(Direction);
     retList["Diffuse"] = StringConverter.ToString(Diffuse);
     retList["Specular"] = StringConverter.ToString(Specular);
     retList["LightRange"] = StringConverter.ToString(Range);
     retList["Attenuation"] = StringConverter.ToString(Attenuation);
     retList["CastShadows"] = StringConverter.ToString(CastShadows);
     retList["Power"] = StringConverter.ToString(Power);
 }
		/// <summary>
		/// Create a new resource instance compatible with this manager (no custom
		/// parameters are populated at this point).
		/// </summary>
		/// <param name="name">The unique name of the resource</param>
		/// <param name="handle"></param>
		/// <param name="group">The name of the resource group to attach this new resource to</param>
		/// <param name="isManual">
		///     Is this resource manually loaded? If so, you should really
		///     populate the loader parameter in order that the load process
		///     can call the loader back when loading is required.
		/// </param>
		/// <param name="loader">
		///     A ManualLoader implementation which will be called
		///     when the Resource wishes to load (should be supplied if you set
		///     isManual to true). You can in fact leave this parameter null
		///     if you wish, but the Resource will never be able to reload if
		///     anything ever causes it to unload. Therefore provision of a proper
		///     ManualLoader instance is strongly recommended.
		/// </param>
		/// <param name="createParams">
		///     If any parameters are required to create an instance,
		///     they should be supplied here as name / value pairs. These do not need
		///     to be set on the instance (handled elsewhere), just used if required
		///     to differentiate which concrete class is created.
		/// </param>
		/// <returns></returns>
		protected abstract Resource _create( string name, ResourceHandle handle, string group, bool isManual,
		                                     IManualResourceLoader loader, NameValuePairList createParams );
		public Resource Load( string name, string group, bool isManual, IManualResourceLoader loader, NameValuePairList loadParams )
		{
			return Load( name, group, isManual, loader, loadParams, false );
		}
		/// <summary>
		/// </summary>
		/// <param name="name"> </param>
		/// <param name="handle"> </param>
		/// <param name="group"> </param>
		/// <param name="isManual"> </param>
		/// <param name="loader"> </param>
		/// <param name="createParams"> </param>
		/// <returns> </returns>
		protected override Resource _create( string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, NameValuePairList createParams )
		{
			return new GLESTexture( this, name, handle, group, isManual, loader, this._glSupport );
		}
Exemple #48
0
        private bool Configure()
        {
            RenderSystem renderSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem");
            renderSys.SetConfigOption("Colour Depth", "16");
            renderSys.SetConfigOption("Display Frequency", "40");
            renderSys.SetConfigOption("FSAA", "0");
            renderSys.SetConfigOption("Full Screen", "No");
            renderSys.SetConfigOption("RTT Preferred Mode", "FBO");
            renderSys.SetConfigOption("VSync", "Yes");
            renderSys.SetConfigOption("VSync Interval", "1");
            renderSys.SetConfigOption("Video Mode", WND_SIZE.x + " x " + WND_SIZE.y);
            renderSys.SetConfigOption("sRGB Gamma Conversion", "No");

            this.mRoot.RenderSystem = renderSys;
            this.mRoot.Initialise(false, "SkyLands");
            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = Handle.ToString();
            this.mWindow = this.mRoot.CreateRenderWindow("Main RenderWindow", (uint)WND_SIZE.x, (uint)WND_SIZE.y, false, misc);

            return true;
        }
		public MovableObject CreateInstance( string name, PCZSceneManager manager, NameValuePairList para )
		{
			throw new NotImplementedException();
		}
		protected override Resource _create( string name, ResourceHandle handle, string group, bool isManual,
		                                     IManualResourceLoader loader, NameValuePairList createParams )
		{
			if ( createParams == null || !createParams.ContainsKey( "language" ) )
			{
				throw new Exception( "You must supply a 'language' parameter" );
			}
			return GetFactory( createParams[ "language" ] ).CreateInstance( this, name, handle, group, isManual, loader );
		}
        private bool Configure() {
            /*
            RenderSystem renderSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem");
            renderSys.SetConfigOption("Colour Depth", "16");
            renderSys.SetConfigOption("Display Frequency", "40");
            renderSys.SetConfigOption("FSAA", "0");
            renderSys.SetConfigOption("Full Screen", "No");
            renderSys.SetConfigOption("RTT Preferred Mode", "FBO");
            renderSys.SetConfigOption("VSync", "Yes");
            renderSys.SetConfigOption("VSync Interval", "1");
            renderSys.SetConfigOption("Video Mode", WND_SIZE.x + " x " + WND_SIZE.y);
            renderSys.SetConfigOption("sRGB Gamma Conversion", "No");

            this.mRoot.RenderSystem = renderSys;
            this.mRoot.Initialise(false, "SkyLands");
            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = Handle.ToString();
            this.mWindow = this.mRoot.CreateRenderWindow("Main RenderWindow", (uint)WND_SIZE.x, (uint)WND_SIZE.y, false, misc);

            return true;
            */
            bool foundit = false;
            foreach (RenderSystem rs in mRoot.GetAvailableRenderers()) {
                mRoot.RenderSystem = rs;
                String rname = mRoot.RenderSystem.Name;
                if (rname == "Direct3D9 Rendering Subsystem") {//"OpenGL Rendering Subsystem"
                    foundit = true;
                    break;
                }
            }

            if (!foundit)
                return false; //we didn't find it... Raise exception?

            //we found it, we might as well use it!
            mRoot.RenderSystem.SetConfigOption("Full Screen", "No");
            mRoot.RenderSystem.SetConfigOption("Video Mode", "640 x 480 @ 32-bit colour");

            mRoot.Initialise(false);
            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = hWnd.ToString();
            mWindow = mRoot.CreateRenderWindow("Simple Mogre Form Window", 0, 0, false, misc);
            return true;
        }
Exemple #52
0
		/// <summary>
		/// Automatically restores position and orientation for free-look cameras.
		/// </summary>
		/// <param name="state"></param>
		public override void RestoreState( NameValuePairList state )
		{
			if ( state.ContainsKey( "CameraPosition" ) && state.ContainsKey( "CameraOrientation" ) )
			{
				this.CameraManager.setStyle( CameraStyle.FreeLook );
				this.Camera.Position = StringConverter.ParseVector3( state[ "CameraPosition" ] );
				this.Camera.Orientation = StringConverter.ParseQuaternion( state[ "CameraOrientation" ] );
			}
		}
		protected override Resource _create( string name, ulong handle, string group, bool isManual,
		                                     IManualResourceLoader loader, NameValuePairList createParams )
		{
			throw new NotImplementedException( "Base class needs update to 1.7.2790" );
		}
		/// <param name="group"></param>
		/// <param name="createParams">If any parameters are required to create an instance, they should be supplied here as name / value pairs</param>
		/// <param name="name"></param>
		public Resource Create( string name, string group, NameValuePairList createParams )
		{
			return Create( name, group, false, null, createParams );
		}
Exemple #55
0
		/// <summary>
		/// Automatically saves position and orientation for free-look cameras.
		/// </summary>
		/// <param name="state"></param>
		public override void SaveState( NameValuePairList state )
		{
			if ( this.CameraManager.getStyle() == CameraStyle.FreeLook )
			{
				state[ "CameraPosition" ] = this.Camera.Position.ToString();
				state[ "CameraOrientation" ] = this.Camera.Orientation.ToString();
			}
		}
		/// <param name="group"></param>
		/// <param name="isManual">
		/// Is this resource manually loaded? If so, you should really
		/// populate the loader parameter in order that the load process
		/// can call the loader back when loading is required.
		/// </param>
		/// <param name="loader">
		/// Pointer to a ManualLoader implementation which will be called
		/// when the Resource wishes to load (should be supplied if you set
		/// isManual to true). You can in fact leave this parameter null
		/// if you wish, but the Resource will never be able to reload if
		/// anything ever causes it to unload. Therefore provision of a proper
		/// ManualLoader instance is strongly recommended.
		/// </param>
		/// <param name="createParams">If any parameters are required to create an instance, they should be supplied here as name / value pairs</param>
		/// <param name="name"></param>
		public virtual Resource Create( string name, string group, bool isManual, IManualResourceLoader loader,
		                                NameValuePairList createParams )
		{
			// Call creation implementation
			var ret = _create( name, (ResourceHandle)name.ToLower().GetHashCode(), group, isManual, loader, createParams );
			if ( createParams != null )
			{
				ret.SetParameters( createParams );
			}

			_add( ret );

			// Tell resource group manager
			ResourceGroupManager.Instance.notifyResourceCreated( ret );

			return ret;
		}
Exemple #57
0
        public void InitMogre()
        {
            //-----------------------------------------------------
            // 1 enter ogre
            //-----------------------------------------------------
            root = new Root();

            //-----------------------------------------------------
            // 2 configure resource paths
            //-----------------------------------------------------
            ConfigFile cf = new ConfigFile();
            cf.Load("resources.cfg", "\t:=", true);

            // Go through all sections & settings in the file
            ConfigFile.SectionIterator seci = cf.GetSectionIterator();

            String secName, typeName, archName;

            // Normally we would use the foreach syntax, which enumerates the values, but in this case we need CurrentKey too;
            while (seci.MoveNext()) {
                secName = seci.CurrentKey;
                ConfigFile.SettingsMultiMap settings = seci.Current;
                foreach (KeyValuePair<string, string> pair in settings) {
                    typeName = pair.Key;
                    archName = pair.Value;
                    ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
                }
            }

            //-----------------------------------------------------
            // 3 Configures the application and creates the window
            //-----------------------------------------------------
            bool foundit = false;
            foreach (RenderSystem rs in root.GetAvailableRenderers()) {
                root.RenderSystem = rs;
                String rname = root.RenderSystem.Name;
                if (rname == "Direct3D9 Rendering Subsystem") {
                    foundit = true;
                    break;
                }
            }

            if (!foundit)
                return; //we didn't find it... Raise exception?

            //we found it, we might as well use it!
            root.RenderSystem.SetConfigOption("Full Screen", "No");
            root.RenderSystem.SetConfigOption("Video Mode", "640 x 480 @ 32-bit colour");

            root.Initialise(false);
            NameValuePairList misc = new NameValuePairList();
            misc["externalWindowHandle"] = hWnd.ToString();
            window = root.CreateRenderWindow("Simple Mogre Form Window", 0, 0, false, misc);
            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            //-----------------------------------------------------
            // 4 Create the SceneManager
            //
            //		ST_GENERIC = octree
            //		ST_EXTERIOR_CLOSE = simple terrain
            //		ST_EXTERIOR_FAR = nature terrain (depreciated)
            //		ST_EXTERIOR_REAL_FAR = paging landscape
            //		ST_INTERIOR = Quake3 BSP
            //-----------------------------------------------------
            sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "SceneMgr");
            sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

            //-----------------------------------------------------
            // 5 Create the camera
            //-----------------------------------------------------
            camera = sceneMgr.CreateCamera("SimpleCamera");
            camera.Position = new Vector3(0f, 0f, 100f);
            // Look back along -Z
            camera.LookAt(new Vector3(0f, 0f, -300f));
            camera.NearClipDistance = 5;

            viewport = window.AddViewport(camera);
            viewport.BackgroundColour = new ColourValue(0.0f, 0.0f, 0.0f, 1.0f);

            Entity ent = sceneMgr.CreateEntity("ogre", "ogrehead.mesh");
            SceneNode node = sceneMgr.RootSceneNode.CreateChildSceneNode("ogreNode");
            node.AttachObject(ent);
        }
		public Axiom.Math.Tuple<Resource, bool> CreateOrRetrieve( string name, string group, bool isManual,
		                                                          IManualResourceLoader loader, NameValuePairList paramaters )
		{
			var hashCode = (ResourceHandle)name.ToLower().GetHashCode();

			var res = this[ hashCode ];
			var created = false;

			if ( res == null )
			{
				res = _create( name, hashCode, group, isManual, loader, paramaters );
				if ( paramaters != null )
				{
					res.SetParameters( paramaters );
				}

				_add( res );

				// Tell resource group manager
				ResourceGroupManager.Instance.notifyResourceCreated( res );

				created = true;
			}

			return new Axiom.Math.Tuple<Resource, bool>( res, created );
		}
		public void LoadWorldGeometry()
		{
			this.bspGeometry = new BspGeometry();

			if ( !optionList.ContainsKey( "Map" ) )
			{
				throw new AxiomException( "Unable to load world geometry. \"Map\" filename option is not set." );
			}

			if ( Path.GetExtension( ( (string)optionList[ "Map" ] ).ToLower() ) != ".bsp" )
			{
				throw new AxiomException( "Unable to load world geometry. Invalid extension of map filename option (must be .bsp)." );
			}

			if ( !optionList.ContainsKey( "SetYAxisUp" ) )
			{
				optionList[ "SetYAxisUp" ] = false;
			}

			if ( !optionList.ContainsKey( "Scale" ) )
			{
				optionList[ "Scale" ] = 1f;
			}

			if ( !optionList.ContainsKey( "Move" ) )
			{
				optionList[ "Move" ] = Vector3.Zero;
				optionList[ "MoveX" ] = 0;
				optionList[ "MoveY" ] = 0;
				optionList[ "MoveZ" ] = 0;
			}

			if ( !optionList.ContainsKey( "UseLightmaps" ) )
			{
				optionList[ "UseLightmaps" ] = true;
			}

			if ( !optionList.ContainsKey( "AmbientEnabled" ) )
			{
				optionList[ "AmbientEnabled" ] = false;
			}

			if ( !optionList.ContainsKey( "AmbientRatio" ) )
			{
				optionList[ "AmbientRatio" ] = 1f;
			}

			InitTextureLighting();

			if ( this.spotlightFrustum == null )
			{
				this.spotlightFrustum = new SpotlightFrustum();
			}

			var paramList = new NameValuePairList();

			foreach ( DictionaryEntry option in optionList )
			{
				paramList.Add( option.Key.ToString(), option.Value.ToString() );
			}

			// Load using resource manager
			this.level =
				(BspLevel)
				BspResourceManager.Instance.Load( (string)optionList[ "Map" ], ResourceGroupManager.Instance.WorldResourceGroupName,
				                                  false, null, paramList );

			// Init static render operation
			this.renderOp.vertexData = this.level.VertexData;

			// index data is per-frame
			this.renderOp.indexData = new IndexData();
			this.renderOp.indexData.indexStart = 0;
			this.renderOp.indexData.indexCount = 0;

			// Create enough index space to render whole level
			this.renderOp.indexData.indexBuffer = HardwareBufferManager.Instance.CreateIndexBuffer( IndexType.Size32,
			                                                                                        this.level.NumIndexes,
			                                                                                        BufferUsage.Dynamic, false );
			this.renderOp.operationType = OperationType.TriangleList;
			this.renderOp.useIndices = true;
		}
		public virtual Resource Load( string name, string group, bool isManual, IManualResourceLoader loader, NameValuePairList loadParams, bool backgroundThread )
		{
			var r = CreateOrRetrieve( name, group, isManual, loader, loadParams ).First;
			// ensure loaded
			r.Load( backgroundThread );
			return r;
		}