Skip to content

Commit

Permalink
Intégration réussie du webgl
Browse files Browse the repository at this point in the history
  • Loading branch information
GWillmann committed Dec 5, 2014
1 parent 40ea639 commit 6332279
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/CG/PlatformBundle/Resources/public/js/earth.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,33 @@ function init()
scene.add( light )

// EarthMesh
var manager = new THREE.LoadingManager();
var texture = new THREE.Texture();

var onProgress = function ( xhr ) {
console.log('On Progress')
};

var onError = function ( xhr ) {
console.log('An error has occured')
console.log(xhr);
};

var loader = new THREE.ImageLoader( manager );
loader.load( '../img/earthTexture.jpg', function ( image ) {
texture.image = image;
texture.needsUpdate = true;
console.log('image loaded successfully')
}, onProgress, onError);






var geometry = new THREE.SphereGeometry(0.5, 32, 32)
var material = new THREE.MeshPhongMaterial()
material.map = THREE.ImageUtils.loadTexture('earthmap1k.jpg')
material.map = texture
earthMesh = new THREE.Mesh(geometry, material)

scene.add(earthMesh)
Expand Down
Binary file modified src/CG/PlatformBundle/Resources/public/js/earthTexture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6332279

Please sign in to comment.