How to use the vendors/video-texture/webcam function in vendors

To help you get started, we’ve selected a few vendors 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 kenjiSpecial / webgl-sketch-dojo / sketches / theme / camera / app01 / index.js View on Github external
mainCamera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, 1, 10000 );
    mainCamera.updateProjectionMatrix();
    mainCamera.position.z = 100;

    renderer = new THREE.WebGLRenderer({alpha: false});
    renderer.autoClear = false;
    renderer.setClearColor ( 0x000000, 1.0 );

    rendererTarget0 = new THREE.WebGLRenderTarget(camWidth, camHeight, {minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, type:THREE.FloatType, stencilBuffer: false, debugTest : false});

    solver = new Solver1(grid, renderer);

    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    camTexture = new CamTexture({width: camWidth, height: camHeight});
    camTexture.eventDispatcher.addEventListener("textuer:ready", onCamReady);

    opticalFlowMat = new OpticalFlowMaterial({width: camWidth, height: camHeight});
    // opticalFlowMat.updateBaseColor(new THREE.Vector3(0.5, 0.5, 0.5));


    swapRenderer = new SwapRenderer({
        shader : glslify('./shaders/advect.frag'),

        width : window.innerWidth,
        height: window.innerHeight,
        uniforms: {
            "target" : { type: "t", value: null },
            "velocity" : { type: "t", value:  solver.velocity.output},
            // "randomTex" : { type: "t", value: velocityRenderer.target },
            "invresolution" : {type : "v2", value: new THREE.Vector2(1/window.innerWidth, 1/window.innerHeight)},
github kenjiSpecial / webgl-sketch-dojo / sketches / basic / video-texture / index.js View on Github external
function init(){
    scene = new THREE.Scene();

    camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
    camera.position.z = 1000;

    renderer = new THREE.WebGLRenderer({alpha: true});
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    camTexture = new CamTexture({width: 600, height: 400});
    camTexture.eventDispatcher.addEventListener("textuer:ready", onCamReady);
    
    videoTexture  = new VideoTexture({files : videoFiles})
    videoTexture.eventDispatcher.addEventListener("textuer:ready", onVideoReady);
    videoScene = new THREE.Scene();

    setComponent();

    raf(animate);
}
github kenjiSpecial / webgl-sketch-dojo / sketches / theme / camera / app00 / index.js View on Github external
function init(){
    scene = new THREE.Scene();

    camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
    camera.position.z = 1000;

    renderer = new THREE.WebGLRenderer({alpha: true});
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    camTexture = new CamTexture({width: 600, height: 400});
    camTexture.eventDispatcher.addEventListener("textuer:ready", onCamReady);

    opticalFlowMat = new OpticalFlowMaterial({width: 600, height: 400});
    opticalFlowMat.updateBaseColor(new THREE.Vector3(0.5, 0.5, 0.5));


    setComponent();

}