@kognifai/cogsengine
    Preparing search index...

    Class BasicTerrainComponent

    Base class for components implementing dynamic behavior.

    Consider using Cogs Control Event "preRender" instead. Any updates to Cogs called from custom Dynamic Component will cause a second rendering. If called from Event "preRender" callback the update is in place Before the frame is rendered.

    Inherit this class to create JavaScript custom components that are added to a Cogs Entity. The dynamic component acts as a non-virtual base for components not designed to be managed by a component system, but implementing behavior in member functions callable by the DynamicComponentSystem that owns all dynamic component instances. Member names assumed to handle Cogs messages: "initialize", "update", "postUpdate", "cleanup", "gpuPicking(number,vec3)".

    See documentation for Dynamic components methods details.

    class MyDynamicComponent extends Cogs.DynamicComponent {
    constructor() {
    // Pass name, of component to DynamicComponent constructor.
    super('MyDynamicComponent');
    }

    // Called by Cogs for component initialization when added to entity
    public initialize = () => console.log('Called: initialize');

    // Called by Cogs on each render pass
    public update = () => console.log('Called: update');
    }

    // Use component:
    const cube = runtime.Cube.create();
    cube.components.add(new MyDynamicComponent());

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    colorMap: TextureResource
    cullMode: CullMode
    diffuseColor: vec4

    Color to use when no color map has been set.

    elevationBias: number

    Bias to use when elevationMapNormalized is false.

    elevationMap: TextureResource
    elevationMapNormalized: boolean

    If true, assume elevationmap values are in [0,1] and stretch to elevationMin/elevationMax

    elevationMax: number

    Maximum elevation for the terrain.

    elevationMin: number

    Minimum elevation for the terrain.

    elevationScale: number

    Scale to use when elevationMapNormalized is false.

    elevationToAlpha: boolean
    elevationToAlphaMax: number
    elevationToAlphaMin: number
    elevationToAlphaPower: number
    isTyped: boolean

    Internal flag set if component is a Cogs Core component.

    noDataEnabled: boolean

    Enable discarding of areas with nodata values.

    noDataValue: number

    No-data value.

    How and if to handle transparency, see notes on enum.

    vibrance: number

    Increase or decrease color saturation.

    Accessors

    • get entity(): Entity

      Gets the optional owning entity

      Returns Entity

    • set entity(entity: Entity): void

      Internal: set owning entity.

      Parameters

      Returns void

    • get name(): string

      Component name == type. For compatibility

      Returns string

    • get type(): string

      Gets the type of the component. Ex. "TransformComponent", "SceneComponent" etc.

      Returns string

    Methods

    • Internal: Creates a new component of the given type (name). Component is wrapped when adding to an entity.

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      Returns Component

      Created Cogs.js component.

    • Internal: Creates a new component being wrapped as an existing member of the entity

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      • entity: Entity

        The owning entity

      Returns Component

      Created Cogs.js component.