Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            scene = new Scene("Scene");
            LevelManager.activeScene = scene;

            GL.Enable(EnableCap.DepthTest);

            isCursorVisible = CursorVisible = false;
            VSync           = VSyncMode.On;

            Camera.main = new Camera(Width / Height);

            imguiRenderer = new ImGuiRenderer("Assets/Shaders/imgui.glsl", Width, Height);

            GameObject lightGO = new GameObject("Light Source");
            var        light   = new LightSource("Light", lightGO);

            lightGO.AddComponent(light);

            GameObject cubeGO = new GameObject("Cube");
            var        cube   = new Cube("Assets/container.jpg", cubeGO);

            cube.Parent.getMatrix4X4() *= Matrix4x4.CreateScale(10, 0.1f, 10);
            cube.Parent.getMatrix4X4() *= Matrix4x4.CreateTranslation(0, -1f, 0);
            cubeGO.AddComponent(cube);

            var modelGO = new GameObject("Model");

            /* modelGO.AddComponent(new Model("Assets/Mesh/Nanosuit/", "nanosuit.obj", modelGO));
             * modelGO.GetComponent<Model>().Parent.getMatrix4X4() *= Matrix4x4.CreateTranslation(0, -1.75f, 0);
             * modelGO.GetComponent<Model>().Parent.getMatrix4X4() *= Matrix4x4.CreateScale(.2f, .2f, .2f);
             * modelGO.GetComponent<Model>().isRotating = true;*/

            modelGO.AddComponent(new Model("Assets/Mesh/Sponza/", "sponza.obj", modelGO));

            scene.Add(modelGO);
            scene.Add(cubeGO);

            scene.Add(lightGO);

            imguiInput = new ImGuiInput();

            MouseDown  += (sender, args) => MasterInput.MouseEvent(args);
            MouseUp    += (sender, args) => MasterInput.MouseEvent(args);
            MouseMove  += (sender, args) => MasterInput.MouseEvent(args);
            MouseWheel += (sender, args) => MasterInput.MouseEvent(args);

            presentationSource = AudioMaster.LoadSourceAndSound("Assets/Sound/bounce.wav");
            presentationSource.SetPosition(Vector3.Zero);

            //RunSimulation();

            base.OnLoad(e);
        }
Esempio n. 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            GL.Enable(EnableCap.DepthTest);

            CursorVisible = false;
            VSync         = VSyncMode.On;

            Camera.main = new Camera(Width / Height);

            AudioMaster.Init();

            imguiRenderer = new ImGuiRenderer("Assets/Shaders/imgui.glsl", Width, Height);
            scene         = new Scene("Scene");

            imguiInput = new ImGuiInput();

            MasterInput.Init();
            MouseDown += (sender, args) => MasterInput.MouseEvent(args);
            MouseUp   += (sender, args) => MasterInput.MouseEvent(args);
            MouseMove += (sender, args) => MasterInput.MouseEvent(args);
        }