A Taste of Virtual Environment Development - SVE Amy Ulinski Raj Inugala
Overview What are Virtual Environments? Displays What is SVE? Steps to making first SVE program Demo Example Fun things you can do
What are Virtual Environments?
Modeling
Displays
Displays cont…
What is SVE? Simple Virtual Environment library –Easy creation of simple Virtual Environment (VE) applications –Provide system of functions, event handlers and 3D description of a Virtual World –Allows use of devices –Device-independent
Scene Graph World Table User Room Chair Nodes contain information about geometry, appearance, behavior, etc. of objects. Place Holder Objects Edges between nodes usually represent coordinate transformations between two coordinate systems
Scene Graph of an Environment Room DoorTableChair Vase
Different Types of Representation Table top Leg Table top Leg Table Vase What happens to the table if you move a leg? What happens to the table if you move the vase? What happens to the vase if you move the table?
Don’t Call Us… We’ll Call You App initializes SVE system Registers “callback” Sve system gains control again
My First SVE Program Create an environment (3DS Max, Maya, Bryce, etc…) Export a.obj and.mtl file –Some software will convert for you ie. Deep Explorations
.obj mtllib office4.mtl # object floor g floor v e v v e v v e v v e v # 8 verticies vt 1 0 vt 1 1 vt 0 1 vt 0 0 # 4 texture verticies vn e-008 vn e-008 vn e vn e vn vn e vn vn # 8 normals usemtl Fabric_Blue_Carpet f 1/1/1 3/2/1 4/3/1 2/4/1 f 5/4/2 6/1/2 8/2/2 7/3/2 f 1/4/3 2/1/3 6/2/3 5/3/3 f 2/4/4 4/1/5 8/2/4 6/3/6 f 4/4/7 3/1/7 7/2/7 8/3/7 f 3/4/8 1/1/8 5/2/8 7/3/8
.mtl newmtl Fabric_Blue_Carpet Ka Kd Ks illum 2 Ns map_Kd Carptblu.bmp map_bump Carptblu.bmp bump Carptblu.bmp
.world Simple Virtual Object File Format version 2.0 object: meadow description file: hello_world.obj move to children { object: floor description file: myfloor.obj scale by 1.1 along y move to }
Loading World into SVE #include "sve.h" main(int argc, char *argv[]) { SVE_config config = SVE_NORMAL; //setting the configuration to normal SVE_init("Example1 (sve)", config, &argc, argv); //initializes SVE system if(!SVE_loadWorld(“example1.world")) { SVE_done(); //quit SVE } SVE_beginEventLoop(); //SVE system gains control of program SVE_done(); }
Simple Example demo
Manipulating Objects Must locate object in object tree SVE_object cube = SVE_findWorldObject("cube"); Examples: SVE_rotateObject(cube, 3, 'y'); SVE_changeObjectName(cube,"cube3"); SVE_setNewObjectPosition(cube,newPosition); SVE_translateObjectGlobal(cube,0.2,0.4,0.5); SVE_scaleObject(cube, 0.1, 0.0,0.0);
LIGHTING Simple Virtual Primitive File Format version 1.1 number of components: 2 component 1 type: light Data of component 1: no of attributes: 3 color local-light TRUE position component 2 type: light Data of component 2: no of attributes: 2 color position
SOUND Open Sound –int sound = SVE_audioOpenSound("belltree_up2.wav"); Play Sound –SVE_audioReplaySound(sound, TRUE); –SVE_audioStopSound(sound);
MORE DEMOS…
Questions ???