public static MDLMesh CreateBox(Vector3 vector, Vector3i segments, MDLGeometryType geometryType, bool inwardNormals, IMDLMeshBufferAllocator allocator, MDLMeshVectorType type = MDLMeshVectorType.Dimensions) { switch (type) { case MDLMeshVectorType.Dimensions: return(NewBoxWithDimensions(vector, segments, geometryType, inwardNormals, allocator)); case MDLMeshVectorType.Extent: return(new MDLMesh(vector, segments, inwardNormals, geometryType, allocator)); default: throw new ArgumentException("The 'MDLMeshVectorType type' argument needs a value."); } }
public void CreateBoxWithDimensonTest() { Vector3 V3 = new Vector3(1, 2, 3); Vector3i V3i = new Vector3i(4, 5, 6); using (var obj = MDLMesh.CreateBox(V3, V3i, MDLGeometryType.Triangles, true, null)) { Assert.IsNotNull(obj, "obj"); Asserts.AreEqual(new MDLAxisAlignedBoundingBox { MaxBounds = new Vector3(0.5f, 1, 1.5f), MinBounds = new Vector3(-0.5f, -1, -1.5f) }, obj.BoundingBox, "BoundingBox"); Assert.AreEqual((nuint)1, obj.Submeshes.Count, "Submeshes Count"); Assert.AreEqual(1, obj.VertexBuffers.Length, "VertexBuffers Count"); Assert.AreEqual(TestRuntime.CheckXcodeVersion(7, 3) ? (nuint)214 : (nuint)24, 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 static MDLMesh CreateBox(Vector3 dimensions, Vector3i segments, MDLGeometryType geometryType, bool inwardNormals, IMDLMeshBufferAllocator allocator) { return(CreateBox(dimensions, segments, geometryType, inwardNormals, allocator, MDLMeshVectorType.Dimensions)); }
internal MDLMesh(Vector3 extent, Vector3i segments, bool inwardNormals, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator) { InitializeHandle(InitBox(extent, segments, inwardNormals, geometryType, allocator), "initBoxWithExtent:segments:inwardNormals:geometryType:allocator:"); }