§ Код

Здесь приведена одна из небольших реализации моего 3Д движка.
clipboard.png
class WebGLApp extends WebGLFrameWork
{
    init()
    {
        this.shader   = this.loadShaderTexture();
        this.texture  = this.loadTexture("/i/icon/math.png");
        this.the_cube = this.makeCube(this.shader, this.texture, this.matMove(0,0,-3));
    }

    // Вращение камеры и объектов
    loop()
    {
        this.cls();

        // Вычисление движения
        if (this.keyboard.w) this.cam.z -= 0.05;
        if (this.keyboard.a) this.cam.x -= 0.05;
        if (this.keyboard.s) this.cam.z += 0.05;
        if (this.keyboard.d) this.cam.x += 0.05;

        // Обновить матрицу общей камеры для дальнейшей работы
        this.updateDefaultCamera();

        // Отрисовка объекта(ов)
        this.drawNode(this.the_cube);
    }

    // Двигаем мышкой
    mouseMove(x,y)
    {
        if (this.mouse.press) {

            this.cam.ry -= (x - this.mouse.lastx) / 200; this.mouse.lastx = x;
            this.cam.rx -= (y - this.mouse.lasty) / 200; this.mouse.lasty = y;
        }
    }

    // Общее нажатие на клаву
    keyCode(c, state)
    {
        if (c === 87) this.keyboard.w = state;
        if (c === 83) this.keyboard.s = state;
        if (c === 65) this.keyboard.a = state;
        if (c === 68) this.keyboard.d = state;
    }
}