/// <summary> /// Draws the geometry texture. /// </summary> /// <param name="buffer">The buffer.</param> /// <param name="position">The position.</param> /// <param name="texture">The texture.</param> /// <param name="opacity">The opacity.</param> /// <param name="depth">The depth.</param> public override void DrawGeometryTexture(GeometryBuffer buffer, PointF position, TextureBase texture, float opacity, float depth) { if (basicEffect == null) { basicEffect = new BasicEffect(GraphicsDevice); } basicEffect.Alpha = opacity; basicEffect.DiffuseColor = new Vector3(1, 1, 1); basicEffect.Texture = texture.GetNativeTexture() as Texture2D; basicEffect.VertexColorEnabled = false; basicEffect.TextureEnabled = true; DrawGeometry(buffer, position, depth); }
/// <summary> /// Draws the geometry texture. /// </summary> /// <param name="buffer">The buffer.</param> /// <param name="position">The position.</param> /// <param name="texture">The texture.</param> /// <param name="opacity">The opacity.</param> /// <param name="depth">The depth.</param> public override void DrawGeometryTexture(GeometryBuffer buffer, PointF position, TextureBase texture, float opacity, float depth) { XenkoGeometryBuffer paradoxBuffer = buffer as XenkoGeometryBuffer; Texture2D nativeTexture = texture.GetNativeTexture() as Texture2D; paradoxBuffer.EffectInstance.Parameters.Set(SpriteEffectKeys.Color, Color.White * opacity); paradoxBuffer.EffectInstance.Parameters.Set(TexturingKeys.Texture0, nativeTexture); DrawGeometry(buffer, position, depth); }
/// <summary> /// Draws the specified texture. /// </summary> /// <param name="texture">The texture.</param> /// <param name="position">The position.</param> /// <param name="renderSize">Size of the render.</param> /// <param name="color">The color.</param> /// <param name="source">The source.</param> /// <param name="centerOrigin">if set to <c>true</c> [center origin].</param> public override void Draw(TextureBase texture, PointF position, Size renderSize, ColorW color, Rect source, bool centerOrigin) { testRectangle.X = (int)position.X; testRectangle.Y = (int)position.Y; testRectangle.Width = (int)renderSize.Width; testRectangle.Height = (int)renderSize.Height; if (isClipped && !spriteBatch.GraphicsDevice.ScissorRectangle.Intersects(testRectangle)) { return; } sourceRect.X = (int)source.X; sourceRect.Y = (int)source.Y; sourceRect.Width = (int)source.Width; sourceRect.Height = (int)source.Height; vecColor.PackedValue = color.PackedValue; Texture2D native = texture.GetNativeTexture() as Texture2D; spriteBatch.Draw(native, testRectangle, sourceRect, vecColor, 0, Vector2.Zero, SpriteEffects.None, 0); }
/// <summary> /// Draws the specified texture. /// </summary> /// <param name="texture">The texture.</param> /// <param name="position">The position.</param> /// <param name="renderSize">Size of the render.</param> /// <param name="color">The color.</param> /// <param name="source">The source.</param> /// <param name="centerOrigin">if set to <c>true</c> [center origin].</param> public override void Draw(TextureBase texture, PointF position, Size renderSize, ColorW color, Rect source, bool centerOrigin) { testRectangle.X = (int)position.X; testRectangle.Y = (int)position.Y; testRectangle.Width = (int)renderSize.Width; testRectangle.Height = (int)renderSize.Height; if (isClipped && !currentScissorRectangle.Intersects(testRectangle)) { return; } sourceRect.X = (int)source.X; sourceRect.Y = (int)source.Y; sourceRect.Width = (int)source.Width; sourceRect.Height = (int)source.Height; vecColor.A = color.A; vecColor.R = color.R; vecColor.G = color.G; vecColor.B = color.B; if (centerOrigin) { origin.X = testRectangle.Width / 2f; origin.Y = testRectangle.Height / 2f; } Texture2D native = texture.GetNativeTexture() as Texture2D; spriteBatch.Draw(native, testRectangle, sourceRect, vecColor, 0, origin); }