Skip to content

Commit a4d347d

Browse files
authored
[ModelIO] Improve and simplify the manually bound constructors for MDLNoiseTexture slightly. (#22844)
Improve and simplify the manually bound constructors for MDLNoiseTexture by using the same pattern we use elsewhere for manually bound constructors.
1 parent 1652dee commit a4d347d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/ModelIO/MDLNoiseTexture.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using Foundation;
23
using ObjCRuntime;
34

45
#if NET
@@ -24,17 +25,18 @@ public MDLNoiseTexture (float input, string name, Vector2i textureDimensions, MD
2425
[SupportedOSPlatform ("tvos")]
2526
#endif
2627
public MDLNoiseTexture (float input, string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding, MDLNoiseTextureType type)
28+
: base (NSObjectFlag.Empty)
2729
{
2830
// two different `init*` would share the same C# signature
2931
switch (type) {
3032
case MDLNoiseTextureType.Vector:
31-
Handle = InitVectorNoiseWithSmoothness (input, name, textureDimensions, channelEncoding);
33+
InitializeHandle (_InitVectorNoiseWithSmoothness (input, name, textureDimensions, channelEncoding), "initVectorNoiseWithSmoothness:name:textureDimensions:channelEncoding:");
3234
break;
3335
case MDLNoiseTextureType.Cellular:
34-
Handle = InitCellularNoiseWithFrequency (input, name, textureDimensions, channelEncoding);
36+
InitializeHandle (_InitCellularNoiseWithFrequency (input, name, textureDimensions, channelEncoding), "initCellularNoiseWithFrequency:name:textureDimensions:channelEncoding:");
3537
break;
3638
default:
37-
throw new ArgumentException ("type");
39+
throw new ArgumentException (nameof (type));
3840
}
3941
}
4042
}

src/modelio.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,7 @@ interface MDLNoiseTexture {
21502150
[Internal]
21512151
[Export ("initVectorNoiseWithSmoothness:name:textureDimensions:channelEncoding:")]
21522152
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
2153-
IntPtr InitVectorNoiseWithSmoothness (float smoothness, [NullAllowed] string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding);
2153+
IntPtr _InitVectorNoiseWithSmoothness (float smoothness, [NullAllowed] string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding);
21542154

21552155
/// <param name="smoothness">To be added.</param>
21562156
/// <param name="name">
@@ -2171,7 +2171,7 @@ interface MDLNoiseTexture {
21712171
[MacCatalyst (13, 1)]
21722172
[Export ("initCellularNoiseWithFrequency:name:textureDimensions:channelEncoding:")]
21732173
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
2174-
IntPtr InitCellularNoiseWithFrequency (float frequency, [NullAllowed] string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding);
2174+
IntPtr _InitCellularNoiseWithFrequency (float frequency, [NullAllowed] string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding);
21752175
}
21762176

21772177
/// <summary>Class that generates a texture that contains surface normal data.</summary>

tests/cecil-tests/ConstructorTest.KnownFailures.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public partial class ConstructorTest {
4343
"ModelIO.MDLMesh::.ctor(System.Numerics.Vector3,CoreGraphics.NVector2i,System.Boolean,System.Boolean,System.Boolean,ModelIO.MDLGeometryType,ModelIO.IMDLMeshBufferAllocator)",
4444
"ModelIO.MDLMesh::.ctor(System.Numerics.Vector3,CoreGraphics.NVector3i,System.Boolean,ModelIO.MDLGeometryType,ModelIO.IMDLMeshBufferAllocator)",
4545
"ModelIO.MDLMesh::.ctor(System.Numerics.Vector3,System.Boolean,ModelIO.MDLGeometryType,ModelIO.IMDLMeshBufferAllocator)",
46-
"ModelIO.MDLNoiseTexture::.ctor(System.Single,System.String,CoreGraphics.NVector2i,ModelIO.MDLTextureChannelEncoding,ModelIO.MDLNoiseTextureType)",
4746
"SpriteKit.SKWarpGeometryGrid::.ctor(System.IntPtr,System.IntPtr,System.Numerics.Vector2[],System.Numerics.Vector2[])",
4847
"UIKit.UIControlEventProxy::.ctor(UIKit.UIControl,System.EventHandler)",
4948
"UIKit.UIImageStatusDispatcher::.ctor(UIKit.UIImage/SaveStatus)",

tests/cecil-tests/SetHandleTest.KnownFailures.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public partial class SetHandleTest {
1717
"Foundation.NSUuid::.ctor(System.Byte[])",
1818
"GameplayKit.GKPath::.ctor(System.Numerics.Vector2[],System.Single,System.Boolean)",
1919
"GameplayKit.GKPath::.ctor(System.Numerics.Vector3[],System.Single,System.Boolean)",
20-
"ModelIO.MDLNoiseTexture::.ctor(System.Single,System.String,CoreGraphics.NVector2i,ModelIO.MDLTextureChannelEncoding,ModelIO.MDLNoiseTextureType)",
2120
"ObjCRuntime.Runtime::RegisterNSObject(Foundation.NSObject,System.IntPtr)",
2221
"ScreenCaptureKit.SCContentFilter::.ctor(ScreenCaptureKit.SCDisplay,ScreenCaptureKit.SCRunningApplication[],ScreenCaptureKit.SCWindow[],ScreenCaptureKit.SCContentFilterOption)",
2322
"ScreenCaptureKit.SCContentFilter::.ctor(ScreenCaptureKit.SCDisplay,ScreenCaptureKit.SCWindow[],ScreenCaptureKit.SCContentFilterOption)",

0 commit comments

Comments
 (0)