3DSTATEfor Visual basic.Net开发
注:转载请说明来源处!
十一、WLD世界文件解析
所有的场景都是保存在wld文件中,在这个文件中包含有摄像机、灯光、空气、模型等。下面我们来看一下这个文件的主要构成。
一般来说,完整的wld文件必须包含有摄像机和模型对象。在WLD文件中也存在着一定的语法规则,如果要注释,采用//,且在/*……*/之间为注释。
eg:
// 注释
/* notes ....
*/
BEGIN_DESIGN: //开始
ATMOSPHERE: 160 160 170 FOG: 0.0100 LIGHT: 0 //设置大气,雾及灯
DEFAULT_COLOR: 160 160 170 //设置默认颜色
CAMERA: default_camera //设置默认摄像机,其名称在程序中将会调用
LOCATION: 500 0 0 //摄像机的位置
DIRECTION: -1 0 0 //摄像机的方向,该方向为一向量
VIEW_FIELD: 90 //可视的范围角度
CULLING_DEPTH: 0
EYE_DISTANCE: 4 //可视距离
TRACK: NO_TRACK //设置摄像机轨迹,在这里没有设置轨迹
CHASE: NO_CHASE //设置摄像机跟踪,在这里没有设置跟踪
CHASE_TYPE: NO_CHASE 0.3
CHASE_DISTANCE: 500
PHYSICS: SPEED: 0 0 0 FORCE: 0 0 0 MAX_SPEED: 0 FRICTION: 0 ELASTICITY: 0
END_CAMERA: default_camera //结束摄像机的定义
BEGIN_MODULE: main //任何世界都必须包含main,main中列出的即为场景中出现的模型对象
OBJECT: //有Object和DYNAMIC两种,其中Object代表静态模型,DYNAMIC表示动态的模型
MODULE_NAME: CUBE //模型的名称,在场景中调用时用
MATRIX:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
END_OBJECT:
END_MODULE: main
BEGIN_MODULE: CUBE //该模型中各部分的具体情况
POLYGON: pCUBE0
COLOR: 255 0 0
BITMAP: NO_BITMAP //没有贴图
TRANSPARENT: -1 DISABLE_BLENDING
ROTATED: NO
LIGHT_DIMINUTION: 20
NUM_OF_POINTS: 4
100 -100 100 1 0 100 RGB: 255 0 0 N: 73 -73 73
-100 -100 100 1 1 100 RGB: 255 0 0 N: -73 -73 73
-100 100 100 0 1 100 RGB: 255 0 0 N: -73 73 73
100 100 100 0 0 100 RGB: 255 0 0 N: 73 73 73
POLYGON: pCUBE1
COLOR: 0 255 0
BITMAP: NO_BITMAP
TRANSPARENT: -1 DISABLE_BLENDING
ROTATED: NO
LIGHT_DIMINUTION: 20
NUM_OF_POINTS: 4
-100 -100 100 1 0 100 RGB: 0 255 0 N: -73 -73 73
-100 -100 -100 1 1 100 RGB: 0 255 0 N: -73 -73 -73
-100 100 -100 0 1 100 RGB: 0 255 0 N: -73 73 -73
-100 100 100 0 0 100 RGB: 0 255 0 N: -73 73 73
POLYGON: pCUBE2
COLOR: 0 255 0
BITMAP: NO_BITMAP
TRANSPARENT: -1 DISABLE_BLENDING
ROTATED: NO
LIGHT_DIMINUTION: 20
NUM_OF_POINTS: 4
100 -100 100 0 1 100 RGB: 0 255 0 N: 73 -73 73
100 100 100 0 0 100 RGB: 0 255 0 N: 73 73 73
100 100 -100 1 0 100 RGB: 0 255 0 N: 73 73 -73
100 -100 -100 1 1 100 RGB: 0 255 0 N: 73 -73 -73
POLYGON: pCUBE3
COLOR: 0 0 255
BITMAP: NO_BITMAP
TRANSPARENT: -1 DISABLE_BLENDING
ROTATED: NO
LIGHT_DIMINUTION: 20
NUM_OF_POINTS: 4
100 100 100 0 0 100 RGB: 0 0 255 N: 73 73 73
-100 100 100 1 0 100 RGB: 0 0 255 N: -73 73 73
-100 100 -100 1 1 100 RGB: 0 0 255 N: -73 73 -73
100 100 -100 0 1 100 RGB: 0 0 255 N: 73 73 -73
POLYGON: pCUBE4
COLOR: 0 0 255
BITMAP: NO_BITMAP
TRANSPARENT: -1 DISABLE_BLENDING
ROTATED: NO
LIGHT_DIMINUTION: 20
NUM_OF_POINTS: 4
100 -100 100 0 0 100 RGB: 0 0 255 N: 73 -73 73
100 -100 -100 2 0 100 RGB: 0 0 255 N: 73 -73 -73
-100 -100 -100 2 2 100 RGB: 0 0 255 N: -73 -73 -73
-100 -100 100 0 2 100 RGB: 0 0 255 N: -73 -73 73
POLYGON: pCUBE5
ORIENTATION: BOTTOM
COLOR: 255 0 0
BITMAP: NO_BITMAP
TRANSPARENT: -1 DISABLE_BLENDING
ROTATED: NO
LIGHT_DIMINUTION: 20
NUM_OF_POINTS: 4
100 -100 -100 0 1 100 RGB: 255 0 0 N: 73 -73 -73
100 100 -100 0 0 100 RGB: 255 0 0 N: 73 73 -73
-100 100 -100 1 0 100 RGB: 255 0 0 N: -73 73 -73
-100 -100 -100 1 1 100 RGB: 255 0 0 N: -73 -73 -73
END_MODULE: CUBE
END_DESIGN:
整个wld文件的内容就是这些。下面我们看一个wld文件,该文件在场景设置及模型方面更加丰富。
// This file was created by Morfit VR Engine
/* notes .... */
BEGIN_DESIGN:
ATMOSPHERE: 160 160 170 FOG: 0.0000 LIGHT: 0
DEFAULT_COLOR: 160 160 170
CAMERA: Camera01
LOCATION: -629.242 -81.1386 97.0172
DIRECTION: 0.998785 0.034767 0.034931
VIEW_FIELD: 45
CULLING_DEPTH: 0
EYE_DISTANCE: 1
TRACK: NO_TRACK
CHASE: NO_CHASE
CHASE_TYPE: NO_CHASE 0.3
CHASE_DISTANCE: 500
PHYSICS: SPEED: 0 0 0 FORCE: 0 0 0 MAX_SPEED: 0 FRICTION: 0 ELASTICITY: 0
END_CAMERA: Camera01
CAMERA: _Last_working_position
LOCATION: -148.464 -146.82 14.6526
DIRECTION: 0.998785 0.034767 0.034931
VIEW_FIELD: 45
CULLING_DEPTH: 0
EYE_DISTANCE: 4
TRACK: NO_TRACK
CHASE: NO_CHASE
CHASE_TYPE: NO_CHASE 0.4
CHASE_DISTANCE: 0
PHYSICS: SPEED: 0 0 0 FORCE: 0 0 0 MAX_SPEED: 0 FRICTION: 0 ELASTICITY: 0
END_CAMERA: _Last_working_position
BACKGROUND: NewBackGround
NUMBER_OF_FRAMES: 1
REPLACE_RATE: 1
PICTURES_EXTENSION: jbm
PICTURES: FON004
DISTANCE: 30000
BOTTOM: -5500
BOTTOM_INTENSITY: 0
INTENSITY_STEP: 0.3
END_BACKGROUND: NewBackGround
LIGHT: NewLight
LOCATION: -670.074 -793.532 317.854
DIRECTION: 0 0 -1
COLOR: 255 255 255
AMBIENT: 0.5 2 100 10
RAYTRACING: NO
DISTANCE: -1
TARGET: GROUP football
AUTO: NO LIGHT_SET
TYPE: LIGHT_DEFAULT
END_LIGHT: NewLight
BEGIN_MODULE: main
DYNAMIC: doorr
MODULE_NAME: doorr
FATHER: NONE
TYPE: regular
CONTROL: 100
TRACK: NO_TRACK 0 0 0
CHASE: NO_CHASE
CHASE_TYPE: NO_CHASE 0.3
CHASE_DISTANCE: 0
PHYSICS: SPEED: 0 0 0 FORCE: 0 0 0 MAX_SPEED: 3.402823466385289E+038 FRICTION: 0 ELASTICITY: 0 ROTATION: WORLD_SPACE 0 0 0
MATRIX:
1 0 0
0 1 0
0 0 1
LOCATION: -6.1 -51.46000000000001 128
SCALE: 1 1 1
END_OBJECT: doorr
DYNAMIC: football
MODULE_NAME: football
FATHER: NONE
TYPE: regular
CONTROL: 100
TRACK: NO_TRACK 0 0 0
CHASE: NO_CHASE
CHASE_TYPE: NO_CHASE 0.3
CHASE_DISTANCE: 0
PHYSICS: SPEED: 0 0 0 FORCE: 0 0 0 MAX_SPEED: 3.402823466385289E+038 FRICTION: 0 ELASTICITY: 0 ROTATION: WORLD_SPACE 0 0 0
MATRIX:
1 0 0
0 1 0
0 0 1
LOCATION: -46.53273344551995 -151.7391199497435 20.0553945686713
SCALE: 1 1 1
END_OBJECT: football
DYNAMIC: doorl
MODULE_NAME: doorl
FATHER: NONE
TYPE: regular
CONTROL: 100
TRACK: NO_TRACK 0 0 0
CHASE: NO_CHASE
CHASE_TYPE: NO_CHASE 0.3
CHASE_DISTANCE: 0
PHYSICS: SPEED: 0 0 0 FORCE: 0 0 0 MAX_SPEED: 3.402823466385289E+038 FRICTION: 0 ELASTICITY: 0 ROTATION: WORLD_SPACE 0 0 0
MATRIX:
1 0 0
0 1 0
0 0 1
LOCATION: -6.099999999999999 0 128
SCALE: 1 1 1
END_OBJECT: doorl
OBJECT:
MODULE_NAME: the_world_2
MATRIX:
1 0 0 0
0 1 0 0
0 0 1 0
0.6599999999998545 2.639999999999873 0 1
END_OBJECT:
END_MODULE: main
/* 在这中间针对各个Model的各个Polygon进行具体的描述,具体参加Worlds文件架中的Object2.wld文件 */
END_DESIGN: