/// <summary> /// Creates a new instance of the SceneState class. /// </summary> public SceneState(string identifier, string title, Camera.Camera camera, Instance instance, RenderState state, SceneType type) { this.identifier = identifier; this.title = title; this.camera = camera; this.instance = instance; RenderState = state; sceneType = type; }
/// <summary> /// Initializes the device. /// </summary> public static void Initialize(Control renderTarget, Pool.Pool pool) { tagPool = pool; if (d3dInitialized) { MdxRender.Device.Dispose(); } RenderCore.renderTarget = renderTarget; int adapter = Manager.Adapters.Default.Adapter; caps = Manager.GetDeviceCaps(adapter, DeviceType); pp.PresentationInterval = PresentInterval.Default; pp.Windowed = true;// !MdxRender.FullScreen; pp.SwapEffect = SwapEffect.Discard; pp.EnableAutoDepthStencil = true; pp.AutoDepthStencilFormat = GetDepthFormat(adapter); //pp.MultiSample = GetMultiSampleType(adapter); //pp.MultiSampleQuality = 0; CreateFlags flags; flags = CreateFlags.SoftwareVertexProcessing; if (caps.DeviceCaps.SupportsHardwareTransformAndLight) { flags = CreateFlags.HardwareVertexProcessing; } // Disable built in events. Device.IsUsingEventHandlers = false; MdxRender.Device = new Device(adapter, DeviceType, renderTarget, flags, pp); SetupDevice(); //MdxRender.Device.DeviceResizing += new System.ComponentModel.CancelEventHandler(device_DeviceResizing); //MdxRender.Device.DeviceReset += new EventHandler(device_DeviceReset); camera = new Camera.Camera(); MdxRender.FrameTimer = new FPSCounter(50); SelectTool.InitializeHandleModel(); Billboard.LoadResources(0.5f, 0.5f); fontFPS = new DXFont(MdxRender.Device, new Font("Arial", 12, FontStyle.Bold)); DebugFont = new Microsoft.DirectX.Direct3D.Font(MdxRender.Device, new Font("Arial", 12, FontStyle.Bold)); console = new DebugConsole.DebugConsole(MdxRender.Device); d3dInitialized = true; }
/// <summary> /// Adds a scene to the list available to be rendered. /// </summary> public static void AddScene(string identifier, string name, Camera.Camera camera, Instance instance, RenderState state, SceneType type) { for (int i = 0; i < scenes.Count; i++) { if (scenes[i].Identifier == identifier) { ActiveSceneName = identifier; return; } } SceneState newScene = new SceneState(identifier, name, camera, instance, state, type); scenes.Add(newScene); if (SceneAdded != null) { SceneAdded(newScene); } }
/// <summary> /// Creates a new instance of the SceneState class. /// </summary> public SceneState(string identifier, Camera.Camera camera, Instance instance, RenderState state, SceneType type) : this(identifier, identifier, camera, instance, state, type) { }