Exemple #1
0
        public void Render(DeviceContext device, DXScene scene)
        {
            Shader.RenderFirstPass(device);

            foreach(var model in Models)
            {
                model.Render(device);
            }

            for(int i = 1; i < Shader.Passes.Count; ++i)
            {
                Shader.RenderPass(device, i);

                foreach(var model in Models)
                {
                    model.Render(device);
                }
            }
        }
Exemple #2
0
        void InitDX()
        {
            IsRendering = false;
            base.Show();

            // Create camera
            Camera = new CamDX.DXCamera();
            Camera.FarBound = 2000.0f;
            Camera.NearBound = 1.0f;
            Camera.Position = new SharpDX.Vector3(0.0f, 000.0f, 300.0f);
            Camera.LookAt = new SharpDX.Vector3(0.0f, 0.0f, 0.0f);
            Camera.UpDir = SharpDX.Vector3.Up;

            // Create renderer for window
            _renderer = new DXRenderer(WinHanldle, new Size2(800, 600));
            var device = _renderer.DxDevice;

            // Load resources
            XmlDocument resDoc = new XmlDocument();
            resDoc.Load("resources.xml");
            XmlNode dxResourcesNode = resDoc.SelectSingleNode("//DXResources");
            ResourcesManager = new DXResourceManager(device, dxResourcesNode);

            // Create scene
            Scene = new CamDX.DXScene(_renderer.DxDevice);
            Scene.GlobalLights = new GlobalLightsData()
            {
                Ambient = new Color4(1.0f)
            };
            _renderer.CurrentScene = Scene;
            Scene.CurrentCamera = Camera;

            base.Hide();
        }