示例#1
0
        void SceneCreating(OgreWindow win)
        {
            win.SceneManager.SetWorldGeometry("terrain.cfg");

            //win.SceneManager.SetSkyBox(true, "Examples/SpaceSkyBox");
            //win.SceneManager.SetSkyBox(true, "Examples/SpaceSkyBox", 10);
            //win.SceneManager.SetSkyBox(true, "Examples/SpaceSkyBox", 5000, false);
            //win.SceneManager.SetSkyBox(true, "Examples/SpaceSkyBox", 100, true);

            //win.SceneManager.SetSkyDome(true, "Examples/CloudySky", 5, 8);
            //win.SceneManager.SetSkyDome(false, "");

            Plane plane;

            plane.d      = 1000;
            plane.normal = Vector3.NEGATIVE_UNIT_Y;

            //win.SceneManager.SetSkyPlane(true, plane, "Examples/SpaceSkyPlane", 1500, 75);
            //win.SceneManager.SetSkyPlane(true, plane, "Examples/SpaceSkyPlane", 1500, 50, true, 1.5f, 150, 150);
            //win.SceneManager.SetSkyPlane(true, plane, "Examples/CloudySky", 1500, 40, true, 1.5f, 150, 150);
            //win.SceneManager.SetSkyPlane(false, new Plane(), "");

            //ColourValue fadeColour = new ColourValue(0.9f, 0.9f, 0.9f);
            //win.Viewport.BackgroundColour = fadeColour;

            //win.SceneManager.SetFog(FogMode.FOG_LINEAR, fadeColour, 0, 50, 500);
            //win.SceneManager.SetFog(FogMode.FOG_EXP, fadeColour, 0.005f);
            //win.SceneManager.SetFog(FogMode.FOG_EXP, fadeColour, 0.003f);
        }
示例#2
0
 public override void sceneHook(OgreWindow win)
 {
     this.win         = win;
     ent1             = win.mSceneMgr.CreateEntity("zeliard", "zeliard.mesh");
     ent1.CastShadows = true;
     sn1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn1.AttachObject(ent1);
     sn1.Position -= new Mogre.Vector3(3f, 6f, 14f);
 }
示例#3
0
        public OgreForm()
        {
            InitializeComponent();
              //this.Size = new Size(800, 600);
              this.Disposed += new EventHandler(OgreForm_Disposed);
              //this.Resize += new EventHandler(OgreForm_Resize);

              window = new OgreWindow(new Point(100, 30), renderWindow.Handle);
              window.init();
        }
示例#4
0
        void SceneCreating(OgreWindow win)
        {
            // Set the ambient light and shadow technique
            SceneManager mgr = win.SceneManager;

            mgr.SetShadowUseInfiniteFarPlane(false);
            mgr.AmbientLight    = ColourValue.Black;
            mgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_ADDITIVE;

            // Create a ninja
            Entity ent = mgr.CreateEntity("ninja", "ninja.mesh");

            ent.CastShadows = true;
            mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

            // Define a ground plane
            Plane plane = new Plane(Vector3.UNIT_Y, 0);

            MeshManager.Singleton.CreatePlane("ground", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                              plane, 1500, 1500, 20, 20, true, 1, 5, 5, Vector3.UNIT_Z);

            // Create a ground plane
            ent = mgr.CreateEntity("GroundEntity", "ground");
            mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

            ent.SetMaterialName("Examples/Rockwall");
            ent.CastShadows = false;


            // Create the first light
            Light light;

            light                = mgr.CreateLight("Light1");
            light.Type           = Light.LightTypes.LT_POINT;
            light.Position       = new Vector3(0, 150, 250);
            light.DiffuseColour  = ColourValue.Red;
            light.SpecularColour = ColourValue.Red;

            // Create the second light
            light                = mgr.CreateLight("Light2");
            light.Type           = Light.LightTypes.LT_DIRECTIONAL;
            light.DiffuseColour  = new ColourValue(.25f, .25f, 0);
            light.SpecularColour = new ColourValue(.25f, .25f, 0);
            light.Direction      = new Vector3(0, -1, -1);

            // Create the third light
            light                = mgr.CreateLight("Light3");
            light.Type           = Light.LightTypes.LT_SPOTLIGHT;
            light.DiffuseColour  = ColourValue.Blue;
            light.SpecularColour = ColourValue.Blue;
            light.Direction      = new Vector3(-1, -1, 0);
            light.Position       = new Vector3(300, 300, 0);
            light.SetSpotlightRange(new Degree(35), new Degree(50));
        }
示例#5
0
 public override void sceneHook(OgreWindow win)
 {
     this.win = win;
     //// Create a slot machine barrel
     //ent_zelbox = win.mSceneMgr.CreateEntity("zelbox_" + collisionPrevention, "zeliard.mesh");
     //ent_zelbox.CastShadows = true;
     //sn_zelbox = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     //sn_zelbox.AttachObject(ent_zelbox);
     //sn_zelbox.Position -= new Mogre.Vector3(4f, 4f, 12f);
     //sn_zelbox.Rotate(new Quaternion(.28f, 0f, -.95f, .16f));
 }
示例#6
0
        void SceneCreating(OgreWindow win)
        {
            mWindow = win;

            Export.CreateGUI();
            Export.SetRenderWindow(win.RenderWindow);
            Export.SetSceneManager(win.SceneManager);
            Export.SetActiveViewport(0);

            PointerManager.Instance.Visible = false;

            MyGUI.Managed.Button button = Gui.Instance.CreateWidget <MyGUI.Managed.Button>("Button", new IntCoord(10, 10, 100, 24), Align.Default, "Main");
            button.Caption = "Quit";
            button.EventMouseButtonClick += button_EventMouseButtonClick;
        }
示例#7
0
        public Form1(string[] args)
        {
            InitializeComponent();
            this.Width = 800;
            this.Height = 600;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.FormClosed +=new FormClosedEventHandler(Form1_FormClosed);
            if (args.Length > 0)
            {
                this.Text = args[0] + "管理窗体";
            }

            mogreWin = new OgreWindow(pictureBox1.Handle);
            mogreWin.InitMogre();
        }
        public SingleViewCloneWindow(NativeOSWindow parentWindow, WindowInfo windowInfo, SceneViewController controller, CameraMover cameraMover, String name, BackgroundScene background, int zIndexStart, bool floatOnParent)
            : base(controller, cameraMover, name, background, zIndexStart)
        {
            IntVector2 location = SystemInfo.getDisplayLocation(windowInfo.MonitorIndex);

            location.y          = -1;
            osWindow            = new NativeOSWindow(parentWindow, "Clone Window", location, new IntSize2(windowInfo.Width, windowInfo.Height), floatOnParent);
            this.rendererWindow = (OgreWindow)OgreInterface.Instance.createRendererWindow(new WindowInfo(osWindow, "CloneWindow"));
            this.createBackground(rendererWindow.OgreRenderTarget, true);
            this.RendererWindow = rendererWindow;
            osWindow.show();
            osWindow.Closed += osWindow_Closed;

            transparencyStateName           = controller.ActiveWindow.CurrentTransparencyState;
            controller.ActiveWindowChanged += controller_ActiveWindowChanged;
        }
示例#9
0
        void SceneCreating(OgreWindow win)
        {
            win.SceneManager.AmbientLight = new ColourValue(0.25f, 0.25f, 0.25f);

            Entity ent = win.SceneManager.CreateEntity("Ninja", "ninja.mesh");

            win.SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

            Light light = win.SceneManager.CreateLight("Light");

            light.Type           = Light.LightTypes.LT_POINT;
            light.Position       = new Vector3(250, 150, 250);
            light.DiffuseColour  = ColourValue.White;
            light.SpecularColour = ColourValue.White;

            win.Camera.Position = new Vector3(0, 200, 400);
            win.Camera.LookAt(ent.BoundingBox.Center);
        }
示例#10
0
 public override void setWindow(OgreWindow win)
 {
     this.win = win;
     //// Create a slot machine barrel
     entity_myentity             = win.mSceneMgr.CreateEntity("cylinder123", "cylinder.mesh");
     entity_myentity.CastShadows = true;
     sn_barrel1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel1.AttachObject(entity_myentity);
     sn_barrel1.Position -= new Mogre.Vector3(8f, 6f, 14f);
     sn_barrel1.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     //// Create a slot machine barrel
     entity_myentity2             = win.mSceneMgr.CreateEntity("cylinder2", "cylinder.mesh");
     entity_myentity2.CastShadows = true;
     sn_barrel2 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel2.AttachObject(entity_myentity2);
     sn_barrel2.Position -= new Mogre.Vector3(7.42f, 6f, 14f);
     sn_barrel2.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     //// Create a slot machine barrel
     entity_myentity3             = win.mSceneMgr.CreateEntity("cylinder3", "cylinder.mesh");
     entity_myentity3.CastShadows = true;
     sn_barrel3 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel3.AttachObject(entity_myentity3);
     sn_barrel3.Position -= new Mogre.Vector3(6.84f, 6f, 14f);
     sn_barrel3.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     //// Create a slot machine barrel
     entity_myentity4             = win.mSceneMgr.CreateEntity("cylinder4", "cylinder.mesh");
     entity_myentity4.CastShadows = true;
     sn_barrel4 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel4.AttachObject(entity_myentity4);
     sn_barrel4.Position -= new Mogre.Vector3(6.26f, 6f, 14f);
     sn_barrel4.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     ent1             = win.mSceneMgr.CreateEntity("border", "border.mesh");
     ent1.CastShadows = true;
     sn1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn1.AttachObject(ent1);
     sn1.Position -= new Mogre.Vector3(8.14f, 6f, 14f);
     //ent1 = win.mSceneMgr.CreateEntity("zeliard", "zeliard.mesh");
     //ent1.CastShadows = true;
     //sn1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     //sn1.AttachObject(ent1);
     //sn1.Position -= new Mogre.Vector3(3f, 6f, 14f);
 }
示例#11
0
 static void Main()
 {
     try
     {
         OgreWindow win = new OgreWindow();
         new SceneCreator(win);
         win.Go();
     }
     catch (System.Runtime.InteropServices.SEHException)
     {
         if (OgreException.IsThrown)
         {
             MessageBox.Show(OgreException.LastException.FullDescription, "An Ogre exception has occurred!");
         }
         else
         {
             throw;
         }
     }
 }
示例#12
0
        public void link(PluginManager pluginManager)
        {
            Root.getSingleton().addArchiveFactory(rocketFilesystemArchiveFactory);

            if (FileInterface == null)
            {
                FileInterface = new VirtualFileSystemFileInterface();
            }

            resources = pluginManager.createLiveResourceManager("Rocket");
            var rendererResources = resources.getSubsystemResource("Ogre");

            CommonResourceGroup = rendererResources.addResourceGroup("Common");
            CommonResourceGroup.addResource("__RmlViewerFilesystem__", RocketFilesystemArchive.ArchiveName, false);
            CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true);
            var shaders = rendererResources.addResourceGroup("Shaders");

            shaders.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", false);
            var shared = rendererResources.addResourceGroup("Shared");

            shared.addResource("__LibRocketCommonResourcesFilesystem__", CommonResourcesArchiveFactory.Name, false);
            resources.initializeResources();

            Root.getSingleton().Disposed += OgreRoot_Disposed;

            OgreWindow ogreWindow = pluginManager.RendererPlugin.PrimaryWindow as OgreWindow;

            systemInterface = new ManagedSystemInterface();
            renderInterface = new RenderInterfaceOgre3D((int)ogreWindow.OgreRenderTarget.getWidth(), (int)ogreWindow.OgreRenderTarget.getHeight());
            renderInterface.PixelsPerInch = pixelsPerInch;
            renderInterface.PixelScale    = ScaleHelper.ScaleFactor;

            renderSystemListener = new RocketRenderSystemListener();
            Root.getSingleton().getRenderSystem().addListener(renderSystemListener);

            Core.SetSystemInterface(systemInterface);
            Core.SetRenderInterface(renderInterface);

            Core.Initialise();
            Controls.Initialise();
        }
示例#13
0
        protected void HandleInput()
        {
            //base.HandleInput(evt);

            // Show/Hide information

            OgreWindow win = OgreWindow.Instance;

            if (OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_F1))
            {
                showInformation = !showInformation;
            }

            if (OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_1) && !(OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_LSHIFT) || OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_RSHIFT)))
            {
                skyManager.TimeMultiplier = 1.0f;
            }
            if (OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_1) && (OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_LSHIFT) || OgreWindow.g_kb.IsKeyDown(MOIS.KeyCode.KC_RSHIFT)))
            {
                skyManager.TimeMultiplier = -1.0f;
            }
        }
示例#14
0
        void SceneCreating(OgreWindow win)
        {
            // Setting the ambient light
            SceneManager mgr = win.SceneManager;

            mgr.AmbientLight = new ColourValue(1, 1, 1);

            // Adding Objects
            Entity    ent  = mgr.CreateEntity("Robot", "robot.mesh");
            SceneNode node = mgr.RootSceneNode.CreateChildSceneNode("RobotNode");

            node.AttachObject(ent);

            Entity    ent2  = mgr.CreateEntity("Robot2", "robot.mesh");
            SceneNode node2 = mgr.RootSceneNode.CreateChildSceneNode("RobotNode2", new Vector3(50, 0, 0));

            node2.AttachObject(ent2);

            // Translating Objects
            node2.Position += new Vector3(10, 0, 10);
            node.Position  += new Vector3(25, 0, 0);

            // Scaling Objects
            node.Scale(.5f, 1, 2);
            node2.Scale(1, 2, 1);

            // Rotating Objects
            Entity    ent3  = mgr.CreateEntity("Robot3", "robot.mesh");
            SceneNode node3 = mgr.RootSceneNode.CreateChildSceneNode("RobotNode3", new Vector3(100, 0, 0));

            node3.AttachObject(ent3);

            node.Pitch(new Degree(90));
            node2.Yaw(new Degree(90));
            node3.Roll(new Degree(90));
        }
示例#15
0
 public SceneCreator(OgreWindow win)
 {
     win.SceneCreating += new OgreWindow.SceneEventHandler(SceneCreating);
     win.Disposed      += new EventHandler(win_Disposed);
 }
示例#16
0
 public SceneCreator(OgreWindow win)
 {
     win.SceneCreating += new OgreWindow.SceneEventHandler(SceneCreating);
 }
示例#17
0
 public override void sceneHook(OgreWindow win)
 {
     this.win = win;
 }
示例#18
0
        public void link(PluginManager pluginManager)
        {
            Log.Info("Initializing MyGUI");

            resources = pluginManager.createLiveResourceManager("MyGUI");
            var rendererResources = resources.getSubsystemResource("Ogre");

            CommonResourceGroup = rendererResources.addResourceGroup("Common");
            CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true);
            resources.initializeResources();

            sceneManager = Root.getSingleton().createSceneManager(SceneType.ST_GENERIC, "MyGUIScene");
            ogreWindow   = pluginManager.RendererPlugin.PrimaryWindow as OgreWindow;

            //Create camera and viewport
            camera = sceneManager.createCamera("MyGUICamera");
            vp     = ogreWindow.OgreRenderTarget.addViewport(camera, ViewportZIndex, 0.0f, 0.0f, 1.0f, 1.0f);
            vp.setBackgroundColor(new Color(1.0f, 0.0f, 1.0f, 0.0f));
            vp.setClearEveryFrame(false);
            vp.clear();

            //Create Ogre Platform
            ogrePlatform = new OgrePlatform();
            ogrePlatform.initialize(vp.getActualWidth(), vp.getActualHeight(), CommonResourceGroup.FullName, LogFile);

            //Create log
            managedLogListener = new ManagedMyGUILogListener();

            renderListener = new MyGUIRenderListener(vp, sceneManager, ogrePlatform.RenderManager);
            if (ogreWindow.OSWindow != null)
            {
                ogreWindow.OSWindow.Resized += OSWindow_Resized;
            }

            gui             = new Gui();
            gui.ScaleFactor = ScaleHelper.ScaleFactor;
            gui.initialize("");

            //Load config files
            if (BeforeMainResourcesLoaded != null)
            {
                BeforeMainResourcesLoaded.Invoke(this);
            }

            ResourceManager resourceManager = ResourceManager.Instance;

            if (!String.IsNullOrEmpty(OSTheme))
            {
                resourceManager.load(OSTheme);
            }
            resourceManager.load(MainTheme);
            resourceManager.load(PointerFile);
            resourceManager.load(LayerFile);
            resourceManager.load(MessageBoxTheme);

            var platformProvider = pluginManager.GlobalScope.ServiceProvider.GetRequiredService <OgrePlatformProvider>();

            platformProvider.OgrePlatform = ogrePlatform;

            Log.Info("Finished initializing MyGUI");
        }
示例#19
0
 public abstract void sceneHook(OgreWindow mainwindow);