Exemplo n.º 1
0
        protected override void CreateScene()
        {
            // set up queue event handlers to run the query
            scene.QueueStarted += new RenderQueueEvent(scene_QueueStarted);
            scene.QueueEnded   += new RenderQueueEvent(scene_QueueEnded);

            scene.AmbientLight = new ColorEx(1.0f, 0.5f, 0.5f, 0.5f);

            // create a default point light
            Light light = scene.CreateLight("MainLight");

            light.Position = new Vector3(20, 80, 50);

            // create a cube (defaults to Main render queue)
            Entity cube = scene.CreateEntity("Cube", "cube.mesh");

            // create an ogre head, assigning it to a later queue group than the cube
            // (to fake front-to-back sorting for this example)
            Entity ogreHead = scene.CreateEntity("Head", "ogrehead.mesh");

            ogreHead.RenderQueueGroup = RenderQueueGroupID.Six;

            // attach the ogre to the scene
            SceneNode node = scene.RootSceneNode.CreateChildSceneNode();

            node.AttachObject(ogreHead);

            // attach a cube to the scene
            node = scene.RootSceneNode.CreateChildSceneNode(new Vector3(0, 0, 100));
            node.AttachObject(cube);

            // create an occlusion query via the render system
            query          = Root.Instance.RenderSystem.CreateHardwareOcclusionQuery();
            query.SkipRate = 1;
        }
        protected override void CreateScene()
        {
            // set up queue event handlers to run the query
            scene.QueueStarted += new RenderQueueEvent(scene_QueueStarted);
            scene.QueueEnded += new RenderQueueEvent(scene_QueueEnded);

            scene.AmbientLight = new ColorEx(1.0f, 0.5f, 0.5f, 0.5f);

            // create a default point light
            Light light = scene.CreateLight("MainLight");
            light.Position = new Vector3(20, 80, 50);

            // create a cube (defaults to Main render queue)
            Entity cube = scene.CreateEntity("Cube", "cube.mesh");

            // create an ogre head, assigning it to a later queue group than the cube
            // (to fake front-to-back sorting for this example)
            Entity ogreHead = scene.CreateEntity("Head", "ogrehead.mesh");
            ogreHead.RenderQueueGroup = RenderQueueGroupID.Six;

            // attach the ogre to the scene
            SceneNode node = scene.RootSceneNode.CreateChildSceneNode();
            node.AttachObject(ogreHead);

            // attach a cube to the scene
            node = scene.RootSceneNode.CreateChildSceneNode(new Vector3(0, 0, 100));
            node.AttachObject(cube);

            // create an occlusion query via the render system
            query = Root.Instance.RenderSystem.CreateHardwareOcclusionQuery();
            query.SkipRate = 1;
        }