[modelio] Update for iOS 10 beta 1 (#606)
This commit is contained in:
Родитель
b611414ef0
Коммит
5999d9cc4e
|
@ -1389,6 +1389,101 @@ namespace Xamarin.BindingMethods.Generator
|
|||
}
|
||||
);
|
||||
|
||||
// Required for ModelIO
|
||||
data.Add (
|
||||
new FunctionData {
|
||||
Comment = " // IntPtr func (Vector3, Vector2i, bool, IntPtr, IntPtr)",
|
||||
Prefix = "simd__",
|
||||
Variants = Variants.NonStret,
|
||||
ReturnType = Types.IntPtr,
|
||||
Parameters = new ParameterData[] {
|
||||
new ParameterData { TypeData = Types.Vector3 },
|
||||
new ParameterData { TypeData = Types.Vector2i },
|
||||
new ParameterData { TypeData = Types.Bool },
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
data.Add (
|
||||
new FunctionData {
|
||||
Comment = " // IntPtr func (Matrix4, bool);",
|
||||
Prefix = "simd__",
|
||||
Variants = Variants.NonStret,
|
||||
ReturnType = Types.IntPtr,
|
||||
Parameters = new ParameterData[] {
|
||||
new ParameterData { TypeData = Types.Matrix4f },
|
||||
new ParameterData { TypeData = Types.Bool },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
data.Add (
|
||||
new FunctionData {
|
||||
Comment = " // IntPtr func (Vector3, Vector2i, bool, nint, IntPtr)",
|
||||
Prefix = "simd__",
|
||||
Variants = Variants.NonStret,
|
||||
ReturnType = Types.IntPtr,
|
||||
Parameters = new ParameterData[] {
|
||||
new ParameterData { TypeData = Types.Vector3 },
|
||||
new ParameterData { TypeData = Types.Vector2i },
|
||||
new ParameterData { TypeData = Types.Bool },
|
||||
new ParameterData { TypeData = Types.NInt },
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
data.Add (
|
||||
new FunctionData {
|
||||
Comment = " // IntPtr func (IntPtr, nint, UInt32, IntPtr)",
|
||||
Prefix = "simd__",
|
||||
Variants = Variants.NonStret,
|
||||
ReturnType = Types.IntPtr,
|
||||
Parameters = new ParameterData[] {
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
new ParameterData { TypeData = Types.NInt },
|
||||
new ParameterData { TypeData = Types.UInt32 },
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
data.Add (
|
||||
new FunctionData {
|
||||
Comment = " // IntPtr func (Vector3, Vector2i, bool, bool, nint, IntPtr)",
|
||||
Prefix = "simd__",
|
||||
Variants = Variants.NonStret,
|
||||
ReturnType = Types.IntPtr,
|
||||
Parameters = new ParameterData[] {
|
||||
new ParameterData { TypeData = Types.Vector3 },
|
||||
new ParameterData { TypeData = Types.Vector2i },
|
||||
new ParameterData { TypeData = Types.Bool },
|
||||
new ParameterData { TypeData = Types.Bool },
|
||||
new ParameterData { TypeData = Types.NInt },
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
data.Add (
|
||||
new FunctionData {
|
||||
Comment = " // IntPtr func (Vector3, Vector2i, int, bool, nint, IntPtr)",
|
||||
Prefix = "simd__",
|
||||
Variants = Variants.NonStret,
|
||||
ReturnType = Types.IntPtr,
|
||||
Parameters = new ParameterData[] {
|
||||
new ParameterData { TypeData = Types.Vector3 },
|
||||
new ParameterData { TypeData = Types.Vector2i },
|
||||
new ParameterData { TypeData = Types.Int32 },
|
||||
new ParameterData { TypeData = Types.Bool },
|
||||
new ParameterData { TypeData = Types.NInt },
|
||||
new ParameterData { TypeData = Types.IntPtr },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// We must expand functions with native types to their actual type as well.
|
||||
for (int i = data.Count - 1; i >= 0; i--) {
|
||||
if (!data [i].HasNativeType)
|
||||
|
|
|
@ -14,6 +14,7 @@ using XamCore.Foundation;
|
|||
using XamCore.CoreFoundation;
|
||||
using XamCore.CoreGraphics;
|
||||
using XamCore.ObjCRuntime;
|
||||
using Vector2i = global::OpenTK.Vector2i;
|
||||
using Vector2 = global::OpenTK.Vector2;
|
||||
using Vector3 = global::OpenTK.Vector3;
|
||||
using Vector4 = global::OpenTK.Vector4;
|
||||
|
@ -26,6 +27,53 @@ using MathHelper = global::OpenTK.MathHelper;
|
|||
namespace XamCore.ModelIO {
|
||||
|
||||
partial class MDLMesh {
|
||||
internal MDLMesh (Vector3 extent, Vector2i segments, bool inwardNormals, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator, int? hemisphereSegments, bool? cap, bool? isCone)
|
||||
{
|
||||
if (hemisphereSegments.HasValue) {
|
||||
// initCapsule
|
||||
InitializeHandle (InitCapsule (extent, segments, hemisphereSegments.Value, inwardNormals, geometryType, allocator), "initCapsuleWithExtent:cylinderSegments:hemisphereSegments:inwardNormals:geometryType:allocator:");
|
||||
} else if (cap.HasValue && isCone.HasValue) {
|
||||
// initHemisphere || initCone
|
||||
if (isCone.Value)
|
||||
InitializeHandle (InitCone (extent, segments, inwardNormals, cap.Value, geometryType, allocator), "initConeWithExtent:segments:inwardNormals:cap:geometryType:allocator:");
|
||||
else
|
||||
InitializeHandle (InitHemisphere (extent, segments, inwardNormals, cap.Value, geometryType, allocator), "initHemisphereWithExtent:segments:inwardNormals:cap:geometryType:allocator:");
|
||||
} else {
|
||||
// initSphere
|
||||
InitializeHandle (InitSphere (extent, segments, inwardNormals, geometryType, allocator), "initSphereWithExtent:segments:inwardNormals:geometryType:allocator:");
|
||||
}
|
||||
}
|
||||
|
||||
internal MDLMesh (MDLMesh mesh, int submeshIndex, uint subdivisionLevels, IMDLMeshBufferAllocator allocator)
|
||||
{
|
||||
InitializeHandle (InitMesh (mesh, submeshIndex, subdivisionLevels, allocator), "initMeshBySubdividingMesh:submeshIndex:subdivisionLevels:allocator:");
|
||||
}
|
||||
|
||||
public static MDLMesh CreateSphere (Vector3 dimensions, Vector2i segments, MDLGeometryType geometryType, bool inwardNormals, IMDLMeshBufferAllocator allocator)
|
||||
{
|
||||
return new MDLMesh (dimensions, segments, inwardNormals, geometryType, allocator, null, null, null);
|
||||
}
|
||||
|
||||
public static MDLMesh CreateHemisphere (Vector3 dimensions, Vector2i segments, MDLGeometryType geometryType, bool inwardNormals, bool cap, IMDLMeshBufferAllocator allocator)
|
||||
{
|
||||
return new MDLMesh (dimensions, segments, inwardNormals, geometryType, allocator, null, cap, false);
|
||||
}
|
||||
|
||||
public static MDLMesh CreateCapsule (Vector3 dimensions, Vector2i segments, MDLGeometryType geometryType, bool inwardNormals, int hemisphereSegments, IMDLMeshBufferAllocator allocator)
|
||||
{
|
||||
return new MDLMesh (dimensions, segments, inwardNormals, geometryType, allocator, hemisphereSegments, null, null);
|
||||
}
|
||||
|
||||
public static MDLMesh CreateCone (Vector3 dimensions, Vector2i segments, MDLGeometryType geometryType, bool inwardNormals, bool cap, IMDLMeshBufferAllocator allocator)
|
||||
{
|
||||
return new MDLMesh (dimensions, segments, inwardNormals, geometryType, allocator, null, cap, true);
|
||||
}
|
||||
|
||||
public static MDLMesh CreateSubdividedMesh (MDLMesh mesh, int submeshIndex, uint subdivisionLevels, IMDLMeshBufferAllocator allocator)
|
||||
{
|
||||
return new MDLMesh (mesh, submeshIndex, subdivisionLevels, allocator);
|
||||
}
|
||||
|
||||
public MDLVertexAttributeData AnisotropyVertexData {
|
||||
get {
|
||||
return GetVertexAttributeDataForAttribute (MDLVertexAttributes.Anisotropy);
|
||||
|
|
|
@ -259,5 +259,27 @@ namespace XamCore.ModelIO {
|
|||
}
|
||||
public Vector4 MinimumExtent, MaximumExtent;
|
||||
}
|
||||
|
||||
[Native]
|
||||
public enum MDLCameraProjection : nuint
|
||||
{
|
||||
Perspective = 0,
|
||||
Orthographic = 1,
|
||||
}
|
||||
|
||||
[Native]
|
||||
public enum MDLMaterialFace : nuint
|
||||
{
|
||||
Front = 0,
|
||||
Back,
|
||||
DoubleSided,
|
||||
}
|
||||
|
||||
[Native]
|
||||
public enum MDLProbePlacement : nint
|
||||
{
|
||||
UniformGrid = 0,
|
||||
IrradianceDistribution,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -574,6 +574,11 @@ namespace XamCore.MobileCoreServices {
|
|||
[Field ("kUTTypeStereolithography", "ModelIO")]
|
||||
NSString Stereolithography { get; }
|
||||
|
||||
[NoWatch]
|
||||
[iOS (10,0)][Mac(10,12, onlyOn64 : true)]
|
||||
[Field ("kUTTypeUniversalSceneDescription", "ModelIO")]
|
||||
NSString UniversalSceneDescription { get; }
|
||||
|
||||
[Watch (2,2)]
|
||||
[iOS (9,1)][TV (9,0)]
|
||||
[NoMac]
|
||||
|
|
297
src/modelio.cs
297
src/modelio.cs
|
@ -67,6 +67,11 @@ namespace XamCore.ModelIO {
|
|||
[Export ("initWithURL:vertexDescriptor:bufferAllocator:")]
|
||||
IntPtr Constructor (NSUrl url, [NullAllowed] MDLVertexDescriptor vertexDescriptor, [NullAllowed] IMDLMeshBufferAllocator bufferAllocator);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[NoMac]
|
||||
[Export ("initWithBufferAllocator:")]
|
||||
IntPtr Constructor ([NullAllowed] IMDLMeshBufferAllocator bufferAllocator);
|
||||
|
||||
[Export ("initWithURL:vertexDescriptor:bufferAllocator:preserveTopology:error:")]
|
||||
IntPtr Constructor (NSUrl url, [NullAllowed] MDLVertexDescriptor vertexDescriptor, [NullAllowed] IMDLMeshBufferAllocator bufferAllocator, bool preserveTopology, out NSError error);
|
||||
|
||||
|
@ -82,6 +87,11 @@ namespace XamCore.ModelIO {
|
|||
[Export ("canExportFileExtension:")]
|
||||
bool CanExportFileExtension (string extension);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("childObjectsOfClass:")]
|
||||
MDLObject[] GetChildObjects (Class objectClass);
|
||||
|
||||
[Export ("boundingBoxAtTime:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
MDLAxisAlignedBoundingBox GetBoundingBox (double atTime);
|
||||
|
@ -134,6 +144,24 @@ namespace XamCore.ModelIO {
|
|||
MDLAsset FromScene (SCNScene scene, [NullAllowed] IMDLMeshBufferAllocator bufferAllocator);
|
||||
}
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Protocol, Model]
|
||||
[BaseType (typeof(NSObject))]
|
||||
interface MDLLightProbeIrradianceDataSource
|
||||
{
|
||||
[Abstract]
|
||||
[Export ("boundingBox", ArgumentSemantic.Assign)]
|
||||
MDLAxisAlignedBoundingBox BoundingBox { get; set; }
|
||||
|
||||
[Export ("sphericalHarmonicsLevel")]
|
||||
nuint SphericalHarmonicsLevel { get; set; }
|
||||
|
||||
[Export ("sphericalHarmonicsCoefficientsAtPosition:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
NSData GetSphericalHarmonicsCoefficients (Vector3 position);
|
||||
}
|
||||
|
||||
[iOS (9,0), Mac(10,11, onlyOn64 : true)]
|
||||
[BaseType (typeof(MDLObject))]
|
||||
interface MDLCamera
|
||||
|
@ -143,6 +171,11 @@ namespace XamCore.ModelIO {
|
|||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] get;
|
||||
}
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("projection", ArgumentSemantic.Assign)]
|
||||
MDLCameraProjection Projection { get; set; }
|
||||
|
||||
[Export ("frameBoundingBox:setNearAndFar:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
void FrameBoundingBox (MDLAxisAlignedBoundingBox boundingBox, bool setNearAndFar);
|
||||
|
@ -387,6 +420,11 @@ namespace XamCore.ModelIO {
|
|||
[Export ("count")]
|
||||
nuint Count { get; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("materialFace", ArgumentSemantic.Assign)]
|
||||
MDLMaterialFace MaterialFace { get; set; }
|
||||
|
||||
[iOS (9,0), Mac(10,11)]
|
||||
[Static]
|
||||
[Export ("materialWithSCNMaterial:")]
|
||||
|
@ -396,10 +434,7 @@ namespace XamCore.ModelIO {
|
|||
[iOS (9,0)][Mac (10,11, onlyOn64 : true)]
|
||||
[BaseType (typeof(NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
// TODO: NSCopying defined but copyWithZone doesn't work
|
||||
// filled radar://26939747 with Apple
|
||||
// https://trello.com/c/6aIzLH4a
|
||||
interface MDLMaterialProperty : MDLNamed
|
||||
interface MDLMaterialProperty : MDLNamed, NSCopying
|
||||
{
|
||||
[DesignatedInitializer]
|
||||
[Export ("initWithName:semantic:")]
|
||||
|
@ -484,12 +519,73 @@ namespace XamCore.ModelIO {
|
|||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] get;
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] set;
|
||||
}
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("luminance")]
|
||||
float Luminance { get; set; }
|
||||
}
|
||||
|
||||
[iOS (10,0), Mac (10,12)]
|
||||
[BaseType (typeof(NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface MDLMaterialPropertyConnection : MDLNamed
|
||||
{
|
||||
[Export ("initWithOutput:input:")]
|
||||
IntPtr Constructor (MDLMaterialProperty output, MDLMaterialProperty input);
|
||||
|
||||
[NullAllowed, Export ("output", ArgumentSemantic.Weak)]
|
||||
MDLMaterialProperty Output { get; }
|
||||
|
||||
[NullAllowed, Export ("input", ArgumentSemantic.Weak)]
|
||||
MDLMaterialProperty Input { get; }
|
||||
}
|
||||
|
||||
[iOS (10,0), Mac (10,12)]
|
||||
[BaseType (typeof(NSObject))]
|
||||
[DisableDefaultCtor]
|
||||
interface MDLMaterialPropertyNode : MDLNamed
|
||||
{
|
||||
[Export ("initWithInputs:outputs:evaluationFunction:")]
|
||||
IntPtr Constructor (MDLMaterialProperty[] inputs, MDLMaterialProperty[] outputs, Action<MDLMaterialPropertyNode> function);
|
||||
|
||||
[Export ("evaluationFunction", ArgumentSemantic.Copy)]
|
||||
Action<MDLMaterialPropertyNode> EvaluationFunction { get; set; }
|
||||
|
||||
[Export ("inputs")]
|
||||
MDLMaterialProperty[] Inputs { get; }
|
||||
|
||||
[Export ("outputs")]
|
||||
MDLMaterialProperty[] Outputs { get; }
|
||||
}
|
||||
|
||||
[iOS (10,0), Mac (10,12)]
|
||||
[BaseType (typeof(MDLMaterialPropertyNode))]
|
||||
[DisableDefaultCtor]
|
||||
interface MDLMaterialPropertyGraph
|
||||
{
|
||||
[Export ("initWithNodes:connections:")]
|
||||
IntPtr Constructor (MDLMaterialPropertyNode[] nodes, MDLMaterialPropertyConnection[] connections);
|
||||
|
||||
[Export ("evaluate")]
|
||||
void Evaluate ();
|
||||
|
||||
[Export ("nodes")]
|
||||
MDLMaterialPropertyNode[] Nodes { get; }
|
||||
|
||||
[Export ("connections")]
|
||||
MDLMaterialPropertyConnection[] Connections { get; }
|
||||
}
|
||||
|
||||
[iOS (9,0), Mac(10,11, onlyOn64 : true)]
|
||||
[BaseType (typeof(MDLObject))]
|
||||
interface MDLMesh
|
||||
{
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("initWithBufferAllocator:")]
|
||||
IntPtr Constructor ([NullAllowed] IMDLMeshBufferAllocator bufferAllocator);
|
||||
|
||||
[Export ("initWithVertexBuffer:vertexCount:descriptor:submeshes:")]
|
||||
IntPtr Constructor (IMDLMeshBuffer vertexBuffer, nuint vertexCount, MDLVertexDescriptor descriptor, MDLSubmesh [] submeshes);
|
||||
|
||||
|
@ -501,6 +597,12 @@ namespace XamCore.ModelIO {
|
|||
[return: NullAllowed]
|
||||
MDLVertexAttributeData GetVertexAttributeDataForAttribute (string attributeName);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("vertexAttributeDataForAttributeNamed:asFormat:")]
|
||||
[return: NullAllowed]
|
||||
MDLVertexAttributeData GetVertexAttributeData (string attributeName, MDLVertexFormat format);
|
||||
|
||||
[Export ("boundingBox")]
|
||||
MDLAxisAlignedBoundingBox BoundingBox {
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] get;
|
||||
|
@ -510,18 +612,45 @@ namespace XamCore.ModelIO {
|
|||
MDLVertexDescriptor VertexDescriptor { get; set; }
|
||||
|
||||
[Export ("vertexCount")]
|
||||
nuint VertexCount { get; }
|
||||
nuint VertexCount {
|
||||
get;
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
set;
|
||||
}
|
||||
|
||||
[Export ("vertexBuffers", ArgumentSemantic.Retain)]
|
||||
IMDLMeshBuffer[] VertexBuffers { get; }
|
||||
|
||||
[Export ("submeshes", ArgumentSemantic.Retain)]
|
||||
NSMutableArray<MDLSubmesh> Submeshes { get; }
|
||||
[NullAllowed]
|
||||
[Export ("submeshes", ArgumentSemantic.Copy)]
|
||||
NSMutableArray<MDLSubmesh> Submeshes {
|
||||
get;
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
set;
|
||||
}
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("allocator", ArgumentSemantic.Retain)]
|
||||
IMDLMeshBufferAllocator Allocator { get; }
|
||||
|
||||
// MDLMesh_Modifiers (category)
|
||||
|
||||
// These are categories on MDLMesh, so I am inlining them here
|
||||
[Export ("addAttributeWithName:format:")]
|
||||
void AddAttribute (string name, MDLVertexFormat format);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("addAttributeWithName:format:type:data:stride:")]
|
||||
void AddAttribute (string name, MDLVertexFormat format, string type, NSData data, nint stride);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("addAttributeWithName:format:type:data:stride:time:")]
|
||||
void AddAttribute (string name, MDLVertexFormat format, string type, NSData data, nint stride, double time);
|
||||
|
||||
[Export ("addNormalsWithAttributeNamed:creaseThreshold:")]
|
||||
void AddNormals ([NullAllowed] string name, float creaseThreshold);
|
||||
|
||||
|
@ -531,9 +660,56 @@ namespace XamCore.ModelIO {
|
|||
[Export ("addTangentBasisForTextureCoordinateAttributeNamed:normalAttributeNamed:tangentAttributeNamed:")]
|
||||
void AddTangentBasisWithNormals (string textureCoordinateAttributeName, string normalAttributeName, string tangentAttributeName);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("addUnwrappedTextureCoordinatesForAttributeNamed:")]
|
||||
void AddUnwrappedTextureCoordinates (string textureCoordinateAttributeName);
|
||||
|
||||
[Export ("makeVerticesUnique")]
|
||||
void MakeVerticesUnique ();
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("replaceAttributeNamed:withData:")]
|
||||
void ReplaceAttribute (string name, MDLVertexAttributeData newData);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("updateAttributeNamed:withData:")]
|
||||
void UpdateAttribute (string name, MDLVertexAttributeData newData);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("removeAttributeNamed:")]
|
||||
void RemoveAttribute (string name);
|
||||
|
||||
// MDLMesh_Generators (category)
|
||||
|
||||
[Internal]
|
||||
[Export ("initSphereWithExtent:segments:inwardNormals:geometryType:allocator:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr InitSphere (Vector3 extent, Vector2i segments, bool inwardNormals, MDLGeometryType geometryType, [NullAllowed] IMDLMeshBufferAllocator allocator);
|
||||
|
||||
[Internal]
|
||||
[Export ("initHemisphereWithExtent:segments:inwardNormals:cap:geometryType:allocator:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr InitHemisphere (Vector3 extent, Vector2i segments, bool inwardNormals, bool cap, MDLGeometryType geometryType, [NullAllowed] IMDLMeshBufferAllocator allocator);
|
||||
|
||||
[Internal]
|
||||
[Export ("initCapsuleWithExtent:cylinderSegments:hemisphereSegments:inwardNormals:geometryType:allocator:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr InitCapsule (Vector3 extent, Vector2i segments, int hemisphereSegments, bool inwardNormals, MDLGeometryType geometryType, [NullAllowed] IMDLMeshBufferAllocator allocator);
|
||||
|
||||
[Internal]
|
||||
[Export ("initConeWithExtent:segments:inwardNormals:cap:geometryType:allocator:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr InitCone (Vector3 extent, Vector2i segments, bool inwardNormals, bool cap, MDLGeometryType geometryType, [NullAllowed] IMDLMeshBufferAllocator allocator);
|
||||
|
||||
[Internal]
|
||||
[Export ("initMeshBySubdividingMesh:submeshIndex:subdivisionLevels:allocator:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr InitMesh (MDLMesh mesh, int submeshIndex, uint subdivisionLevels, [NullAllowed] IMDLMeshBufferAllocator allocator);
|
||||
|
||||
[Static]
|
||||
[Export ("newBoxWithDimensions:segments:geometryType:inwardNormals:allocator:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
|
@ -758,6 +934,11 @@ namespace XamCore.ModelIO {
|
|||
[NullAllowed, Export ("parent", ArgumentSemantic.Weak)]
|
||||
MDLObject Parent { get; set; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("path")]
|
||||
string Path { get; }
|
||||
|
||||
[NullAllowed, Export ("transform", ArgumentSemantic.Retain)]
|
||||
IMDLTransformComponent Transform { get; set; }
|
||||
|
||||
|
@ -1050,6 +1231,11 @@ namespace XamCore.ModelIO {
|
|||
[Export ("indexBuffer", ArgumentSemantic.Retain)]
|
||||
IMDLMeshBuffer IndexBuffer { get; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("indexBufferAsIndexType:")]
|
||||
IMDLMeshBuffer GetIndexBuffer (MDLIndexBitDepth indexType);
|
||||
|
||||
[Export ("indexCount")]
|
||||
nuint IndexCount { get; }
|
||||
|
||||
|
@ -1152,6 +1338,11 @@ namespace XamCore.ModelIO {
|
|||
|
||||
[Export ("isCube")]
|
||||
bool IsCube { get; set; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("hasAlphaValues")]
|
||||
bool HasAlphaValues { get; set; }
|
||||
}
|
||||
|
||||
[iOS (9,0)][Mac (10,11, onlyOn64 : true)]
|
||||
|
@ -1197,10 +1388,21 @@ namespace XamCore.ModelIO {
|
|||
[Export ("initWithTransformComponent:")]
|
||||
IntPtr Constructor (IMDLTransformComponent component);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("initWithTransformComponent:resetsTransform:")]
|
||||
IntPtr Constructor (IMDLTransformComponent component, bool resetsTransform);
|
||||
|
||||
[Export ("initWithMatrix:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr Constructor (Matrix4 matrix);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("initWithMatrix:resetsTransform:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
IntPtr Constructor (Matrix4 matrix, bool resetsTransform);
|
||||
|
||||
[Export ("setIdentity")]
|
||||
void SetIdentity ();
|
||||
|
||||
|
@ -1285,6 +1487,14 @@ namespace XamCore.ModelIO {
|
|||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")] set;
|
||||
}
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
#if XAMCORE_4_0
|
||||
[Abstract]
|
||||
#endif
|
||||
[Export ("resetsTransform")]
|
||||
bool ResetsTransform { get; set; }
|
||||
|
||||
[Abstract]
|
||||
[Export ("minimumTime")]
|
||||
double MinimumTime { get; }
|
||||
|
@ -1293,6 +1503,14 @@ namespace XamCore.ModelIO {
|
|||
[Export ("maximumTime")]
|
||||
double MaximumTime { get; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
#if XAMCORE_4_0
|
||||
[Abstract]
|
||||
#endif
|
||||
[Export ("keyTimes", ArgumentSemantic.Copy)]
|
||||
NSNumber[] KeyTimes { get; }
|
||||
|
||||
[Export ("setLocalTransform:forTime:")]
|
||||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
void SetLocalTransform (Matrix4 transform, double time);
|
||||
|
@ -1421,6 +1639,11 @@ namespace XamCore.ModelIO {
|
|||
[Export ("addOrReplaceAttribute:")]
|
||||
void AddOrReplaceAttribute (MDLVertexAttribute attribute);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("removeAttributeNamed:")]
|
||||
void RemoveAttribute (string name);
|
||||
|
||||
[Export ("attributes", ArgumentSemantic.Retain)]
|
||||
NSMutableArray<MDLVertexAttribute> Attributes { get; set; }
|
||||
|
||||
|
@ -1438,17 +1661,32 @@ namespace XamCore.ModelIO {
|
|||
}
|
||||
|
||||
[iOS (9,0),Mac(10,11, onlyOn64 : true)]
|
||||
[BaseType (typeof(NSObject))]
|
||||
[BaseType (
|
||||
#if MONOMAC
|
||||
typeof(NSObject)
|
||||
#else
|
||||
typeof(MDLObject)
|
||||
#endif
|
||||
)]
|
||||
[DisableDefaultCtor]
|
||||
interface MDLVoxelArray
|
||||
{
|
||||
|
||||
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use new MDLVoxelArray (MDLAsset, int, float)")]
|
||||
[Obsoleted (PlatformName.iOS, 10, 0, message: "Use new MDLVoxelArray (MDLAsset, int, float)")]
|
||||
[Export ("initWithAsset:divisions:interiorShells:exteriorShells:patchRadius:")]
|
||||
IntPtr Constructor (MDLAsset asset, int divisions, int interiorShells, int exteriorShells, float patchRadius);
|
||||
|
||||
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use new MDLVoxelArray (MDLAsset, int, float)")]
|
||||
[Obsoleted (PlatformName.iOS, 10, 0, message: "Use new MDLVoxelArray (MDLAsset, int, float)")]
|
||||
[Export ("initWithAsset:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:")]
|
||||
IntPtr Constructor (MDLAsset asset, int divisions, float interiorNBWidth, float exteriorNBWidth, float patchRadius);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("initWithAsset:divisions:patchRadius:")]
|
||||
IntPtr Constructor (MDLAsset asset, int divisions, float patchRadius);
|
||||
|
||||
[Export ("initWithData:boundingBox:voxelExtent:")]
|
||||
IntPtr Constructor (NSData voxelData, MDLAxisAlignedBoundingBox boundingBox, float voxelExtent);
|
||||
|
||||
|
@ -1464,9 +1702,18 @@ namespace XamCore.ModelIO {
|
|||
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
|
||||
void SetVoxel (Vector4i index);
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("setVoxelsForMesh:divisions:patchRadius:")]
|
||||
void SetVoxels (MDLMesh mesh, int divisions, float patchRadius);
|
||||
|
||||
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use SetVoxels (MDLMesh, int, float)")]
|
||||
[Obsoleted (PlatformName.iOS, 10, 0, message: "Use SetVoxels (MDLMesh, int, float)")]
|
||||
[Export ("setVoxelsForMesh:divisions:interiorShells:exteriorShells:patchRadius:")]
|
||||
void SetVoxels (MDLMesh mesh, int divisions, int interiorShells, int exteriorShells, float patchRadius);
|
||||
|
||||
[Deprecated (PlatformName.MacOSX, 10, 12, message: "Use SetVoxels (MDLMesh, int, float)")]
|
||||
[Obsoleted (PlatformName.iOS, 10, 0, message: "Use SetVoxels (MDLMesh, int, float)")]
|
||||
[Export ("setVoxelsForMesh:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:")]
|
||||
void SetVoxels (MDLMesh mesh, int divisions, float interiorNBWidth, float exteriorNBWidth, float patchRadius);
|
||||
|
||||
|
@ -1507,6 +1754,38 @@ namespace XamCore.ModelIO {
|
|||
|
||||
[Export ("boundingBox")]
|
||||
MDLAxisAlignedBoundingBox BoundingBox { get; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("convertToSignedShellField")]
|
||||
void ConvertToSignedShellField ();
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("isValidSignedShellField")]
|
||||
bool IsValidSignedShellField { get; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("shellFieldInteriorThickness")]
|
||||
float ShellFieldInteriorThickness { get; set; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("shellFieldExteriorThickness")]
|
||||
float ShellFieldExteriorThickness { get; set; }
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("coarseMesh")]
|
||||
[return: NullAllowed]
|
||||
MDLMesh GetCoarseMesh ();
|
||||
|
||||
// Added in iOS 10 SDK but it is supposed to be present in iOS 9.
|
||||
[Mac (10,12)]
|
||||
[Export ("coarseMeshUsingAllocator:")]
|
||||
[return: NullAllowed]
|
||||
MDLMesh GetCoarseMeshUsingAllocator ([NullAllowed] IMDLMeshBufferAllocator allocator);
|
||||
}
|
||||
|
||||
[Static]
|
||||
|
|
|
@ -73,10 +73,6 @@ namespace Introspection {
|
|||
case "GKScore":
|
||||
// new in iOS8 and 10.0
|
||||
case "NSExtensionContext":
|
||||
// TODO: MDLMaterialProperty has NSCopying defined but copyWithZone doesn't work
|
||||
// filled radar://26939747 with Apple
|
||||
// https://trello.com/c/6aIzLH4a
|
||||
case "MDLMaterialProperty":
|
||||
case "NSLayoutAnchor`1":
|
||||
case "NSLayoutDimension":
|
||||
case "NSLayoutXAxisAnchor":
|
||||
|
|
|
@ -122,6 +122,13 @@ namespace Introspection {
|
|||
return true;
|
||||
}
|
||||
break;
|
||||
case "MDLMaterialProperty":
|
||||
switch (selectorName) {
|
||||
case "copyWithZone:":
|
||||
// not working before iOS 10, macOS 10.12
|
||||
return !TestRuntime.CheckXcodeVersion (8, 0);
|
||||
}
|
||||
break;
|
||||
// Xcode 8 beta 2
|
||||
case "GKGraph":
|
||||
case "NEFlowMetaData":
|
||||
|
@ -156,6 +163,16 @@ namespace Introspection {
|
|||
return true;
|
||||
}
|
||||
break;
|
||||
case "MDLMesh":
|
||||
switch (selectorName) {
|
||||
case "initCapsuleWithExtent:cylinderSegments:hemisphereSegments:inwardNormals:geometryType:allocator:":
|
||||
case "initConeWithExtent:segments:inwardNormals:cap:geometryType:allocator:":
|
||||
case "initHemisphereWithExtent:segments:inwardNormals:cap:geometryType:allocator:":
|
||||
case "initMeshBySubdividingMesh:submeshIndex:subdivisionLevels:allocator:":
|
||||
case "initSphereWithExtent:segments:inwardNormals:geometryType:allocator:":
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "NSImage":
|
||||
switch (selectorName) {
|
||||
case "initByReferencingFile:":
|
||||
|
|
|
@ -12,6 +12,11 @@ using NUnit.Framework;
|
|||
public static class Asserts
|
||||
{
|
||||
#if !__WATCHOS__
|
||||
public static void AreEqual (bool expected, bool actual, string message)
|
||||
{
|
||||
Assert.AreEqual (expected, actual, message + " (M)");
|
||||
}
|
||||
|
||||
public static void AreEqual (float expected, float actual, string message)
|
||||
{
|
||||
Assert.AreEqual (expected, actual, message + " (M)");
|
||||
|
|
|
@ -193,7 +193,6 @@ namespace MonoTouchFixtures.ModelIO {
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("MDLMaterialProperty has NSCopying defined but copyWithZone doesn't work. radar://26939747 - https://trello.com/c/6aIzLH4a")]
|
||||
public void Copy ()
|
||||
{
|
||||
using (var obj = new MDLMaterialProperty ("name", MDLMaterialSemantic.AmbientOcclusion)) {
|
||||
|
|
|
@ -74,6 +74,14 @@ namespace MonoTouchFixtures.ModelIO {
|
|||
}
|
||||
using (var obj = MDLMesh.CreatePlane (new Vector2 (1, 1), new Vector2i (1, 1), MDLGeometryType.Triangles, null)) {
|
||||
}
|
||||
using (var obj = MDLMesh.CreateSphere (new Vector3 (1, 2, 3), new Vector2i (4, 5), MDLGeometryType.Triangles, true, null)) {
|
||||
}
|
||||
using (var obj = MDLMesh.CreateHemisphere (new Vector3 (1, 2, 3), new Vector2i (4, 5), MDLGeometryType.Triangles, true, true, null)) {
|
||||
}
|
||||
using (var obj = MDLMesh.CreateCapsule (new Vector3 (1, 2, 3), new Vector2i (4, 5), MDLGeometryType.Triangles, true, 10, null)) {
|
||||
}
|
||||
using (var obj = MDLMesh.CreateCone (new Vector3 (1, 2, 3), new Vector2i (4, 5), MDLGeometryType.Triangles, true, true, null)) {
|
||||
}
|
||||
// using (var obj = MDLMesh.CreateSubdividedMesh (new MDLMesh (), 0, 0)) {
|
||||
// }
|
||||
|
||||
|
@ -173,6 +181,74 @@ namespace MonoTouchFixtures.ModelIO {
|
|||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateSphereTest ()
|
||||
{
|
||||
Vector3 V3 = new Vector3 (1, 2, 3);
|
||||
Vector2i V2i = new Vector2i (4, 5);
|
||||
|
||||
using (var obj = MDLMesh.CreateSphere (V3, V2i, MDLGeometryType.Triangles, true, null)) {
|
||||
Assert.IsNotNull (obj, "obj");
|
||||
Asserts.AreEqual (new MDLAxisAlignedBoundingBox { MaxBounds = new Vector3 (0.9510565f, 2, 2.85317f), MinBounds = new Vector3 (-0.9510565f, -2, -2.85317f) }, obj.BoundingBox, "BoundingBox");
|
||||
Assert.AreEqual (1, obj.Submeshes.Count, "Submeshes Count");
|
||||
Assert.AreEqual (1, obj.VertexBuffers.Length, "VertexBuffers Count");
|
||||
Assert.AreEqual (22, obj.VertexCount, "VertexCount");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateHemisphereTest ()
|
||||
{
|
||||
Vector3 V3 = new Vector3 (1, 2, 3);
|
||||
Vector2i V2i = new Vector2i (4, 5);
|
||||
|
||||
using (var obj = MDLMesh.CreateHemisphere (V3, V2i, MDLGeometryType.Triangles, true, true, null)) {
|
||||
Assert.IsNotNull (obj, "obj");
|
||||
Asserts.AreEqual (new MDLAxisAlignedBoundingBox { MaxBounds = new Vector3 (0.9510565f, 2, 2.85317f), MinBounds = new Vector3 (-0.9510565f, 0.6180339f, -2.85317f) }, obj.BoundingBox, "BoundingBox");
|
||||
Assert.AreEqual (1, obj.Submeshes.Count, "Submeshes Count");
|
||||
Assert.AreEqual (1, obj.VertexBuffers.Length, "VertexBuffers Count");
|
||||
Assert.AreEqual (16, obj.VertexCount, "VertexCount");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateCapsuleTest ()
|
||||
{
|
||||
Vector3 V3 = new Vector3 (1, 2, 3);
|
||||
Vector2i V2i = new Vector2i (4, 5);
|
||||
|
||||
using (var obj = MDLMesh.CreateCapsule (V3, V2i, MDLGeometryType.Triangles, true, 10, null)) {
|
||||
Assert.IsNotNull (obj, "obj");
|
||||
Asserts.AreEqual (new MDLAxisAlignedBoundingBox { MaxBounds = new Vector3 (0.6f, 1.333333f, 1.8f), MinBounds = new Vector3 (-0.6f, -1, -1.8f) }, obj.BoundingBox, "BoundingBox");
|
||||
Assert.AreEqual (1, obj.Submeshes.Count, "Submeshes Count");
|
||||
Assert.AreEqual (3, obj.VertexBuffers.Length, "VertexBuffers Count");
|
||||
Assert.AreEqual (152, obj.VertexCount, "VertexCount");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateConeTest ()
|
||||
{
|
||||
Vector3 V3 = new Vector3 (1, 2, 3);
|
||||
Vector2i V2i = new Vector2i (4, 5);
|
||||
|
||||
using (var obj = MDLMesh.CreateCone (V3, V2i, MDLGeometryType.Triangles, true, true, null)) {
|
||||
Assert.IsNotNull (obj, "obj");
|
||||
Asserts.AreEqual (new MDLAxisAlignedBoundingBox { MaxBounds = new Vector3 (0.5f, -0.5f, 1.5f), MinBounds = new Vector3 (-0.5f, -2.5f, -1.5f) }, obj.BoundingBox, "BoundingBox");
|
||||
Assert.AreEqual (1, obj.Submeshes.Count, "Submeshes Count");
|
||||
Assert.AreEqual (3, obj.VertexBuffers.Length, "VertexBuffers Count");
|
||||
Assert.AreEqual (36, obj.VertexCount, "VertexCount");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count");
|
||||
Assert.AreEqual (31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count");
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: figure out valid input arguments for GenerateAmbientOcclusionTexture
|
||||
// [Test]
|
||||
// public void GenerateAmbientOcclusionTextureTest ()
|
||||
|
|
|
@ -77,6 +77,18 @@ namespace MonoTouchFixtures.ModelIO {
|
|||
Asserts.AreEqual (Vector3.One, obj.Scale, "Scale");
|
||||
Asserts.AreEqual (Vector3.Zero, obj.Rotation, "Rotation");
|
||||
Asserts.AreEqual (id, obj.Matrix, "Matrix");
|
||||
Asserts.AreEqual (false, obj.ResetsTransform, "ResetsTransform");
|
||||
|
||||
obj.Translation = V3;
|
||||
Asserts.AreEqual (V3, obj.Translation, "Translation 2");
|
||||
}
|
||||
|
||||
using (var obj = new MDLTransform (id, true)) {
|
||||
Asserts.AreEqual (Vector3.Zero, obj.Translation, "Translation");
|
||||
Asserts.AreEqual (Vector3.One, obj.Scale, "Scale");
|
||||
Asserts.AreEqual (Vector3.Zero, obj.Rotation, "Rotation");
|
||||
Asserts.AreEqual (id, obj.Matrix, "Matrix");
|
||||
Asserts.AreEqual (true, obj.ResetsTransform, "ResetsTransform");
|
||||
|
||||
obj.Translation = V3;
|
||||
Asserts.AreEqual (V3, obj.Translation, "Translation 2");
|
||||
|
|
Загрузка…
Ссылка в новой задаче