public override void Load()
        {
            var sound = World.SoundController.Load2DSoundFromFile("Assets/Sounds/ElevatorMusic.ogg", true);

            _soundChannel = World.SoundController.PlaySound(sound);
            InputRegistry.BindKey(Keys.Escape, (_, _) => DestroyWindow(), InputType.OnPressed);
        }
 public override void Load()
 {
     InputRegistry.BindKey(Keys.Escape, (_, _) => DestroyWindow(), InputType.OnPressed);
     _mesh = new StaticTexturedMesh("Assets/Textures/container.png", is2d: true, genMipmaps: false);
     _mesh.AddSquare(
         new TextureVertex(-1, -1, 0, 0, 0),
         new TextureVertex(1, -1, 0, 1, 0),
         new TextureVertex(-1, 1, 0, 0, 1),
         new TextureVertex(1, 1, 0, 1, 1));
     _mesh.BakeMesh();
 }
        public override void Load()
        {
            InputRegistry.BindKey(Keys.Escape, (_, _) => DestroyWindow(), InputType.OnPressed);
            Camera.Position = new Vector3(0, -10, 10);
            const string tex = "Assets/Textures/container.png";

            World.AddCube(40.0f, false, new Vector3(0, -40, 0), tex);
            World.AddCube(2.0f, true, new Vector3(0, 0, 0), tex);
            World.AddCube(1.5f, true, new Vector3(0, 5, 1f), tex);
            World.AddCube(2.5f, true, new Vector3(0, 10, 0), tex);
            World.AddCube(2.0f, true, new Vector3(0, 15, 0), tex);
            InputRegistry.BindKey(Keys.E, (_, _) => World.AddCube(3.0f, true, Camera.Position, tex), InputType.OnPressed);
        }
示例#4
0
        public override void Load()
        {
            InputRegistry.BindKey(Keys.Escape, (_, _) => DestroyWindow(), InputType.OnPressed);
            Camera.Position = new Vector3(0, 0, 5);
            var mesh1 = new StaticTexturedMesh("Assets/Textures/container.png");

            mesh1.LoadObj("Assets/Models/demo.obj");
            mesh1.BakeMesh();
            var mesh2 = new StaticTexturedMesh("Assets/Textures/container.png");

            mesh2.LoadObj("Assets/Models/deformedcube.obj");
            mesh2.BakeMesh();
            World.AddMesh(mesh1, new Vector3(0, 0, 0));
            World.AddMesh(mesh2, new Vector3(0, 3, 0));
            World.AddMesh(mesh2, new Vector3(0, -3, 0));
            World.AddMesh(mesh2, new Vector3(3, 0, 0));
            World.AddMesh(mesh2, new Vector3(-3, 0, 0));
        }
 public override void Load()
 {
     _vertexBufferId = GL.GenBuffer();
     GL.BindBuffer(BufferTarget.ArrayBuffer, _vertexBufferId);
     GL.BufferData(BufferTarget.ArrayBuffer, _vertices.Length * sizeof(float), _vertices, BufferUsageHint.StaticDraw);
     _vertexArrayId = GL.GenVertexArray();
     GL.BindVertexArray(_vertexArrayId);
     _elementBufferId = GL.GenBuffer();
     GL.BindBuffer(BufferTarget.ElementArrayBuffer, _elementBufferId);
     GL.BufferData(BufferTarget.ElementArrayBuffer, _indices.Length * sizeof(uint), _indices, BufferUsageHint.StaticDraw);
     _triangleShader = new UnlitShader("Assets/Shaders/democolor.vert", "Assets/Shaders/democolor.frag");
     _triangleShader.Use();
     GL.VertexAttribPointer(_triangleShader.GetAttribLocation("position"), 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
     GL.EnableVertexAttribArray(_triangleShader.GetAttribLocation("position"));
     GL.VertexAttribPointer(_triangleShader.GetAttribLocation("color"), 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 3 * sizeof(float));
     GL.EnableVertexAttribArray(_triangleShader.GetAttribLocation("color"));
     InputRegistry.BindKey(Keys.Escape, (_, _) => DestroyWindow(), InputType.OnPressed);
 }
示例#6
0
 public override void Load()
 {
     _mesh = StaticTexturedMesh.GetCubeMesh(1f, "Assets/Textures/container.png");
     InputRegistry.BindKey(Keys.Escape, (_, _) => DestroyWindow(), InputType.OnPressed);
 }