Package apple.modelio
Class MDLMesh
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.modelio.MDLObject
-
- apple.modelio.MDLMesh
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.modelio.MDLObject
MDLObject.Block_enumerateChildObjectsOfClassRootUsingBlockStopPointer
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMDLMesh(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()voidaddAttributeWithNameFormat(java.lang.String name, long format)addAttributeWithName:format Convenience method to add an attribute The mesh's allocator will be used to create storage for the new attribute.voidaddAttributeWithNameFormatTypeDataStride(java.lang.String name, long format, java.lang.String type, NSData data, long stride)addAttributeWithName:format:type:data:stride Create a new vertex attribute including an associated buffer with a copy of the supplied data, and update the vertex descriptor accordinglyvoidaddAttributeWithNameFormatTypeDataStrideTime(java.lang.String name, long format, java.lang.String type, NSData data, long stride, double time)addAttributeWithName:format:type:data:stride:time Create a new vertex attribute including an associated buffer with a copy of the supplied data, and update the vertex descriptor accordingly Adding an attribute, such as position data, at multiple times will result in attributes being created for each of those times.voidaddNormalsWithAttributeNamedCreaseThreshold(java.lang.String attributeName, float creaseThreshold)addNormalsWithAttributeNamed:creaseThreshold: Calculate and add vertex normal data Uses the attribute named MDLVertexAttributePosition to calculate vertex normals.voidaddOrthTanBasisForTextureCoordinateAttributeNamedNormalAttributeNamedTangentAttributeNamed(java.lang.String textureCoordinateAttributeName, java.lang.String normalAttributeName, java.lang.String tangentAttributeName)addOrthTanBasisForTextureCoordinateAttributeNamed:normalAttributeNamed:tangentAttributeNamed Create an orthonormal tangent basis with tangent specified Uses the attribute named MDLVertexAttributePosition and textureCoordinateAttributeName and the specified normals to calculate tangent information.voidaddTangentBasisForTextureCoordinateAttributeNamedNormalAttributeNamedTangentAttributeNamed(java.lang.String textureCoordinateAttributeName, java.lang.String normalAttributeName, java.lang.String tangentAttributeName)addTangentBasisForTextureCoordinateAttributeNamed:normalAttributeNamed:tangentAttributeNamed Create tangents which are orthogonal to the normal Uses the attribute named MDLVertexAttributePosition and textureCoordinateAttributeName and the specified normals to calculate tangent information.voidaddTangentBasisForTextureCoordinateAttributeNamedTangentAttributeNamedBitangentAttributeNamed(java.lang.String textureCoordinateAttributeName, java.lang.String tangentAttributeName, java.lang.String bitangentAttributeName)addTangentBasisForTextureCoordinateAttributeNamed:tangentAttributeNamed:bitangentAttributeNamed Create a shader basis where the tangent and bitangent span the uv -> object space transform Uses the attribute named MDLVertexAttributePosition and textureCoordinateAttributeName to calculate tangent and bitangent attributes.voidaddUnwrappedTextureCoordinatesForAttributeNamed(java.lang.String textureCoordinateAttributeName)addTextureCoordinatesForAttributeNamed:textureCoordinateAttributeName Creates texture coordinates by unwrapping the mesh Uses the attribute named MDLVertexAttributePosition and if available, the attribute named MDLVertexAttributeNormal to calculate texture coordinatesstatic MDLMeshalloc()MDLMeshBufferAllocatorallocator()[@property] allocator allocator used to allocate contained mesh buffersstatic java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voidflipTextureCoordinatesInAttributeNamed(java.lang.String textureCoordinateAttributeName)flipTextureCoordinatesInAttributeNamed: Flips texture coordinates by performing the operation (u,v) = (u, 1-v) Many application generate model files with texture coordinate mapping assuming a bottom left bitmap origin.booleangenerateAmbientOcclusionTextureWithQualityAttenuationFactorObjectsToConsiderVertexAttributeNamedMaterialPropertyNamed(float bakeQuality, float attenuationFactor, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName, java.lang.String materialPropertyName)generateAmbientOcclusionTextureWithQuality: Creates an Ambient Occlusion texture, returns true upon success, false upon failurebooleangenerateAmbientOcclusionVertexColorsWithQualityAttenuationFactorObjectsToConsiderVertexAttributeNamed(float bakeQuality, float attenuationFactor, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName)booleangenerateAmbientOcclusionVertexColorsWithRaysPerSampleAttenuationFactorObjectsToConsiderVertexAttributeNamed(long raysPerSample, float attenuationFactor, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName)booleangenerateLightMapTextureWithQualityLightsToConsiderObjectsToConsiderVertexAttributeNamedMaterialPropertyNamed(float bakeQuality, NSArray<? extends MDLLight> lightsToConsider, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName, java.lang.String materialPropertyName)booleangenerateLightMapVertexColorsWithLightsToConsiderObjectsToConsiderVertexAttributeNamed(NSArray<? extends MDLLight> lightsToConsider, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName)static longhash_static()MDLMeshinit()MDLMeshinitMeshBySubdividingMeshSubmeshIndexSubdivisionLevelsAllocator(MDLMesh mesh, int submeshIndex, int subdivisionLevels, MDLMeshBufferAllocator allocator)initMeshBySubdividingMesh:submeshIndex:subdivisionLevels:allocator Factory method that generates a subdivided mesh from a source mesh Subdivision levels over four are likely to generate more triangles than can be reasonably displayed.MDLMeshinitWithBufferAllocator(MDLMeshBufferAllocator bufferAllocator)initWithAllocator: Initialize a mesh with an allocatorMDLMeshinitWithVertexBuffersVertexCountDescriptorSubmeshes(NSArray<?> vertexBuffers, long vertexCount, MDLVertexDescriptor descriptor, NSArray<? extends MDLSubmesh> submeshes)initWithVertexBuffer:vertexCount:descriptor:submeshes: Initialize object with an array of vertex buffers (Structure of Arrays) and a collection of submeshes Allows initialization with the layout of the vertexBuffers in a structure-of-arrays form, in other words, non-interleaved vertex attributesMDLMeshinitWithVertexBufferVertexCountDescriptorSubmeshes(MDLMeshBuffer vertexBuffer, long vertexCount, MDLVertexDescriptor descriptor, NSArray<? extends MDLSubmesh> submeshes)initWithVertexBuffer:vertexCount:descriptor:submeshes: Initialize object with a vertex buffer and a collection of submeshesstatic NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)voidmakeVerticesUnique()makeVerticesUnique: Deindexes the vertex array If any vertices are shared on multiple faces, duplicate those vertices so faces do not share vertices.booleanmakeVerticesUniqueAndReturnError(org.moe.natj.general.ptr.Ptr<NSError> error)makeVerticesUniqueAndReturnError: Deindexes the vertex array If any vertices are shared on multiple faces, duplicate those vertices so faces do not share vertices.static MDLMeshmeshWithSCNGeometry(SCNGeometry scnGeometry)static MDLMeshmeshWithSCNGeometryBufferAllocator(SCNGeometry scnGeometry, MDLMeshBufferAllocator bufferAllocator)static java.lang.Objectnew_objc()static java.lang.ObjectnewIcosahedronWithRadiusInwardNormalsAllocator(float radius, boolean inwardNormals, MDLMeshBufferAllocator allocator)static java.lang.ObjectnewIcosahedronWithRadiusInwardNormalsGeometryTypeAllocator(float radius, boolean inwardNormals, long geometryType, MDLMeshBufferAllocator allocator)static java.lang.ObjectnewSubdividedMeshSubmeshIndexSubdivisionLevels(MDLMesh mesh, long submeshIndex, long subdivisionLevels)static MDLMeshobjectWithSCNNode(SCNNode scnNode)static MDLMeshobjectWithSCNNodeBufferAllocator(SCNNode scnNode, MDLMeshBufferAllocator bufferAllocator)voidremoveAttributeNamed(java.lang.String name)removeAttributeNamed: remove an attribute if the named attribute does not exist, nothing happens.voidreplaceAttributeNamedWithData(java.lang.String name, MDLVertexAttributeData newData)replaceAttributeNamed:withData replace existing attribute data with new attribute data retaining the format of the replacement data.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetSubmeshes(NSMutableArray<MDLSubmesh> value)[@property] submeshes Array of submeshes containing an indexbuffer referencing the vertex data and material to be applied when the mesh is renderedstatic voidsetVersion_static(long aVersion)voidsetVertexBuffers(NSArray<?> value)[@property] vertexBuffers Array of buffers containing vertex data The vertex buffers in this array are indexed by the vertex descriptor.voidsetVertexCount(long value)[@property] vertexCount Number of vertices in the vertexBuffers The size of vertex data in each buffer can be computed by multiplying this value with the stride of the buffer in the vertexDescriptor's layoutvoidsetVertexDescriptor(MDLVertexDescriptor value)[@property] vertexDescriptor Immutable vertex descriptor for interpreting data in vertexBuffers Setting this applies the new layout in 'vertexBuffers' thus is a heavyweight operation as structured copies of almost all vertex buffer data could be made.NSMutableArray<MDLSubmesh>submeshes()[@property] submeshes Array of submeshes containing an indexbuffer referencing the vertex data and material to be applied when the mesh is renderedstatic org.moe.natj.objc.Classsuperclass_static()voidupdateAttributeNamedWithData(java.lang.String name, MDLVertexAttributeData newData)updateAttributeNamed:withData update existing attribute data with new attribute data retaining the format of the existing data.static longversion_static()MDLVertexAttributeDatavertexAttributeDataForAttributeNamed(java.lang.String name)vertexAttributeDataForAttributeNamed: convenience selector to get quick access to vertex attribute data the vertex buffer will remain mapped until the MDLVertexAttributeData is freed.MDLVertexAttributeDatavertexAttributeDataForAttributeNamedAsFormat(java.lang.String name, long format)vertexAttributeDataForAttributeNamed:asFormat convenience selector to get quick access to vertex attribute data reformatted to the requested format if necessary.NSArray<?>vertexBuffers()[@property] vertexBuffers Array of buffers containing vertex data The vertex buffers in this array are indexed by the vertex descriptor.longvertexCount()[@property] vertexCount Number of vertices in the vertexBuffers The size of vertex data in each buffer can be computed by multiplying this value with the stride of the buffer in the vertexDescriptor's layoutMDLVertexDescriptorvertexDescriptor()[@property] vertexDescriptor Immutable vertex descriptor for interpreting data in vertexBuffers Setting this applies the new layout in 'vertexBuffers' thus is a heavyweight operation as structured copies of almost all vertex buffer data could be made.-
Methods inherited from class apple.modelio.MDLObject
addChild, children, components, enumerateChildObjectsOfClassRootUsingBlockStopPointer, hidden, instance, name, objectAtPath, parent, path, setChildren, setHidden, setInstance, setName, setParent, setParent_unsafe, setTransform, transform
-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MDLMesh alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
keyPathsForValuesAffectingValueForKey
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
meshWithSCNGeometry
public static MDLMesh meshWithSCNGeometry(SCNGeometry scnGeometry)
-
meshWithSCNGeometryBufferAllocator
public static MDLMesh meshWithSCNGeometryBufferAllocator(SCNGeometry scnGeometry, MDLMeshBufferAllocator bufferAllocator)
-
new_objc
public static java.lang.Object new_objc()
-
newIcosahedronWithRadiusInwardNormalsAllocator
public static java.lang.Object newIcosahedronWithRadiusInwardNormalsAllocator(float radius, boolean inwardNormals, MDLMeshBufferAllocator allocator)
-
newIcosahedronWithRadiusInwardNormalsGeometryTypeAllocator
public static java.lang.Object newIcosahedronWithRadiusInwardNormalsGeometryTypeAllocator(float radius, boolean inwardNormals, long geometryType, MDLMeshBufferAllocator allocator)
-
newSubdividedMeshSubmeshIndexSubdivisionLevels
public static java.lang.Object newSubdividedMeshSubmeshIndexSubdivisionLevels(MDLMesh mesh, long submeshIndex, long subdivisionLevels)
-
objectWithSCNNodeBufferAllocator
public static MDLMesh objectWithSCNNodeBufferAllocator(SCNNode scnNode, MDLMeshBufferAllocator bufferAllocator)
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
version_static
public static long version_static()
-
addAttributeWithNameFormat
public void addAttributeWithNameFormat(java.lang.String name, long format)addAttributeWithName:format Convenience method to add an attribute The mesh's allocator will be used to create storage for the new attribute.
-
addAttributeWithNameFormatTypeDataStride
public void addAttributeWithNameFormatTypeDataStride(java.lang.String name, long format, java.lang.String type, NSData data, long stride)addAttributeWithName:format:type:data:stride Create a new vertex attribute including an associated buffer with a copy of the supplied data, and update the vertex descriptor accordingly- Parameters:
name- The name the attribute can be found byformat- Format of the data, such as MDLVertexFormatFloat3type- The usage of the attribute, such as MDLVertexAttributePositiondata- Object containing the data to be used in the new vertex bufferstride- The increment in bytes from the start of one data entry to the next.
-
addAttributeWithNameFormatTypeDataStrideTime
public void addAttributeWithNameFormatTypeDataStrideTime(java.lang.String name, long format, java.lang.String type, NSData data, long stride, double time)addAttributeWithName:format:type:data:stride:time Create a new vertex attribute including an associated buffer with a copy of the supplied data, and update the vertex descriptor accordingly Adding an attribute, such as position data, at multiple times will result in attributes being created for each of those times. Attributes corresponding to multiple times can be retrieved from the vertex descriptor.- Parameters:
name- The name the attribute can be found byformat- Format of the data, such as MDLVertexFormatFloat3type- The usage of the attribute, such as MDLVertexAttributePositiondata- Object containing the data to be used in the new vertex bufferstride- The increment in bytes from the start of one data entry to the next.time- The time the attribute is to be invoked at.
-
addNormalsWithAttributeNamedCreaseThreshold
public void addNormalsWithAttributeNamedCreaseThreshold(java.lang.String attributeName, float creaseThreshold)addNormalsWithAttributeNamed:creaseThreshold: Calculate and add vertex normal data Uses the attribute named MDLVertexAttributePosition to calculate vertex normals. If the mesh does not have an attribute with 'attributeName', it will be added, otherwise the attribute name will be overwritten with vertex normal data. 'vertexDescriptor' will be updated to reflect the new attribute.- Parameters:
attributeName- Name is the attribute name of vertex normal attribute. If nil, vertex normals will be added with the MDLVertexAttributeNormal name stringcreaseThreshold- Threshold of the dot product between the 2 triangles after which their face normal will be smoothed out. Therefore, a threshold of 0 will smooth everything and a threshold of 1 won't smooth anything.
-
addTangentBasisForTextureCoordinateAttributeNamedNormalAttributeNamedTangentAttributeNamed
public void addTangentBasisForTextureCoordinateAttributeNamedNormalAttributeNamedTangentAttributeNamed(java.lang.String textureCoordinateAttributeName, java.lang.String normalAttributeName, java.lang.String tangentAttributeName)addTangentBasisForTextureCoordinateAttributeNamed:normalAttributeNamed:tangentAttributeNamed Create tangents which are orthogonal to the normal Uses the attribute named MDLVertexAttributePosition and textureCoordinateAttributeName and the specified normals to calculate tangent information. The mesh's vertexDescriptor will be updated to reflect the new attribute if necessary. Note that this method does NOT produce a T.w component which is used in B = (N x T) * T.w Please use addOrthTanBasisForTextureCoordinateAttributeNamed.- Parameters:
textureCoordinateAttributeName- texture coordinates to use in calculationsnormalAttributeName- normals to use in calculationstangentAttributeName- Name of a four component vertex tangent attribute.
-
addTangentBasisForTextureCoordinateAttributeNamedTangentAttributeNamedBitangentAttributeNamed
public void addTangentBasisForTextureCoordinateAttributeNamedTangentAttributeNamedBitangentAttributeNamed(java.lang.String textureCoordinateAttributeName, java.lang.String tangentAttributeName, java.lang.String bitangentAttributeName)addTangentBasisForTextureCoordinateAttributeNamed:tangentAttributeNamed:bitangentAttributeNamed Create a shader basis where the tangent and bitangent span the uv -> object space transform Uses the attribute named MDLVertexAttributePosition and textureCoordinateAttributeName to calculate tangent and bitangent attributes. The mesh's vertexDescriptor will be updated to reflect the new attributes if necessary. The basis may not be orthogonal; to gaurantee an orthogonal tangent basis please use addOrthTanBasisForTextureCoordinateAttibuteNamed selector.- Parameters:
textureCoordinateAttributeName- Name of texture coordinates to use in calculationstangentAttributeName- Name of vertex tangent attribute.bitangentAttributeName- Name of vertex bitangent attribute.
-
addUnwrappedTextureCoordinatesForAttributeNamed
public void addUnwrappedTextureCoordinatesForAttributeNamed(java.lang.String textureCoordinateAttributeName)
addTextureCoordinatesForAttributeNamed:textureCoordinateAttributeName Creates texture coordinates by unwrapping the mesh Uses the attribute named MDLVertexAttributePosition and if available, the attribute named MDLVertexAttributeNormal to calculate texture coordinates- Parameters:
textureCoordinateAttributeName- texture coordinates to modify or create
-
allocator
public MDLMeshBufferAllocator allocator()
[@property] allocator allocator used to allocate contained mesh buffers
-
generateAmbientOcclusionTextureWithQualityAttenuationFactorObjectsToConsiderVertexAttributeNamedMaterialPropertyNamed
public boolean generateAmbientOcclusionTextureWithQualityAttenuationFactorObjectsToConsiderVertexAttributeNamedMaterialPropertyNamed(float bakeQuality, float attenuationFactor, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName, java.lang.String materialPropertyName)generateAmbientOcclusionTextureWithQuality: Creates an Ambient Occlusion texture, returns true upon success, false upon failure- Parameters:
bakeQuality- Float between 0 and 1 that defines quality of the bake process. 0 is of lower quality but bakes faster and uses less memory, where 1 is of higher quality.attenuationFactor- Float between 0 to 1 that defines how to attenuate the AO value. 0 doesn't change it, and at 1, all AO values are white except if they are originally completely black. Quadratic attenuation in between.objectsToConsider- NSArray of MDLMeshes containing the objects to raytrace againstvertexAttributeName- NSString of the MDLVertexAttribute where the vertex texture UVs will be stored. Creates it if it doesn't exist, otherwise overwrites current values.materialPropertyName- NSString of the MDLMaterialProperty that will store the texture in the Mesh.- Returns:
- Success or failure of the baking process.
-
generateAmbientOcclusionVertexColorsWithQualityAttenuationFactorObjectsToConsiderVertexAttributeNamed
public boolean generateAmbientOcclusionVertexColorsWithQualityAttenuationFactorObjectsToConsiderVertexAttributeNamed(float bakeQuality, float attenuationFactor, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName)
-
generateAmbientOcclusionVertexColorsWithRaysPerSampleAttenuationFactorObjectsToConsiderVertexAttributeNamed
public boolean generateAmbientOcclusionVertexColorsWithRaysPerSampleAttenuationFactorObjectsToConsiderVertexAttributeNamed(long raysPerSample, float attenuationFactor, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName)
-
generateLightMapTextureWithQualityLightsToConsiderObjectsToConsiderVertexAttributeNamedMaterialPropertyNamed
public boolean generateLightMapTextureWithQualityLightsToConsiderObjectsToConsiderVertexAttributeNamedMaterialPropertyNamed(float bakeQuality, NSArray<? extends MDLLight> lightsToConsider, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName, java.lang.String materialPropertyName)
-
generateLightMapVertexColorsWithLightsToConsiderObjectsToConsiderVertexAttributeNamed
public boolean generateLightMapVertexColorsWithLightsToConsiderObjectsToConsiderVertexAttributeNamed(NSArray<? extends MDLLight> lightsToConsider, NSArray<? extends MDLObject> objectsToConsider, java.lang.String vertexAttributeName)
-
initMeshBySubdividingMeshSubmeshIndexSubdivisionLevelsAllocator
public MDLMesh initMeshBySubdividingMeshSubmeshIndexSubdivisionLevelsAllocator(MDLMesh mesh, int submeshIndex, int subdivisionLevels, MDLMeshBufferAllocator allocator)
initMeshBySubdividingMesh:submeshIndex:subdivisionLevels:allocator Factory method that generates a subdivided mesh from a source mesh Subdivision levels over four are likely to generate more triangles than can be reasonably displayed. Index and vertex data will use the same allocator used for the source mesh. Loading an asset using the topology preservation flag set to YES will result in the best subdivision results.- Parameters:
mesh- Mesh from which to generate a subdivided meshsubmeshIndex- Index of submesh in Mesh's submesh array from which to generate a subdivided meshsubdivisionLevels- The number of levels to subdivide mesh- Returns:
- Returns a mesh subdivided to index level, unless subdivision is impossible.
-
initWithBufferAllocator
public MDLMesh initWithBufferAllocator(MDLMeshBufferAllocator bufferAllocator)
initWithAllocator: Initialize a mesh with an allocator- Returns:
- An empty mesh
-
initWithVertexBufferVertexCountDescriptorSubmeshes
public MDLMesh initWithVertexBufferVertexCountDescriptorSubmeshes(MDLMeshBuffer vertexBuffer, long vertexCount, MDLVertexDescriptor descriptor, NSArray<? extends MDLSubmesh> submeshes)
initWithVertexBuffer:vertexCount:descriptor:submeshes: Initialize object with a vertex buffer and a collection of submeshes- Parameters:
vertexBuffer- MDLMeshBuffer object containing all vertex data for the meshvertexCount- Number of vertices in the vertexBufferdescriptor- VertexDescriptor specifying how to interpret vertex datasubmeshes- Array of submeshes with index buffers referencing vertex data and/or materials to be applied to mesh- Returns:
- Initialized mesh or nil if descriptor's layout array does not describe a single buffer
-
initWithVertexBuffersVertexCountDescriptorSubmeshes
public MDLMesh initWithVertexBuffersVertexCountDescriptorSubmeshes(NSArray<?> vertexBuffers, long vertexCount, MDLVertexDescriptor descriptor, NSArray<? extends MDLSubmesh> submeshes)
initWithVertexBuffer:vertexCount:descriptor:submeshes: Initialize object with an array of vertex buffers (Structure of Arrays) and a collection of submeshes Allows initialization with the layout of the vertexBuffers in a structure-of-arrays form, in other words, non-interleaved vertex attributes- Parameters:
vertexCount- Number of vertices in vertexBuffersdescriptor- VertexDescriptor specifying how to interpret vertex datasubmeshes- Array of submeshes with index buffers referencing vertex data and/or materials to be applied to mesh- Returns:
- Initialized mesh or nil if descriptor's layout array is incompatible with vertexBuffers array
-
makeVerticesUnique
public void makeVerticesUnique()
makeVerticesUnique: Deindexes the vertex array If any vertices are shared on multiple faces, duplicate those vertices so faces do not share vertices. The vertex buffer and index buffers on submeshes may grow to accomadate any vertices added.
-
removeAttributeNamed
public void removeAttributeNamed(java.lang.String name)
removeAttributeNamed: remove an attribute if the named attribute does not exist, nothing happens.
-
replaceAttributeNamedWithData
public void replaceAttributeNamedWithData(java.lang.String name, MDLVertexAttributeData newData)replaceAttributeNamed:withData replace existing attribute data with new attribute data retaining the format of the replacement data. If the specified attribute does not already exist, it will be created.
-
setSubmeshes
public void setSubmeshes(NSMutableArray<MDLSubmesh> value)
[@property] submeshes Array of submeshes containing an indexbuffer referencing the vertex data and material to be applied when the mesh is rendered
-
setVertexBuffers
public void setVertexBuffers(NSArray<?> value)
[@property] vertexBuffers Array of buffers containing vertex data The vertex buffers in this array are indexed by the vertex descriptor.
-
setVertexCount
public void setVertexCount(long value)
[@property] vertexCount Number of vertices in the vertexBuffers The size of vertex data in each buffer can be computed by multiplying this value with the stride of the buffer in the vertexDescriptor's layout
-
setVertexDescriptor
public void setVertexDescriptor(MDLVertexDescriptor value)
[@property] vertexDescriptor Immutable vertex descriptor for interpreting data in vertexBuffers Setting this applies the new layout in 'vertexBuffers' thus is a heavyweight operation as structured copies of almost all vertex buffer data could be made. Additionally, if the new vertexDescriptor does not have an attribute in the original vertexDescriptor, that attribute will be deleted. If the original vertexDescriptor does not have an attribute in the new vertexDescriptor, the data for the added attribute set as the added attribute's initializationValue property. The allocator associated with each original meshbuffer is used to reallocate the corresponding resultant meshbuffer.
-
submeshes
public NSMutableArray<MDLSubmesh> submeshes()
[@property] submeshes Array of submeshes containing an indexbuffer referencing the vertex data and material to be applied when the mesh is rendered
-
updateAttributeNamedWithData
public void updateAttributeNamedWithData(java.lang.String name, MDLVertexAttributeData newData)updateAttributeNamed:withData update existing attribute data with new attribute data retaining the format of the existing data. If the specified attribute does not already exist, it will be created with the same format as the newData.
-
vertexAttributeDataForAttributeNamed
public MDLVertexAttributeData vertexAttributeDataForAttributeNamed(java.lang.String name)
vertexAttributeDataForAttributeNamed: convenience selector to get quick access to vertex attribute data the vertex buffer will remain mapped until the MDLVertexAttributeData is freed.
-
vertexAttributeDataForAttributeNamedAsFormat
public MDLVertexAttributeData vertexAttributeDataForAttributeNamedAsFormat(java.lang.String name, long format)
vertexAttributeDataForAttributeNamed:asFormat convenience selector to get quick access to vertex attribute data reformatted to the requested format if necessary. If the desired format has less elements than the source attribute elements, excess elements will be discarded. If the desired format has more elements than the source attribute, then the destination elements will be set to zero. The vertex buffer will remain mapped until the MDLVertexAttributeData is freed.
-
vertexBuffers
public NSArray<?> vertexBuffers()
[@property] vertexBuffers Array of buffers containing vertex data The vertex buffers in this array are indexed by the vertex descriptor.
-
vertexCount
public long vertexCount()
[@property] vertexCount Number of vertices in the vertexBuffers The size of vertex data in each buffer can be computed by multiplying this value with the stride of the buffer in the vertexDescriptor's layout
-
vertexDescriptor
public MDLVertexDescriptor vertexDescriptor()
[@property] vertexDescriptor Immutable vertex descriptor for interpreting data in vertexBuffers Setting this applies the new layout in 'vertexBuffers' thus is a heavyweight operation as structured copies of almost all vertex buffer data could be made. Additionally, if the new vertexDescriptor does not have an attribute in the original vertexDescriptor, that attribute will be deleted. If the original vertexDescriptor does not have an attribute in the new vertexDescriptor, the data for the added attribute set as the added attribute's initializationValue property. The allocator associated with each original meshbuffer is used to reallocate the corresponding resultant meshbuffer.
-
addOrthTanBasisForTextureCoordinateAttributeNamedNormalAttributeNamedTangentAttributeNamed
public void addOrthTanBasisForTextureCoordinateAttributeNamedNormalAttributeNamedTangentAttributeNamed(java.lang.String textureCoordinateAttributeName, java.lang.String normalAttributeName, java.lang.String tangentAttributeName)addOrthTanBasisForTextureCoordinateAttributeNamed:normalAttributeNamed:tangentAttributeNamed Create an orthonormal tangent basis with tangent specified Uses the attribute named MDLVertexAttributePosition and textureCoordinateAttributeName and the specified normals to calculate tangent information. The mesh's vertexDescriptor will be updated to reflect the new attribute if necessary. Note that the bitangent can be calculated from the normal and tangent by B = (N x T) * T.w- Parameters:
textureCoordinateAttributeName- texture coordinates to use in calculationsnormalAttributeName- normals to use in calculationstangentAttributeName- Name of a three/four component vertex tangent attribute.
-
flipTextureCoordinatesInAttributeNamed
public void flipTextureCoordinatesInAttributeNamed(java.lang.String textureCoordinateAttributeName)
flipTextureCoordinatesInAttributeNamed: Flips texture coordinates by performing the operation (u,v) = (u, 1-v) Many application generate model files with texture coordinate mapping assuming a bottom left bitmap origin. It can be more convenient to have texture coordinates corresponding to an upper left bitmap origin. This selector will perform the flip operation if the requested texture coordinate attribute exists on the mesh. An exception will be raised if the attribute cannot be found- Parameters:
textureCoordinateAttributeName- texture coordinates to modify
-
makeVerticesUniqueAndReturnError
public boolean makeVerticesUniqueAndReturnError(org.moe.natj.general.ptr.Ptr<NSError> error)
makeVerticesUniqueAndReturnError: Deindexes the vertex array If any vertices are shared on multiple faces, duplicate those vertices so faces do not share vertices. The vertex buffer and index buffers on submeshes may grow to accomadate any vertices added.
-
-