public bool Draw2D(Texture2D texture, Vector3 position, Vector3 hue) { m_AllocatedVertices[0] = new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y, 0), new Vector3(0, 0, 1), new Vector3(0, 0, 0)); m_AllocatedVertices[1] = new VertexPositionNormalTextureHue(new Vector3(position.X + texture.Width, position.Y, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)); m_AllocatedVertices[2] = new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y + texture.Height, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); m_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)); m_AllocatedVertices[0].Hue = m_AllocatedVertices[1].Hue = m_AllocatedVertices[2].Hue = m_AllocatedVertices[3].Hue = hue; return(DrawSprite(texture, m_AllocatedVertices)); }
public bool Draw2D(Texture2D texture, Rectangle destRect, Vector3 hue) { m_AllocatedVertices[0] = new VertexPositionNormalTextureHue(new Vector3(destRect.X, destRect.Y, 0), new Vector3(0, 0, 1), new Vector3(0, 0, 0)); m_AllocatedVertices[1] = new VertexPositionNormalTextureHue(new Vector3(destRect.X + destRect.Width, destRect.Y, 0), new Vector3(0, 0, 1), new Vector3(1, 0, 0)); m_AllocatedVertices[2] = new VertexPositionNormalTextureHue(new Vector3(destRect.X, destRect.Y + destRect.Height, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)); m_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)); m_AllocatedVertices[0].Hue = m_AllocatedVertices[1].Hue = m_AllocatedVertices[2].Hue = m_AllocatedVertices[3].Hue = hue; return(DrawSprite(texture, m_AllocatedVertices)); }
public bool Draw2D(Texture2D texture, Rectangle destRect, Rectangle 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; m_AllocatedVertices[0] = new VertexPositionNormalTextureHue(new Vector3(destRect.X, destRect.Y, 0), new Vector3(0, 0, 1), new Vector3(minX, minY, 0)); m_AllocatedVertices[1] = new VertexPositionNormalTextureHue(new Vector3(destRect.X + destRect.Width, destRect.Y, 0), new Vector3(0, 0, 1), new Vector3(maxX, minY, 0)); m_AllocatedVertices[2] = new VertexPositionNormalTextureHue(new Vector3(destRect.X, destRect.Y + destRect.Height, 0), new Vector3(0, 0, 1), new Vector3(minX, maxY, 0)); m_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)); m_AllocatedVertices[0].Hue = m_AllocatedVertices[1].Hue = m_AllocatedVertices[2].Hue = m_AllocatedVertices[3].Hue = hue; return(DrawSprite(texture, m_AllocatedVertices)); }