Unity.ts - Classes

For the web page, we start by creating a namespace called unitySample. This namespace contains several interfaces and classes. This section covers the classes in unitySample.

In This Section

RenderCommand

The RenderCommand class makes it possible to use WebGL properly.

    // WebGL class for rendering command
    class RenderCommand {
        visible: boolean;
        vtx: [WebGLBuffer, number]; // Vertex buffer and length
        idx: [WebGLBuffer, number]; // Index buffer and length
        tex: any; // Texture ID.
        img: any; // HTML image used for the texture (async load).
    }

unityController

The unityController class does all the interactions with the page and displays the associated content. Since this class is the most important part of this help documentation, we divided the content in several sections:

In the unity.ts file, you’ll find that each section described begins with an easy-to-find comment which contains the section name.