Merge branch 'master' of github.com:logsol/chuck.js

This commit is contained in:
Jeena 2013-11-30 11:16:27 +01:00
commit 59978429c7
7 changed files with 33 additions and 29 deletions

3
.floo Normal file
View file

@ -0,0 +1,3 @@
{
"url": "https://floobits.com/r/logsol/chuck/"
}

2
.gitignore vendored
View file

@ -1,5 +1,3 @@
node_modules/
*.log
.DS_Store
.floo
.sublime-project

7
.sublime-project vendored Normal file
View file

@ -0,0 +1,7 @@
{
"folders": [
{
"path": "/Users/karlpannek/Work/projects/js/chuck.js"
}
]
}

View file

@ -61,17 +61,10 @@ define(requires, function (DomController, Three, Settings, CameraController) {
//this.scene.add(directionalLight);
this.createMesh(100, 100, 100, 100, 'static/img/100.png', function (mesh) {
self.mesh = mesh;
self.scene.add(mesh);
});
/*
this.createMesh(50, 50, 200, 100, 'static/img/100.png', function (mesh) {
self.scene.add(mesh);
});
*/
//this.animate(this);
//this.createMesh(100, 100, 100, 100, 'static/img/100.png', function (mesh) {
// self.mesh = mesh;
// self.scene.add(mesh);
//});
}
ViewController.prototype.loadMeshes = function(objects) {
@ -88,6 +81,7 @@ define(requires, function (DomController, Three, Settings, CameraController) {
self.createMesh(Settings.TILE_SIZE, Settings.TILE_SIZE, x, y, 'static/img/Tiles/' + material + '/' + o.s + '' + o.r + '.gif', function(mesh) {
self.scene.add(mesh);
console.log("img height:", mesh.material.map.image.height);
//mesh.rotation.z = rad;
});
})();
@ -108,27 +102,23 @@ define(requires, function (DomController, Three, Settings, CameraController) {
}
ViewController.prototype.render = function () {
this.renderer.render(this.scene, this.cameraController.getCamera());
}
ViewController.prototype.createMesh = function (width, height, x, y, imgPath, callback) {
var textureImg = new Image();
textureImg.onload = function () { // FIXME: perhaps not needed to load double?
var material = new Three.MeshLambertMaterial({
map: Three.ImageUtils.loadTexture(imgPath),
transparent: true
});
var mesh;
var material = new Three.MeshLambertMaterial({
map: Three.ImageUtils.loadTexture(imgPath, new THREE.UVMapping(), function(){
callback(mesh);
}),
transparent: true
});
var mesh = new Three.Mesh(new Three.PlaneGeometry(width, height), material);
mesh.overdraw = true;
//mesh.position.z = 1;
mesh.position.x = x;
mesh.position.y = y;
callback(mesh);
};
textureImg.src = imgPath;
mesh = new Three.Mesh(new Three.PlaneGeometry(width, height), material);
mesh.overdraw = true;
mesh.position.x = x;
mesh.position.y = y;
//mesh.position.z = 1;
}
return ViewController;

View file

@ -0,0 +1,6 @@
var myCanvas = null;
myCanvas = document.getElementsByTagName('canvas')[0];
myCanvas.onmousemove = function(e){
console.log(e.clientX - this.offsetLeft)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB