예제 #1
0
 /// <summary>
 /// performs a rotscale centered around the specified point in the source image and scaled by the provided x/y factors. angle is in radians.
 /// </summary>
 public void RotScale(Image src, int x, int y, float angle, float xscale, float yscale, float xc, float yc)
 {
     MatrixStack ms = new MatrixStack();
     ms.Translate(-xc, -yc, 0);
     ms.Scale(xscale, yscale, 1);
     ms.RotateAxis(vectorRotZ, angle);
     ms.Translate(_window.X + x, _window.Y + y, 0);
     grs.transform = ms.Top;
     Blit(src, 0, 0);
     updateTransform();
 }
예제 #2
0
 /// <summary>
 /// sets the current world transform
 /// </summary>
 public void World(MatrixStack ms)
 {
     Matrices.world = ms.Top;
 }
예제 #3
0
        protected override void render(FunkImage dest)
        {
            g.begin3d();
            g.setDestAndDepthBuffer(dest);
            g.clearDest();
            g.setRenderMode(GraphicsHW.RenderMode.Texture);
            //??
            g.device.Transform.View = Microsoft.DirectX.Matrix.LookAtLH(new Microsoft.DirectX.Vector3(0, 0, -50), new Microsoft.DirectX.Vector3(0, 0, 0), new Microsoft.DirectX.Vector3(0, 1, 0));
            g.device.Transform.Projection = dx.Matrix.PerspectiveFovLH(1.04719755f, 1.33333f, 1, 1000);
            //??
            //g.device.Transform.World = dx.Matrix.Scaling(1, 1, 1);
            g.device.Transform.World = dx.Matrix.Identity;
            //g.device.Transform.World = dx.Matrix.Scaling(20, 20, 20);
            g.device.RenderState.AlphaBlendEnable = false;
            g.device.RenderState.CullMode = Microsoft.DirectX.Direct3D.Cull.CounterClockwise;
            g.device.RenderState.ZBufferEnable = true;
            g.device.RenderState.Lighting = false;
            g.setLinearFiltering();

            MatrixStack ms = new MatrixStack(g.device.Transform.World);
            ms.Scale(1, 1, -1);
            ms.RotateX(Lib.rads(45));
            ms.Translate(0, -10, 0);
            ms.Scale(1.2f);
            if(facing == Directions.w) ms.RotateAxisLocal(0, 0, 1, Lib.rads(90));
            else if(facing == Directions.s) ms.RotateAxisLocal(0, 0, 1, Lib.rads(180));
            else if(facing == Directions.e) ms.RotateAxisLocal(0, 0, 1, Lib.rads(270));
            g.device.Transform.World = ms.Top;

            g.setRenderColor(1, Color.SpringGreen);
            g.setRenderMode(GraphicsHW.RenderMode.Color);
            //g.renderLine(0, 0, 0, 0, 0, 20);
            //g.renderLine(-4, 0, 0, 4, 0, 0);
            //g.renderLine(0, 4, 0, 0, -4, 0);
            g.setRenderMode(GraphicsHW.RenderMode.Texture);
            model.Render();
        }
예제 #4
0
 public void MultiplyMatrixLocal(MatrixStack ms)
 {
     MultiplyMatrixLocal(ms.Top); IsDirty = true;
 }