public bool Draw2D(Texture2DInfo texture, RectInt destRect, Vector3 hue) { _allocatedVertices[0] = new VertexPositionNormalTextureHue(new Vector3(destRect.x, destRect.y, 0), new Vector3(0, 0, 1), new Vector3(0, 0, 0)); _allocatedVertices[1] = new VertexPositionNormalTextureHue(new Vector3(destRect.x + destRect.width, destRect.y, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)); _allocatedVertices[2] = new VertexPositionNormalTextureHue(new Vector3(destRect.x, destRect.y + destRect.height, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); _allocatedVertices[3] = new VertexPositionNormalTextureHue(new Vector3(destRect.x + destRect.width, destRect.y + destRect.height, 0), new Vector3(0, 0, 1), new Vector3(1, 1, 0)); _allocatedVertices[0].Hue = _allocatedVertices[1].Hue = _allocatedVertices[2].Hue = _allocatedVertices[3].Hue = hue; return(DrawSprite(texture, _allocatedVertices)); }
public bool Draw2D(Texture2DInfo texture, Vector3 position, Vector3 hue) { _allocatedVertices[0] = new VertexPositionNormalTextureHue(new Vector3(position.x, position.y, 0), new Vector3(0, 0, 1), new Vector3(0, 0, 0)); _allocatedVertices[1] = new VertexPositionNormalTextureHue(new Vector3(position.x + texture.Width, position.y, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)); _allocatedVertices[2] = new VertexPositionNormalTextureHue(new Vector3(position.x, position.y + texture.Height, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); _allocatedVertices[3] = new VertexPositionNormalTextureHue(new Vector3(position.x + texture.Width, position.y + texture.Height, 0), new Vector3(0, 0, 1), new Vector3(1, 1, 0)); _allocatedVertices[0].Hue = _allocatedVertices[1].Hue = _allocatedVertices[2].Hue = _allocatedVertices[3].Hue = hue; return(DrawSprite(texture, _allocatedVertices)); }
public bool Draw2D(Texture2DInfo texture, RectInt destRect, RectInt sourceRect, Vector3 hue) { float minX = sourceRect.x / (float)texture.Width, maxX = (sourceRect.x + sourceRect.width) / (float)texture.Width; float minY = sourceRect.y / (float)texture.Height, maxY = (sourceRect.y + sourceRect.height) / (float)texture.Height; _allocatedVertices[0] = new VertexPositionNormalTextureHue(new Vector3(destRect.x, destRect.y, 0), new Vector3(0, 0, 1), new Vector3(minX, minY, 0)); _allocatedVertices[1] = new VertexPositionNormalTextureHue(new Vector3(destRect.x + destRect.width, destRect.y, 0), new Vector3(0, 0, 1), new Vector3(maxX, minY, 0)); _allocatedVertices[2] = new VertexPositionNormalTextureHue(new Vector3(destRect.x, destRect.y + destRect.height, 0), new Vector3(0, 0, 1), new Vector3(minX, maxY, 0)); _allocatedVertices[3] = new VertexPositionNormalTextureHue(new Vector3(destRect.x + destRect.width, destRect.y + destRect.height, 0), new Vector3(0, 0, 1), new Vector3(maxX, maxY, 0)); _allocatedVertices[0].Hue = _allocatedVertices[1].Hue = _allocatedVertices[2].Hue = _allocatedVertices[3].Hue = hue; return(DrawSprite(texture, _allocatedVertices)); }