Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void drawNormalMapSprite(Texture2D sourceTex, Vector2 screenPoint, Rectangle sRect, float rot, Vector2 origin, Vector2 scale) {
- // Convert rotation to 0..1 range
- float rotVal = (rot % MathHelper.TwoPi) / MathHelper.TwoPi;
- // Encode rotation to color
- normalRotateColor.R = (byte)(rotVal * 255); // First approximation with 8 bits
- normalRotateColor.G = (byte)(((rotVal * 255f) % 1) * 255); // Take the remaining fractional part and scale that again to 8 bit range
- batches[(int)SpriteBatchType.spriteMainBatch].Draw(sourceTex, screenPoint, sRect, normalRotateColor, rot, origin, scale, SpriteEffects.None, 0f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement