cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              (function() {
      window.location.href = 'http://cityjumperweb.com/webgl/colladaPick/';
    }.call(this));
/****Source
(function() {
  var scene = new THREE.Scene();
  var container = document.getElementById("container");
  var raycaster = new THREE.Raycaster();
  var mouse = new THREE.Vector2();
  var camera = new THREE.PerspectiveCamera(45, 16 / 9, 1, 5000);  
  camera.position.set(0, 400, 250);
  //Mesh
  var video = document.createElement('video');
  video.src = "vid/fa.mp4";
  video.load();
  var videoImage = document.createElement('canvas');
  videoImage.width = 1280;
  videoImage.height = 720;
  var videoImageContext = videoImage.getContext('2d');
  videoImageContext.fillStyle = '#000000';
  videoImageContext.fillRect(0, 0, videoImage.width, videoImage.height);
  var videoTexture = new THREE.Texture(videoImage);
  videoTexture.minFilter = THREE.LinearFilter;
  videoTexture.magFilter = THREE.LinearFilter;
  var screenMaterial = new THREE.MeshBasicMaterial({
    map: videoTexture,
    overdraw: true
  });
  var screebGeometry = new THREE.PlaneGeometry(16, 9, 1, 1);
  var movieScreen = new THREE.Mesh(screebGeometry, screenMaterial);
  movieScreen.position.y = 134;
  movieScreen.position.x = -8;
  movieScreen.position.z = -8;
  movieScreen.scale.set(8.1, 8.1, 8.1);
  scene.add(movieScreen);
  var loader = new THREE.TextureLoader();
  drawing = loader.load('textures/light.jpg');
  var canvasMaterial = new THREE.MeshLambertMaterial({
    map: drawing
  });
  var canvasGeometry = new THREE.BoxGeometry(1, 1, .01);
  var canvasMesh1 = new THREE.Mesh(canvasGeometry, canvasMaterial);
  canvasMesh1.scale.set(200, 200, 200);
  canvasMesh1.position.set(250, 250, -63.5);
  scene.add(canvasMesh1);

  var loader = new THREE.TextureLoader();
  grass = loader.load('textures/grass.jpg');
  var planeMaterial = new THREE.MeshLambertMaterial({
    map: grass,
    side: THREE.DoubleSide
  });
  var planeGeometry = new THREE.PlaneGeometry(1, 1, 1, 1);
  var ground = new THREE.Mesh(planeGeometry, planeMaterial);
  ground.rotation.x = Math.PI / 180 * 90;
  ground.scale.set(3000, 3000, 1);
  ground.position.set(-975, -1, -1028);
  scene.add(ground);
  brush = loader.load('textures/brushtexture.jpg');
  var brushGeometry = new THREE.BoxGeometry(20, .8, .8);
  var brushMaterial = new THREE.MeshLambertMaterial({
    map: brush
  });

  brush1 = [
    new THREE.Vector2(0.20, 0.12),
    new THREE.Vector2(0.22, 0.12),
    new THREE.Vector2(0.22, 0.98),
    new THREE.Vector2(0.20, 0.98),
  ];

  brushGeometry.faceVertexUvs[0] = [];
  for (i = 0; i < 12; i++) {
    if (i % 2 == 0) {
      brushGeometry.faceVertexUvs[0][i] = [brush1[0], brush1[1], brush1[3]];
    } else {
      brushGeometry.faceVertexUvs[0][i] = [brush1[1], brush1[2], brush1[3]];
    }
  }
  var brushMesh1 = new THREE.Mesh(brushGeometry, brushMaterial);
  var brushMesh2 = new THREE.Mesh(brushGeometry, brushMaterial);
  var brushMesh3 = new THREE.Mesh(brushGeometry, brushMaterial);
  brushMesh1.position.set(300, 1, 80);
  brushMesh2.position.set(305, 1, 82);
  brushMesh3.position.set(308, 1, 91);
  brushMesh3.rotation.y = 1;
  scene.add(brushMesh1);
  scene.add(brushMesh2);
  scene.add(brushMesh3);
  //Mesh End
  //ColladaLoader Mesh
  var loader = new THREE.ColladaLoader();
  loader.load(
    'models/roooom.dae',
    function(collada) {
      var room = collada.scene;
      var loader = new THREE.TextureLoader();
      texture = loader.load('textures/room.jpg');
      num = room.children.length;
      meshName = [
        'desk',
        'wall',
        'chair',
        'pc',
        'keyboard',
        'mousePad',
        'mouse',
      ];
      for (i = 0; i < num; i++) {
        roomMesh = room.children[i].children[0];
        roomMesh.material.map = texture;
        roomMesh.scale.set(10, 10, 10);
        roomMesh.name = meshName[i];
        scene.add(roomMesh);
      }
    }
  );
  loader.load(
    'models/easel.dae',
    function(collada) {
      var easel = collada.scene;
      var loader = new THREE.TextureLoader();
      texture = loader.load('textures/easel.jpg');
      easel.children[0].children[0].scale.set(1, 1, 1);
      easel.children[0].children[0].rotation.y = Math.PI / 180 * 45;
      easel.children[0].children[0].position.set(250, 1, 100);
      easel.children[0].children[0].material.opacity = 1;
      easel.children[0].children[0].material.map = texture;
      easel.children[0].children[0].name = 'easel';
      scene.add(easel.children[0].children[0]);
    }
  );
  loader.load(
    'models/montex.dae',
    function(collada) {
      var mon = collada.scene;
      var loader = new THREE.TextureLoader();
      texture = loader.load('textures/monitorTexture.png');
      mon.children[0].children[0].scale.set(9.5, 9.5, 9.5);
      mon.children[0].children[0].position.y = 80;
      mon.children[0].children[0].position.x = -9;
      mon.children[0].children[0].material.map = texture;
      scene.add(mon.children[0].children[0]);
    }
  );
  //ColladaLoader Mesh End
  //Functional Objects
  var axis = new THREE.AxisHelper(1000);
  axis.position.set(0, 0, 0);
  //scene.add(axis);
  var hemi = new THREE.HemisphereLight(0xff7226, 0xffffff);
  hemi.position.set(-1000, 0, -1000);
  scene.add(hemi);
  var spot = new THREE.SpotLight(0xff7226);
  spot.position.set(-1200, 200, 300);
  scene.add(spot);
  //Functional Objects End
  //Rendering Start
  var renderer = new THREE.WebGLRenderer();
  document.addEventListener('mousedown', onDocumentMouseDown, false);

  function onDocumentMouseDown(event) {
    event.preventDefault();
    mouse.x = ((event.clientX - container.offsetLeft) / container.clientWidth) * 2 - 1;
    mouse.y = -((event.clientY - container.offsetTop) / container.clientHeight) * 2 + 1;
    raycaster.setFromCamera(mouse, camera);
    intersects = raycaster.intersectObjects(scene.children);
    if (intersects.length >= 1) {
      if (intersects[0].object.name == 'mouse' || intersects[0].object.name == 'mousePad') {
        video.play();
      } else if (intersects[0].object.name == 'keyboard') {
        video.pause();
      }
    }
  }
  //Mouse Event Setting End 
    
  renderer.setSize(window.innerWidth, window.innerHeight);  
  renderer.setClearColor(0xeeeeee, 1);
  renderer.shadowMap.enabled = true;
  container.appendChild(renderer.domElement);
  renderer.render(scene, camera);

  function render() {
    requestAnimationFrame(render);
    renderer.render(scene, camera);
    if (video.readyState === video.HAVE_ENOUGH_DATA) {
      videoImageContext.drawImage(video, 0, 0);
      if (videoTexture) {
        videoTexture.needsUpdate = true;
      }
    }
  }
  render();
  var controls = new THREE.OrbitControls(camera, renderer.domElement);
  $(window).resize(function() {
    SCREEN_WIDTH = window.innerWidth;
    SCREEN_HEIGHT = window.innerHeight;
    camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT;
    camera.updateProjectionMatrix();
    renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
  });
})();

***/

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console