コード例 #1
0
        public void onEnter()
        {
            this.cameraPosition = new Vector3(0f, 0f, 10f);
            this.screenQuadView = Matrix4.CreateTranslation(new Vector3(0, 0, 0));
            //Game.assets.shader("blur");
            this.textureShader = Game.assets.shader("texture");
            this.fboShader     = Game.assets.shader("invert");

            this.fbo      = new FrameBuffer(true);
            this.camera2D = new Camera2D();
            this.camera2D.setToOrtho(true);

            Vector3 cam2dPos = new Vector3(70, 0, -1);

            camera2D.transform(ref cam2dPos);
            //this.camera2D.translate(ref cameraPosition);
            camera2D.update();

            Camera tmpCam = this.camera2D;

            this.screenQuad = MeshBuilder.screenQuad(ref tmpCam, 0);

            this.camera = new PerspecitveCamera();
            this.camera.translate(ref cameraPosition);

            Vector3 target = new Vector3(0f, 0f, 0f);

            this.camera.lookAt(ref target);
            this.mesh      = MeshBuilder.generateTextureQuad();
            this.modelView = Matrix4.CreateTranslation(quadPosition);

            this.texture = Game.assets.texture("uvmap.png");

            camera.update();
        }
コード例 #2
0
        public void onEnter()
        {
            this.camera = new PerspecitveCamera(MathHelper.PiOver4, Game.shared.width, Game.shared.height);
            this.shader = Game.assets.shader("test");
            VertexAttributes attrs = new VertexAttributes(VertexAttribute.Position(), VertexAttribute.Color());

            this.rawMesh     = new VertexBufferObject(true, 3, 7, attrs);
            this.rawIndicies = new IndexBufferObject(true);

            float[] data = new float[] {
                -0.8f, -0.8f, 0f, 1f, 0f, 0f, 1.0f,
                0.8f, -0.8f, 0f, 0f, 1f, 0f, 1.0f,
                0f, 0.8f, 0f, 0f, 0f, 1f, 1.0f,
                0.8f, 0.8f, 0f, 1f, 0f, 1f, 1.0f
            };

            uint[] indicies = new uint[] {
                0, 1, 2,
                1, 2, 3
            };

            this.rawIndicies.setIndicies(ref indicies);
            this.rawMesh.setVerticies(ref data);

            this.mviewdata = Matrix4.Translation(0f, 0f, 0f);
            Vector3 cameraPosition = new Vector3(5f, 5f, 5f);

            this.camera.translate(ref cameraPosition);

            Vector3 target = new Vector3(0f, 0f, 0f);

            this.camera.lookAt(ref target);
        }
コード例 #3
0
ファイル: MeshTest.cs プロジェクト: macbury/SpaceSharp
        public void onEnter()
        {
            this.shader         = Game.assets.shader("test");
            this.camera         = new PerspecitveCamera();
            this.cameraPosition = new Vector3(0f, 5f, -20f);
            this.camera.translate(ref cameraPosition);

            Vector3 target = new Vector3(0f, 0f, 0f);

            this.camera.lookAt(ref target);

            float[] vertData = new float[] {
                -1f, -1f, -1f, 0.0f, 1.0f, 1.0f, 1.0f,
                1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
                1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
                -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
                -1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f,
                1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
                1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
                -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f
            };

            uint[] indicedata = new uint[] {
                //front
                0, 7, 3,
                0, 4, 7,
                //back
                1, 2, 6,
                6, 5, 1,
                //left
                0, 2, 1,
                0, 3, 2,
                //right
                4, 5, 6,
                6, 7, 4,
                //top
                2, 3, 6,
                6, 3, 7,
                //bottom
                0, 1, 5,
                0, 5, 4
            };

            VertexAttributes attrs = new VertexAttributes(VertexAttribute.Position(), VertexAttribute.Color());

            this.mesh = new Mesh(true, 8, 7, attrs);

            this.mesh.setVerticies(ref vertData);
            this.mesh.setIndicies(ref indicedata);

            this.posVector      = Vector3.Zero;
            this.mviewdata      = Matrix4.CreateTranslation(Vector3.Zero);
            this.rotationMatrix = Matrix4.CreateRotationX(0f);
            this.finalMatrix    = new Matrix4();
        }
コード例 #4
0
ファイル: TextureTest.cs プロジェクト: macbury/SpaceSharp
        public void onEnter()
        {
            this.shader = Game.assets.shader("texture");

            this.texture = Game.assets.texture("uvmap.png");

            this.camera         = new PerspecitveCamera();
            this.cameraPosition = new Vector3(0f, 0f, 10f);
            this.camera.translate(ref cameraPosition);

            Vector3 target = new Vector3(0f, 0f, 0f);

            this.camera.lookAt(ref target);
            this.mesh      = MeshBuilder.generateTextureQuad();
            this.modelView = Matrix4.CreateTranslation(quadPosition);

            camera.update();
            Game.logger.info("Camera matrix", camera.ToString());
        }