Skip to content

Commit

Permalink
Merge pull request MonoGame#4676 from SickheadGames/release_3_5_1
Browse files Browse the repository at this point in the history
Release 3.5.1
  • Loading branch information
tomspilman committed Mar 30, 2016
2 parents 21c3235 + a06468c commit 071136f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Build/Module.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Module>
<Name>MonoGame.Framework</Name>
<DefaultAction>Generate</DefaultAction>
<DefaultLinuxPlatforms>Angle,Linux,WindowsGL</DefaultLinuxPlatforms>
<DefaultMacOSPlatforms>Angle,MacOS,iOS,WindowsGL,Android,tvOS</DefaultMacOSPlatforms>
<DefaultMacOSPlatforms>Angle,MacOS,iOS,WindowsGL,Android,tvOS,Linux</DefaultMacOSPlatforms>
<DefaultWindowsPlatforms>Android,Angle,Linux,Ouya,Windows8,Windows,WindowsGL,WindowsPhone,WindowsPhone81,WindowsUniversal,iOS,tvOS</DefaultWindowsPlatforms>
<SupportedPlatforms>Android,Angle,Linux,Ouya,Windows8,Windows,WindowsGL,WindowsPhone,WindowsPhone81,WindowsUniversal,iOS,MacOS,Web,tvOS</SupportedPlatforms>
<DisableSynchronisation>true</DisableSynchronisation>
Expand Down
5 changes: 2 additions & 3 deletions MonoGame.Framework.Content.Pipeline/TextureImporter.cs
Expand Up @@ -99,7 +99,7 @@ public override TextureContent Import(string filename, ContentImporterContext co

// Create the byte array for the data
byte[] bytes = new byte[((width * height * bpp - 1) / 8) + 1];

//Converts the pixel data to bytes, do not try to use this call to switch the color channels because that only works for 16bpp bitmaps
FreeImage.ConvertToRawBits(bytes, fBitmap, pitch, bpp, redMask, greenMask, blueMask, true);
// Create the Pixel bitmap content depending on the image type
Expand Down Expand Up @@ -152,8 +152,7 @@ private static FIBITMAP ConvertAndSwapChannels(FIBITMAP fBitmap, FREE_IMAGE_TYPE

case FREE_IMAGE_TYPE.FIT_RGBAF:
case FREE_IMAGE_TYPE.FIT_RGBA16:
// Swap R and B channels to make it BGRA
SwitchRedAndBlueChannels(fBitmap);
//Don't switch channels in this case or colors will be shown wrong
break;

default:
Expand Down
22 changes: 11 additions & 11 deletions MonoGame.Framework/Graphics/PackedVector/Rgba64.cs
Expand Up @@ -7,7 +7,7 @@
namespace Microsoft.Xna.Framework.Graphics.PackedVector
{
/// <summary>
/// Packed vector type containing four 16-bit unsigned normalized values ranging from 0 to 1.
/// Packed vector type containing four 16-bit unsigned normalized values ranging from 0 to 1.
/// </summary>
public struct Rgba64 : IPackedVector<ulong>, IEquatable<Rgba64>, IPackedVector
{
Expand Down Expand Up @@ -59,11 +59,11 @@ public Rgba64(Vector4 vector)
public Vector4 ToVector4()
{
return new Vector4(
(float) (((packedValue >> 48) & 0xFFFF) / 65535.0f),
(float) (((packedValue >> 32) & 0xFFFF) / 65535.0f),
(float) (((packedValue >> 16) & 0xFFFF) / 65535.0f),
(float) ((packedValue & 0xFFFF) / 65535.0f)
);
(float) (((packedValue) & 0xFFFF) / 65535.0f),
(float) (((packedValue >> 16) & 0xFFFF) / 65535.0f),
(float) (((packedValue >> 32) & 0xFFFF) / 65535.0f),
(float) (((packedValue >> 48) & 0xFFFF) / 65535.0f)
);
}

/// <summary>
Expand Down Expand Up @@ -126,11 +126,11 @@ public override int GetHashCode()
private static ulong Pack(float x, float y, float z, float w)
{
return (ulong) (
(((int) (MathHelper.Clamp(x, 0, 1) * 65535.0f) & 0xFFFF) << 48) |
(((int) (MathHelper.Clamp(y, 0, 1) * 65535.0f) & 0xFFFF) << 32) |
(((int) (MathHelper.Clamp(z, 0, 1) * 65535.0f) & 0xFFFF) << 16) |
((int) (MathHelper.Clamp(w, 0, 1) * 65535.0f) & 0xFFFF)
);
(((ulong) (MathHelper.Clamp(x, 0, 1) * 65535.0f) ) ) |
(((ulong) (MathHelper.Clamp(y, 0, 1) * 65535.0f) ) << 16) |
(((ulong) (MathHelper.Clamp(z, 0, 1) * 65535.0f) ) << 32) |
(((ulong) (MathHelper.Clamp(w, 0, 1) * 65535.0f) ) << 48)
);
}
}
}
12 changes: 5 additions & 7 deletions MonoGame.Framework/Graphics/Texture2D.OpenGL.cs
Expand Up @@ -515,7 +515,7 @@ private void FillTextureFromStream(Stream stream)

private void PlatformSaveAsJpeg(Stream stream, int width, int height)
{
#if MONOMAC || WINDOWS
#if DESKTOPGL || MONOMAC
SaveAsImage(stream, width, height, ImageFormat.Jpeg);
#elif ANDROID
SaveAsImage(stream, width, height, Bitmap.CompressFormat.Jpeg);
Expand All @@ -526,17 +526,15 @@ private void PlatformSaveAsJpeg(Stream stream, int width, int height)

private void PlatformSaveAsPng(Stream stream, int width, int height)
{
#if MONOMAC || WINDOWS || IOS
var pngWriter = new PngWriter();
pngWriter.Write(this, stream);
#elif ANDROID
#if ANDROID
SaveAsImage(stream, width, height, Bitmap.CompressFormat.Png);
#else
throw new NotImplementedException();
var pngWriter = new PngWriter();
pngWriter.Write(this, stream);
#endif
}

#if MONOMAC || WINDOWS
#if DESKTOPGL || MONOMAC
private void SaveAsImage(Stream stream, int width, int height, ImageFormat format)
{
if (stream == null)
Expand Down
6 changes: 3 additions & 3 deletions MonoGame.Framework/Input/GamePad.cs
Expand Up @@ -29,7 +29,7 @@ public static GamePadCapabilities GetCapabilities(PlayerIndex playerIndex)
public static GamePadCapabilities GetCapabilities(int index)
{
if (index < 0 || index >= PlatformGetMaxNumberOfGamePads())
throw new InvalidOperationException();
return new GamePadCapabilities();

return PlatformGetCapabilities(index);
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone dea
public static GamePadState GetState(int index, GamePadDeadZone deadZoneMode)
{
if (index < 0 || index >= PlatformGetMaxNumberOfGamePads())
throw new InvalidOperationException();
return GamePadState.Default;

return PlatformGetState(index, deadZoneMode);
}
Expand All @@ -103,7 +103,7 @@ public static bool SetVibration(PlayerIndex playerIndex, float leftMotor, float
public static bool SetVibration(int index, float leftMotor, float rightMotor)
{
if (index < 0 || index >= PlatformGetMaxNumberOfGamePads())
throw new InvalidOperationException();
return false;

return PlatformSetVibration(index, MathHelper.Clamp(leftMotor, 0.0f, 1.0f), MathHelper.Clamp(rightMotor, 0.0f, 1.0f));
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -61,7 +61,7 @@ If you are interested in contributing fixes or features to MonoGame, please read
The full source code is available here from GitHub:

* Clone the source: `git clone https://github.com/mono/MonoGame.git`
* Setup the submodules: 'git submodule update --init'
* Setup the submodules: `git submodule update --init`
* Run Protobuild.exe to generate project files and solutions.
* If on Linux or Mac, run it with mono: `mono Protobuild.exe`
* You can generate solutions for platforms that are not buildable from the current OS with:
Expand Down
4 changes: 3 additions & 1 deletion Test/ContentPipeline/TextureImporterTests.cs
Expand Up @@ -115,6 +115,7 @@ public void ImportRGBA16Png()
var importer = new TextureImporter();
var context = new TestImporterContext(intermediateDirectory, outputDirectory);
var content = importer.Import("Assets/Textures/RGBA16.png", context);
ulong expectedPixelValue = 5714832815570484476;
Assert.NotNull(content);
Assert.AreEqual(content.Faces.Count, 1);
Assert.AreEqual(content.Faces[0].Count, 1);
Expand All @@ -123,6 +124,7 @@ public void ImportRGBA16Png()
SurfaceFormat format;
Assert.True(content.Faces[0][0].TryGetFormat(out format));
Assert.AreEqual(SurfaceFormat.Rgba64, format);
Assert.AreEqual(expectedPixelValue, ((PixelBitmapContent<Rgba64>)content.Faces[0][0]).GetRow(1)[12].PackedValue);
// Clean-up the directories it may have produced, ignoring DirectoryNotFound exceptions
try
{
Expand Down Expand Up @@ -173,7 +175,7 @@ public void ImportDdsMipMap()
Assert.NotNull(content);
Assert.AreEqual(content.Faces.Count, 1);
CheckDdsFace(content, 0);

SurfaceFormat format;
Assert.True(content.Faces[0][0].TryGetFormat(out format));
Assert.AreEqual(format, SurfaceFormat.Dxt3);
Expand Down
3 changes: 3 additions & 0 deletions Test/Framework/PackedVectorTest.cs
Expand Up @@ -80,6 +80,9 @@ public void Rgba64()
// Test clamping.
Assert.AreEqual(Vector4.Zero, new Rgba64(Vector4.One * -1234.0f).ToVector4());
Assert.AreEqual(Vector4.One, new Rgba64(Vector4.One * 1234.0f).ToVector4());

//Test data ordering
Assert.AreEqual(0xC7AD8F5C570A1EB8, new Rgba64(((float) 0x1EB8) / 0xffff, ((float) 0x570A) / 0xffff, ((float) 0x8F5C) / 0xffff, ((float) 0xC7AD) /0xffff).PackedValue);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion ThirdParty/Dependencies

0 comments on commit 071136f

Please sign in to comment.