BNBMeshInstance

Objective-C

@interface BNBMeshInstance : NSObject

/**
 *Fabric method for mesh_instance creating.
 *@return mesh_instance component (mesh_instance)
 */
+ (nullable BNBMeshInstance *)create;

/**
 *set mesh visibility flag. Will be overridden if entity with mesh_instance component is child of entity with face_tracker component.
 *@param visible(bool) visibility flag.
 */
- (void)setVisible:(BOOL)visible;

/**@return visibility flag (bool) */
- (BOOL)isVisible;

/**
 *set for mesh sub geometry with specified name specified material if sub geometry with given name exists.
 *@param subGeometryName (string) sub geometry name.
 *@param material (material) sub geometry material.
 */
- (void)setSubGeometryMaterial:(nonnull NSString *)subGeometryName
                      material:(nullable BNBMaterial *)material;

/**
 *returns material from mesh sub geometry with specified name if it exist, null otherwise
 *@param subGeometryName (string) sub geometry name.
 *@return sub geometry material (material).
 */
- (nullable BNBMaterial *)getSubGeometryMaterial:(nonnull NSString *)subGeometryName;

/**
 *get materials for each sub geometry
 *@return materials (list<material>)
 */
- (nonnull NSArray<BNBMaterial *> *)getMaterials;

/**
 *set mesh for given mesh instance. Of some mesh was settled before need to re set all materials.
 *@param mesh (mesh) new mesh.
 */
- (void)setMesh:(nullable BNBMesh *)mesh;

/**@return mesh (mesh). */
- (nullable BNBMesh *)getMesh;

/**
 *Change current animation if animation with specified name exist.
 *@param name (string) new animation.
 *@param mode (animation_mode).
 */
- (void)animationChange:(nonnull NSString *)animation
                   mode:(BNBAnimationMode)mode;

/**Start animation playback. */
- (void)animationPlay;

/**pause animation playback. */
- (void)animationPause;

/**
 *Set current animation playback position.
 *@param positionNs (long): position in ns.
 */
- (void)animationSeek:(int64_t)positionNs;

/**
 *True if animation playback was started.
 *@return animation playback active flag (bool).
 */
- (BOOL)isAnimationPlaying;

/**
 *True if animation playback stop.
 *@return animation playback active flag (bool).
 */
- (BOOL)isAnimationEnded;

/**@return current setted animation name (string). */
- (nonnull NSString *)getAnimation;

/**@return current setted animation mode (animation_mode). Can be off loop once once_reversed fixed. */
- (BNBAnimationMode)getAnimationMode;

/**@return current animation playback position (long). */
- (int64_t)getAnimationPositionNs;

/**@return current animation playback duration (long). */
- (int64_t)getAnimationDurationNs;

/**
 *Returns current animation playback time offset from begin(0). Typycally equals animation position mod animation duration.
 *@return animation playback time offset (long).
 */
- (int64_t)getAnimationTimeOffsetNs;

/**
 *Set current animation playback time offset from begin(0). duration.
 *@param timeNs (long): animation playback time offset.
 */
- (void)setAnimationTimeOffsetNs:(int64_t)timeNs;

/**@return physics_simulator of current mesh_instance  */
- (nullable BNBPhysicsSimulator *)getPhysicsSimulator;

/**@return upcast to base type */
- (nullable BNBComponent *)asComponent;

@end

Swift

class BNBMeshInstance : NSObject

Undocumented

  • Fabric method for mesh_instance creating.

    Declaration

    Objective-C

    + (nullable BNBMeshInstance *)create;

    Swift

    class func create() -> BNBMeshInstance?

    Return Value

    mesh_instance component (mesh_instance)

  • set mesh visibility flag. Will be overridden if entity with mesh_instance component is child of entity with face_tracker component.

    Declaration

    Objective-C

    - (void)setVisible:(BOOL)visible;

    Swift

    func setVisible(_ visible: Bool)

    Parameters

    visible(bool)

    visibility flag.

  • Declaration

    Objective-C

    - (BOOL)isVisible;

    Swift

    func isVisible() -> Bool

    Return Value

    visibility flag (bool)

  • set for mesh sub geometry with specified name specified material if sub geometry with given name exists.

    Declaration

    Objective-C

    - (void)setSubGeometryMaterial:(nonnull NSString *)subGeometryName
                          material:(nullable BNBMaterial *)material;

    Swift

    func setSubGeometryMaterial(_ subGeometryName: String, material: BNBMaterial?)

    Parameters

    subGeometryName

    (string) sub geometry name.

    material

    (material) sub geometry material.

  • returns material from mesh sub geometry with specified name if it exist, null otherwise

    Declaration

    Objective-C

    - (nullable BNBMaterial *)getSubGeometryMaterial:
        (nonnull NSString *)subGeometryName;

    Swift

    func getSubGeometryMaterial(_ subGeometryName: String) -> BNBMaterial?

    Parameters

    subGeometryName

    (string) sub geometry name.

    Return Value

    sub geometry material (material).

  • get materials for each sub geometry

    Declaration

    Objective-C

    - (nonnull NSArray<BNBMaterial *> *)getMaterials;

    Swift

    func getMaterials() -> [BNBMaterial]

    Return Value

    materials (list)

  • set mesh for given mesh instance. Of some mesh was settled before need to re set all materials.

    Declaration

    Objective-C

    - (void)setMesh:(nullable BNBMesh *)mesh;

    Swift

    func setMesh(_ mesh: BNBMesh?)

    Parameters

    mesh

    (mesh) new mesh.

  • Declaration

    Objective-C

    - (nullable BNBMesh *)getMesh;

    Swift

    func getMesh() -> BNBMesh?

    Return Value

    mesh (mesh).

  • Change current animation if animation with specified name exist.

    Declaration

    Objective-C

    - (void)animationChange:(nonnull NSString *)animation
                       mode:(BNBAnimationMode)mode;

    Swift

    func animationChange(_ animation: String, mode: BNBAnimationMode)

    Parameters

    name

    (string) new animation.

    mode

    (animation_mode).

  • Start animation playback.

    Declaration

    Objective-C

    - (void)animationPlay;

    Swift

    func animationPlay()
  • pause animation playback.

    Declaration

    Objective-C

    - (void)animationPause;

    Swift

    func animationPause()
  • Set current animation playback position.

    Declaration

    Objective-C

    - (void)animationSeek:(int64_t)positionNs;

    Swift

    func animationSeek(_ positionNs: Int64)

    Parameters

    positionNs

    (long): position in ns.

  • True if animation playback was started.

    Declaration

    Objective-C

    - (BOOL)isAnimationPlaying;

    Swift

    func isAnimationPlaying() -> Bool

    Return Value

    animation playback active flag (bool).

  • True if animation playback stop.

    Declaration

    Objective-C

    - (BOOL)isAnimationEnded;

    Swift

    func isAnimationEnded() -> Bool

    Return Value

    animation playback active flag (bool).

  • Declaration

    Objective-C

    - (nonnull NSString *)getAnimation;

    Swift

    func getAnimation() -> String

    Return Value

    current setted animation name (string).

  • Declaration

    Objective-C

    - (BNBAnimationMode)getAnimationMode;

    Swift

    func getAnimationMode() -> BNBAnimationMode

    Return Value

    current setted animation mode (animation_mode). Can be off loop once once_reversed fixed.

  • Declaration

    Objective-C

    - (int64_t)getAnimationPositionNs;

    Swift

    func getAnimationPositionNs() -> Int64

    Return Value

    current animation playback position (long).

  • Declaration

    Objective-C

    - (int64_t)getAnimationDurationNs;

    Swift

    func getAnimationDurationNs() -> Int64

    Return Value

    current animation playback duration (long).

  • Returns current animation playback time offset from begin(0). Typycally equals animation position mod animation duration.

    Declaration

    Objective-C

    - (int64_t)getAnimationTimeOffsetNs;

    Swift

    func getAnimationTimeOffsetNs() -> Int64

    Return Value

    animation playback time offset (long).

  • Set current animation playback time offset from begin(0). duration.

    Declaration

    Objective-C

    - (void)setAnimationTimeOffsetNs:(int64_t)timeNs;

    Swift

    func setAnimationTimeOffsetNs(_ timeNs: Int64)

    Parameters

    timeNs

    (long): animation playback time offset.

  • Declaration

    Objective-C

    - (nullable BNBPhysicsSimulator *)getPhysicsSimulator;

    Swift

    func getPhysicsSimulator() -> BNBPhysicsSimulator?

    Return Value

    physics_simulator of current mesh_instance

  • Declaration

    Objective-C

    - (nullable BNBComponent *)asComponent;

    Swift

    func asComponent() -> BNBComponent?

    Return Value

    upcast to base type