RRRenderable

Objective-C

@interface RRRenderable : NSObject

Swift

class RRRenderable : NSObject

Base class for renderable objects. Can be used together with the RRAbstractRenderableLayout to display content. Renderables are organized in a hierarchical tree structure. One renderable can have an arbitrary amount of ordered child renderables and can be child of one single parent renderable.

  • Returns a RRRenderableType instance identifying the renderable’s type. This instance can be compared to other RRRenderableType instances using isEqual: returned by the function getRenderableType of any AbstractRenderable subclass.

    Declaration

    Objective-C

    - (RRRenderableType *_Nonnull)getType;

    Swift

    func getType() -> RRRenderableType

    Return Value

    the RRRenderable type instance

  • Compares two renderables for equality. Note, since this is just a wrapper class you must use this functionality to compare renderables instead of just comparing their pointer address!

    Declaration

    Objective-C

    - (BOOL)isEqualToRenderable:(RRRenderable *_Nullable)renderable;

    Swift

    func isEqual(to renderable: RRRenderable?) -> Bool

    Parameters

    renderable

    The renderable to campare with

    Return Value

    Returns YES if equal, NO otherwise.

  • This property returns a list of all child renderables directly associated with this renderable

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray<RRRenderable *> *_Nonnull children;

    Swift

    var children: [RRRenderable] { get }
  • This property returns the parent renderable, which can also be nil if not associated with one

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) RRRenderable *_Nullable parent;

    Swift

    weak var parent: RRRenderable? { get }
  • Add a child renderable to this renderable instance. The child renderable will be appended to the end of the children array

    Declaration

    Objective-C

    - (BOOL)addChild:(RRRenderable *_Nonnull)renderable
        didFailWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func addChild(_ renderable: RRRenderable) throws

    Parameters

    renderable

    The child renderable to add

    error

    An optional pointer to an NSError pointer. When this method fails, it will set an NSError instance to this pointer if provided.

    Return Value

    YES if successful, NO otherwise.

  • Insert a new child renderable at a specified children array index

    Declaration

    Objective-C

    - (BOOL)insertChild:(RRRenderable *_Nonnull)renderable
                   index:(NSUInteger)index
        didFailWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func insertChild(_ renderable: RRRenderable, index: UInt) throws

    Parameters

    renderable

    The child renderable to insert

    index

    The index position to insert at. This index refers to the children array.

    error

    An optional pointer to an NSError pointer. When this method fails, it will set an NSError instance to this pointer if provided.

    Return Value

    YES if successful, NO otherwise.

  • Remove a child from this renderable instance

    Declaration

    Objective-C

    - (void)removeChild:(RRRenderable *_Nonnull)renderable;

    Swift

    func removeChild(_ renderable: RRRenderable)

    Parameters

    renderable

    The child renderable to remove

  • Remove all children of the renderable instance

    Declaration

    Objective-C

    - (void)removeAllChildren;

    Swift

    func removeAllChildren()
  • Remove the renderable instance from its parent renderable’s child renderables

    Declaration

    Objective-C

    - (void)removeFromParent;

    Swift

    func removeFromParent()
  • Check if the renderable instance has a specific parent

    Declaration

    Objective-C

    - (BOOL)hasParent:(RRRenderable *_Nonnull)parent recursive:(BOOL)recursive;

    Swift

    func hasParent(_ parent: RRRenderable, recursive: Bool) -> Bool

    Parameters

    parent

    The parent renderable to check for

    recursive

    Setting this parameter to YES will search for the provided parent renderable recursive. Otherwise just the instance’s own parent is compared

    Return Value

    Returns whether the provided parent renderable was identified as a parent of the instance this method was called on

  • This property defines the local 3D transformation of the renderable instance. This transformation is recursively concatenated for all child renderables when rendering

    Declaration

    Objective-C

    @property (nonatomic, strong) RRTransformation *_Nonnull transformation;

    Swift

    var transformation: RRTransformation { get set }
  • This property defines the world 3D transformation of the renderable instance. This transformation is applied to the renderable’s geometry when rendering it.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) RRTransformation *_Nonnull worldTransformation;

    Swift

    var worldTransformation: RRTransformation { get }
  • Attach an RRCollider instance to the renderable. Colliders are used for hit testing the rendered scene.

    Declaration

    Objective-C

    - (void)attachCollider:(RRCollider *_Nonnull)collider;

    Swift

    func attachCollider(_ collider: RRCollider)

    Parameters

    collider

    The collider instance to attach to the renderable

  • Detach an RRCollider instance from the renderable. Colliders are used for hit testing the rendered scene.

    Declaration

    Objective-C

    - (void)detachCollider:(RRCollider *_Nonnull)collider;

    Swift

    func detachCollider(_ collider: RRCollider)

    Parameters

    collider

    The collider instance to detach from the renderable

  • Attach an RRRenderer instance to the renderable.

    Declaration

    Objective-C

    - (void)attachRenderer:(RRRenderer *_Nonnull)renderer;

    Swift

    func attach(_ renderer: RRRenderer)

    Parameters

    renderer

    The renderer instance to attach to the renderable

  • Detach an RRRenderer instance from the renderable.

    Declaration

    Objective-C

    - (void)detachRenderer:(RRRenderer *_Nonnull)renderer;

    Swift

    func detach(_ renderer: RRRenderer)

    Parameters

    renderer

    The renderer instance to detach from the renderable

  • This property returns the list of colliders currently attached to the renderable instance.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray<RRCollider *> *_Nonnull colliders;

    Swift

    var colliders: [RRCollider] { get }
  • This property enables a convenient way to hide/show a renderable without the need to add/remove it to/from the renderview.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isHidden;

    Swift

    var isHidden: Bool { get set }
  • A getter for the local boundingbox of the renderable. It can be specified if hidden renderables/child renderables should also be included in the boundingbox calculation

    Declaration

    Objective-C

    - (RRAxisAlignedBoundingBox3D *_Nonnull)
        getBoundingBoxLocalWithHiddenRenderablesIncluded:
            (BOOL)hiddenRenderablesIncluded;

    Swift

    func getBoundingBoxLocal(withHiddenRenderablesIncluded hiddenRenderablesIncluded: Bool) -> RRAxisAlignedBoundingBox3D

    Parameters

    hiddenRenderablesIncluded

    If YES, also hidden renderables/child renderables are incorporated into the boundingbox calculation.

    Return Value

    An axis aligned boundingbox of the renderable represented in the renderable’s local coordinate system.