How to use the webgl-operate.Wizard.Precision function in webgl-operate

To help you get started, we’ve selected a few webgl-operate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cginternals / webgl-operate / demos / point-cloud / point-cloud.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        const alpha2coverage = auxiliaries.GETparameter('alpha2coverage');

        this._canvas = new Canvas(element, {
            antialias: alpha2coverage === undefined ? false : JSON.parse(alpha2coverage!),
        });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new PointCloudRenderer();
        this._canvas.renderer = this._renderer;


        const input = document.getElementById('input-file')! as HTMLInputElement;
        // const label = document.getElementById('label-file')! as HTMLLabelElement;
        input.addEventListener('change', () => {
            importPointsFromCSV(input.files!).then(result => console.log(result));
        });

        return true;
    }
github cginternals / webgl-operate / examples / label3d-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new Label3DRenderer();
        this._canvas.renderer = this._renderer;

        // Create a target cross as reference for coordinate origin [0,0,0]

        const hlStyle = 'z-index: 1; position: absolute; width: 100%; margin: 0; margin-left: 0%;'
            + 'border: none; border-bottom: 1pt solid #1c75bc; border-top: 1pt solid #1c75bc;';
        const vlStyle = 'z-index: 1; position: absolute; height: 100%; margin: 0; margin-top: 0%;'
            + 'border: none; border-left: 1pt solid #1cbc75; border-right: 1pt solid #1cbc75;';

        const hl = document.createElement('hl');
        hl.setAttribute('style', `${hlStyle} top: 50%;`);
        const vl = document.createElement('vl');
        vl.setAttribute('style', `${vlStyle} left: 50%;`);
github cginternals / webgl-operate / demos / cornell-box / cornellbox.ts View on Github external
const lights2 = new Float32Array(lights.length * 3);
        let i2 = 0;
        for (const light of lights) {
            lights2[i2++] = light[0];
            lights2[i2++] = light[1];
            lights2[i2++] = light[2];
        }

        // special case for webgl1 and no float support
        if (this._context.isWebGL1 && !this._context.supportsTextureFloat) {
            this._hsphereImage.initialize(32 * 3, 32, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE);
            this._hsphereImage.data(this.encodeFloatArrayAndScale(spherePoints));
            this._lightsImage.initialize(32 * 3, 32, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE);
            this._lightsImage.data(this.encodeFloatArrayAndScale(lights2));
        } else {
            const format = Wizard.queryInternalTextureFormat(this._context, gl.RGB, Wizard.Precision.float);
            this._hsphereImage.initialize(samplerSize, samplerSize, format[0], gl.RGB, format[1]);
            this._hsphereImage.data(spherePoints);
            this._lightsImage.initialize(32, 32, format[0], gl.RGB, format[1]);
            this._lightsImage.data(lights2);
        }

        this._hsphereImage.wrap(gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE);
        this._hsphereImage.filter(gl.NEAREST, gl.NEAREST);
        this._lightsImage.wrap(gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE);
        this._lightsImage.filter(gl.NEAREST, gl.NEAREST);


        // scene textures for webgl1
        if (this._context.isWebGL1) {
            this._program.bind();
            gl.uniform1i(this._program.uniform('u_vertices'), 2);
github cginternals / webgl-operate / examples / cube-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new CubeRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }
github cginternals / webgl-operate / examples / colorscale-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];
        this._canvas.clearColor = new Color();

        this._renderer = new ColorScaleRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }
github cginternals / webgl-operate / examples / envprojections-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new EnvironmentProjectionRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }
github cginternals / webgl-operate / examples / labelelide-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new LabelElideRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }
github cginternals / webgl-operate / examples / shadowmap-multiframe-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element);
        this._canvas.framePrecision = Wizard.Precision.half;
        this._canvas.frameScale = [1.0, 1.0];

        this._canvas.clearColor.fromHex('ffffff');
        this._canvas.controller.multiFrameNumber = 128;

        this._renderer = new ShadowMapMultiframeRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }
github cginternals / webgl-operate / examples / triangle-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new TriangleRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }
github cginternals / webgl-operate / examples / canvassize-example.ts View on Github external
initialize(element: HTMLCanvasElement | string): boolean {

        this._canvas = new Canvas(element, { antialias: false });
        this._canvas.controller.multiFrameNumber = 1;
        this._canvas.framePrecision = Wizard.Precision.byte;
        this._canvas.frameScale = [1.0, 1.0];

        this._renderer = new CanvasSizeRenderer();
        this._canvas.renderer = this._renderer;

        return true;
    }