// Reset public void Reset() { Offset = new Vector2(); Scale = new Vector2( 1.0f ); Rotation = new Vector3(); TransformMatrix = Matrix.Identity; }
public override void Draw(GameTime gameTime) { Matrix worldMatrix = Matrix.Identity; switch (Resources.Instance.GameSize) { case Resources.LevelSize.SMALL: worldMatrix = Matrix.Identity * Matrix.CreateScale(85); break; case Resources.LevelSize.MEDIUM: worldMatrix = Matrix.Identity * Matrix.CreateScale(100); break; case Resources.LevelSize.LARGE: worldMatrix = Matrix.Identity * Matrix.CreateScale(115); break; } Matrix[] transforms = new Matrix[_model.Bones.Count]; _model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in _model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.Projection = MathConverter.Convert(_manager.Camera.ProjectionMatrix); effect.View = MathConverter.Convert(_manager.Camera.ViewMatrix); effect.World = worldMatrix; } mesh.Draw(); } base.Draw(gameTime); }
public Planet(string name, Vector3d position, IModule module, Effect testEffect, float radius, Color sea, Color land, Color mountains) { nodesBeingBuilt = new Dictionary <Vector3, PatchMinMax>(); neighbourTracker = new NeighbourTracker(); this.Name = name; planetId = ++planetIdList; this.module = module; this.testEffect = testEffect; this.radius = radius; Position = new HighPrecisionPosition(); AddComponent(Position); Transform.SetHighPrecisionPosition(position); splitDistance = radius * 4; customProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, SystemCore.GraphicsDevice.Viewport.AspectRatio, 1f, this.radius * 10); SeaColor = sea; LandColor = land; MountainColor = mountains; Initialise(); }
private void InitializeXNA() { _device = SharedGraphicsDeviceManager.Current.GraphicsDevice; // Set the sharing mode of the graphics device to turn on XNA rendering _device.SetSharingMode(true); // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(_device); BackgroundRenderer = new UIElementRenderer(this, _device.Viewport.Width, _device.Viewport.Height); // Create a timer for this page _gameTimer = new GameTimer(); _gameTimer.UpdateInterval = TimeSpan.FromTicks(333333); _gameTimer.Update += new EventHandler <GameTimerEventArgs>(_gameTimer_Update); _gameTimer.Draw += new EventHandler <GameTimerEventArgs>(_gameTimer_Draw); _cameraMatrix = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward, Vector3.Up); _projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, (float)(this.LayoutRoot.ActualWidth / this.LayoutRoot.ActualHeight), 0.01f, 10000.0f); foreach (LocationsVM.Location l in myVM.SelectedNearbyLocations) { l.Object3dEffect = new BasicEffect(_device); l.Object3dEffect.World = l.WorldMatrix; l.Object3dEffect.View = _cameraMatrix; l.Object3dEffect.Projection = _projectionMatrix; l.Object3dEffect.TextureEnabled = true; } _gameTimer.Start(); }
private void UpdateViewMatrix(PageOrientation orientation) { if (orientation == LandscapeLeft) { view = Microsoft.Xna.Framework.Matrix.CreateLookAt( new Microsoft.Xna.Framework.Vector3(0, 0, 1), Microsoft.Xna.Framework.Vector3.Zero, Microsoft.Xna.Framework.Vector3.Right); } else if (orientation == LandscapeRight) { view = Microsoft.Xna.Framework.Matrix.CreateLookAt( new Microsoft.Xna.Framework.Vector3(0, 0, 1), Microsoft.Xna.Framework.Vector3.Zero, Microsoft.Xna.Framework.Vector3.Left); } else //if (orientation == PageOrientation.PortraitUp) { view = Microsoft.Xna.Framework.Matrix.CreateLookAt( new Microsoft.Xna.Framework.Vector3(0, 0, 1), Microsoft.Xna.Framework.Vector3.Zero, Microsoft.Xna.Framework.Vector3.Up); } //Camera projection relies on the view matrix - invalidate camera projection _cameraProjection = null; InvalidateArrange(); }
public override void StartFrame(ref Microsoft.Xna.Framework.Matrix view, ref Microsoft.Xna.Framework.Matrix projection, Microsoft.Xna.Framework.BoundingFrustum frustrum) { rend = 0; MaterialSortedObjects.Clear(); Vector3[] corners = new Vector3[8]; frustrum.GetCorners(corners); List <I2DPhysicObject> objs = world.PhysicWorld.TestAABB(new Vector2(corners[0].X, corners[0].Y), new Vector2(corners[2].X, corners[2].Y)); foreach (var item in objs) { I2DObject obj = item.Owner; if (!MaterialSortedObjects.ContainsKey(obj.Material.GetType())) { MaterialSortedObjects[obj.Material.GetType()] = new List <I2DObject>(); } MaterialSortedObjects[obj.Material.GetType()].Add(obj); rend++; } foreach (var obj in ghosts) { if (!MaterialSortedObjects.ContainsKey(obj.Material.GetType())) { MaterialSortedObjects[obj.Material.GetType()] = new List <I2DObject>(); } MaterialSortedObjects[obj.Material.GetType()].Add(obj); } rend += ghosts.Count; }
protected override void Draw(Matrix worldTransform, Color overlayColor, float overlayColorWeight, bool tryCull) { BoundingBox[,] transformedBoundingBoxes = new BoundingBox[mBoundingBoxes.GetLength(0), mBoundingBoxes.GetLength(1)]; for (int row = 0; row < mBoundingBoxes.GetLength(0); ++row) { for (int col = 0; col < mBoundingBoxes.GetLength(1); ++col) { transformedBoundingBoxes[row, col] = new BoundingBox(Vector3.Transform(mBoundingBoxes[row, col].Min, worldTransform), Vector3.Transform(mBoundingBoxes[row, col].Max, worldTransform)); } } TerrainRenderer.TerrainParameters parameters = new TerrainRenderer.TerrainParameters(); parameters.BoundingBoxes = transformedBoundingBoxes; parameters.DrawCursor = DrawCursor; parameters.CursorPosition = CursorPosition; parameters.CursorInnerRadius = CursorInnerRadius; parameters.CursorOuterRadius = CursorOuterRadius; parameters.Name = Name; parameters.OverlayColor = overlayColor; parameters.OverlayWeight = overlayColorWeight; parameters.TextureMask = LayerMask; parameters.TryCull = tryCull; parameters.World = worldTransform; GraphicsManager.EnqueueRenderable(parameters, RendererType); }
/// <summary> /// Renders the bounding box for debugging purposes. /// </summary> /// <param name="box">The box to render.</param> /// <param name="graphicsDevice">The graphics device to use when rendering.</param> /// <param name="view">The current view matrix.</param> /// <param name="projection">The current projection matrix.</param> /// <param name="color">The color to use drawing the lines of the box.</param> public static void Render( BoundingBox box, GraphicsDevice graphicsDevice, Matrix view, Matrix projection, Color color) { if (box.Min == box.Max) { return; } if (effect == null) { effect = new BasicEffect(graphicsDevice) {TextureEnabled = false, VertexColorEnabled = true, LightingEnabled = false}; } Vector3[] corners = box.GetCorners(); for (int i = 0; i < 8; i++) { verts[i].Position = corners[i]; verts[i].Color = color; } effect.View = view; effect.Projection = projection; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); graphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.LineList, verts, 0, 8, indices, 0, indices.Length/2); } }
/// <summary> /// Handy dandy game method for implementating screen shake /// </summary> /// <param name="Transform"></param> /// <returns></returns> public override Microsoft.Xna.Framework.Matrix ModifyTransformMatrix(Microsoft.Xna.Framework.Matrix Transform) { if (!Main.gameMenu) { if (!Main.gamePaused) { shakeTick++; if (shakeIntensity >= 0 && shakeTick >= 4) { shakeIntensity--; } if (shakeIntensity > 10) { shakeIntensity = 10; //cap it } if (shakeIntensity < 0) { shakeIntensity = 0; } return(Transform * Microsoft.Xna.Framework.Matrix.CreateTranslation( Main.rand.Next((int)(shakeIntensity * -0.5f), (int)(shakeIntensity * 0.5f + 1)), Main.rand.Next((int)(shakeIntensity * -0.5f), (int)(shakeIntensity * 0.5f + 1)), 0f)); } } else { shakeIntensity = 0; shakeTick = 0; } return(Transform); }
public static Matrix Convert(Microsoft.Xna.Framework.Matrix matrix) { Matrix toReturn; Convert(ref matrix, out toReturn); return(toReturn); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(MXF.GameTime gameTime) { ICameraManagerService cameraManagerService = (ICameraManagerService)this.Services.GetService(typeof(ICameraManagerService)); graphics.GraphicsDevice.Clear(MXF.Color.CornflowerBlue); // Copy any parent transforms. MXF.Matrix[] transforms = new MXF.Matrix[castle.Bones.Count]; castle.CopyAbsoluteBoneTransformsTo(transforms); //// Draw the model. A model can have multiple meshes, so loop. foreach (XFG.ModelMesh mesh in castle.Meshes) { // This is where the mesh orientation is set, as well as our camera and projection. foreach (XFG.BasicEffect effect in mesh.Effects) { effect.World = MXF.Matrix.CreateRotationY(this.modelRotation) * MXF.Matrix.CreateTranslation(this.modelPosition); effect.View = cameraManagerService.Camera.View; effect.Projection = cameraManagerService.Camera.Projection; effect.EnableDefaultLighting(); } // Draw the mesh, using the effects set above. mesh.Draw(); } base.Draw(gameTime); }
public override void Render(XNA.Matrix ViewMatrix, XNA.Matrix ProjectionMatrix) { base.Render(ViewMatrix, ProjectionMatrix); Gl.DrawElements(PrimitiveType.Triangles, 6, DrawElementsType.UnsignedInt, IntPtr.Zero); Gl.BindVertexArray(0); }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> public override void Draw(GameTime gameTime) { Game.GraphicsDevice.RenderState.DepthBufferWriteEnable = true; Game.GraphicsDevice.RenderState.DepthBufferEnable = true; Game.GraphicsDevice.RenderState.AlphaBlendEnable = false; Game.GraphicsDevice.RenderState.AlphaTestEnable = false; var transforms = new Matrix[_cube.Bones.Count]; _cube.CopyAbsoluteBoneTransformsTo(transforms); const int cols = 10, rows = 10; for (int z = -rows/2; z < rows/2; z++) for (int x = -cols/2; x < cols/2; x++) { foreach (ModelMesh mesh in _cube.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.View = _basicEffect.View; effect.Projection = _basicEffect.Projection; effect.World = transforms[mesh.ParentBone.Index]* Matrix.CreateScale(0.01f, 0.005f, 0.01f)* Matrix.CreateTranslation(x/1.0f, -0.5f, z/1.0f); } mesh.Draw(); } } base.Draw(gameTime); }
/// <summary> /// Gets an array of vertices and indices from the provided model. /// </summary> /// <param name="collisionModel">Model to use for the collision shape.</param> /// <param name="vertices">Compiled set of vertices from the model.</param> /// <param name="indices">Compiled set of indices from the model.</param> public static void GetVerticesAndIndicesFromModel(Model collisionModel, out Microsoft.Xna.Framework.Vector3[] vertices, out int[] indices) { var verticesList = new List <Microsoft.Xna.Framework.Vector3>(); var indicesList = new List <int>(); var transforms = new Microsoft.Xna.Framework.Matrix[collisionModel.Bones.Count]; collisionModel.CopyAbsoluteBoneTransformsTo(transforms); Microsoft.Xna.Framework.Matrix transform; foreach (Microsoft.Xna.Framework.Graphics.ModelMesh mesh in collisionModel.Meshes) { if (mesh.ParentBone != null) { transform = transforms[mesh.ParentBone.Index]; } else { transform = Microsoft.Xna.Framework.Matrix.Identity; } AddMesh(mesh, transform, verticesList, indicesList); } vertices = verticesList.ToArray(); indices = indicesList.ToArray(); }
public void Update(GameTime gameTime) { var direction = XVector3.Transform(XVector3.UnitZ, Matrix.CreateRotationX(MathHelper.ToRadians(Game.Client.Pitch)) * Matrix.CreateRotationY(MathHelper.ToRadians(-(Game.Client.Yaw - 180) + 180))); var cast = VoxelCast.Cast(Game.Client.World, new TRay(Game.Camera.Position, new TVector3(direction.X, direction.Y, direction.Z)), Game.BlockRepository, TrueCraftGame.Reach, TrueCraftGame.Reach + 2); if (cast == null) { Game.HighlightedBlock = -Coordinates3D.One; } else { var provider = Game.BlockRepository.GetBlockProvider(Game.Client.World.GetBlockID(cast.Item1)); if (provider.InteractiveBoundingBox != null) { var box = provider.InteractiveBoundingBox.Value; Game.HighlightedBlock = cast.Item1; Game.HighlightedBlockFace = cast.Item2; DestructionEffect.World = HighlightEffect.World = Matrix.Identity * Matrix.CreateScale(new XVector3((float)box.Width, (float)box.Height, (float)box.Depth)) * Matrix.CreateTranslation(new XVector3((float)box.Min.X, (float)box.Min.Y, (float)box.Min.Z)) * Matrix.CreateTranslation(new XVector3(cast.Item1.X, cast.Item1.Y, cast.Item1.Z)); } } }
public RectangleProjection(RectangleF rectangle, Matrix transform) { Vertices[0] = Vector2.Transform(rectangle.TopLeft, transform); Vertices[1] = Vector2.Transform(rectangle.TopRight, transform); Vertices[2] = Vector2.Transform(rectangle.BottomLeft, transform); Vertices[3] = Vector2.Transform(rectangle.BottomRight, transform); }
public void Transform() { // STANDART OVERLOADS TEST var expectedResult1 = new Vector3(51, 58, 65); var expectedResult2 = new Vector3(33, -14, -1); var v1 = new Vector3(1, 2, 3); var m1 = new Matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); var v2 = new Vector3(1, 2, 3); var q1 = new Quaternion(2, 3, 4, 5); Vector3 result1; Vector3 result2; Assert.That(expectedResult1, Is.EqualTo(Vector3.Transform(v1, m1)).Using(Vector3Comparer.Epsilon)); Assert.That(expectedResult2, Is.EqualTo(Vector3.Transform(v2, q1)).Using(Vector3Comparer.Epsilon)); // OUTPUT OVERLOADS TEST Vector3.Transform(ref v1, ref m1, out result1); Vector3.Transform(ref v2, ref q1, out result2); Assert.That(expectedResult1, Is.EqualTo(result1).Using(Vector3Comparer.Epsilon)); Assert.That(expectedResult2, Is.EqualTo(result2).Using(Vector3Comparer.Epsilon)); }
private void Transform(AstroObject astroObject, Matrix3D baseTransformation, FrameworkElement txt) { // Transform Model if (astroObject == null) { return; } var m = Matrix.Identity; m *= Matrix.CreateTranslation(0, 60, 0); m *= Matrix.CreateRotationX(Microsoft.Xna.Framework.MathHelper.ToRadians(90)); m *= baseTransformation.ToXnaMatrix(); astroObject.Transform = m; astroObject.IsVisible = true; // Transform FrameworkElement // Center at origin of the TextBlock var centerAtOrigin = Matrix3DFactory.CreateTranslation(-txt.ActualWidth * 0.5, -txt.ActualHeight * 0.5, 0); // Swap the y-axis var scale = Matrix3DFactory.CreateScale(1, -1, 1); // Move a bit away from the center var translation = Matrix3DFactory.CreateTranslation(0, 50, 0); // Calculate the complete transformation matrix based on the first detection result var world = centerAtOrigin * translation * scale * baseTransformation; // Calculate the final transformation matrix by using the camera projection matrix var vp = Matrix3DFactory.CreateViewportTransformation(Viewport.ActualWidth, Viewport.ActualHeight); var mp = Matrix3DFactory.CreateViewportProjection(world, Matrix3D.Identity, arDetector.Projection, vp); // Apply the final transformation matrix to the TextBox txt.Projection = new Matrix3DProjection { ProjectionMatrix = mp }; txt.Visibility = Visibility.Visible; }
public static void DrawWireframe(PrimitiveDrawer primitiveDrawer, Vector3 cameraPosition, Matrix cameraView, Matrix cameraProjection, Vector3 center, float radius, Quaternion rotation, Color color) { // Draw three orthogonal discs. Disc.DrawWireframe(primitiveDrawer, cameraPosition, cameraView, cameraProjection, center, Vector3.Normalize(Vector3.Transform(Vector3.Up, rotation)), radius, color, true); Disc.DrawWireframe(primitiveDrawer, cameraPosition, cameraView, cameraProjection, center, Vector3.Normalize(Vector3.Transform(Vector3.Forward, rotation)), radius, color, true); Disc.DrawWireframe(primitiveDrawer, cameraPosition, cameraView, cameraProjection, center, Vector3.Normalize(Vector3.Transform(Vector3.Left, rotation)), radius, color, true); // Draw disc aligned with camera. To do this, first calculate the largest visible cross section using // the technique described here: http://www.quantimegroup.com/solutions/pages/Article/Article.html // Solve for dy. Vector3 cameraToCenter = center - cameraPosition; float distanceToCenter = cameraToCenter.Length(); float radius2 = radius * radius; float dy = radius2 / distanceToCenter; float r = MathUtility.Sqrt(radius2 - (dy * dy)); Vector3 directionToCenter = Vector3.Normalize(cameraToCenter); Vector3 newCenter = cameraPosition + directionToCenter * (distanceToCenter - dy); // Disc aligned with camera Disc.DrawWireframe(primitiveDrawer, cameraPosition, cameraView, cameraProjection, newCenter, directionToCenter, r, Color.White, false); }
private void DrawSkybox() { SamplerState ss = new SamplerState(); ss.AddressU = TextureAddressMode.Clamp; ss.AddressV = TextureAddressMode.Clamp; Engine.Video.GraphicsDevice.SamplerStates[0] = ss; DepthStencilState dss = new DepthStencilState(); dss.DepthBufferEnable = false; Engine.Video.GraphicsDevice.DepthStencilState = dss; Matrix[] skyboxTransforms = new Matrix[skyboxModel.Bones.Count]; skyboxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms); int i = 0; foreach(ModelMesh mesh in skyboxModel.Meshes) { foreach(Effect currentEffect in mesh.Effects) { Matrix worldMatrix = skyboxTransforms[mesh.ParentBone.Index]; currentEffect.CurrentTechnique = currentEffect.Techniques["Textured"]; currentEffect.Parameters["xWorld"].SetValue(worldMatrix); currentEffect.Parameters["xView"].SetValue(camera.ViewMatrix); currentEffect.Parameters["xProjection"].SetValue(camera.ProjectionMatrix); currentEffect.Parameters["xTexture"].SetValue(skyboxTextures[i++]); } mesh.Draw(); } dss = new DepthStencilState(); dss.DepthBufferEnable = true; Engine.Video.GraphicsDevice.DepthStencilState = dss; }
protected override void LoadContent() { base.LoadContent(); _projectionMatrix = Matrix.CreatePerspectiveFieldOfView( (float)Math.PI * 0.25f, (float)TargetSize.Width / TargetSize.Height, 0.05f, 1000f); var camera = new Camera(_projectionMatrix) { ViewPosition = new Vector3(-.0f, .0f, 1.2f) }; var device = Graphics.GraphicsDevice; _sun = new Sun(StarType); _sun.Create(Graphics, Content, camera); _usePostProcessor = device.GraphicsDeviceCapabilities.DeviceType == DeviceType.Hardware && device.GraphicsDeviceCapabilities.MaxPixelShaderProfile >= ShaderProfile.PS_3_0; if (_usePostProcessor) { _postProcessor = new PostProcessor(device, Content); } }
/* * Draw * * This function will draw the current menu * * SpriteBatch spriteBatch: The current sprite batch used to draw * * GraphicsDeviceManager graphics: The current graphics manager */ public void Draw(SpriteBatch spriteBatch, GraphicsDeviceManager graphics, Matrix scale) { spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, scale); var mSize = new float[2] { _mScreenRect.Width / (float)graphics.GraphicsDevice.Viewport.Width, _mScreenRect.Height / (float)graphics.GraphicsDevice.Viewport.Height }; spriteBatch.Draw(_mTrans, graphics.GraphicsDevice.Viewport.Bounds, Color.White); spriteBatch.Draw(_mTitle, new Rectangle(_mScreenRect.Center.X - (int)(_mTitle.Width * mSize[0]) / 2, _mScreenRect.Top, (int)(_mTitle.Width * mSize[0]), (int)(_mTitle.Height * mSize[1])), Color.White); var currentLocation = new Vector2(_mScreenRect.Left, _mScreenRect.Top + (int)(_mTitle.Height * mSize[1])); var height = _mScreenRect.Height - (int)(_mTitle.Height * mSize[1]); height -= ((int)(_mItems[0].Height * mSize[1]) + (int)(_mItems[1].Height * mSize[1]) + (int)(_mItems[2].Height * mSize[1])); height /= 2; currentLocation.Y += height; for (var i = 0; i < NumOptions; i++) { spriteBatch.Draw(_mItems[i], new Rectangle(_mScreenRect.Center.X - ((int)(_mItems[i].Width * mSize[0]) / 2), (int)currentLocation.Y, (int)(_mItems[i].Width * mSize[0]), (int)(_mItems[i].Height * mSize[1])), Color.White); currentLocation.Y += (int)(_mItems[i].Height * mSize[1]); } spriteBatch.End(); }
/// <summary> /// Draw the model. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // Copy any parent transforms. Matrix[] transforms = new Matrix[this.model.Bones.Count]; ModelBone bone = this.model.Bones["AF_Helmet_Xmas_D.bmp"]; //Matrix boneTransform = bone.Transform; bone.Transform *= Matrix.CreateRotationY(this.rotation / 30); this.model.CopyAbsoluteBoneTransformsTo(transforms); // Draw the model. A model can have multiple meshes, so loop. foreach (ModelMesh mesh in this.model.Meshes) { // This is where the mesh orientation is set, as well // as our camera and projection. foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.AmbientLightColor = new Vector3(255, 255, 255); effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateScale(this.size, this.size, this.size) * Matrix.CreateRotationY(this.rotation + this.baseRotation) * Matrix.CreateTranslation(this.position); effect.View = this.game.Camera.View; effect.Projection = this.game.Camera.Projection; } // Draw the mesh, using the effects set above. mesh.Draw(); } base.Draw(gameTime); }
void updatematrix() { matrix = Matrix.CreateTranslation(-position.X, -position.Y, 0.0f) * Matrix.CreateRotationZ(rotation) * Matrix.CreateScale(scale) * Matrix.CreateTranslation(viewport.X / 2, viewport.Y / 2, 0.0f); }
/// <summary> /// Simply set the matrices. /// </summary> /// <param name="view">The view.</param> /// <param name="projection">The bad.</param> public BaseCamera(Matrix view, Matrix projection) { this.View = view; this.Projection = projection; if (ProjectionChanged != null) ProjectionChanged(this); }
public void Draw(Scattaring fx) { Matrix[] modelTansforms = new Matrix[Fbx.Bones.Count]; Fbx.CopyAbsoluteBoneTransformsTo(modelTansforms); foreach (ModelMesh mesh in Fbx.Meshes) { foreach (Effect currentEffect in mesh.Effects) { Matrix world = modelTansforms[mesh.ParentBone.Index] * fx.WorldMatrix; currentEffect.Parameters["WorldViewProj"].SetValue(world * fx.viewProjection); currentEffect.Parameters["WorldInverseTranspose"].SetValue(fx.invertTransposeWorld); currentEffect.Parameters["World"].SetValue(world); currentEffect.Parameters["ViewInv"].SetValue(fx.invertView); currentEffect.Parameters["LightDirection"].SetValue(fx.lightDirection); currentEffect.Parameters["LightColor"].SetValue(fx.lightColor); currentEffect.Parameters["LightColorAmbient"].SetValue(fx.lightColorAmbient); currentEffect.Parameters["FogColor"].SetValue(fx.fogColor); currentEffect.Parameters["fDensity"].SetValue(fx.fogDensity); currentEffect.Parameters["SunLightness"].SetValue(fx.sunLightness); currentEffect.Parameters["sunRadiusAttenuation"].SetValue(fx.sunRadiusAttenuation); currentEffect.Parameters["largeSunLightness"].SetValue(fx.largeSunLightness); currentEffect.Parameters["largeSunRadiusAttenuation"].SetValue(fx.largeSunRadiusAttenuation); currentEffect.Parameters["dayToSunsetSharpness"].SetValue(fx.dayToSunsetSharpness); currentEffect.Parameters["hazeTopAltitude"].SetValue(fx.hazeTopAltitude); } mesh.Draw(); } }
bool intersectPixels(Vector2 worldpos) { Vector2 positionInB = Vector2.Transform(worldpos, Matrix.Invert(_transform)); var xB = (int)Math.Round(positionInB.X); var yB = (int)Math.Round(positionInB.Y); if (_properties.FlipHorizontally) { xB = _texture.Width - xB; } if (_properties.FlipVertically) { yB = _texture.Height - yB; } // If the pixel lies within the bounds of B if (0 <= xB && xB < _texture.Width && 0 <= yB && yB < _texture.Height) { Color colorB = _colorDataForTexture[xB + yB * _texture.Width]; if (colorB.A != 0) { return(true); } } return(false); }
void RenderResults(RenderMode renderMode, simengine.MatrixTransforms transforms, simengine.CameraEntity currentCamera) { _timeAttenuationHandle.SetValue(new xna.Vector4(100 * (float)Math.Cos(_appTime * (1.0f / SCAN_INTERVAL)), 0, 0, 1)); // render impact points as a quad xna.Matrix inverseViewRotation = currentCamera.ViewMatrix; inverseViewRotation.M41 = inverseViewRotation.M42 = inverseViewRotation.M43 = 0; xna.Matrix.Invert(ref inverseViewRotation, out inverseViewRotation); xna.Matrix localTransform = xna.Matrix.CreateFromAxisAngle(new xna.Vector3(1, 0, 0), (float)-Math.PI / 2) * inverseViewRotation; simengine.SimulationEngine.GlobalInstance.Device.DepthStencilState = xnagrfx.DepthStencilState.DepthRead; for (int i = 0; i < _lastResults.ImpactPoints.Count; i++) { xna.Vector3 pos = new xna.Vector3(_lastResults.ImpactPoints[i].Position.X, _lastResults.ImpactPoints[i].Position.Y, _lastResults.ImpactPoints[i].Position.Z); xna.Vector3 resultDir = pos - Position; resultDir.Normalize(); localTransform.Translation = pos - .02f * resultDir; transforms.World = localTransform; base.Render(renderMode, transforms, Meshes[0]); } simengine.SimulationEngine.GlobalInstance.Device.DepthStencilState = xnagrfx.DepthStencilState.Default; }
public EnvironmentBatch(GraphicsDevice device, ContentManager content, Matrix projection) { _environmentEffect = content.Load<Effect>("AmbientEffect"); _environmentEffect.Parameters["BaseTexture"].SetValue(content.Load<Texture2D>("Drydock Floor")); _environmentEffect.Parameters["Projection"].SetValue(projection); _environmentEffect.Parameters["World"].SetValue(Matrix.CreateScale(_environmentScale)); }
/// <summary> /// Processes the particles. /// </summary> /// <param name="dt">Elapsed time in whole and fractional seconds.</param> /// <param name="particleArray">A pointer to an array of particles.</param> /// <param name="count">The number of particles which need to be processed.</param> protected internal override unsafe void Process(float dt, Particle* particleArray, int count) { // Create the transformation matrix... float h = ((this.HueShift * dt) * Calculator.Pi) / 180f; float u = Calculator.Cos(h); float w = Calculator.Sin(h); Matrix hueTransform = new Matrix(1f, 0f, 0f, 0f, 0f, u, -w, 0f, 0f, w, u, 0f, 0f, 0f, 0f, 1f); for (int i = 0; i < count; i++) { Particle* particle = (particleArray + i); Vector4 colour; // Convert the current colour of the particle to YIQ colour space... Vector4.Transform(ref particle->Colour, ref HueShiftModifier.YIQTransformMatrix, out colour); // Transform the colour in YIQ space... Vector4.Transform(ref colour, ref hueTransform, out colour); // Convert the colour back to RGB... Vector4.Transform(ref colour, ref HueShiftModifier.RGBTransformMatrix, out colour); // And apply back to the particle... particle->Colour.X = colour.X; particle->Colour.Y = colour.Y; particle->Colour.Z = colour.Z; } }
public void ResetCamera() { Position = Vector3.Zero; Target = Vector3.Zero; ViewMatrix = Matrix.Identity; ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), Engine.Video.GraphicsDevice.Viewport.AspectRatio, 0.5f, 500f); }
public BasicEntity(ModelDefinition modelbb, MaterialEffect material, Vector3 position, double angleZ, double angleX, double angleY, Vector3 scale, MeshMaterialLibrary library = null, Entity physicsObject = null) { Id = IdGenerator.GetNewId(); Name = GetType().Name + " " + Id; WorldTransform = new TransformMatrix(Matrix.Identity, Id); ModelDefinition = modelbb; Model = modelbb.Model; BoundingBox = modelbb.BoundingBox; BoundingBoxOffset = modelbb.BoundingBoxOffset; SignedDistanceField = modelbb.SDF; Material = material; Position = position; Scale = scale; RotationMatrix = Matrix.CreateRotationX((float)angleX) * Matrix.CreateRotationY((float)angleY) * Matrix.CreateRotationZ((float)angleZ); if (library != null) { RegisterInLibrary(library); } if (physicsObject != null) { RegisterPhysics(physicsObject); } WorldTransform.World = Matrix.CreateScale(Scale) * RotationMatrix * Matrix.CreateTranslation(Position); WorldTransform.Scale = Scale; WorldTransform.InverseWorld = Matrix.Invert(Matrix.CreateTranslation(BoundingBoxOffset * Scale) * RotationMatrix * Matrix.CreateTranslation(Position)); }
private void DrawModel(Model m) { Matrix[] transforms = new Matrix[m.Bones.Count]; float aspectRatio = Context.Graphics.Device.Viewport.AspectRatio; m.CopyAbsoluteBoneTransformsTo(transforms); Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); Matrix view = Matrix.CreateLookAt(new Vector3(0.0f, 2.0f, 10f), Vector3.Zero, Vector3.Up); var state = new RasterizerState(); state.CullMode = CullMode.None; Context.Graphics.Device.RasterizerState = state; foreach (ModelMesh mesh in m.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.DiffuseColor = new Vector3(1, 1, 1); effect.View = view; effect.Projection = projection; effect.World = Matrix.Identity * transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(Position) * Matrix.CreateRotationY(MathHelper.ToRadians(angle)); } mesh.Draw(); } }
public void Draw(Vector3 center, Matrix newView, short clip) { Game.device.DepthStencilState = DepthStencilState.None; Game.device.RasterizerState = RasterizerState.CullNone; Game.device.BlendState = BlendState.Opaque; Matrix[] skyboxTransforms = new Matrix[skyBoxModel.Bones.Count]; skyBoxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms); int i = 0; foreach (ModelMesh mesh in skyBoxModel.Meshes) { foreach (Effect currentEffect in mesh.Effects) { Matrix worldMatrix = /*Matrix.CreateRotationY(rotation+=0.0001f) **/ Matrix.CreateScale(500f) * skyboxTransforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(center); currentEffect.CurrentTechnique = currentEffect.Techniques["Sky"]; currentEffect.Parameters["xWorld"].SetValue(skyboxTransforms[mesh.ParentBone.Index]*worldMatrix); currentEffect.Parameters["xViewProjection"].SetValue(newView * Game.cam.infinite_proj); currentEffect.Parameters["xTexture"].SetValue(skyBoxTextures[i++]); currentEffect.Parameters["xCamPos"].SetValue(Game.cam.cameraPosition); currentEffect.Parameters["xShEye"].SetValue(Game.cam.shEye); currentEffect.Parameters["xGrayScale"].SetValue(Game.enviro.grayScale); currentEffect.Parameters["xInvertedColors"].SetValue(Game.enviro.invertColors); currentEffect.Parameters["xUnderWater"].SetValue(Game.enviro.underWater); currentEffect.Parameters["xClipping"].SetValue(clip); currentEffect.Parameters["xClipHeight"].SetValue(Game.enviro.waterLevel); } mesh.Draw(); } Game.device.BlendState = BlendState.Opaque; Game.device.RasterizerState = RasterizerState.CullClockwise; Game.device.DepthStencilState = DepthStencilState.Default; }
public Matrix GetScaleMatrix() { if (scaleMatrix.HasValue == false) { var screenSize = Client.ScreenManager.CurrentScreen.GetLayoutSize(); var gameWorldSize = new Vector2(screenSize.Width, screenSize.Height); var vp = graphicsDevice.Viewport; var scaleX = vp.Width / gameWorldSize.X; var scaleY = vp.Height / gameWorldSize.Y; scaleY = scaleX; var translateX = (vp.Width - (gameWorldSize.X * scaleX)) / 2f; var translateY = (vp.Height - (gameWorldSize.Y * scaleY)) / 2f; var camera = Matrix.CreateScale(scaleX, scaleY, 1) * Matrix.CreateTranslation(translateX, translateY, 0); scaleMatrix = camera; } return(scaleMatrix.Value); }
public void Draw(Matrix view, Matrix projection) { Effect.Projection = projection; Effect.View = view; Effect.CurrentTechnique.Passes[0].Apply(); Device.DrawUserPrimitives(PrimitiveType.LineList, Vertices, 0, 3); }
public void Update(Matrix chasedObjectsWorld) { if (_target != null) { UpdateViewMatrix(chasedObjectsWorld); } }
public static Matrix ComputeMatrix(Vector2 size, Vector2 ptUL, Vector2 ptUR, Vector2 ptLL, Vector2 ptLR) { // Scale transform Matrix S = Matrix.CreateScale(1 / size.X, 1 / size.Y, 1); // Affine transform Matrix A = ComputeAffineTransform(ptUL, ptUR, ptLL); // Non-Affine transform Matrix B = new Matrix(); float den = A.M11 * A.M22 - A.M12 * A.M21; float a = (A.M22 * ptLR.X - A.M21 * ptLR.Y + A.M21 * A.M42 - A.M22 * A.M41) / den; float b = (A.M11 * ptLR.Y - A.M12 * ptLR.X + A.M12 * A.M41 - A.M11 * A.M42) / den; B.M11 = a / (a + b - 1); B.M22 = b / (a + b - 1); B.M33 = 1; B.M14 = B.M11 - 1; B.M24 = B.M22 - 1; B.M44 = 1; // Product of three transforms return S * B * A; }
public RebootPOSTEffect() : base("RebootPOSTEffect") { this.texture = new SemanticMappedTexture(this.effect.Parameters, "BaseTexture"); this.pseudoWorldMatrix = new SemanticMappedMatrix(this.effect.Parameters, "PseudoWorldMatrix"); this.PseudoWorld = Matrix.Identity; }
public static void Draw(this BoundingFrustum frustum, GraphicsDevice graphicsDevice, Matrix view, Matrix projection, Color color) { if (effect == null) { effect = new BasicEffect(graphicsDevice); effect.VertexColorEnabled = true; effect.LightingEnabled = false; } Vector3[] corners = frustum.GetCorners(); for (int i = 0; i < 8; i++) { verts[i].Position = corners[i]; verts[i].Color = color; } effect.View = view; effect.Projection = projection; foreach (var t in effect.Techniques) foreach (var p in t.Passes) { p.Apply(); graphicsDevice.DrawUserIndexedPrimitives( PrimitiveType.LineList, verts, 0, 8, indices, 0, indices.Length / 2); } }
public void Update(Matrix modelMatrix) { for (int j = 0; j < 8; j++) { transformedCorners[j] = Vector3.Transform(corners[j], modelMatrix); } }
public override void Draw(GameTime gameTime) { Vector3 cameraPosition = MathConverter.Convert(_manager.Camera.Position); Matrix[] transforms = new Matrix[_model.Bones.Count]; _model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in _model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { if (_texture != null) { effect.TextureEnabled = true; effect.Texture = _texture; } effect.EnableDefaultLighting(); effect.Projection = MathConverter.Convert(_manager.Camera.ProjectionMatrix); effect.View = MathConverter.Convert(_manager.Camera.ViewMatrix); effect.World = Matrix.CreateScale(3000) * Matrix.CreateTranslation(cameraPosition.X, cameraPosition.Y, cameraPosition.Z); } mesh.Draw(); } base.Draw(gameTime); }
public Lamp(Game game, Matrix worldMatrix) : base(game) { Name = "Lamp"; On = true; WorldMatrix = worldMatrix; }
internal static EffectDirtyFlags SetWorldViewProjAndFog(EffectDirtyFlags dirtyFlags, ref Matrix world, ref Matrix view, ref Matrix projection, ref Matrix worldView, bool fogEnabled, float fogStart, float fogEnd, EffectParameter worldViewProjParam, EffectParameter fogVectorParam) { if ((dirtyFlags & EffectDirtyFlags.WorldViewProj) != ~EffectDirtyFlags.All) { Matrix.Multiply(ref world, ref view, out worldView); Matrix result; Matrix.Multiply(ref worldView, ref projection, out result); worldViewProjParam.SetValue(result); dirtyFlags &= ~EffectDirtyFlags.WorldViewProj; } if (fogEnabled) { if ((dirtyFlags & (EffectDirtyFlags.Fog | EffectDirtyFlags.FogEnable)) != ~EffectDirtyFlags.All) { EffectHelpers.SetFogVector(ref worldView, fogStart, fogEnd, fogVectorParam); dirtyFlags &= ~(EffectDirtyFlags.Fog | EffectDirtyFlags.FogEnable); } } else if ((dirtyFlags & EffectDirtyFlags.FogEnable) != ~EffectDirtyFlags.All) { fogVectorParam.SetValue(Vector4.Zero); dirtyFlags &= ~EffectDirtyFlags.FogEnable; } return dirtyFlags; }
public static BoundingBox CreateBoundingBox(Model model, Matrix worldTransform) { Vector3 min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); Vector3 max = new Vector3(float.MinValue, float.MinValue, float.MinValue); foreach (ModelMesh mesh in model.Meshes) { foreach (ModelMeshPart meshPart in mesh.MeshParts) { int vertexStride = meshPart.VertexBuffer.VertexDeclaration.VertexStride; int vertexBufferSize = meshPart.NumVertices * vertexStride; float[] vertexData = new float[vertexBufferSize / sizeof(float)]; meshPart.VertexBuffer.GetData<float>(vertexData); for (int i = 0; i < vertexBufferSize / sizeof(float); i += vertexStride / sizeof(float)) { Vector3 transformedPosition = Vector3.Transform(new Vector3(vertexData[i + 1], vertexData[i + 2], vertexData[i]), worldTransform); min = Vector3.Min(min, transformedPosition); max = Vector3.Max(max, transformedPosition); } } } return new BoundingBox(min, max); }
/// <summary> /// Draws the display object. /// </summary> /// <param name="viewMatrix">Current view matrix.</param> /// <param name="projectionMatrix">Current projection matrix.</param> public override void Draw(Matrix viewMatrix, Matrix projectionMatrix) { //This is not a particularly fast method of drawing. //It's used very rarely in the demos. model.CopyAbsoluteBoneTransformsTo(transforms); for (int i = 0; i < Model.Meshes.Count; i++) { for (int j = 0; j < Model.Meshes[i].Effects.Count; j++) { var effect = Model.Meshes[i].Effects[j] as BasicEffect; if (effect != null) { effect.World = transforms[Model.Meshes[i].ParentBone.Index] * WorldTransform; effect.View = viewMatrix; effect.Projection = projectionMatrix; if (Texture != null) { effect.TextureEnabled = true; effect.Texture = Texture; } else effect.TextureEnabled = false; } } Model.Meshes[i].Draw(); } }
public void RotateAboutAxis(Vector3D axis, double angleRad) { var v = new sVector3D((float)axis.X, (float)axis.Y, (float)axis.Z); m = m * sMatrix3D.CreateFromQuaternion(sQuaternion.CreateFromAxisAngle(v, (float)angleRad)); //m.Rotate(new sQuaternion(new sVector3D(axis.X, axis.Y, axis.Z), angleRad.ToDeg())); }
public void Begin(Microsoft.Xna.Framework.Matrix transform) { var mt3x2 = new SharpDX.Matrix3x2(transform.M11, transform.M12, transform.M21, transform.M22, transform.M41, transform.M42); this.Begin(mt3x2); }
private MMatrix(MMatrix mat) { m_matrix = new Matrix(); m_matrix = mat.m_matrix; MMatrix instance = this; addMatrix(ref instance); }
/// <summary> /// Gets the value of the annotation as a matrix. /// </summary> /// <returns> /// The matrix value /// </returns> public Matrix GetValueMatrix() { XNA.Matrix xm = _annotation.GetValueMatrix(); Matrix m; XNAHelper.ConvertMatrix(ref xm, out m); return(m); }
/// <summary> /// Gets the value of the parameter as a matrix transpose. /// </summary> /// <returns> /// The matrix transpose value /// </returns> public Matrix GetValueMatrixTranspose() { XNA.Matrix xm = _param.GetValueMatrixTranspose(); Matrix m; XNAHelper.ConvertMatrix(ref xm, out m); return(m); }
private MMatrix() { m_matrix = new Matrix(); m_matrix = Matrix.Identity; MMatrix instance = this; addMatrix(ref instance); }
private void _motion_CurrentValueChanged(object sender, SensorReadingEventArgs <MotionReading> e) { double motionDelta = 0.01; if (!_motion.IsDataValid) { return; } if (Math.Abs(e.SensorReading.Attitude.Yaw - _yaw) > motionDelta) { _yaw = e.SensorReading.Attitude.Yaw; } if (Math.Abs(e.SensorReading.Attitude.Roll - _roll) > motionDelta) { _roll = e.SensorReading.Attitude.Roll; } if (Math.Abs(e.SensorReading.Attitude.Pitch - _pitch) > motionDelta) { _pitch = e.SensorReading.Attitude.Pitch; } Dispatcher.BeginInvoke(delegate() { if (myVM.ClickedNearbyLocation != null) { myVM.ClickedNearbyLocation.CalculateHeadingAngle(MathHelper.ToDegrees(_yaw)); } }); if (_onDragEndAnimation) { return; } if (_gestureState == GestureStateEnum.OnFreeDrag) { _cameraMatrixBehindDrag = Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, -1), Vector3.Up); _cameraMatrixBehindDrag *= Matrix.CreateRotationY(-_yaw); _cameraMatrixBehindDrag *= Matrix.CreateRotationZ(_roll); _cameraMatrixBehindDrag *= Matrix.CreateRotationX(-_pitch + MathHelper.PiOver2); } else { _cameraMatrix = Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, -1), Vector3.Up); _cameraMatrix *= Matrix.CreateRotationY(-_yaw); _cameraMatrix *= Matrix.CreateRotationZ(_roll); _cameraMatrix *= Matrix.CreateRotationX(-_pitch + MathHelper.PiOver2); //rotate radar Dispatcher.BeginInvoke(delegate() { (radarCanvas.RenderTransform as System.Windows.Media.RotateTransform).Angle = MathHelper.ToDegrees((_yaw)); }); } }
void LoadRotationMatrix(UInt16 address) { System.Diagnostics.Debug.Assert(address < 0x8000); if (address == 0x787C) { address = 0x15; } WorldRotation = GetMatrix4At(address); }
public override void Render(XNA.Matrix ViewMatrix, XNA.Matrix ProjectionMatrix) { if (ShaderProgram != null) { ShaderProgram.Use(); Gl.BindVertexArray(VAO); SetMVP(ViewMatrix, ProjectionMatrix); } }
public override void Draw(GraphicsDevice gd, TimeSpan time, Camera camera) { if (!IsVisible) { return; } ccwState = new RasterizerState { CullMode = CullMode.CullCounterClockwiseFace, FillMode = ShowWireframe ? FillMode.WireFrame : FillMode.Solid, }; gd.Textures[0] = sunTexture; gd.Textures[1] = turbulence1Texture; gd.Textures[2] = turbulence2Texture; gd.Textures[3] = gradientTexture; gd.SamplerStates[1] = SamplerState.AnisotropicWrap; gd.SamplerStates[2] = SamplerState.AnisotropicWrap; gd.SamplerStates[3] = SamplerState.LinearClamp; // // Pass 1, Sun map // var transform = Transform; transform = Matrix.CreateScale((float)Scale) * transform; shaderConstants.WorldMatrix = transform; shaderConstants.WorldInverseTransposeMatrix = Matrix.Transpose(Matrix.Invert(transform)); shaderConstants.WorldViewProjectionMatrix = transform * camera.ViewTransform * camera.ProjectionTransform; shaderConstants.ViewInverseMatrix = Matrix.Invert(camera.ViewTransform); shaderConstants.TotalSeconds.X = (float)time.TotalSeconds; shaderConstants.LightPos = new Vector4(LightPosition, 1); gd.SetVertexShaderConstantFloat4(0, ref shaderConstants); var showWireframe = new Vector4(ShowWireframe ? 1 : 0); gd.SetPixelShaderConstantFloat4(0, ref showWireframe); gd.SetVertexShader(sunVertexShader); gd.SetPixelShader(sunPixelShader); gd.DepthStencilState = depthState; gd.BlendState = BlendState.Opaque; gd.RasterizerState = ccwState; // Perform refraction mapping if (ReflectionTexture != null) { gd.Textures[0] = ReflectionTexture; gd.SetPixelShader(refractionPixelShader); } mesh.Draw(gd); }
public void InitializeViewport() { // Initialize the viewport and matrixes for 3d projection. viewport = new Viewport(0, 0, (int)this.ActualWidth, (int)this.ActualHeight); float aspect = viewport.AspectRatio; projection = Matrix.CreatePerspectiveFieldOfView(1, aspect, 1, 12); view = Matrix.CreateLookAt(new Vector3(0, 0, 1), Vector3.Zero, Vector3.Up); }
public Camera(Game g, Vector3 position, Vector3 target, Vector3 up) : base(g) { view = Matrix.CreateLookAt(position, target, up); projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, (float)g.Window.ClientBounds.Width / g.Window.ClientBounds.Height, 1, 100); }
public static string ToString(Microsoft.Xna.Framework.Matrix m) { string s = ""; s += m.M11.ToString("0.000000") + " " + m.M12.ToString("0.000000") + " " + m.M13.ToString("0.000000") + " " + m.M14.ToString("0.000000") + "\r\n"; s += m.M12.ToString("0.000000") + " " + m.M22.ToString("0.000000") + " " + m.M23.ToString("0.000000") + " " + m.M24.ToString("0.000000") + "\r\n"; s += m.M13.ToString("0.000000") + " " + m.M32.ToString("0.000000") + " " + m.M33.ToString("0.000000") + " " + m.M34.ToString("0.000000") + "\r\n"; s += m.M14.ToString("0.000000") + " " + m.M42.ToString("0.000000") + " " + m.M43.ToString("0.000000") + " " + m.M44.ToString("0.000000") + "\r\n"; return(s); }
private void EndDrag() { if (_targetImage.IsMouseCaptured) { _targetImage.ReleaseMouseCapture(); } _isDragging = false; _worldMatrix = Matrix.Identity; }