@kognifai/cogsengine
    Preparing search index...

    Class TextureResource

    Defined Resource storing Texture Handle. Used by the

    Resources class.

    Created by: Cogs.Resources.loadTexture*(..) Release using: TextureResource.release()

    Hierarchy (View Summary)

    Index

    Properties

    externalTexture: number | undefined = undefined
    idRenderBufferWebGL: WebGLRenderbuffer | null = null
    idWebGL: WebGLTexture | null = null
    objWebGPU: GPUTexture | null = null

    Accessors

    • get id(): number

      Gets the COGS resource ID of the Resource

      Returns number

      resource ID

    • get isReleased(): boolean

      Returns flag marking if resource is released

      Returns boolean

    • get name(): string | null

      Gets the optional name

      Returns string | null

      name of the resource

    • get runtime(): Runtime

      Internal runtime access

      Returns Runtime

    Methods

    • Compare two Cogs Resource types for equality.

      Parameters

      Returns boolean

      True if same Resource class type & ID and belongs to same Cogs instance.

    • Compare two Cogs Resource types for equality.

      Parameters

      Returns boolean

      True if same Resource class type & ID and belongs to same Cogs instance.

    • Internal release cleanup

      Returns void

    • Release TextureResource resources after use.

      Returns void

    • Log error message

      Parameters

      • message: string

      Returns void

    • Release to free resources after use. Also release local handle after creating resource and passing to Cogs.

      Returns void

      const model = runtime.ModelEntity.create("Model");
      const modelResource: runtime.resources.loadModel(modelPath);
      model.modelComponent.model = modelResource;
      modelResource.release(); // ModelComponent now sole owner

      internalRelease for actual release.

    • CogsInternal: Replace the dummy WebGPU texture slot with a real uploaded texture. Destroys the dummy and installs newTexture at the same jsObjects index so the existing C-side handle remains valid.

      Parameters

      • newTexture: GPUTexture

      Returns void

    • Internal: Creates new texture resource

      Parameters

      • runtime: Runtime
      • id: number
      • name: string | null

      Returns TextureResource