-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[modelio] Update for iOS 10.2 beta 1 (#1126)
- Loading branch information
1 parent
7aa3a42
commit c198dc6
Showing
6 changed files
with
203 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#if XAMCORE_2_0 || !MONOMAC | ||
using System; | ||
using XamCore.ObjCRuntime; | ||
using Vector2i = global::OpenTK.Vector2i; | ||
|
||
namespace XamCore.ModelIO { | ||
|
||
[iOS (9,0), Mac (10,11, onlyOn64 : true)] | ||
public enum MDLNoiseTextureType { | ||
Vector, | ||
Cellular, | ||
} | ||
|
||
public partial class MDLNoiseTexture { | ||
[iOS (9,0), Mac (10,11, onlyOn64 : true)] | ||
public MDLNoiseTexture (float input, string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding) : this (input, name, textureDimensions, channelEncoding, MDLNoiseTextureType.Vector) | ||
{ | ||
} | ||
|
||
[iOS (10,2), Mac (10,12, onlyOn64 : true)] | ||
public MDLNoiseTexture (float input, string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding, MDLNoiseTextureType type) | ||
{ | ||
// two different `init*` would share the same C# signature | ||
switch (type) { | ||
case MDLNoiseTextureType.Vector: | ||
Handle = InitVectorNoiseWithSmoothness (input, name, textureDimensions, channelEncoding); | ||
break; | ||
case MDLNoiseTextureType.Cellular: | ||
Handle = InitCellularNoiseWithFrequency (input, name, textureDimensions, channelEncoding); | ||
break; | ||
default: | ||
throw new ArgumentException ("type"); | ||
} | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// | ||
// MDLNoiseTexture Unit Tests | ||
// | ||
// Authors: | ||
// Vincent Dondain <vidondai@microsoft.com> | ||
// | ||
// Copyright 2016 Microsoft | ||
// | ||
|
||
#if !__WATCHOS__ | ||
|
||
using System; | ||
#if XAMCORE_2_0 | ||
using Foundation; | ||
using ModelIO; | ||
using ObjCRuntime; | ||
#else | ||
using MonoTouch.Foundation; | ||
using MonoTouch.ModelIO; | ||
using MonoTouch.ObjCRuntime; | ||
#endif | ||
using OpenTK; | ||
using NUnit.Framework; | ||
|
||
namespace MonoTouchFixtures.ModelIO | ||
{ | ||
|
||
[TestFixture] | ||
// we want the test to be available if we use the linker | ||
[Preserve (AllMembers = true)] | ||
public class MDLNoiseTextureTest | ||
{ | ||
[TestFixtureSetUp] | ||
public void Setup () | ||
{ | ||
TestRuntime.AssertXcodeVersion (8, 2); | ||
|
||
if (Runtime.Arch == Arch.SIMULATOR && IntPtr.Size == 4) { | ||
// There's a bug in the i386 version of objc_msgSend where it doesn't preserve SIMD arguments | ||
// when resizing the cache of method selectors for a type. So here we call all selectors we can | ||
// find, so that the subsequent tests don't end up producing any cache resize (radar #21630410). | ||
object dummy; | ||
using (var obj = new MDLNoiseTexture (1.0f, "texture", Vector2i.Zero, MDLTextureChannelEncoding.Float16)) { | ||
dummy = obj.ChannelCount; | ||
dummy = obj.ChannelEncoding; | ||
dummy = obj.Dimensions; | ||
dummy = obj.IsCube; | ||
dummy = obj.MipLevelCount; | ||
dummy = obj.Name; | ||
dummy = obj.RowStride; | ||
obj.GetTexelDataWithBottomLeftOrigin (); | ||
obj.GetTexelDataWithBottomLeftOrigin (1, false); | ||
obj.GetTexelDataWithTopLeftOrigin (); | ||
obj.GetTexelDataWithTopLeftOrigin (1, false); | ||
} | ||
using (var obj = new MDLTexture ()) { | ||
} | ||
} | ||
} | ||
|
||
[Test] | ||
public void Ctor () | ||
{ | ||
var V2 = new Vector2i (123, 456); | ||
|
||
using (var obj = new MDLNoiseTexture (1.0f, "texture", V2, MDLTextureChannelEncoding.Float16, MDLNoiseTextureType.Cellular)) { | ||
Asserts.AreEqual (V2, obj.Dimensions, "dimensions"); | ||
} | ||
|
||
using (var obj = new MDLNoiseTexture (1.0f, "texture", V2, MDLTextureChannelEncoding.Float16, MDLNoiseTextureType.Vector)) { | ||
Asserts.AreEqual (V2, obj.Dimensions, "dimensions"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#endif // !__WATCHOS__ |