Beispiel #1
0
        // Just override the mandatory create scene method
        public override void CreateScene()
        {
            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

            // Create a point light
            Light l = sceneMgr.CreateLight("MainLight");

            // Accept default settings: point light, white diffuse, just set position
            // NB I could attach the light to a SceneNode if I wanted it to move automatically with
            //  other objects, but I don't
            l.Position = new Vector3(20, 80, 50);

            createScalingPlane();
            createScrollingKnot();
            createWateryPlane();

            // Set up a material for the skydome
            MaterialPtr skyMat = MaterialManager.Singleton.Create("SkyMat",
                                                                  ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);

            // Perform no dynamic lighting on the sky
            skyMat.SetLightingEnabled(false);
            // Use a cloudy sky
            TextureUnitState t = skyMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("clouds.jpg");

            // Scroll the clouds
            t.SetScrollAnimation(0.15f, 0f);

            // System will automatically set no depth write

            // Create a skydome
            sceneMgr.SetSkyDome(true, "SkyMat", -5, 2);
        }
Beispiel #2
0
        public static SceneNode DrawLine(SceneManager mSceneMgr, Vector3 start, Vector3 end)
        {
            ManualObject line     = mSceneMgr.CreateManualObject("line" + numLines);
            SceneNode    lineNode = mSceneMgr.RootSceneNode.CreateChildSceneNode("line" + numLines + "_node");

            MaterialPtr lineMaterial = MaterialManager.Singleton.Create("line" + numLines + "_material", "Default");

            lineMaterial.ReceiveShadows = false;
            lineMaterial.SetLightingEnabled(true);
            lineMaterial.SetDiffuse(LineColour.r, LineColour.g, LineColour.b, 0);
            lineMaterial.SetAmbient(LineColour.r, LineColour.g, LineColour.b);
            lineMaterial.SetSelfIllumination(LineColour.r, LineColour.g, LineColour.b);

            line.Begin("line" + numLines + "_material", RenderOperation.OperationTypes.OT_LINE_LIST);
            line.Position(start);
            line.Position(end);
            line.End();

            lineNode.AttachObject(line);
            ++numLines;
            return(lineNode);
        }
Beispiel #3
0
        private void _ogre_OnInitialised(object sender, RoutedEventArgs e)
        {
            var sceneMgr = _ogreImage.SceneManager;

            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

            // Create a point light
            Light l = sceneMgr.CreateLight("MainLight");

            // Accept default settings: point light, white diffuse, just set position
            // NB I could attach the light to a SceneNode if I wanted it to move automatically with
            //  other objects, but I don't
            l.Position = new Vector3(20, 80, 50);


            // Set up a material for the skydome
            MaterialPtr skyMat = MaterialManager.Singleton.Create("SkyMat",
                                                                  ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);

            // Perform no dynamic lighting on the sky
            skyMat.SetLightingEnabled(false);
            // Use a cloudy sky
            TextureUnitState t = skyMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("clouds.jpg");

            // Scroll the clouds
            t.SetScrollAnimation(0.15f, 0f);

            // System will automatically set no depth write

            // Create a skydome
            sceneMgr.SetSkyDome(true, "SkyMat", -5, 2);
            //当窗口改变大小时。会重表创建渲染窗口,这时,场景管理器中的所有结点会被销毁,所以这需重新创建。
            EsdSceneManager.Singleton.MainNode     = sceneMgr.RootSceneNode.CreateChildSceneNode("ogreNode");
            EsdSceneManager.Singleton.AddmodelNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
            EsdSceneManager.Singleton.WRnode       = sceneMgr.RootSceneNode.CreateChildSceneNode("wrnode");
            inittool();
        }