@kognifai/cogsengine
    Preparing search index...

    Class MaterialResource

    Cogs Material Resource.

    Created by: Cogs.Resources.loadMaterial() Release using: Material.release()

    Hierarchy (View Summary)

    Index

    Accessors

    • get bridge(): Bridge

      Internal bridge access

      Returns Bridge

    • 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

      Gets the optional name

      Returns string

      name of the resource

    • get path(): string

      Gets the optional path.

      Returns string

      path. Only set for material created. null for Wrapped.

    • 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.

    • Does actual resource release. Override in sub-class.

      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.

    • Internal: instance creator by runtime.resources.loadMaterial()

      Parameters

      • runtime: Runtime
      • path: string
      • name: string

      Returns MaterialResource

    • Internal: Create a Material from existing resource Called from field getter for Material

      Parameters

      Returns MaterialResource