RedGPU API - v3.0.0-Alpha
    Preparing search index...

    Class RedGPUContext

    RedGPUContext 클래스는 WebGPU 초기화 후 제공되는 최상위 컨텍스트 객체입니다.

    • GPU, 캔버스, 디바이스, 어댑터 등 WebGPU의 핵심 정보를 속성으로 가집니다.
    • View3D 객체를 소유하며, 실제 최상위 컨테이너 역할을 합니다.
    • 리사이즈, 배경색, 디버그 패널, 안티앨리어싱, 리소스 관리 등 다양한 기능을 제공합니다.

    Hierarchy

    • RedGPUContextViewContainer
      • RedGPUContext
    Index

    Constructors

    • Parameters

      • htmlCanvas: HTMLCanvasElement
      • gpuAdapter: GPUAdapter
      • gpuDevice: GPUDevice
      • gpuContext: GPUCanvasContext
      • alphaMode: GPUCanvasAlphaMode

      Returns RedGPUContext

    Properties

    currentRequestAnimationFrame: number

    현재 requestAnimationFrame ID (프레임 루프 관리용)

    currentTime: number

    현재 시간(프레임 기준, ms)

    onResize: (width: number, height: number) => void = null

    리사이즈 이벤트 핸들러 (캔버스 크기 변경 시 호출)

    Accessors

    • get alphaMode(): GPUCanvasAlphaMode

      Retrieves the alpha mode of the GPUCanvas object.

      Returns GPUCanvasAlphaMode

      The alpha mode of the GPUCanvas.

    • set alphaMode(value: GPUCanvasAlphaMode): void

      Sets the alpha mode of the GPUCanvas.

      Parameters

      • value: GPUCanvasAlphaMode

        The new alpha mode value to be set.

      Returns void

    • get configurationDescription(): GPUCanvasConfiguration

      Retrieves the GPU canvas configuration description.

      Returns GPUCanvasConfiguration

      The configuration description.

    • get detector(): RedGPUContextDetector

      Retrieves the RedGPUContextDetector instance.

      Returns RedGPUContextDetector

      The RedGPUContextDetector instance.

    • get height(): string | number

      Retrieves the height of the sizeManager.

      Returns string | number

      The height of the sizeManager.

    • set height(value: string | number): void

      Sets the height value of the element.

      Parameters

      • value: string | number

        The height value to set. It can be either a number or a string.

      Returns void

    • get htmlCanvas(): HTMLCanvasElement

      Retrieves the HTML canvas element associated with the current instance of the class.

      Returns HTMLCanvasElement

      The HTML canvas element.

    • get renderScale(): number

      Retrieves the render scale value from the size manager.

      Returns number

      The render scale value.

    • set renderScale(value: number): void

      Sets the render scale for the size manager.

      Parameters

      • value: number

        The render scale value to set.

      Returns void

    • get screenRectObject(): { height: number; width: number; x: number; y: number }

      Returns { height: number; width: number; x: number; y: number }

    • get sizeManager(): RedGPUContextSizeManager

      Retrieves the size manager of the RedGPU context.

      Returns RedGPUContextSizeManager

      The size manager of the RedGPU context.

    • get width(): string | number

      Retrieves the width of the object.

      Returns string | number

      The width of the object.

    • set width(value: string | number): void

      Sets the width value for the size manager.

      Parameters

      • value: string | number

        The width value to set. It can be either a number or a string.

      Returns void

    Methods

    • Adds a view at a specified index in the view list.

      Parameters

      • view: View3D

        The view to be added.

      • index: number

        The index at which the view should be inserted.

      Returns void

    • Checks if the given child View3D is contained within the current View3D.

      Parameters

      • child: View3D

        The child View3D to check for containment.

      Returns boolean

      • Returns true if the child View3D is contained, otherwise false.
    • Destroys the GPU device. It releases any allocated resources and cleans up the GPU device.

      Returns void

    • Returns the index of the specified view in the view list.

      Parameters

      • view: View3D

        The view to search for.

      Returns number

      • The index of the view in the view list. Returns -1 if the view is not found.
    • Removes the view at the specified index from the view list.

      Parameters

      • index: number

        The index of the view to remove.

      Returns void

      • Throws an error if the index is out of range.
    • Sets the size of the element.

      Parameters

      • Optionalw: string | number = ...

        The width of the element. It can be either a string or a number. Defaults to the current width.

      • Optionalh: string | number = ...

        The height of the element. It can be either a string or a number. Defaults to the current height.

      Returns void

    • Sets the view at the specified index in the viewList of the RedGPUContext instance.

      Parameters

      • view: View3D

        The View3D instance to set at the specified index.

      • index: number

        The index at which to set the view.

      Returns void

      If the input view is not registered in the RedGPUContext instance.

      If the index is out of bounds, i.e., greater than or equal to the length of viewList.

    • Swaps the positions of two views in the view list of the RedGPUContext instance.

      Parameters

      • view1: View3D

        The first view to be swapped.

      • view2: View3D

        The second view to be swapped.

      Returns void

      If either view1 or view2 is not an instance of the View3D class.

      If either view1 or view2 is not a child of this RedGPUContext instance.

    • Swaps two views at the specified indices in the view list.

      Parameters

      • index1: number

        The index of the first view to swap.

      • index2: number

        The index of the second view to swap.

      Returns void

      • If either index1 or index2 is not a positive integer. If either index1 or index2 is larger than or equal to the length of the view list.