Upload
slametz-pembuka
View
408
Download
5
Embed Size (px)
DESCRIPTION
VRML, latihan VRML
Citation preview
CONTOH LATIHAN VRML
TEKNIK INFORMATIKA Informatic EngineeringUniversitas Nasional
Contoh desain menggunakan VRML V1.0rumah
#VRML V1.0 asciiDEF BackgroundColor Info { string "1 1 1"}
DEF Dinding Separator{Texture2 {filename "batubata.jpg"}
Cube{ width 1.5
height 1depth 1.5 }
} DEF Atap Separator {
Texture2 {filename "batik.jpg"} Transform {translation -1 0.5 1}
Coordinate3 {point [0 0 0,
2 0 0, 2 0 -2, 0 0 -2, 1 1 -1] }
IndexedFaceSet{ coordIndex
[0, 1, 2, 3, 0, -1, 0, 1, 4, -1, 1, 2, 4, -1, 2, 3, 4, -1, 0, 3, 4, -1] }
}
DEF Pintu Separator {
Texture2 {filename "kayu.jpg"}Coordinate3{ point [0.25 -0.5 0.75,
0.25 0.25 0.75, -0.25 0.25 0.75, -0.25 -0.5 0.75] }
IndexedFaceSet { coordIndex
[0, 1, 2, 3, -1] } }
Membuat Meja
#VRML V1.0 ascii
DEF BackgroundColor Info {string "1 1 1"}### objek meja #DEF Meja Separator{
#Alas meja#DEF Alas Separator{Texture2 {filename "kayu.jpg"}
Cube{ width 10 height 1.5 depth 7}
}
Separator {
Transform { translation 3 -2 -2} #kaki meja# DEF Kaki Separator {
Texture2 {filename "batu.jpg"} Cylinder { radius 0.5
height 5 } }
} }# kaki meja ke-2# Separator {Transform {translation -3 -2 -2}
USE Kaki}
# kaki meja ke-3# Separator { Transform {translation 3 -2 2 }
USE Kaki}#kaki meja ke -4# Separator { Transform {translation -3 -2 2}
USE Kaki} } #akhir objek meja#
Membuat Roket
#VRML V1.0 asciiDEF BackgroundColor Info { string "1 1 1"}
DEF Roket Separator{
Material {diffuseColor 1 1 0}
DEF Pertama Separator{
Transform {translation 0.5 0 0.5}DEF Kaki Separator{ Cylinder {radius 0.5 height 1 } }Transform {translation -1 0 0}USE Kaki
Transform {translation 0 0 -1}USE KakiTransform {translation 1 0 0}USE Kaki
}Transform {translation 0 1 0}DEF Kedua Separator{
Material {diffuseColor 1 0 0}Cylinder { }
}
DEF Ketiga Separator{
Material {diffuseColor 0 0 1}Transform {translation 0.5 2 0.5}DEF Tiang Separator{
Cylinder { radius 0.25 }}Transform {translation -1 0 0}USE Tiang
Transform {translation 0 0 -1}USE TiangTransform {translation 1 0 0}USE Tiang
}DEF Keempat Separator{
Material {diffuseColor 0 1 0}
Transform {translation 0 4 0}Cylinder { }
}DEF Kelima Separator {
Material {diffuseColor 1 0 0}Transform {translation 0 6 0}Cone { }
}}
Membuat Monas
#VRML V1.0 ascii#membuat groud tanah#DEF Tanah Separator{
Texture2 {filename "silver.jpg"}Cube {width 10
height 0.05 depth 10
} } #bagian bawah monas# DEF Dasar Separator {
Texture2 {filename "silver.jpg"} Transform {rotation 1 0 0 3.14} Coordinate3
{ point [
1 0 1, 1 0 -1, -1 0 -1, -1 0 1, 2 -1 2, 2 -1 -2, -2 -1 -2, -2 -1 2] } IndexedFaceSet { coordIndex
[0, 1, 2, 3, -1, 4, 5, 6, 7, -1, 0, 1, 5, 4, -1, 1, 2, 6, 5, -1, 2, 3, 7, 6, -1, 3, 0, 4, 7, -1] }
}#alas penutup poligon#DEF Alas Separator{
Texture2 {filename "silver.jpg" }Transform{translation 0 1 0}Cube {width 3.5
depth 3.5 height 0.05}
}#tiang monas#DEF Tiang Separator{
Texture2 {filename "silver.jpg" }Transform {translation 0 3 0}Cube {width 0.75
depth 0.75height 5 }
}#bagian atas monas#
DEF Atap Separator{
Transform {translation 0 5.5 0 }Transform {scaleFactor 0.5 0.5 0.5 }USE DasarUSE Alas
}#Emas monas#
DEF Emas Separator{
Texture2 {filename "gold.jpg" }Transform {translation 0 7 0}Cone {bottomRadius 0.4
height 1.75}}
Puri Inggris
#VRML V1.0 ascii#DEF BackgroundImage Info { string " "}DEF BackgroundColor Info { string "1 1 1" }#objek menara bigbenDEF Bigben Separator{
#dinding ke-1DEF Kubus Separator{
Texture2 {filename "batu.jpg"}Cube {}
}#dinding ke-2DEF Silinder Separator{
Texture2 {filename "silver.jpg"}Transform {translation 0 2 0}Cylinder {}
}#dinding ke-3Separator{
Transform {translation 0 4 0}USE Kubus
}#jamDEF Bola Separator{
Transform {translation 0 4 0}Texture2 {filename "rose.jpg"}Sphere {radius 1.25}
}#atap menaraDEF Kerucut Separator{
Texture2 {filename "gold.jpg"}Transform {translation 0 6 0}Cone {}
}}#objek pagar sekeliling menara#DEF Wall Separator{
Texture2 {filename "seratkayu.jpg"}
Transform {translation 3 0 0}Cube{width 5
height 2depth 1}
}#mengkopi menara sebanyak 3 kali#
Separator{ Transform {translation 6 0 0}
USE BigbenTransform {translation 0 0 -6}USE BigbenTransform {translation -6 0 0}USE Bigben }
#mengkopi pager sebanyak 3 kali#Separator{Transform {translation 0 0 -6}
USE Wall }Separator{
Transform {rotation 0 1 0 1.5707}#Transform {translation 0 0 0}USE WallTransform {translation 0 0 6}USE Wall
}