虚拟现实技术实验报告一
- 格式:doc
- 大小:452.00 KB
- 文档页数:7
华北水利水电大学虚拟现实技术实验报告2015~2016学年第二学期 2013 级专业计算机科学与技术班级:2013156 学号: 201315616 姓名:张亚
实验一创建VRML基本形体
一、实验目的:
熟悉虚拟现实建模语言的编辑环境,掌握创建基本形体和复杂形体的步骤
二、试验内容:
1、熟悉VRML的编辑环境;
2、网格造型节点的使用;
3、纹理贴图的使用;
4、创建复合形体(带有文字注释的透明木板)
5、挤出造型节点的使用
三、核心程序源代码:
1、熟悉VRML的编辑环境
2、网格造型节点的使用
#VRML V2.0 utf8
Background {
skyColor 0.0 0.6 0.8}
Shape {
appearance Appearance {
material Material {
diffuseColor 0.8 0.2 0.2
specularColor 0.5 0.5 0.5
shininess 0.2
}
}
geometry ElevationGrid{
xDimension 2
xSpacing 1
zDimension 12
zSpacing 0.2
height [
2,2,1,2,2,1,2,0,2,2,1,0,2,0,1,2,
1,2,1,1,0,2,2,1,2,2,1,2,0,1,0,1
1,2,0,0,1,1,1,0,1,2,0,1,1,0,2,0,
0,2,0,2,1,2,1,1,1,2,2,0,2,1,1,1,
0,2,2,0,2,2,0,1,2,0,2,1,0,1,1,0,
2,0,2,2,0,2,0,2,0,0,1,0,1,1,0,1,
2,0,1,0,1,2,2,1,1,0,1,1,2,1,0,0,
1,0,1,2,2,0,2,2,2,0,0,1,0,2,2,2,
1,0,0,1,0,0,1,1,0,1,2,2,1,1,2,1,
2,0,2,0,1,0,1,0,1,0,2,1,1,2,1,2,
0,1,1,1,2,0,0,2,2,1,1,2,0,2,1,1,
1,1,1,0,0,1,2,0,0,1,1,1,0,2,0,2,
2,1,0,2,1,0,1,2,1,1,0,0,2,2,0,1,
0,1,0,1,2,1,1,0,1,1,0,2,2,0,2,0,
1,1,2,2,0,1,0,2,0,2,2,0,1,0,2,2,
2,2,2,1,1,1,0,1,0,1,2,2,1,0,1,0, ]
creaseAngle 1.2
solid FALSE
}
}
3、纹理贴图的使用;
#VRML V2.0 utf8
Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url "E:\qq\1.jpg"
}
}
geometry Box {
size 1 1 1
}
}
Transform {
translation -1 0 1
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0 1 1
}
}
geometry Box {
size 2 2 0.16
}
}
]
}
4、创建复合形体(带有文字注释的透明木板)#VRML V2.0 utf8
Shape {
appearance Appearance {
material Material {
diffuseColor 0.8 0.2 0.1
specularColor 0.2 0 0
transparency 0.1
}
}
geometry Box {
size 20 15 5
}
}
Shape {
geometry Text {
string ["hello huashui!"]
maxExtent 10
fontStyle FontStyle {
family "hello"
size 8.0
spacing 5.0
style "PLAIN"
horizontal TRUE
justify ["MIDDLE"]
leftToRight TRUE
topToBottom TRUE
}
}
}
5、挤出造型节点的使用
Background {
skyColor [
0.0 0.6 0.8]
}
Shape {
appearance Appearance {
material Material {
diffuseColor 0.8 0.1 0.1
ambientIntensity 0.2
specularColor 0.8 0.8 0.8
shininess 0.15
}
}
geometry Extrusion {
crossSection
[
0,-1,1,0,0,1,-8,1 -8,
2.0 2.2,2,2,-2,0,-2,-8,-5,
-1.0,-1,]
spine[
1,0,0,-1,0,0,]
scale [
0.00.0
0.5 0.5
1.0 1.0
1.2 1.2
2.0 2.0
]
orientation [
0 1 0 0
0 1 0 1.57
0 1 0 3.14
0 1 0 4.71
0 1 0 6.28
]