mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
Merge branch 'master' of github.com:logsol/chuck.js
This commit is contained in:
commit
59978429c7
7 changed files with 33 additions and 29 deletions
3
.floo
Normal file
3
.floo
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"url": "https://floobits.com/r/logsol/chuck/"
|
||||||
|
}
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,5 +1,3 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.floo
|
|
||||||
.sublime-project
|
|
||||||
|
|
|
||||||
7
.sublime-project
vendored
Normal file
7
.sublime-project
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "/Users/karlpannek/Work/projects/js/chuck.js"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -61,17 +61,10 @@ define(requires, function (DomController, Three, Settings, CameraController) {
|
||||||
//this.scene.add(directionalLight);
|
//this.scene.add(directionalLight);
|
||||||
|
|
||||||
|
|
||||||
this.createMesh(100, 100, 100, 100, 'static/img/100.png', function (mesh) {
|
//this.createMesh(100, 100, 100, 100, 'static/img/100.png', function (mesh) {
|
||||||
self.mesh = mesh;
|
// self.mesh = mesh;
|
||||||
self.scene.add(mesh);
|
// self.scene.add(mesh);
|
||||||
});
|
//});
|
||||||
/*
|
|
||||||
this.createMesh(50, 50, 200, 100, 'static/img/100.png', function (mesh) {
|
|
||||||
self.scene.add(mesh);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
//this.animate(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewController.prototype.loadMeshes = function(objects) {
|
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.createMesh(Settings.TILE_SIZE, Settings.TILE_SIZE, x, y, 'static/img/Tiles/' + material + '/' + o.s + '' + o.r + '.gif', function(mesh) {
|
||||||
self.scene.add(mesh);
|
self.scene.add(mesh);
|
||||||
|
console.log("img height:", mesh.material.map.image.height);
|
||||||
//mesh.rotation.z = rad;
|
//mesh.rotation.z = rad;
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
@ -108,27 +102,23 @@ define(requires, function (DomController, Three, Settings, CameraController) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewController.prototype.render = function () {
|
ViewController.prototype.render = function () {
|
||||||
|
|
||||||
this.renderer.render(this.scene, this.cameraController.getCamera());
|
this.renderer.render(this.scene, this.cameraController.getCamera());
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewController.prototype.createMesh = function (width, height, x, y, imgPath, callback) {
|
ViewController.prototype.createMesh = function (width, height, x, y, imgPath, callback) {
|
||||||
var textureImg = new Image();
|
var mesh;
|
||||||
textureImg.onload = function () { // FIXME: perhaps not needed to load double?
|
var material = new Three.MeshLambertMaterial({
|
||||||
var material = new Three.MeshLambertMaterial({
|
map: Three.ImageUtils.loadTexture(imgPath, new THREE.UVMapping(), function(){
|
||||||
map: Three.ImageUtils.loadTexture(imgPath),
|
callback(mesh);
|
||||||
transparent: true
|
}),
|
||||||
});
|
transparent: true
|
||||||
|
});
|
||||||
|
|
||||||
var mesh = new Three.Mesh(new Three.PlaneGeometry(width, height), material);
|
mesh = new Three.Mesh(new Three.PlaneGeometry(width, height), material);
|
||||||
mesh.overdraw = true;
|
mesh.overdraw = true;
|
||||||
//mesh.position.z = 1;
|
mesh.position.x = x;
|
||||||
mesh.position.x = x;
|
mesh.position.y = y;
|
||||||
mesh.position.y = y;
|
//mesh.position.z = 1;
|
||||||
|
|
||||||
callback(mesh);
|
|
||||||
};
|
|
||||||
textureImg.src = imgPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ViewController;
|
return ViewController;
|
||||||
|
|
|
||||||
6
snippets/canvas-mouseposition.js
Normal file
6
snippets/canvas-mouseposition.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
var myCanvas = null;
|
||||||
|
myCanvas = document.getElementsByTagName('canvas')[0];
|
||||||
|
|
||||||
|
myCanvas.onmousemove = function(e){
|
||||||
|
console.log(e.clientX - this.offsetLeft)
|
||||||
|
}
|
||||||
BIN
static/img/Animation/chuckwitharmssprite.png
Normal file
BIN
static/img/Animation/chuckwitharmssprite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
BIN
static/img/Animation/chuckwithoutarmssprite.png
Normal file
BIN
static/img/Animation/chuckwithoutarmssprite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
Loading…
Add table
Add a link
Reference in a new issue