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:"); } }
public void Vector2dTest() { if (!TestRuntime.CheckXcodeVersion(8, 0)) { Assert.Ignore("Ignoring GameplayKit tests: Requires iOS10+"); } var size = new Vector2d(1.0, 1.0); var origin = new Vector2d(0, 0); var sample = new Vector2i(100, 100); using (var noise = new GKNoise(GKCylindersNoiseSource.Create(1))) using (var baseMap = new GKNoiseMap(noise)) using (var map = new GKNoiseMap(noise, size, origin, sample, false)) { Assert.NotNull(baseMap, "baseMap is null"); Assert.NotNull(map, "baseMap is null"); Assert.AreEqual(size, map.Size, "map size is different"); Assert.AreEqual(size, baseMap.Size, "baseMap size is different"); Assert.AreEqual(origin, map.Origin, "map origin is different"); Assert.AreEqual(origin, baseMap.Origin, "baseMap origin is different"); Assert.AreEqual(sample, map.SampleCount, "map sample is different"); Assert.AreEqual(sample, baseMap.SampleCount, "baseMap sample is different"); } }
public void Ctor() { var V2 = new Vector2i(123, 456); using (var obj = new MDLTexture(null, true, null, V2, 12, 2, MDLTextureChannelEncoding.Float16, false)) { Asserts.AreEqual(V2, obj.Dimensions, "dimensions"); } }
public void DimensionsTest() { var V2 = new Vector2i(123, 456); using (var txt = new MDLTexture()) { Asserts.AreEqual(Vector2i.Zero, txt.Dimensions, "a"); } }
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"); } }
public void CreatePaneTest() { TestRuntime.AssertXcodeVersion(8, 0); Vector3 V3 = new Vector3(1, 2, 3); Vector2i V2i = new Vector2i(4, 5); using (var obj = MDLMesh.CreatePlane(V3, V2i, MDLGeometryType.Triangles, null)) { Assert.IsNotNull(obj, "obj"); Assert.AreEqual((nuint)1, obj.Submeshes.Count, "Submeshes Count"); Assert.That(obj.VertexBuffers.Length, Is.GreaterThanOrEqualTo(1), "VertexBuffers Count"); Assert.AreEqual((nuint)30, obj.VertexCount, "VertexCount"); Assert.AreEqual((nuint)31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count"); Assert.AreEqual((nuint)31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count"); } }
public void CreatePlaneTest() { var V2 = new Vector2(3, 3); var V2i = new Vector2i(3, 3); using (var obj = MDLMesh.CreatePlane(V2, V2i, MDLGeometryType.Triangles, null)) { Assert.IsNotNull(obj, "obj"); Asserts.AreEqual(new MDLAxisAlignedBoundingBox { MaxBounds = new Vector3(1.5f, 0, 1.5f), MinBounds = new Vector3(-1.5f, 0, -1.5f) }, obj.BoundingBox, "BoundingBox"); Assert.AreEqual((nuint)1, obj.Submeshes.Count, "Submeshes Count"); Assert.That(obj.VertexBuffers.Length, Is.GreaterThanOrEqualTo(1), "VertexBuffers Count"); Assert.AreEqual((nuint)16, obj.VertexCount, "VertexCount"); Assert.AreEqual((nuint)31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count"); Assert.AreEqual((nuint)31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count"); } }
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"); } }
public void CreateHemisphereTest() { TestRuntime.AssertXcodeVersion(8, 0); 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((nuint)1, obj.Submeshes.Count, "Submeshes Count"); Assert.AreEqual(1, obj.VertexBuffers.Length, "VertexBuffers Count"); Assert.That(obj.VertexCount, Is.GreaterThanOrEqualTo((nuint)16), "VertexCount"); Assert.AreEqual((nuint)31, obj.VertexDescriptor.Attributes.Count, "VertexDescriptor Attributes Count"); Assert.AreEqual((nuint)31, obj.VertexDescriptor.Layouts.Count, "VertexDescriptor Layouts Count"); } }
public void CreateIrradianceTextureCubeTest_b() { var V2 = new Vector2i(3, 3); using (var obj = new MDLTexture()) { using (var txt = MDLTexture.CreateIrradianceTextureCube(obj, "name", V2, 0.1234f)) { if (TestRuntime.CheckXcodeVersion(8, 0)) { Assert.IsNull(txt, "Is Null"); // this is probably because the arguments to CreateIrradianceTextureCube are invalid, but I haven't been able to figure out valid values. } else { Assert.IsNotNull(txt, "Ain't Null"); Assert.AreEqual((nuint)4, txt.ChannelCount, "ChannelCount"); Assert.AreEqual(MDLTextureChannelEncoding.UInt8, txt.ChannelEncoding, "ChannelEncoding"); Assert.AreEqual(new Vector2i(3, 18), txt.Dimensions, "Dimensions"); Assert.AreEqual((nuint)1, txt.MipLevelCount, "MipLevelCount"); Assert.AreEqual((nint)12, txt.RowStride, "RowStride"); } } } }
public static MDLMesh CreateCylinder(Vector3 extent, Vector2i segments, bool inwardNormals, bool topCap, bool bottomCap, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator) { return(new MDLMesh(extent, segments, inwardNormals, topCap, bottomCap, geometryType, allocator)); }
public static void AreEqual(Vector2i expected, Vector2i actual, string message) { Assert.AreEqual(expected.X, actual.X, message + " (X)"); Assert.AreEqual(expected.Y, actual.Y, message + " (Y)"); }
public virtual GKGridGraphNode GetNodeAt(Vector2i position) { return(GetNodeAt <GKGridGraphNode> (position)); }
public NodeType GetNodeAt <NodeType> (Vector2i position) where NodeType : GKGridGraphNode { return(Runtime.GetNSObject <NodeType> (_GetNodeAt(position))); }
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 CreatePlane(Vector3 extent, Vector2i segments, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator) { return(new MDLMesh(extent, segments, geometryType, allocator)); }
internal MDLMesh(Vector3 extent, Vector2i segments, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator) { InitializeHandle(InitPlane(extent, segments, geometryType, allocator), "initPlaneWithExtent:segments:geometryType:allocator:"); }
public MDLNoiseTexture(float input, string name, Vector2i textureDimensions, MDLTextureChannelEncoding channelEncoding) : this(input, name, textureDimensions, channelEncoding, MDLNoiseTextureType.Vector) { }
public static void AreEqual(Vector2i expected, Vector2i actual, string message) { Assert.AreEqual(expected.X, actual.X, $"{message} (X) expected: {expected} actual: {actual}"); Assert.AreEqual(expected.Y, actual.Y, $"{message} (Y) expected: {expected} actual: {actual}"); }
internal MDLMesh(Vector3 extent, Vector2i segments, bool inwardNormals, bool topCap, bool bottomCap, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator) { InitializeHandle(InitCylinder(extent, segments, inwardNormals, topCap, bottomCap, geometryType, allocator), "initCylinderWithExtent:segments:inwardNormals:topCap:bottomCap:geometryType:allocator:"); }