@kognifai/cogsengine
    Preparing search index...

    @kognifai/cogsengine

    Cogs.js - A component based 3D graphics engine for modern web applications

    • Introduction first explains what Cogs.js, how to learn and use it. Then it highlights important concepts and points to the Cogs.Core library Introduction.

    • GettingStarted translates the high-level steps from the introduction into an HTML based example for more practical learning. It is recommended to start your learning here even if you eventually aim to use Cogs.js in a framework such as Angular.

    • HelloWorldAngular also translates the steps from the introduction, but here into an Angular application with a Cogs view.

    • FAQ Some frequently asked questions.

    This requires a source distribution of Cogs.js, or at least a copy of our examples folder:

    cd examples

    npm i

    # launch live-server via a script defined in package.json
    npm run start

    TODO: the following needs to be reviewed. Should also be moved down into getting started guide.

    • Node Package Manager via Node.js. LTS is a good choice.

    Install npm package

    # requires .npmrc config with access token
    npm install @kognifai/cogsengine

    Cogs.js uses npm package gl-matrix for 2D/3D coordinates, Quaternions etc. Install using:

    npm install gl-matrix
    

    WebXR types are referenced by the Cogs.js Typescript types. If using XR in Cogs.js or experiencing compilation problems in dist/cogs.edm.d.ts - install:

    npm i --save-dev @types/webxr
    

    Optional install for more vector types and vector utilities:

    npm install @kognifai/cogsmatrix
    

    Examples showing usage of Cogs.js is available in SDK distribution in folder examples/. Note that the examples uses JavaScript with some Typescript type checking support.

    Recommended imports are:

    import * as Cogs from "@kognifai/cogsengine";
    import { dvec3 } from '@kognifai/cogsengine';
    import { vec3, vec4, ... } from "gl-matrix";

    TODO: move this to dedicated guide

    Cogs.js has a debug interface showing framerate, Entities etc.

    runtime.setVariable('gui.enabled', true);
    

    To dump processed shader source to the console log when a shader fails to build:

    runtime.setVariable('effects.logShaderInfo', true);
    

    To dump attribute and uniform info as well as processed shader source to the console log for all shaders:

    runtime.setVariable('effects.logShaderSource', true);
    

    These messages are logged at loglevel DEBUG, so you might need to adjust loglevel to see them.

    Cogs.js is (C) 2014-2025 Kongsberg Digital. All rights reserved.

    Contact Thomas Hammer thomas.hammer@kongsbergdigital.com for licensing inquiries.

    Also see the licenses for open source used in Cogs.