void updateMatrices()
        {
            camera.AspectRatio = (float)swapChain.Width / swapChain.Height;

            matrices.projection = camera.Projection;
            matrices.view       = camera.View;
            matrices.model      = camera.Model;
            uboMats.Update(matrices, (uint)Marshal.SizeOf <Matrices> ());
            matrices.view *= Matrix4x4.CreateTranslation(-matrices.view.Translation);
            matrices.model = Matrix4x4.Identity;
            uboMats.Update(matrices, (uint)Marshal.SizeOf <Matrices> (), (uint)Marshal.SizeOf <Matrices> ());
        }
Beispiel #2
0
        void updateMatrices()
        {
            camera.AspectRatio = (float)swapChain.Width / swapChain.Height;

            matrices.projection = camera.Projection;
            matrices.view       = camera.View;
            matrices.model      = camera.Model;
            uboMats.Update(matrices, (uint)Marshal.SizeOf <Matrices> ());
        }
Beispiel #3
0
        protected override void onMouseButtonDown(MouseButton button)
        {
            int xPad = (int)swapChain.Width / 2 - (int)imgDim * (int)zoom / 2;
            int yPad = (int)swapChain.Height / 2 - (int)imgDim * (int)zoom / 2;

            int localX = (int)((lastMouseX - xPad) / zoom);
            int localY = (int)((lastMouseY - yPad) / zoom);

            if (localX < 0 || localY < 0 || localX >= imgDim || localY >= imgDim)
            {
                base.onMouseButtonDown(button);
            }
            else
            {
                addSeed((uint)localX, (uint)localY);
                stagingDataBuff.Update(datas);
            }
        }
Beispiel #4
0
        void updateMatrices()
        {
            matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView(Utils.DegreesToRadians(60f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 5.0f);
            matrices.view       =
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitZ, rotZ) *
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitY, rotY) *
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitX, rotX);

            uboMats.Update(matrices, (uint)Marshal.SizeOf <Matrices> ());
        }
Beispiel #5
0
        //view update override, see base method for more informations.
        public override void UpdateView()
        {
            mvp =
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitY, rotY) *
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitX, rotX) *
                Matrix4x4.CreateTranslation(0, 0, -3f * zoom) *
                Utils.CreatePerspectiveFieldOfView(Utils.DegreesToRadians(45f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f);

            uboMats.Update(mvp, (uint)Marshal.SizeOf <Matrix4x4> ());
            base.UpdateView();
        }
Beispiel #6
0
        public override void UpdateView()
        {
            matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView(Utils.DegreesToRadians(60f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f);
            matrices.view       = Matrix4x4.CreateTranslation(0, 0, -2.5f * zoom);
            matrices.model      =
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitZ, rotZ) *
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitY, rotY) *
                Matrix4x4.CreateFromAxisAngle(Vector3.UnitX, rotX);

            uboMats.Update(matrices, (uint)Marshal.SizeOf <Matrices> ());

            updateViewRequested = false;
        }
Beispiel #7
0
        public static void UpdateBuff(uint instIdx, ref VkChess.InstanceData data)
        {
            if (instanceBuff == null)
            {
                return;
            }
            instanceBuff.Update(instIdx, data);

            if (flushEnd == 0)
            {
                flushStart = instIdx;
                flushEnd   = instIdx + 1;
            }
            else if (instIdx < flushStart)
            {
                flushStart = instIdx;
            }
            else if (flushEnd <= instIdx)
            {
                flushEnd = instIdx + 1;
            }
        }
Beispiel #8
0
        bool pong;         //ping-pong between buffers

        void addPoint(uint x, uint y)
        {
            points[pointCount] = new Vector2(x, y);
            pointCount++;
            staggingVBO.Update(points, pointCount * (ulong)Marshal.SizeOf <Vector2> ());
        }