VRMLで作った町


#VRML V1.0 ascii

DEF BackgroundColor Info { string "0.678431373 0.956862745 0.988235294" }

#Sphere { radius 10 }

PerspectiveCamera {
  position        -65 -10 60
  orientation     0 -1 0 1.57
  focalDistance   12
} 
LOD {# 4 levels of detail
	range [ 440, 660, 880 ]
	center -70 -10 60

	Separator { # entire street

		DEF more_more_houses Group {

			DEF more_houses Group {

				DEF houses Group {

					Texture2 { filename "stone.gif" }

					DEF house_base Separator {
						DEF main_cube Separator {
						DEF metrix Texture2Transform { scaleFactor  8 8 } 
						DEF 1F Cube { height 30 width 30 depth 20 }
						}# main_cube
						Separator { # door
							Translation { translation -8 -10 10 }
							Texture2Transform { scaleFactor  3 2 } 
							Texture2 { filename "wood2.gif" }
							WWWAnchor {
    								name "vrml51.htm"        
    								description "C'mon! open the door to click"
								Cube { height 10 width 7 depth 0.6 }
							}
							Texture2 { }
							# nob
							Translation { translation 2.5 0 0 }
							Cube { height 2 width 1 depth 0.8 }
							Rotation { rotation 1 0 0 1.57 }
							Cylinder { radius 0.4 height 1.5 }
						}# door
						DEF windows Separator {
							Translation { translation -8 7 10 }
							DEF window Group {
								Texture2 { filename "window.gif" }
								WWWAnchor {
									name "vrml41.htm"        
									description "Click to see egg man"
									Cube { 
										height 6 
										width 6 
										depth 0.6 }
								}
							}# windows group
							Translation { translation 14 0 0 }
							USE window
							Translation { translation 0 -15 0 }
							USE window
						}# window separator
					}# house_base

					DEF triangle_walls Separator { 
						Translation { translation -15 15 10 }
						DEF triangle_wall Group {
							Coordinate3 {
								point [
									0 5 -10,  #0
									0 0 0,  #1
									0 0 -20,  #2
								]
							}
							IndexedFaceSet {
								coordIndex [
									0, 1, 2, -1,
								]
							}
						} # triangle_wall group
						Translation { translation 30 0 0 }
						USE triangle_wall
					}# triangle_walls separator

					DEF roofs Separator {
						Texture2 { }
						Material {
							diffuseColor 1 0 0
							specularColor 0.01 0 0
							shininess 0.1
						}	
						Separator { # single roof
							Rotation { rotation -1 0 0 1.1 }
							Translation { translation 0 2 18 }
							DEF roof Cube { height 15 width 35 depth 1 }
						} # single roof
						Separator { # single roof2
							Rotation { rotation 1 0 0 1.1 }
							Translation { translation 0 2 -18 }
							USE roof
						}# single roof2
					} # roofs

					Separator { #2nd house
						DEF next Translation { translation 40 0 0 }
						Texture2 { filename "brick2.gif" }
						DEF house2 Group {
							USE house_base
							Translation { translation 0 30 0 }
							DEF 2F_windows Separator {
								USE windows
								Translation { translation -8 -8 10 }
								USE window
							} # 2F_windows separator
							USE metrix
							USE 1F
						} # house2 group
					} # 2nd house separator 

					Separator { #3rd house
						USE next	USE next
						Texture2 { filename "wood.gif" }
						USE house_base USE roofs USE triangle_walls
					}# 3rd house

					Separator { # shop
						Translation { translation 105 -5 0 }
						Texture2 { filename "wood3.gif" }
						Separator { #shop walls
							Texture2Transform { scaleFactor 3 4 }
							DEF 3rd_wall Cube { height 20 width 1 depth 20 }
							Translation { translation 30 0 0 }
							USE 3rd_wall
							Transform { 
								translation -15 0 -10 
								rotation 0 1 0 1.57 
								scaleFactor 1 1 1.5 }
							USE 3rd_wall
						} #Shop walls separator
						Separator { #shop roof
							Translation { translation 15 -5 0 }
							USE triangle_walls
							USE roofs
							Translation { translation 0 11 10 }
							DEF board Cube { height 7 width 30 depth 0 }	
						}# shop roof separator
						Separator { # green roof
							Transform {
								translation 15 3 12.5
								rotation -1 0 0 1.2 }
							Texture2 { }
							Material { 
								diffuseColor 0.5 1 0.5 
								specularColor 0.005 0.01 0.005
								shininess 0.3 }
							USE board
							Transform {
								translation 0 -3.7 -0.5
								rotation 1 0 0 1
								scaleFactor 1 0.2 1 }
							USE board
						} #green roof sepator 
						Separator { # poles
							Texture2 { }
							Material { 
								diffuseColor 0.8 0.8 0.8 
								specularColor 0.08 0.08 0.08
								shininess 0.8 }
							Transform {
								translation  0.5 0 11 
								rotation 1 0 0 1.1 }
							DEF pole1 Cylinder { height 8.8 radius 0.3 }
							Translation { translation 29 0 0 }
							USE pole1
						} #poles separator
						Separator { # shop board
							Texture2 { filename "board.gif" }
							Transform {
								translation 15 6 11
								rotation 1 0 0 0.4
								scaleFactor 0.9 0.7 1 }
							USE board
						}# shop board separator
						Separator {# inside shop
							Texture2 { }
							Translation { translation 7 -8 8 }
							DEF shelfs Group {
								Cube { height 4 width 12 depth 8 }
								Translation { translation 0 1 -12 }
								Cube { height 6 width 12 depth 8 }
							} # shelfs group
							Translation { translation 16 -1 12 }
							USE shelfs
						}# inside shop separator
					}# shop separator

					Separator { # pavement
						Texture2 { filename "brick.gif" }
						Texture2Transform { scaleFactor 12 8 }
						Translation { translation 60 -16 0 }
						Cube { height 3 width 180 depth 50 }
					} # pavement

					Separator { # streetlamp
						Texture2 { }
						Translation { translation 21 6 13 }
						Cylinder { height 40 radius 1.5 }
						Transform {
							translation 0 10 3
							rotation -1 0 0 0.6 }
						Cone { height 3 bottomRadius 2 parts ALL }
						Translation { translation 0 3 0 }
						Cylinder { height 4 radius 0.1 }
						Translation { translation 0 -4.3 0 }
						Sphere { radius 0.6 }
					}# streetlamp
				} #houses

				Separator { # oposite row
					Rotation { rotation 0 1 0 3.1415 }
					Translation { translation -120 0 -120 }
					USE houses
				}# oposite row separator 

				Separator { #road
					Texture2 { }
					Translation { translation 60 -20 60 }
					Cube { height 5 width 220 depth 180 }
				}#road
			}# more_houses

			DEF north Translation { translation 220 0 0 }
			USE more_houses
		}# more_more_houses separator

		USE north USE more_more_houses
	}
	Separator {# 2nd level
	Texture2 { }
		USE north USE north USE more_more_houses
	}
	Separator {# 3nd level
	Texture2 { }
		USE north USE north USE north USE more_more_houses
	}
	Separator {# 4nd level
	Texture2 { }
		USE north USE north USE north USE north USE more_more_houses
	}
}#LOD

Separator { # gon
	Translation { translation -25 -11 60 }
	Separator {
		Rotation { rotation 0 -1 0 1.45 }
		WWWAnchor {
		name "vrml6.htm"        
		description "Let me get out from here"
		WWWInline { name "gon.wrl" }
		}
	}
}#gon
Separator { # girl
	Translation { translation -5 -1.5 50 }
	Separator {
		Rotation { rotation 0 -1 0 1.45 }
		Scale { scaleFactor 0.02 0.02 0.02 }
		WWWAnchor {
		name "vrml51.htm"        
		description "Go to my room together!"
		WWWInline { name "girl.wrl" }
		}
	}
}#girl

比較的長いソースですが、全部手で書いてます。もしツールを使ったらもっともっと長いソースになると思います。
結構、適当に書いたので、ソースは汚いですが、参考にはなるかもしません。
戻る メインページ