Permalink
Browse files

more work

  • Loading branch information...
1 parent f7cf825 commit e5f4894ccabcf2e98e4344fdfba5bccf0e9a1673 @jeromeetienne committed Feb 27, 2013
Showing with 88 additions and 30 deletions.
  1. +27 −7 build/tquery-bundle-require.js
  2. +27 −7 build/tquery-bundle.js
  3. +27 −7 build/tquery.js
  4. +7 −9 plugins/skymap/examples/dynamicdemo.html
@@ -37636,6 +37636,21 @@ tQuery.convert.toThreeColor = function(/* arguments */){
return undefined; // never reached - just to workaround linter complaint
};
+/**
+ * Convert the arguments into a THREE.Vector3
+ * @return {THREE.Vector3} the resulting THREE.Vector3
+ */
+tQuery.convert.toVector3 = function(/* arguments */){
+ // handle parameters
+ if( arguments[0] instanceof THREE.Vector3 && arguments.length === 1 ){
+ return arguments[0]
+ }else if( typeof arguments[0] === "number" && arguments.length === 3 ){
+ return new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
+ }else{
+ console.assert(false, "invalid parameter for Vector3");
+ }
+};
+
tQuery.convert.toNumber = function(value){
if( arguments.length === 1 && typeof(value) === 'number'){
return value;
@@ -37906,13 +37921,21 @@ tQuery.Object3D.prototype.material = function(){
*/
tQuery.Object3D.prototype.clone = function(){
var clones = [];
- this._lists.forEach(function(tObject3d){
+ this.each(function(tObject3d){
var clone = tObject3d.clone();
clones.push(clone);
})
return tQuery(clones)
}
+tQuery.Object3D.prototype.lookAt = function(position){
+ position = tQuery.convert.toVector3.apply(null, arguments);
+ this.each(function(tObject3d){
+ tObject3d.lookAt(position)
+ })
+ return this;
+};
+
//////////////////////////////////////////////////////////////////////////////////
// addTo/removeFrom tQuery.World/tQuery.Object3d //
//////////////////////////////////////////////////////////////////////////////////
@@ -39758,13 +39781,10 @@ tQuery.Object3D.registerInstance('position', function(vector3){
// handle the getter
if( vector3 === undefined ) return this.get(0).position;
// handle parameters
- if( typeof vector3 === "number" && arguments.length === 3 ){
- vector3 = new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
- }
- console.assert(vector3 instanceof THREE.Vector3, "Object3D.position parameter error");
+ vector3 = tQuery.convert.toVector3.apply(null, arguments);
// do the operation on each node
- this.each(function(object3d){
- object3d.position.copy(vector3);
+ this.each(function(tObject3d){
+ tObject3d.position.copy(vector3);
});
// return this, to get chained API
return this;
View
@@ -37636,6 +37636,21 @@ tQuery.convert.toThreeColor = function(/* arguments */){
return undefined; // never reached - just to workaround linter complaint
};
+/**
+ * Convert the arguments into a THREE.Vector3
+ * @return {THREE.Vector3} the resulting THREE.Vector3
+ */
+tQuery.convert.toVector3 = function(/* arguments */){
+ // handle parameters
+ if( arguments[0] instanceof THREE.Vector3 && arguments.length === 1 ){
+ return arguments[0]
+ }else if( typeof arguments[0] === "number" && arguments.length === 3 ){
+ return new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
+ }else{
+ console.assert(false, "invalid parameter for Vector3");
+ }
+};
+
tQuery.convert.toNumber = function(value){
if( arguments.length === 1 && typeof(value) === 'number'){
return value;
@@ -37906,13 +37921,21 @@ tQuery.Object3D.prototype.material = function(){
*/
tQuery.Object3D.prototype.clone = function(){
var clones = [];
- this._lists.forEach(function(tObject3d){
+ this.each(function(tObject3d){
var clone = tObject3d.clone();
clones.push(clone);
})
return tQuery(clones)
}
+tQuery.Object3D.prototype.lookAt = function(position){
+ position = tQuery.convert.toVector3.apply(null, arguments);
+ this.each(function(tObject3d){
+ tObject3d.lookAt(position)
+ })
+ return this;
+};
+
//////////////////////////////////////////////////////////////////////////////////
// addTo/removeFrom tQuery.World/tQuery.Object3d //
//////////////////////////////////////////////////////////////////////////////////
@@ -39758,13 +39781,10 @@ tQuery.Object3D.registerInstance('position', function(vector3){
// handle the getter
if( vector3 === undefined ) return this.get(0).position;
// handle parameters
- if( typeof vector3 === "number" && arguments.length === 3 ){
- vector3 = new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
- }
- console.assert(vector3 instanceof THREE.Vector3, "Object3D.position parameter error");
+ vector3 = tQuery.convert.toVector3.apply(null, arguments);
// do the operation on each node
- this.each(function(object3d){
- object3d.position.copy(vector3);
+ this.each(function(tObject3d){
+ tObject3d.position.copy(vector3);
});
// return this, to get chained API
return this;
View
@@ -410,6 +410,21 @@ tQuery.convert.toThreeColor = function(/* arguments */){
return undefined; // never reached - just to workaround linter complaint
};
+/**
+ * Convert the arguments into a THREE.Vector3
+ * @return {THREE.Vector3} the resulting THREE.Vector3
+ */
+tQuery.convert.toVector3 = function(/* arguments */){
+ // handle parameters
+ if( arguments[0] instanceof THREE.Vector3 && arguments.length === 1 ){
+ return arguments[0]
+ }else if( typeof arguments[0] === "number" && arguments.length === 3 ){
+ return new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
+ }else{
+ console.assert(false, "invalid parameter for Vector3");
+ }
+};
+
tQuery.convert.toNumber = function(value){
if( arguments.length === 1 && typeof(value) === 'number'){
return value;
@@ -680,13 +695,21 @@ tQuery.Object3D.prototype.material = function(){
*/
tQuery.Object3D.prototype.clone = function(){
var clones = [];
- this._lists.forEach(function(tObject3d){
+ this.each(function(tObject3d){
var clone = tObject3d.clone();
clones.push(clone);
})
return tQuery(clones)
}
+tQuery.Object3D.prototype.lookAt = function(position){
+ position = tQuery.convert.toVector3.apply(null, arguments);
+ this.each(function(tObject3d){
+ tObject3d.lookAt(position)
+ })
+ return this;
+};
+
//////////////////////////////////////////////////////////////////////////////////
// addTo/removeFrom tQuery.World/tQuery.Object3d //
//////////////////////////////////////////////////////////////////////////////////
@@ -2532,13 +2555,10 @@ tQuery.Object3D.registerInstance('position', function(vector3){
// handle the getter
if( vector3 === undefined ) return this.get(0).position;
// handle parameters
- if( typeof vector3 === "number" && arguments.length === 3 ){
- vector3 = new THREE.Vector3(arguments[0], arguments[1], arguments[2]);
- }
- console.assert(vector3 instanceof THREE.Vector3, "Object3D.position parameter error");
+ vector3 = tQuery.convert.toVector3.apply(null, arguments);
// do the operation on each node
- this.each(function(object3d){
- object3d.position.copy(vector3);
+ this.each(function(tObject3d){
+ tObject3d.position.copy(vector3);
});
// return this, to get chained API
return this;
@@ -8,13 +8,13 @@
var world = tQuery.createWorld().boilerplate().start()
var controls = tQuery.world.getCameraControls();
- controls.rangeX *= 1/10;
- controls.rangeY *= 1/10;
+ controls.rangeX *= 1/5;
+ controls.rangeY *= 1/5;
controls.target.y = 0.75;
// keep the camera above the ground
world.loop().hook(function(delta, now){
var camera = tQuery(world.tCamera())
- var minHeight = 0.1;
+ var minHeight = 0.2;
if( camera.positionY() < minHeight ) camera.positionY(minHeight)
})
@@ -32,10 +32,9 @@
cubeCamera.renderTarget.minFilter = THREE.LinearMipMapLinearFilter;
- var sphere = tQuery.createCube().addTo(world)
- .translateY(0.8)
+ var sphere = tQuery.createSphere().addTo(world)
.geometry()
- .scaleBy(1/2)
+ .scaleBy(0.75)
.back()
.setBasicMaterial()
.envMap(cubeCamera.renderTarget)
@@ -57,9 +56,8 @@
})
world.loop().hook(function(delta, now){
- var angle = 0.2 * now * Math.PI * 2;
- sphere.positionY(Math.sin(angle)*0.5 + 0.6)
- .scale(Math.sin(angle)*0.3 + 1)
+ var angle = 0.3 * now * Math.PI * 2;
+ sphere.positionY(Math.abs(Math.cos(angle)*1.3) + 0.75/2)
})

0 comments on commit e5f4894

Please sign in to comment.