rhodonite
    Preparing search index...

    Class FrameBuffer

    FrameBuffer class represents a framebuffer object that manages render targets for off-screen rendering operations. It handles color, depth, and stencil attachments and provides methods to configure and manage the framebuffer state.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _tags: RnTags = {}

    Collection of tags associated with this object

    cgApiResourceUid: number = CGAPIResourceRepository.InvalidCGAPIResourceUid
    height: number = 0
    width: number = 0
    currentMaxObjectCount: number = 0

    Current maximum object count for UID generation

    InvalidObjectUID: -1

    Invalid object UID constant

    Accessors

    • get objectUID(): number

      Gets the unique object identifier

      Returns number

      The object's UID

    • get uniqueName(): string

      Gets the unique name of this object

      Returns string

      The unique name string

    Methods

    • Creates and initializes the framebuffer with the specified dimensions.

      Parameters

      • width: number

        The width of the framebuffer

      • height: number

        The height of the framebuffer

      Returns number

      The CG API resource handle for the created framebuffer

    • Destroys all 3D API resources associated with this framebuffer and its attachments. This includes the framebuffer object itself and all attached render targets. After calling this method, the framebuffer is no longer usable until recreated.

      Returns void

    • Gets the render target texture attached to the specified color attachment index.

      Parameters

      • index: number

        The color attachment index

      Returns RenderTargetTexture | undefined

      The render target texture or undefined if not found or not a render target texture

    • Retrieves a complete tag object (name and value) for the specified tag name

      Parameters

      • tagName: string

        The name of the tag to retrieve

      Returns Tag

      A Tag object containing the name and value

    • Retrieves the value associated with a specific tag name

      Parameters

      • tagName: string

        The name of the tag whose value to retrieve

      Returns any

      The tag value, or undefined if the tag doesn't exist

    • Checks whether this object has a tag with the specified name

      Parameters

      • tagName: string

        The name of the tag to check for

      Returns boolean

      True if the tag exists (value is not null/undefined), false otherwise

    • Checks if this object has a tag with the specified name and value

      Parameters

      • tagName: string

        The tag name to match

      • tagValue: string

        The tag value to match

      Returns boolean

      True if the object has a matching tag, false otherwise

    • Checks if this object has all the specified tags with exactly matching values

      Parameters

      • tags: RnTags

        Object containing tag names as keys and expected values

      Returns boolean

      True if all specified tags exist with matching values, false otherwise

    • Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.

      Parameters

      • stringArray: string[]

        Array of strings that must all be present in the combined tag string

      Returns boolean

      True if all strings are found in the combined tag string, false otherwise

    • Resizes the framebuffer and all its attachments to the specified dimensions. This method destroys the current framebuffer and recreates it with new dimensions.

      Parameters

      • width: number

        The new width

      • height: number

        The new height

      Returns void

    • Sets a color attachment at the specified index.

      Parameters

      • index: number

        The color attachment index

      • renderable: IRenderable

        The renderable object to attach

      Returns boolean

      True if the attachment was successful, false if dimensions don't match

    • Sets a color attachment for a specific face of a cube texture.

      Parameters

      • attachmentIndex: number

        The color attachment index

      • faceIndex: number

        The cube face index (0-5)

      • mipLevel: number

        The mip level to attach

      • renderable: IRenderable

        The cube texture renderable to attach

      Returns boolean

      True if the attachment was successful, false if dimensions don't match

    • Sets a color attachment layer at the specified index for array textures.

      Parameters

      • index: number

        The color attachment index

      • renderable: IRenderable

        The renderable object to attach

      • layerIndex: number

        The layer index within the array texture

      • mipLevel: number

        The mip level to attach

      Returns boolean

      True if the attachment was successful, false if dimensions don't match

    • Sets the depth attachment for this framebuffer.

      Parameters

      • renderable: IRenderable

        The renderable object to use as depth attachment

      Returns boolean

      True if the attachment was successful, false if dimensions don't match

    • Sets the combined depth-stencil attachment for this framebuffer.

      Parameters

      • renderable: IRenderable

        The renderable object to use as depth-stencil attachment

      Returns boolean

      True if the attachment was successful, false if dimensions don't match

    • Sets the stencil attachment for this framebuffer.

      Parameters

      • renderable: IRenderable

        The renderable object to use as stencil attachment

      Returns boolean

      True if the attachment was successful, false if dimensions don't match

    • Attempts to set a tag on this object. If the tag already exists, it will be replaced.

      Parameters

      • tag: Tag

        The tag object containing the name and value to set

      Returns boolean

      True if the tag was successfully set, false if the tag name contains invalid characters

    • Attempts to set a unique name for this object

      Parameters

      • name: string

        The desired unique name

      • toAddNameIfConflict: boolean

        If true, appends UID to make name unique when conflicts occur; if false, fails on conflict

      Returns boolean

      True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false

    • Validates that a tag string contains only allowed characters (alphanumeric and underscore)

      Parameters

      • val: string

        The string to validate

      Returns boolean

      True if the string contains only valid characters, false if it contains invalid characters

    • Finds the index of the specified renderable in the color attachments array.

      Parameters

      • renderable: IRenderable

        The renderable object to search for

      Returns number

      The index of the renderable in color attachments, or -1 if not found

    • Retrieves an RnObject instance by its unique identifier

      Parameters

      • objectUid: number

        The unique identifier of the object to retrieve

      Returns RnObject | undefined

      The RnObject instance or undefined if not found or garbage collected

    • Searches for the first object that has a specific tag with the given value

      Parameters

      • tag: string

        The tag name to search for

      • value: string

        The tag value to match

      Returns WeakRef<RnObject> | undefined

      WeakRef to the first matching object, or undefined if not found