This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > December 2004 > Basic VRML question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Basic VRML question
syzygy2k3@gmail.com

2004-12-15, 12:26 pm

Hi, I'm working on a VRML project for one of my final projects. It's
nothing complicated, we never did any VRML in class, so I can't ask the
teacher and I can't figure it out. Im basically trying to figure out to
how change the ImageTexture of a sphere when you click on it, and I
can't figure it out. I want to change the image from earth.gif to
earth2.gif whenever the sphere is clicked.

Here's what I have:
=========================================
#VRML V2.0 utf8
Group {
children [
DEF ts TouchSensor { }
Shape {
appearance Appearance {
texture DEF it ImageTexture {url "earth.gif" repeatS FALSE
repeatT FALSE}
material Material {
ambientIntensity 0.1
diffuseColor 0.75 0 0.05
specularColor 0.9 0.9 0.9
emissiveColor 0 0 0
shininess .1
transparency 0
}
}

geometry
Sphere {radius 2.5}
}
ROUTE ts.touchTime TO it.url "earth2.gif"
]
}

Background {
backUrl "stars.gif"
leftUrl "stars.gif"
rightUrl "stars.gif"
frontUrl "stars.gif"
}
=========================================

And also, does anyone know how I can have this rotating automatically
all the time?

Thanks in advance,
syzygy2k3@XXXXXXXXXX

psi

2004-12-15, 12:26 pm


syzygy2k3@XXXXXXXXXX wrote:
> Hi, I'm working on a VRML project for one of my final projects. It's
> nothing complicated, we never did any VRML in class, so I can't ask

the
> teacher and I can't figure it out. Im basically trying to figure out

to
> how change the ImageTexture of a sphere when you click on it, and I
> can't figure it out. I want to change the image from earth.gif to
> earth2.gif whenever the sphere is clicked.
>
> Here's what I have:
> =========================================
> #VRML V2.0 utf8
> Group {
> children [
> DEF ts TouchSensor { }
> Shape {
> appearance Appearance {
> texture DEF it ImageTexture {url "earth.gif" repeatS FALSE
> repeatT FALSE}
> material Material {
> ambientIntensity 0.1
> diffuseColor 0.75 0 0.05
> specularColor 0.9 0.9 0.9
> emissiveColor 0 0 0
> shininess .1
> transparency 0
> }
> }
>
> geometry
> Sphere {radius 2.5}
> }
> ROUTE ts.touchTime TO it.url "earth2.gif"
> ]
> }
>
> Background {
> backUrl "stars.gif"
> leftUrl "stars.gif"
> rightUrl "stars.gif"
> frontUrl "stars.gif"
> }
> =========================================
>
> And also, does anyone know how I can have this rotating automatically
> all the time?
>
> Thanks in advance,
> syzygy2k3@XXXXXXXXXX


many, many ways, but can't immediatly think of one that doesn't involve
a script ( maybe in X3D ), since url is an exposed multi-string, route
your click event to a script that then outputs a string that's the file
name you want, and then route this to the sphere.

in VRML you do seem to need scripts very early on, and also more routes
than would on the face of it, seem the minimum.

examples of the rotation can be found all over the place, check
tutorials etc.

simon.

syzygy2k3@gmail.com

2004-12-15, 12:26 pm

Well thanks for the suggestion - I got the Imagetexture figured out.
You wouldn't possibly know how I could make the sphere spin by itself?

Joerg Scheurich aka MUFTI

2004-12-15, 7:21 pm

> You wouldn't possibly know how I could make the sphere spin by itself?

You can also try to let spin the texture alone 8-)

so long
MUFTI

#VRML V2.0 utf8

Transform
{
children
[
Shape
{
appearance Appearance
{
material Material
{
}
texture PixelTexture
{
image 4 4 3
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x0000ffff
}
textureTransform DEF TextureTransform1 TextureTransform
{
}
}
geometry Sphere
{
}
}
]
}

DEF TimeSensor1 TimeSensor
{
cycleInterval 10
loop TRUE
}

DEF ScalarInterpolator1 ScalarInterpolator
{
key
[
0
0.500000
1
]
keyValue
[
0
3.140000
6.280000
]
}

ROUTE TimeSensor1.fraction_changed TO ScalarInterpolator1.set_fraction
ROUTE ScalarInterpolator1.value_changed TO TextureTransform1.set_rotation
syzygy2k3@gmail.com

2004-12-17, 7:19 pm

Well thanks for the suggestion - I got the Imagetexture figured out.
You wouldn't possibly know how I could make the sphere spin by itself?

Joerg Scheurich aka MUFTI

2004-12-17, 11:16 pm


> Im basically trying to figure out to
> how change the ImageTexture of a sphere when you click on it, and I
> can't figure it out.


Take a look at

http://www.csv.ica.uni-stuttgart.de...ture_change.wrl

so long
MUFTI
--
Die Leistung des Spieles kann verlangsamt werden durch
eine schwer zerlegbare Festplatte.
Joerg Scheurich aka MUFTI

2004-12-17, 11:16 pm

> You wouldn't possibly know how I could make the sphere spin by itself?

You can also try to let spin the texture alone 8-)

so long
MUFTI

#VRML V2.0 utf8

Transform
{
children
[
Shape
{
appearance Appearance
{
material Material
{
}
texture PixelTexture
{
image 4 4 3
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x00ffff00
0x00ff00ff
0x0000ffff
0x0000ffff
}
textureTransform DEF TextureTransform1 TextureTransform
{
}
}
geometry Sphere
{
}
}
]
}

DEF TimeSensor1 TimeSensor
{
cycleInterval 10
loop TRUE
}

DEF ScalarInterpolator1 ScalarInterpolator
{
key
[
0
0.500000
1
]
keyValue
[
0
3.140000
6.280000
]
}

ROUTE TimeSensor1.fraction_changed TO ScalarInterpolator1.set_fraction
ROUTE ScalarInterpolator1.value_changed TO TextureTransform1.set_rotation
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews