media @ VU
web3d-video-grid.vr
web3d-video-grid.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
Web3D/VR
world
DEF WorldInfo WorldInfo {
title "Movie Cube Grid Space 1"
info [
"12/1999 / 05 2001 Holger Grahn hg@snafu.de"
"options:relativeTime=true,wwwProgress=true"
]
}
translate 4 times
PROTO T4 [
field SFVec3f bboxSize -1 -1 -1
field SFVec3f bboxCenter 0 0 0
field MFNode children []
field SFVec3f scale 1 1 1
]
{
Group {
children [
Transform {
bboxSize IS bboxSize
bboxCenter IS bboxCenter
children IS children
translation 50 0 50
scale IS scale
}
Transform {
bboxSize IS bboxSize
bboxCenter IS bboxCenter
children IS children
translation -50 0 50
scale IS scale
}
Transform {
bboxSize IS bboxSize
bboxCenter IS bboxCenter
children IS children
translation 50 0 -50
scale IS scale
}
Transform {
bboxSize IS bboxSize
bboxCenter IS bboxCenter
children IS children
translation -50 0 -50
scale IS scale
}
]
}
}
world
DEF background Background {
skyColor 0 0 0.1
leftUrl "logo.jpg"
rightUrl "logo.jpg"
backUrl "logo.jpg"
frontUrl "logo.jpg"
topUrl "logo.jpg"
bottomUrl "logo.jpg" # "../textures/starstr.gif"
}
NavigationInfo {
type [ "WALK" "ANY" ]
headlight TRUE
avatarSize [0.5 1.75, 0.75 ]
## visibilityLimit 140
speed 10
}
Fog {
fogType "LINEAR"
visibilityRange 1500
##visibilityStart 50
color 0 0 1
}
Viewpoint {
position 0 0 120
description "Entry"
fieldOfView 1
}
collision(s)
Collision {
collide FALSE
children [
DEF Root Group { }
#Shape {
# geometry DEF gridIls IndexedLineSet { ## will be computed by script
# coord DEF gridCoord Coordinate { }
#}}
DEF MasterTime TimeSensor { loop TRUE startTime 0 cycleInterval 20 }
DEF MasterTransform Transform
{
rotation 0 1 0 0
scaleOrientation 0 1 0 0
}
]
}
gridder
DEF Gridder Script
{
field SFNode root USE Root
field SFNode master USE MasterTransform
field SFNode masterTime USE MasterTime
field MFNode particleObjects [
Shape { geometry Box { size 10 10 10 }
appearance Appearance {
material DEF MasterMaterial Material {
diffuseColor 0.7 0.7 0.7
transparency 0.5
}
##texture ImageTexture { url "../textures/redpat1blur.png" }
texture DEF M1 MovieTexture { loop TRUE startTime 0
url [ ## "star wars vi - return of the jedi [divx].avi"
"../assets/clips/tube/about-content.mpg"
]
}
textureTransform DEF tx TextureTransform { }
}
}
]
field MFNode particles []
field SFInt32 uDimension 7
field SFInt32 vDimension 7
field SFInt32 wDimension 7
field SFVec3f bboxSize 60 60 60
field SFVec3f bboxCenter 0 0 0
##field SFNode gridIls USE gridIls # the ILS for visualization
field MFVec3f pts []
field MFVec3f scale []
field SFVec3f scaleSize 2 2 2
field SFVec3f scaleCenter 1.5 1.5 1.5
## anim stuff
field SFVec3f center 0 0 0
eventIn SFFloat centerAnim
eventIn SFVec3f set_center
eventIn SFTime enterTime
eventIn SFTime exitTime
script
url "javascript:
// compute equal spaced 3D grid coordinates, based on bbox
function computeGridCoord(nu,nv,nw)
{ var u,v,w;
var x,y,z;
var bmin = bboxCenter.subtract(bboxSize.multiply(0.5));
//var pts = new MFVec3f();
var ptsi=0;
pts.length = nw*nv*nu;
for(w=0; w<nw;w++) {
z=bmin.z + bboxSize.z * w/(nw-1);
for(v=0; v//particles[ptsi]=new SFNode('Transform {}');
//particles[ptsi].set_children = particleObjects;
particles[ptsi]=new SFNode('Transform { children Shape { appearance Appearance {textureTransform TextureTransform { } }}}');
particles[ptsi].children[0].geometry = particleObjects[0].geometry;
particles[ptsi].children[0].appearance.material = particleObjects[0].appearance.material;
particles[ptsi].children[0].appearance.texture = particleObjects[0].appearance.texture;
particles[ptsi].set_translation = pts[ptsi];
ptsi++;
}
}
}
return pts;
}
// compute equal spaced 3D grid coordinates, based on bbox
// also compute texture transform to map 0 -1 texture coordinate space
function computeGridCoordUV(nu,nv,nw)
{ var u,v,w;
var x,y,z;
var tu,tv;
var su,sv;
var bmin = bboxCenter.subtract(bboxSize.multiply(0.5));
//var pts = new MFVec3f();
var ptsi=0;
pts.length = nw*nv*nu;
su= 1/(nu);
sv= 1/(nv);
for(w=0; w//particles[ptsi]=new SFNode('Transform {}');
//particles[ptsi].set_children = particleObjects;
p= new SFNode('Transform { children [ Shape { appearance Appearance {textureTransform TextureTransform { } }} PositionInterpolator {} ]}');
pip = p.children[1];
particles[ptsi]=p;
// re-use these nodes
p.children[0].geometry = particleObjects[0].geometry;
p.children[0].appearance.material = particleObjects[0].appearance.material;
p.children[0].appearance.texture = particleObjects[0].appearance.texture;
p.children[0].appearance.textureTransform.translation = new SFVec2f(tu/su,tv/sv);
p.children[0].appearance.textureTransform.scale = new SFVec2f(su,sv);
p.set_translation = pts[ptsi];
Browser.addRoute(master,'rotation',p,'set_rotation');
Browser.addRoute(master,'scaleOrientation',p,'scaleOrientation');
Browser.addRoute(master,'scale',p,'scale');
// position interpolation
Browser.addRoute(masterTime,'fraction_changed',pip,'set_fraction');
Browser.addRoute(pip,'value_changed',p,'set_translation');
var i=0;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
pip.keyValue[i]=new SFVec3f(x*2,y*2,z); i++;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
pip.keyValue[i]=new SFVec3f(x,-20,-y); i++;
pip.keyValue[i]=new SFVec3f(x,-20,-y); i++;
pip.keyValue[i]=new SFVec3f(x*3,y,z*3); i++;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
pip.keyValue[i]=new SFVec3f(1*Math.random()*bboxSize.x,1*Math.random()*bboxSize.y,1*Math.random()*bboxSize.z); i++;
pip.keyValue[i]=new SFVec3f(-1*Math.random()*bboxSize.x,-1*Math.random()*bboxSize.y,-1*Math.random()*bboxSize.z); i++;
pip.keyValue[i]=new SFVec3f(bmin.x+2*Math.random()*bboxSize.x,bmin.y+2*Math.random()*bboxSize.y,bmin.z+2*Math.random()*bboxSize.z); i++;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
pip.keyValue[i]=new SFVec3f(x,y,z); i++;
ptsi++;
}
}
}
return pts;
}
// computed coordIndex for 3D grid ILS
function computeGridLines(nu,nv,nw)
{ var u,v,w;
var ind = new MFInt32();
var ptsi=0;
var indi=0;
ind.length = nw*nv*(nu+1);
for(w=0; w// setup everything
function initialize() {
var u,v,w;
u = uDimension;
v = vDimension;
w = wDimension;
var pts;
//pts = computeGridCoord(u,v,w);
pts = computeGridCoordUV(u,v,w);
root.set_children = particles; // add all particles to root
//particles.length=0;
//gridIls.coord.set_point = pts;
//gridIls.set_coordIndex = computeGridLines(u,v,w);
}
function shutdown()
{
particles.length=0;
pts.length=0;
}
function centerAnim(f) {
var n=particles.length;
var i;
for (i=0; iTimeSensor { startTime 0 loop TRUE cycleInterval 20 }
DEF S_tx Script {
directOutput TRUE
field SFNode tx USE tx # the
field SFNode master USE MasterTransform
field SFNode masterMaterial USE MasterMaterial
field SFNode gridder USE Gridder
eventIn SFFloat anim
url "javascript:
function anim(f) {
master.rotation[3] = Math.PI*Math.sin(2.0*f*Math.PI);
//f= 2+Math.sin(2.0*f*Math.PI);
//master.scale = new SFVec3f(f,f,f);
masterMaterial.transparency = 0.1+0.25*0.5*(1+Math.sin(2.0*f*Math.PI));
//x= 1.0+Math.sin(2.0*f*Math.PI);
//master.scale = new SFVec3f(x,x,x);
//gridder.centerAnim = (1 + 0.5*x) ;
//tx.translation.x = f;
//tx.rotation = Math.PI*Math.sin(2.0*f*Math.PI);
}
"
}
ROUTE TS.fraction_changed TO S_tx.anim
# VRML absolute time
# startup timer
DEF initTS TimeSensor {
cycleInterval 0.1
loop TRUE
}
# start video
ROUTE initTS.cycleTime TO M1.set_startTime
# stop the startup timer
ROUTE initTS.cycleTime TO initTS.set_stopTime
(C) A. Eliëns
21/5/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.