You are on page 1of 12

CONTOH LATIHAN VRML

TEKNIK INFORMATIKA
Informatic Engineering
Universitas Nasional
Contoh desain menggunakan VRML V1.0
rumah

#VRML V1.0 ascii


DEF BackgroundColor Info { string "1 1 1"}

DEF Dinding Separator


{Texture2 {filename "batubata.jpg"}

Cube
{ width 1.5
height 1
depth 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 ascii


DEF 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 Kaki
Transform {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 Tiang
Transform {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.75
height 5 }
}
#bagian atas monas#
DEF Atap Separator
{

Transform {translation 0 5.5 0 }


Transform {scaleFactor 0.5 0.5 0.5 }
USE Dasar
USE 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 bigben
DEF Bigben Separator
{
#dinding ke-1
DEF Kubus Separator
{
Texture2 {filename "batu.jpg"}
Cube {}
}
#dinding ke-2
DEF Silinder Separator
{
Texture2 {filename "silver.jpg"}
Transform {translation 0 2 0}
Cylinder {}
}
#dinding ke-3
Separator
{
Transform {translation 0 4 0}
USE Kubus
}
#jam
DEF Bola Separator
{
Transform {translation 0 4 0}
Texture2 {filename "rose.jpg"}
Sphere {radius 1.25}
}
#atap menara
DEF 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 2
depth 1}
}
#mengkopi menara sebanyak 3 kali#
Separator
{ Transform {translation 6 0 0}
USE Bigben
Transform {translation 0 0 -6}
USE Bigben
Transform {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 Wall
Transform {translation 0 0 6}
USE Wall
}

You might also like