Skip to content

Instantly share code, notes, and snippets.

@jsermeno
Created May 22, 2011 21:15

Revisions

  1. jsermeno revised this gist Sep 24, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion initialize.js
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ function initialize() {
    meshCanvas.rotation.x = -90 * Math.PI / 180;
    meshCanvas.scale.x = meshCanvas.scale.y = meshCanvas.scale.z = 100;

    scene.add( meshCanvas );
    scene.addChild( meshCanvas );

    renderer = new THREE.WebGLRenderer( { antialias: true } );
    renderer.setSize( window.innerWidth, window.innerHeight );
  2. jsermeno revised this gist Sep 24, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions initialize.js
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ function initialize() {
    grass = THREE.ImageUtils.loadTexture( "textures/grass.gif" );
    grass.wrapT = grass.wrapS = THREE.RepeatWrapping;

    plane = new THREE.Plane(8, 8, 8, 8);
    plane = new THREE.PlaneGeometry(8, 8, 8, 8);

    for ( i = 0; i < plane.faceVertexUvs[ 0 ].length; i ++ ) {

    @@ -39,7 +39,7 @@ function initialize() {
    meshCanvas.rotation.x = -90 * Math.PI / 180;
    meshCanvas.scale.x = meshCanvas.scale.y = meshCanvas.scale.z = 100;

    scene.addObject( meshCanvas );
    scene.add( meshCanvas );

    renderer = new THREE.WebGLRenderer( { antialias: true } );
    renderer.setSize( window.innerWidth, window.innerHeight );
  3. jsermeno revised this gist Jun 20, 2011. No changes.
  4. jsermeno revised this gist Jun 20, 2011. No changes.
  5. jsermeno revised this gist May 30, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions initialize.js
    Original file line number Diff line number Diff line change
    @@ -11,9 +11,9 @@ function initialize() {
    i, j, uvs;

    camera = new THREE.Camera( 3, window.innerWidth / window.innerHeight, -2000, 10000 );
    camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 1, window.innerHeight / - 1, - 2000, 10000 );
    camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 2000, 10000 );
    camera.position.x = 100;
    camera.position.y = 200;
    camera.position.y = 70.711; // 30 degree angle from the xz plane
    camera.position.z = 100;

    scene = new THREE.Scene();
  6. jsermeno revised this gist May 23, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion initialize.js
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ function initialize() {
    i, j, uvs;

    camera = new THREE.Camera( 3, window.innerWidth / window.innerHeight, -2000, 10000 );
    camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 2000, 10000 );
    camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 1, window.innerHeight / - 1, - 2000, 10000 );
    camera.position.x = 100;
    camera.position.y = 200;
    camera.position.z = 100;
  7. jsermeno revised this gist May 23, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion initialize.js
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ function initialize() {
    camera = new THREE.Camera( 3, window.innerWidth / window.innerHeight, -2000, 10000 );
    camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 2000, 10000 );
    camera.position.x = 100;
    camera.position.y = 300;
    camera.position.y = 200;
    camera.position.z = 100;

    scene = new THREE.Scene();
  8. jsermeno created this gist May 22, 2011.
    48 changes: 48 additions & 0 deletions initialize.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    var
    camera,
    scene,
    renderer;

    function initialize() {
    var
    grass,
    meshCanvas,
    plane,
    i, j, uvs;

    camera = new THREE.Camera( 3, window.innerWidth / window.innerHeight, -2000, 10000 );
    camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 2000, 10000 );
    camera.position.x = 100;
    camera.position.y = 300;
    camera.position.z = 100;

    scene = new THREE.Scene();

    grass = THREE.ImageUtils.loadTexture( "textures/grass.gif" );
    grass.wrapT = grass.wrapS = THREE.RepeatWrapping;

    plane = new THREE.Plane(8, 8, 8, 8);

    for ( i = 0; i < plane.faceVertexUvs[ 0 ].length; i ++ ) {

    uvs = plane.faceVertexUvs[ 0 ][ i ];

    for ( j = 0; j < uvs.length; j ++ ) {

    uvs[ j ].u *= 8;
    uvs[ j ].v *= 8;

    }
    }

    meshCanvas = new THREE.Mesh( plane, new THREE.MeshBasicMaterial( { map: grass, wireframe: false } ));
    meshCanvas.rotation.x = -90 * Math.PI / 180;
    meshCanvas.scale.x = meshCanvas.scale.y = meshCanvas.scale.z = 100;

    scene.addObject( meshCanvas );

    renderer = new THREE.WebGLRenderer( { antialias: true } );
    renderer.setSize( window.innerWidth, window.innerHeight );

    document.body.appendChild(renderer.domElement);
    }