tutorial de vrml

54
LICENCIATURA EN SISTEMAS COMPUTACIONALES PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN UNIVERSIDAD AUTÓNOMA DEL ESTADO DE HIDALGO ESCUELA SUPERIOR DE: TLAHUELILPAN MANUAL DE PRÁCTICAS DE GRAFICACIÓN MANUAL VRMLMARISOL DORANTES DORANTES SEXTO SEMESTRE

Upload: sol-setnarod

Post on 15-Jan-2016

28 views

Category:

Documents


0 download

DESCRIPTION

70 ejemplos prácticos del lenguaje VRML que te ayudarán a aprender.

TRANSCRIPT

Page 1: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

UNIVERSIDAD AUTÓNOMA DEL ESTADO DE HIDALGO

ESCUELA SUPERIOR DE: TLAHUELILPAN

MANUAL DE PRÁCTICAS DE GRAFICACIÓN

“MANUAL VRML”

MARISOL DORANTES DORANTES

SEXTO SEMESTRE

Page 2: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 Shape {

geometry Box { size 4 3 5 }}

#VRML V2.0 utf8Shape {

geometry Sphere { radius 5 }}

#VRML V2.0 utf8Shape {

geometry Cone { bottomRadius 3height 2

}}

Page 3: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8Shape {

geometry Cylinder { radius 4height 5

} }

#VRML V2.0 utf8Shape {

geometry Box { size 4 3 5 }appearance Appearance {

material Material {diffuseColor 1 0 0

}}

}

#VRML V2.0 utf8

Page 4: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

Shape {geometry Cylinder {

radius 4height 5

}appearance Appearance {

material Material {diffuseColor 0 1 1

}}

}

#VRML V2.0 utf8Shape { # Esfera roja que nos marca el origen de coordenadas

geometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 1 0 0 } }

}

Transform {translation 10 0 0children [

Shape { # Esfera verde trasladada 10 unidades en el eje Xgeometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 0 1 0 } }

}]

}

Page 5: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8Shape { # Esfera roja que nos marca el origen de coordenadas

geometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 1 0 0 } }

}

Transform {translation 10 0 0children [

Shape { # Esfera verde trasladada 10 unidades en el eje Xgeometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 0 1 0 } }

}]

}

Transform {translation 10 3 0children [

Shape { # Cono azul trasladado 10 unidades en el eje X y 3 en el eje Ygeometry Cone { bottomRadius 2 height 2 }appearance Appearance { material Material { diffuseColor 0 0 1 } }

}]

}

#VRML V2.0 utf8Shape { # Caja amarilla que nos señala la rotación cero

geometry Box { size 4 2 4 }appearance Appearance { material Material { diffuseColor 1 1 0 } }

}

Transform {rotation 0 1 0 0.7854 # 45 grados en radianeschildren [

Shape { # Caja azul que es rotada 45 grados respecto al eje Ygeometry Box { size 2 4 2 }appearance Appearance { material Material { diffuseColor 0 0 1 } }

}]

}

Page 6: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8Shape { # Caja amarilla que nos marca la rotación cero

geometry Box { size 4 2 4 }appearance Appearance { material Material { diffuseColor 1 1 0 } }

}

Transform {rotation 1 0 0 0.7854 # Rotación eje Xchildren [

Transform {rotation 0 1 0 0.7854 # Rotación eje Ychildren [

Shape { # Caja azulgeometry Box { size 2 4 2 }appearance Appearance { material Material { diffuseColor 0

0 1 } }}

]}

]}

#VRML V2.0 utf8Transform {

scale 2 1 1 # Crece el doble en la dirección X y queda igual en las direcciones Y y Zchildren [

Shape { # Cubo naranjageometry Box { size 1 1 1 }

Page 7: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

appearance Appearance { material Material { diffuseColor 1 0.5 0 } }}

]}

#VRML V2.0 utf8Transform {

translation 5 4 0rotation 1 0 0 0.5236 # 30 gradosscale 0.5 0.5 1children [

Shape { # Cubo verde obscurogeometry Box { size 1 1 1 }appearance Appearance { material Material { diffuseColor 0 0.5 0.2 } }

}]

}

#VRML V2.0 utf8Transform {

translation 5 4 0children [

Transform {rotation 1 0 0 0.5236 # 30 gradoschildren [

Transform {scale 0.5 0.5 1children [

Shape { # Cubo verde obsurogeometry Box { size 1 1 1 }appearance Appearance { material Material

{ diffuseColor 0 0.5 0.2 } }

Page 8: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}]

}]

}]

}

#VRML V2.0 utf8

Transform {scale 0.5 0.5 1children [

Transform {rotation 1 0 0 0.5236 # 30 gradoschildren [

Transform {translation 5 4 0children [

Shape { # Cubo verde obscurogeometry Box { size 1 1 1 }appearance Appearance { material Material

{ diffuseColor 0 0.5 0.2 } }}

]}

]}

]}

Page 9: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8Shape {

appearance Appearance { material Material { diffuseColor 1 0 0 } }geometry

IndexedFaceSet {coord Coordinate {

point [ 0.5 0.5 0.5, 0.5 0.5 -0.5,-0.5 0.5 -0.5,-0.5 0.5 0.5, 0.5 -0.5 0.5, 0.5 -0.5 -0.5,-0.5 -0.5 -0.5,-0.5 -0.5 0.5

]}coordIndex [

0, 1, 2, 3, -1,0, 4, 5, 1, -1,1, 5, 6, 2, -1,2, 6, 7, 3, -1,3, 7, 4, 0, -1,4, 7, 6, 5, -1

]}

}

#VRML V2.0 utf8

Page 10: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

Shape { geometry

IndexedFaceSet {coord Coordinate {

point [ 0.5 0.5 0.5, 0.5 0.5 -0.5,-0.5 0.5 -0.5,-0.5 0.5 0.5, 0.5 -0.5 0.5, 0.5 -0.5 -0.5,-0.5 -0.5 -0.5,-0.5 -0.5 0.5

]}coordIndex [

0, 1, 2, 3, -1,0, 4, 5, 1, -1,1, 5, 6, 2, -1,2, 6, 7, 3, -1,3, 7, 4, 0, -1,4, 7, 6, 5, -1

]colorPerVertex FALSEcolor Color {

color [1 0 0,0 1 0,0 0 1,1 0 1,1 1 0,0 1 1

]}

}}

#VRML V2.0 utf8Shape {

geometryIndexedFaceSet {

coord Coordinate {point [

0.5 0.5 0.5,

Page 11: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

0.5 0.5 -0.5,-0.5 0.5 -0.5,-0.5 0.5 0.5, 0.5 -0.5 0.5, 0.5 -0.5 -0.5,-0.5 -0.5 -0.5,-0.5 -0.5 0.5

]}coordIndex [

0, 1, 2, 3, -1,0, 4, 5, 1, -1,1, 5, 6, 2, -1,2, 6, 7, 3, -1,3, 7, 4, 0, -1,4, 7, 6, 5, -1

]colorPerVertex FALSEcolor Color {

color [0 0 1,1 1 0

]}colorIndex [

0, 0, 0, 1, 1, 1]

}}

#VRML V2.0 utf8Shape {

geometryIndexedFaceSet {

coord Coordinate {point [

0.5 0.5 0.5, 0.5 0.5 -0.5,-0.5 0.5 -0.5,-0.5 0.5 0.5, 0.5 -0.5 0.5,

Page 12: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

0.5 -0.5 -0.5,-0.5 -0.5 -0.5,-0.5 -0.5 0.5

]}coordIndex [

0, 1, 2, 3, -1,0, 4, 5, 1, -1,1, 5, 6, 2, -1,2, 6, 7, 3, -1,3, 7, 4, 0, -1,4, 7, 6, 5, -1

]colorPerVertex TRUE # No haría falta ponerlo porque es el valor por defecto.color Color {

color [1 0 0,0 1 0,0 0 1,1 0 1,1 1 0,0 1 1,1 0.5 0,0 1 0.5

]}colorIndex [

0, 1, 2, 3, -1,0, 4, 5, 1, -1,1, 5, 6, 2, -1,2, 6, 7, 3, -1,3, 7, 4, 0, -1,4, 7, 6, 5, -1

]}

}

#VRML V2.0 utf8 Shape {

Page 13: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

appearance Appearance { material Material { emissiveColor 0 0.8 1 } }geometry

IndexedLineSet {coord Coordinate {

point [ 0.5 0.5 0.5, 0.5 0.5 -0.5,-0.5 0.5 -0.5,-0.5 0.5 0.5, 0.5 -0.5 0.5, 0.5 -0.5 -0.5,-0.5 -0.5 -0.5,-0.5 -0.5 0.5

]}coordIndex [

0, 1, 2, 3, 0, -1,4, 5, 6, 7, 4, -1,0, 4, -1,1, 5, -1,2, 6, -1,3, 7, -1

]}

}

#VRML V2.0 utf8 Shape {

geometryIndexedLineSet {

coord Coordinate {point [

-22 4 0,-18 -6 0,-14 4 0,-10 -6 0,-10 4 0,-4 4 0,-2 2 0,-2 0 0,-4 -2 0,

Page 14: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

-10 -2 0,-2 -6 0,2 -6 0,2 4 0,6 0 0,10 4 0,10 -6 0,14 4 0,14 -6 0,22 -6 0

]}coordIndex [

0, 1, 2, -1, # V3, 4, 5, 6, 7, 8, 9, -1, 8, 10, -1, # R11, 12, 13, 14, 15, -1, # M16, 17, 18, -1 # L

]colorPerVertex FALSEcolor Color {

color [1 0 0, 0 1 0, 0 0 1, 1 1 0

]}colorIndex [

0, 1, 1, 2, 3]

}}

#VRML V2.0 utf8 Shape {

appearance Appearance { material Material { emissiveColor 1 1 0 } }geometry

PointSet {coord Coordinate {

point [ 0.5, 0.5, 0.5, 0.5, 0.5, -0.5,

Page 15: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

-0.5, 0.5, -0.5,-0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5,-0.5, -0.5, -0.5,-0.5, -0.5, 0.5

]}

}}

#VRML V2.0 utf8 DirectionalLight {

ambientIntensity 0.5color 1 1 1intensity 1direction -0.5 -0.5 0

}

Shape { appearance Appearance {

material Material {ambientIntensity 1diffuseColor 0 0 1

}}geometry Sphere { radius 2 }

}

Transform {translation 2 5 -5children [

Shape { appearance Appearance {

material Material {ambientIntensity 1diffuseColor 1 1 0

}}geometry Cone { bottomRadius 2 height 3 }

}

Page 16: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

]}

#VRML V2.0 utf8 DirectionalLight { # Luz Roja

ambientIntensity 0.5color 1 0 0intensity 1direction 0.5 -0.5 -0.1

}

DirectionalLight { # Luz VerdeambientIntensity 0.5color 0 1 0intensity 1direction -0.5 -0.5 -0.1

}

DirectionalLight { # Luz AzulambientIntensity 0.5color 0 0 1intensity 1direction 0 0.5 -0.1

}

Shape { appearance Appearance {

material Material {ambientIntensity 1diffuseColor 1 1 1

}}geometry Sphere { radius 2 }

}

Page 17: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 PointLight { # Luz azul sin atenuación

location 8 -3 -10radius 15ambientIntensity 0.5color 0 0 1intensity 1attenuation 1 0 0 # Esta combinación no presenta atenuación

}

Transform {translation 0 -5 -10children Shape {

appearance Appearance {material Material {

ambientIntensity 1diffuseColor 1 1 1

}}geometry Box { size 20 1 10 }

}}

#VRML V2.0 utf8 PointLight { # Luz azul con atenuación

location 8 -3 -10radius 15ambientIntensity 0.5

Page 18: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

color 0 0 1intensity 1attenuation 1 0.5 0 # Presenta una cierta atenuación

}

Transform {translation 0 -5 -10children Shape {

appearance Appearance {material Material {

ambientIntensity 1diffuseColor 1 1 1

}}geometry Box { size 20 1 10 }

}}

#VRML V2.0 utf8 SpotLight { # Spot rojo

location 0 0 -10radius 3ambientIntensity 0.5color 1 0 0intensity 1attenuation 1 0 0 # Esta combinación no presenta atenuacióndirection 0 -1 0 # apunta directamente hacia abajocutOffAngle 1.0472 # 60 grados en radianesbeamWidth 0.785398 # 45 grados en radianes

}

Transform {translation -10 -4 -15children Shape {

appearance Appearance {material Material {

ambientIntensity 1diffuseColor 1 1 1

}}geometry ElevationGrid {

colorPerVertex FALSExDimension 20zDimension 10

Page 19: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

xSpacing 1zSpacing 1height [

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

]}

}}

#VRML V2.0 utf8 Viewpoint {

position 0 0 10orientation 0 0 1 0description "PVpor_Defecto"

}

Viewpoint {position 10 0 10orientation 0 1 0 0.7854 # 45 grados en radianesdescription "PV_tres_cuartos"

}Shape {

appearance Appearance { material Material { diffuseColor 1 0.6 0 } }geometry Sphere { radius 2 }

}

Transform {translation 0 0 -8children

Shape {appearance Appearance { material Material { diffuseColor 0.4 0 1 } }geometry Sphere { radius 2 }

Page 20: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}}

#VRML V2.0 utf8 Viewpoint {

position 0 0 10orientation 0 0 1 0description "PVpor_Defecto"

}

Viewpoint {position 10 0 10orientation 0 1 0 0.7854 # 45 grados en radianesdescription "PV_tres_cuartos"

}Shape {

appearance Appearance { material Material { diffuseColor 1 0.6 0 } }geometry Sphere { radius 2 }

}

Transform {translation 0 0 -8children

Shape {appearance Appearance { material Material { diffuseColor 0.4 0 1 } }geometry Sphere { radius 2 }

}}

Page 21: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 Viewpoint {

fieldOfView 2.618description "Gran_Angular"

}

Viewpoint {fieldOfView 1.3962667description "80mm"

}

Viewpoint {fieldOfView 0.31416description "Telefoto"

}

Shape {appearance Appearance { material Material { diffuseColor 1 0.6 0 } }geometry Box { size 30 10 2 }

}

Shape {appearance Appearance { material Material { diffuseColor 0.3 0 1 } }geometry Box { size 8 5 5 }

}

Shape {appearance Appearance { material Material { diffuseColor 0 1 0.5 } }geometry Box { size 1 1 8 }

}

Page 22: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 PROTO Paraguas [

field SFColor colorBaston 0.1 0.1 0field SFColor colorTela 0 0.2 1

]{

Group {children [

Shape {geometry Cylinder { height 3 radius 0.1 }appearance Appearance { material Material { diffuseColor IS

colorBaston } }}Transform {

translation 0 1.75 0children Shape {

geometry Cone { height 0.5 bottomRadius 3 }appearance Appearance { material Material { diffuseColor IS

colorTela } }}

}]

}}

Paraguas { } #Creamos un objeto Paraguas con los valores por defecto

Transform {translation 8 0 0children Paraguas { colorBaston 0.2 0 0 colorTela 0 0.2 0.1 }

}

Transform {translation -8 0 0children Paraguas { colorBaston 0 0 0.3 colorTela 0.4 0 0.1 }

}

Page 23: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 PROTO Banquillo [

field SFColor colorPatas 1 1 0field SFColor colorAsiento 0 0 1field SFVec3f proporciones 1 1 1field SFVec3f posicion 0 0 0

]{

PROTO Pata [field SFColor colorPata 1 1 0field SFVec3f posicion 0 0 0

]{

Transform {translation IS posicionchildren Shape {

geometry Cylinder { radius 0.1 height 1 }appearance Appearance { material Material { diffuseColor IS

colorPata } }}

}}

Transform {translation IS posicionscale IS proporcioneschildren [

Shape { # Asientogeometry Box { size 1 0.2 1 }appearance Appearance { material Material { diffuseColor IS

colorAsiento } }}Pata { posicion 0.4 -0.6 0.4 colorPata IS colorPatas }Pata { posicion -0.4 -0.6 0.4 colorPata IS colorPatas }Pata { posicion -0.4 -0.6 -0.4 colorPata IS colorPatas }Pata { posicion 0.4 -0.6 -0.4 colorPata IS colorPatas }

]}

}

Banquillo { } #Creamos un objeto Banquillo con los valores por defecto

Page 24: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

Banquillo { colorPatas 1 0.5 0 colorAsiento 0.5 0 1 posicion -2 0 0 }Banquillo { colorPatas 0.5 1 0 colorAsiento 1 0.5 0 posicion 2 0 0 }Banquillo { colorPatas 1 0 0.8 colorAsiento 1 0.5 0 posicion 0 2 0 proporciones 3 1 1 }

#VRML V2.0 utf8 DEF MiRojo Appearance {

material Material {diffuseColor 0.8 0.2 0.4

}}

Transform {translation -2 0 0children Shape {

geometry Box { size 3 3 3 }appearance USE MiRojo

}}Transform {

translation 2 0 0children Shape {

geometry Sphere { radius 2 }appearance USE MiRojo

}}

#VRML V2.0 utf8

Page 25: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

DEF MiRojo Appearance {material Material {

diffuseColor 1 0.2 0}

}

Transform {translation -2 0 0children Shape {

geometry Box { size 3 3 3 }appearance USE MiRojo

}}Transform {

translation 2 0 0children Shape {

geometry Sphere { radius 2 }appearance USE MiRojo

}}

#VRML V2.0 utf8 Shape { # Objeto de referencía con material mate.

geometry Sphere { radius 1.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5

}}

}Transform {

translation -2 2 0children Shape {

geometry Sphere { radius 1.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5specularColor 1 0 0shininess 0

}}

}

Page 26: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}Transform {

translation 2 2 0children Shape {

geometry Sphere { radius 1.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5specularColor 1 0 0shininess 0.05

}}

}}Transform {

translation -2 -2 0children Shape {

geometry Sphere { radius 1.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5specularColor 1 0 0shininess 0.3

}}

}}Transform {

translation 2 -2 0children Shape {

geometry Sphere { radius 1.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5specularColor 1 0 0shininess 1

}}

}}

Page 27: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 Transform {

translation -1.5 0 0children Shape {

geometry Cylinder { radius 0.2 height 8 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5

}}

}}Transform {

translation -0.5 0 0children Shape {

geometry Cylinder { radius 0.2 height 8 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5emissiveColor 1 1 1

}}

}}Transform {

translation 0.5 0 0children Shape {

geometry Cylinder { radius 0.2 height 8 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5emissiveColor 1 1 0

}}

}}Transform {

translation 1.5 0 0children Shape {

geometry Cylinder { radius 0.2 height 8 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5emissiveColor 0.6 1 1

}}

}}

Page 28: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 Transform { # Objeto de fondo para referencia translation 0 0 -2

children Shape {geometry Box { size 10 10 0.5 }appearance Appearance {

material Material {diffuseColor 0 0 1

}}

}}Transform {

translation -3.75 0 0children Shape {

geometry Box { size 2 4 0.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5transparency 0

}}

}}Transform {

translation -1.25 0 0children Shape {

geometry Box { size 2 4 0.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5transparency 0.33

}}

}}Transform {

translation 1.25 0 0children Shape {

geometry Box { size 2 4 0.5 }appearance Appearance {

Page 29: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

material Material {diffuseColor 0.5 0.5 0.5transparency 0.66

}}

}}Transform {

translation 3.75 0 0children Shape {

geometry Box { size 2 4 0.5 }appearance Appearance {

material Material {diffuseColor 0.5 0.5 0.5transparency 0.9

}}

}}

#VRML V2.0 utf8 Transform {

translation -2 0 0children Shape {

geometry Box { size 3 3 3 }appearance Appearance {

texture ImageTexture {url "teapot.gif"

}}

}}

Transform {translation 2 0 0children Shape {

geometry Box { size 3 3 3 }appearance Appearance {

material Material {diffuseColor 1 1 1

}texture ImageTexture {

url "teapot.gif"}

}

Page 30: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}}

#VRML V2.0 utf8 DEF Textura Appearance {

material Material {diffuseColor 1 1 1

}texture ImageTexture {

url "teapot.gif"}

}

Transform {translation -2 2 0children Shape {

geometry Box { size 3 3 3 }appearance USE Textura

}}

Transform {translation 2 2 0children Shape {

geometry Sphere { radius 1.5 }appearance USE Textura

}}Transform {

translation -2 -2 0children Shape {

geometry Cone { height 3 bottomRadius 1.5 }appearance USE Textura

}}

Transform {translation 2 -2 0children Shape {

geometry Cylinder { height 3 radius 1.5 }appearance USE Textura

}

Page 31: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}

#VRML V2.0 utf8 Shape {

geometry Box { size 3 3 3 }appearance Appearance {

material Material {diffuseColor 1 1 1

}texture ImageTexture {

url "ccoo.jpg"}textureTransform TextureTransform {

scale 2 2rotation 1.5708 # PI/2

}}

}

#VRML V2.0 utf8 Transform { # Fondo de referencia translation 0 0 -5

children Shape {geometry Box { size 10 10 0.2 }appearance Appearance {

Page 32: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

material Material {diffuseColor 0.2 0.8 0.4

}}

}}Shape {

geometry Box { size 4 2 4 }appearance Appearance {

material Material {diffuseColor 1 1 1

}texture ImageTexture {

url "ccoo.jpg"}

}}

#VRML V2.0 utf8 Anchor {

children Shape {geometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 0.8 0.5 0 } }

}url "http://www.iua.upf.es/~npares/docencia/vrml/material/mater7.wrl"

}

#VRML V2.0 utf8 Anchor {

children Shape {geometry Box { size 1 1 1 }

Page 33: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

appearance Appearance { material Material { diffuseColor 0 0.2 0.8 } }}url "http://www.iua.upf.es/~npares/docencia/vrml/anchor/anchor.htm"parameter [ "target=nuevoframe" ]

}

#VRML V2.0 utf8 Shape {

geometry Cylinder { height 8 radius 0.2 }appearance Appearance { material Material { diffuseColor 0 0.2 0.8 } }

}

Inline {url "http://www.iua.upf.es/~npares/docencia/vrml/anchor/anchor1.wrl"

}

#VRML V2.0 utf8 Billboard {

axisOfRotation 0 1 0children Shape {

geometry IndexedFaceSet {coord Coordinate {

point [ 2 3 0, -2 3 0, -2 -3 0, 2 -3 0 ]}coordIndex [ 0 1 2 3 ]solid FALSEtexCoord TextureCoordinate {

Page 34: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

point [ 1 1, 0 1, 0 0, 1 0 ]}

}appearance Appearance {

texture ImageTexture {url "redwood.gif"

}}

}}

#VRML V2.0 utf8 Collision {

collide FALSEchildren [

Transform {translation -3 0 0children Shape {

geometry Box { size 2 2 2 }appearance Appearance { material Material { diffuseColor 1 0 0 } }

}}

]}

Collision {collide TRUEchildren [

Shape {geometry Sphere { radius 1 }appearance Appearance { material Material { diffuseColor 0 1 0 } }

}Transform {

translation 3 0 0children Shape {

geometry Cone { height 1 bottomRadius 1 }appearance Appearance { material Material { diffuseColor 0 0.5 1 } }

}}

]}

Page 35: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 Shape {

geometry Sphere { radius 2 }appearance Appearance {

material DEF MaterialEsfera Material { diffuseColor 1 0 0 }}

}

DEF Luz DirectionalLight {color 1 1 1direction 0.5 0.5 0intensity 1

}

#VRML V2.0 utf8 DEF motorColor TimeSensor{

loop TRUEcycleInterval 5

}

DEF Arcoiris ColorInterpolator {key [ 3, 0.7, 0.6, 1]keyValue [ 1 0 0, 0 1 0, 0 0 1, 1 0 0]

}

DEF CuboColorCambiante Shape {

Page 36: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

geometry Box { size 2 2 2 }appearance Appearance { material DEF materialColorCambiante Material {} }

}

#VRML V2.0 utf8 DEF motorColor TimeSensor{

loop TRUEcycleInterval 5

}

DEF Arcoiris ColorInterpolator {key [ 0, 0.3, 0.6, 1]keyValue [ 1 0 0, 0 1 0, 0 0 1, 1 0 0]

}

DEF CuboColorCambiante Shape {geometry Box { size 2 2 2 }appearance Appearance { material DEF materialColorCambiante Material {} }

}

DEF ZonaActiva ProximitySensor {center 0 0 0size 8 8 8

}

ROUTE motorColor.fraction_changed TO Arcoiris.set_fractionROUTE Arcoiris.value_changed TO materialColorCambiante.diffuseColor

ROUTE ZonaActiva.isActive TO motorColor.enabled

Page 37: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 DEF motorColor TimeSensor{

loop TRUEcycleInterval 5enabled FALSE

}

DEF Arcoiris ColorInterpolator {key [ 0, 0.3, 0.6, 1]keyValue [ 1 0 0, 0 1 0, 0 0 1, 1 0 0]

}

DEF CuboColorCambiante Shape {geometry Box { size 2 2 2 }appearance Appearance { material DEF materialColorCambiante Material {} }

}

DEF BotonVerde Transform {translation 0 -1 7children [

Shape {geometry Cylinder { height 0.1 radius 1 }appearance Appearance { material Material { diffuseColor 0 1 0 } }

}DEF SensorBotonVerde TouchSensor { }

]}

ROUTE motorColor.fraction_changed TO Arcoiris.set_fractionROUTE Arcoiris.value_changed TO materialColorCambiante .diffuseColor

ROUTE SensorBotonVerde.isActive TO motorColor.enabled

Page 38: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 Transform { # Cubo de referencia

translation -3 0 0children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0.7 0.3 0 }}

}}

Group {children [

DEF Cubo Transform {children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0 0.7 0.3 }}

}}DEF PS PlaneSensor { }

]}

ROUTE PS.translation_changed TO Cubo.translation

#VRML V2.0 utf8 Group {

children [

Page 39: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

Transform { # Cubo activotranslation -3 0 0children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0.7 0.3 0 }}

}}DEF PS PlaneSensor { }

]}

DEF Cubo Transform { # Cubo que se muevechildren Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0 0.7 0.3 }}

}}

ROUTE PS.translation_changed TO Cubo.translation

#VRML V2.0 utf8 Transform { # Cubo de referencia

translation -3 0 0children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0.7 0.3 0 }}

}}

Group {children [

DEF Cubo Transform {children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0 0.7 0.3 }}

Page 40: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}}DEF CS CylinderSensor { }

]}

ROUTE CS.rotation_changed TO Cubo.rotation

#VRML V2.0 utf8 Transform { # Cubo de referencia

translation -3 0 0children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0.7 0.3 0 }}

}}

Group {children [

DEF Cubo Transform {children Shape {

geometry Box { size 2 2 2 }appearance Appearance {

material Material { diffuseColor 0 0.7 0.3 }}

}}DEF SS SphereSensor { }

]}

ROUTE SS.rotation_changed TO Cubo.rotation

Page 41: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 LOD {

range [ 10 15 20 ]level [

Group { # Niell 1 (máximo nivel): dos cajas y cuatro cilindroschildren [

Transform { # Respaldotranslation 0 3.5 -1.75children Shape {

geometry Box { size 3.5 3 0.5 }appearance Appearance { material Material

{ diffuseColor 0.8 0.6 0 } }}

}Shape { # Asiento

geometry Box { size 3.5 0.5 3.5 }appearance Appearance { material Material { diffuseColor

0.8 0.6 0 } }}Transform { # Pata posterior izquierda

translation -1.75 0 -1.75children Shape {

geometry Cylinder { radius 0.25 height 10 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }}

}Transform { # Pata posterior derecha

translation 1.75 0 -1.75children Shape {

geometry Cylinder { radius 0.25 height 10 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }}

}Transform { # Pata frontal izquierda

translation -1.75 -2.5 1.75children Shape {

geometry Cylinder { radius 0.25 height 5 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }

Page 42: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}}Transform { # Pata frontal derecha

translation 1.75 -2.5 1.75children Shape {

geometry Cylinder { radius 0.25 height 5 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }}

}]

}Group { # Nivel 2: seis cajas

children [Transform { # Respaldo

translation 0 3.5 -1.75children Shape {

geometry Box { size 3.5 3 0.5 }appearance Appearance { material Material

{ diffuseColor 0.8 0.6 0 } }}

}Shape { # Asiento

geometry Box { size 3.5 0.5 3.5 }appearance Appearance { material Material { diffuseColor

0.8 0.6 0 } }}Transform { # Pata posterior izquierda

translation -1.75 0 -1.75children Shape {

geometry Box { size 0.5 10 0.5 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }}

}Transform { # Pata posterior derecha

translation 1.75 0 -1.75children Shape {

geometry Box { size 0.5 10 0.5 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }}

}Transform { # Pata frontal izquierda

translation -1.75 -2.5 1.75children Shape {

geometry Box { size 0.5 5 0.5 }appearance Appearance { material Material

{ diffuseColor 0.8 0 0.2 } }}

}Transform { # Pata frontal derecha

translation 1.75 -2.5 1.75children Shape {

geometry Box { size 0.5 5 0.5 }

Page 43: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

appearance Appearance { material Material { diffuseColor 0.8 0 0.2 } }

}}

]}Group { # Nivel 3: dos cajas

children [Transform { # Respaldo

translation 0 2.5 -1.75children Shape {

geometry Box { size 4 5 0.5 }appearance Appearance { material Material

{ diffuseColor 0.8 0.6 0 } }}

}Transform { # Asiento

translation 0 -2.5 0children Shape {

geometry Box { size 4 5 4 }appearance Appearance { material Material

{ diffuseColor 0.8 0.6 0 } }}

}]

}Shape { # Nivel 4 (más bajo): una caja

geometry Box { size 4 10 4 }appearance Appearance { material Material { diffuseColor 0.8 0.6 0 } }

}]

}Video#VRML V2.0 utf8 Shape {

geometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 1 1 0 } }

}

Sound {minFront 200minBrack 200maxFront 200maxBack 200spatialize FALSEsource AudioClip {

url "Wildlife.wmv"startTime 1loop TRUE

}}

Page 44: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 DEF TransfCubo Transform {

translation 0 0 0children [

Shape {geometry Box { size 1 1 1 }

}DEF TS TouchSensor {}

]}

DEF MiScript Script {eventIn SFTime clickfield SFNode TCubo USE TransfCubo

url "javascript:function click(v,t) {

if(TCubo.translation[0] > 5) ...}

"}

ROUTE TS.touchTime TO MiScript.click

Page 45: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

#VRML V2.0 utf8 DEF TransfCubo Transform {

translation 0 0 0children [

Shape {geometry Box { size 1 1 1 }

}DEF TS TouchSensor {}

]}

DEF MiScript Script {eventIn SFTime clickfield SFNode TCubo USE TransfCubo

url "javascript:function click(v,t) {

if(TCubo.translation[0] > 5) ...}

"}

ROUTE TS.touchTime TO MiScript.click

#VRML V2.0 utf8 Background {

skyColor [ 0.8 0.8 1 ]}

Page 46: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

Shape { # Objeto de referenciageometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 1 0.8 0 } }

}

#VRML V2.0 utf8 Background {

# 0º 22º 45º 60º 75º 85º 90ºskyAngle [ 0.384, 0.785, 1.047, 1.309, 1.484, 1.5708 ]skyColor [ 0 0 0.2, 0 0 1, 0 1 1, 0.75 0.75 1, 0.8 0.8 0, 0.8 0.6 0, 1 0.4 0 ]# azulobscuro azul cian azulclaro amarillo anaranjado rojizo

}

Shape { # Objeto de referenciageometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 1 0.8 0 } }

}

#VRML V2.0 utf8 Background {

# 0º 22º 45º 60º 75º 85º 90ºskyAngle [ 0.384, 0.785, 1.047, 1.309, 1.484, 1.5708 ]skyColor [ 0 0 0.2, 0 0 1, 0 1 1, 0.75 0.75 1, 0.8 0.8 0, 0.8 0.6 0, 1 0.4 0 ]# azulobscuro azul cian azulclaro amarillo anaranjado rojizo

# 0º 90ºgroundAngle [ 1.5708 ]groundColor [ 0.2 1 0.4, 0.2 1 0.4 ]

Page 47: Tutorial de VRML

LICENCIATURA EN SISTEMAS COMPUTACIONALES

PROGRAMAS DEL MANUAL DE VRML GRAFICACIÓN

}

Shape { # Objeto de referenciageometry Sphere { radius 2 }appearance Appearance { material Material { diffuseColor 1 0.8 0 } }

}