Permalink
Browse files

more work

  • Loading branch information...
1 parent 22d104c commit 14fc5d92d8e912f44cc54420d2780d194c6e5960 @jeromeetienne committed Mar 2, 2013
View
1 build/tquery-bundle-require.js
@@ -40727,6 +40727,7 @@ requirejs.config({
"plugins/tweenjs/vendor/Tween"
],
"plugins/videos/tquery.createvideotexture": [
+ "plugins/videos/tquery.audiovideotexture",
"plugins/videos/tquery.createwebcamtexture",
"plugins/videos/tquery.createtvsnowtexture"
],
View
5 js/tquery.core.create.js
@@ -109,6 +109,11 @@ tQuery.registerStatic('createTorusKnot', function(){
return this._createMesh(ctor, dflGeometry, arguments)
});
+tQuery.registerStatic('createCircle', function(){
+ var ctor = THREE.CircleGeometry;
+ var dflGeometry = [0.5, 32];
+ return this._createMesh(ctor, dflGeometry, arguments)
+});
tQuery.registerStatic('createVector3', function(x, y, z){
return new THREE.Vector3(x, y, z);
View
2 plugins/minecraft/tquery.camerafpscontrols.js
@@ -49,7 +49,7 @@ tQuery.registerStatic('CameraFpsControls', function(opts){
tQuery.CameraFpsControls.prototype.update = function(delta, now){
var delta = this._deltaTarget.get(0).position.clone()
- delta.subSelf(this._deltaCamera.get(0).position);
+ delta.sub(this._deltaCamera.get(0).position);
this._opts.tCamera.lookAt(delta);
}
View
1 plugins/requirejs/build/all.confrequire.js
@@ -222,6 +222,7 @@ requirejs.config({
"plugins/tweenjs/vendor/Tween"
],
"plugins/videos/tquery.createvideotexture": [
+ "plugins/videos/tquery.audiovideotexture",
"plugins/videos/tquery.createwebcamtexture",
"plugins/videos/tquery.createtvsnowtexture"
],
View
1 plugins/requirejs/confrequire/videos.confrequire.js
@@ -6,6 +6,7 @@ requirejs.config({
},
shim : {
'plugins/videos/tquery.createvideotexture' : [
+ 'plugins/videos/tquery.audiovideotexture',
'plugins/videos/tquery.createwebcamtexture',
'plugins/videos/tquery.createtvsnowtexture'
]
View
75 plugins/skymap/examples/dynamic.html
@@ -6,34 +6,27 @@
tQuery.createSkymap('mars').addTo(world);
- tQuery.createGrassGround({
- textureRepeatX : 10,
- textureRepeatY : 10,
- }).addTo(world).scale(30)
- .translateY(-0.001)
+ // tQuery.createGrassGround({
+ // textureRepeatX : 10,
+ // textureRepeatY : 10,
+ // }).addTo(world).scale(30)
+ // .translateY(-0.001)
- var cubeCamera = new THREE.CubeCamera( 0.001, 1000, 256 );
+ var cubeCamera = new THREE.CubeCamera( 0.001, 1000, 1024 );
// to avoid flickering on the border of the sphere
cubeCamera.renderTarget.minFilter = THREE.LinearMipMapLinearFilter;
-
- // var sphere = tQuery.createSphere().addTo(world).translateY(0.8)
- // .setBasicMaterial()
- // .envMap(cubeCamera.renderTarget)
- // .color(0xffff00)
- // .back()
-
-
- // TODO make a better API
-
- // attempts to make a puddle
- var sphere = tQuery.createPlane().addTo(world)
+ var sphere = tQuery.createSphere().addTo(world)
.setBasicMaterial()
.envMap(cubeCamera.renderTarget)
.color(0xffff00)
.back()
- //.scaleBy(10)
- //.positionY(5).positionZ(-3)
+
+ // world.loop().hook(function(delta, now){
+ // sphere.rotateY( 0.1 * delta * Math.PI*2)
+ // })
+
+
tQuery(cubeCamera).addTo(sphere)
@@ -44,5 +37,47 @@
sphere.visible(true) // *cough*
})
+
+
+ var container = tQuery.createObject3D().addTo(world)
+ .positionY(-0.5)
+ tQuery.createTorusKnot().addTo(container).position( 0, 0, 1)
+ tQuery.createTorusKnot().addTo(container).position( 0, 0,-1)
+ tQuery.createTorusKnot().addTo(container).position( 1, 0, 0).rotateY( Math.PI/2)
+ tQuery.createTorusKnot().addTo(container).position(-1, 0, 0).rotateY(-Math.PI/2)
+
+ world.loop().hook(function(delta, now){
+ container.rotateY( 0.3 * delta * Math.PI*2)
+ })
+
+
+ var textureW = 1024;
+ var textureH = 1024;
+ var rtTexture = new THREE.WebGLRenderTarget(textureW, textureH, {
+ minFilter : THREE.LinearFilter,
+ magFilter : THREE.NearestFilter,
+ format : THREE.RGBFormat
+ });
+
+ var tCamera = new THREE.PerspectiveCamera(35, textureW/textureH, 0.01, 10000);
+
+
+ world.loop().hook(function(delta, now){
+ var tRenderer = world.tRenderer();
+ tRenderer.render( world.tScene(), tCamera, rtTexture, true );
+ })
+
+ var mirror = tQuery.createPlane(16/10,9/10).addTo(world)
+ // .scaleXBy(16)
+ // .scaleYBy(9)
+ // .scaleBy(1/10)
+ .translateX(-1.5)
+ .translateZ(-1)
+ .rotateY(Math.PI/3)
+ .setBasicMaterial()
+ .map(rtTexture)
+ .back()
+ tQuery(tCamera).addTo(mirror)
+ .rotateY(Math.PI)
})
</script></body>
View
41 plugins/videos/examples/videobrowser.html
@@ -1,41 +0,0 @@
-<!doctype html><title>Minimal tQuery Page</title>
-<script src="../../../build/tquery-bundle-require.js"></script>
-<script src="../tquery.audiovideotexture.js"></script>
-<body><script>
-require(['tquery.webaudio', 'tquery.videos', 'tquery.domevent'], function(){
- var world = tQuery.createWorld().boilerplate().start();
- //var object = tQuery.createTorus().addTo(world);
-
- world.enableDomEvent()
- .enableWebAudio()
-
- console.assert(WebAudio.isAvailable);
-
-
- var avTexture = tQuery.createAudioVideoTexture('../../assets/videos/sintel.ogv');
- var object3D = tQuery.createCube(1.6,0.9,0.2).addTo(world)
- .setBasicMaterial()
- .map(avTexture.tTexture()) // To get the video
- .back()
-
- world.loop().hook(function(delta, now){
- var angle = 0.4 * now * Math.PI * 2;
- object3D.positionX( Math.cos(angle)*3 );
- object3D.positionZ( Math.sin(angle)*3 );
- })
-
- object3D.on('click', function(event){
- var tObject3D = event.target;
- var videoElem = avTexture.video();
- var notPlaying = videoElem.paused || videoElem.ended;
- if(notPlaying) videoElem.play();
- else videoElem.pause();
- });
-
- avTexture.addEventListener('soundReady', function(){
- console.log('soundReady', arguments)
- avTexture.sound().follow(object3D)
- })
-
-});
-</script></body>
View
3 plugins/videos/tquery.audiovideotexture.js
@@ -35,8 +35,9 @@ tQuery.registerStatic('AudioVideoTexture', function(opts){
}.bind(this));
- var webaudio = this._world.getWebAudio();
+ // wait until the vid is loaded
this._video.addEventListener('canplaythrough', function(event){
+ var webaudio = this._world.getWebAudio();
// creating custom nodeChain
var nodesChain = WebAudio.NodeChainBuilder.create(webaudio.context())
.mediaElementSource(this._video)

0 comments on commit 14fc5d9

Please sign in to comment.