Exemplo n.º 1
0
        protected override void CreateScene()
        {
            ((Overlay)OverlayManager.Instance.getByName("Gangsta/Demo/Target")).show();

            Light l = mSceneManager.CreateLight("Light");

            l.Position = new Math3D.Vector3(400, 500, 300);
            l.SetSpecularColour(1.0f, 1.0f, 1.0f);
            l.SetCastShadows(true);

            mSceneManager.SetShadowTechnique(ShadowTechnique.ShadowTypeStencilModulative);
            mSceneManager.SetShadowColour(Converter.GetColor(0.5f, 0.5f, 0.5f));
            mSceneManager.SetAmbientLight(Converter.GetColor(0.5f, 0.5f, 0.5f));
            mSceneManager.SetSkyBox(true, "Gangsta/Skybox/Io");

            Plane plane = new Plane();

            plane.Normal.x = 0.0f;
            plane.Normal.y = 1.0f;
            plane.Normal.z = 0.0f;
            plane.D        = 0.0f;
            MeshPtr m = MeshManager.GetSingleton().CreatePlane("Plane_mesh", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                                               plane, 400.0f, 400.0f, 10, 10, true,
                                                               1, 16.0f, 16.0f, Vector3.NegativeUnitZ);
            Entity e = mSceneManager.CreateEntity("Plane_entity", "Plane_mesh");

            e.SetCastShadows(false);
            e.SetMaterialName("Gangsta/Ground/Dust");
            m.SetNull();
            m = null;

            SceneNode n = mSceneManager.GetRootSceneNode().CreateChildSceneNode("Plane_node");

            n.AttachObject(e);
        }
Exemplo n.º 2
0
        protected override void CreateScene()
        {
            mLog = LogManager.Singleton.createLog("DemoCompositor.log", false, true);
            mLog.LogMessage(string.Format("DemoCompositor log {0}", System.DateTime.Now));
            this.DebugOverlayVisible = false;

            mSceneManager.SetShadowTechnique(ShadowTechnique.ShadowTypeTextureModulative);
            mSceneManager.SetShadowFarDistance(1000.0f);

            // setup GUI system
            mGuiRenderer = new OgreCEGUIRenderer(mRenderWindow,
                                                 (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY,
                                                 false, 3000, mSceneManager);
            mGuiRenderer.Initialise();                  //tell the CeguiNet proxy class the IntPtr to the CPP object

            // load scheme and set up defaults
            mGuiSystem = new GuiSystem(mGuiRenderer, (CeguiDotNet.ScriptModule)null,
                                       (CeguiDotNet.ResourceProvider)null, "CompositorDemoCegui.config");

            mGuiSystem.SetDefaultMouseCursor("TaharezLook", "MouseArrow");

            OgreDotNet.MovableObject.setDefaultVisibilityFlags(0x00000001);



            // Set ambient light
            mSceneManager.SetAmbientLight(Converter.GetColor(0.3f, 0.3f, 0.2f));

            Light   l   = mSceneManager.CreateLight("Light2");
            Vector3 dir = new Vector3(-1.0f, -1.0f, 0.0f);

            dir.Normalize();
            l.Type      = Light.LightTypes.Directional;
            l.Direction = dir;
            l.SetDiffuseColour(1.0f, 1.0f, 0.8f);
            l.SetSpecularColour(1.0f, 1.0f, 1.0f);


            Entity pEnt;

            // House
            pEnt = mSceneManager.CreateEntity("1", "tudorhouse.mesh");
            SceneNode n1 = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(350.0f, 450.0f, -200.0f));

            n1.AttachObject(pEnt);

            pEnt = mSceneManager.CreateEntity("2", "tudorhouse.mesh");
            SceneNode n2 = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(-350.0f, 450.0f, -200.0f));

            n2.AttachObject(pEnt);

            pEnt    = mSceneManager.CreateEntity("3", "knot.mesh");
            mSpinny = mSceneManager.GetRootSceneNode().CreateChildSceneNode(new Vector3(0.0f, 0.0f, 300.0f));
            mSpinny.AttachObject(pEnt);
            pEnt.SetMaterialName("Examples/MorningCubeMap");

            mSceneManager.SetSkyBox(true, "Examples/MorningSkyBox");


            Plane plane = new Plane();

            plane.Normal = OgreVector3.FromVector3(Math3D.Vector3.UnitY);
            plane.D      = 100.0f;
            MeshPtr m = MeshManager.Instance.CreatePlane("Myplane",
                                                         ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, plane,
                                                         1500.0f, 1500.0f, 10, 10, true, 1, 5.0f, 5.0f, Vector3.UnitZ);
            Entity pPlaneEnt = mSceneManager.CreateEntity("plane", "Myplane");

            pPlaneEnt.SetMaterialName("Examples/Rockwall");
            pPlaneEnt.SetCastShadows(false);
            mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(pPlaneEnt);
            m.SetNull();
            m = null;

            mCamera.SetPosition(-400.0f, 50.0f, 900.0f);
            mCamera.LookAt = new Vector3(0.0f, 80.0f, 0.0f);

            connectMainEventHandlers();

            /// Create a couple of hard coded postfilter effects as an example of how to do it
            /// but the preferred method is to use compositor scripts.
            createEffects();
        }