220 likes | 413 Views
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….
E N D
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 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
World User Room Table Chair Scene Graph • Nodes contain information about geometry, appearance, behavior, etc. of objects. • Place Holder Objects • Edges between nodes usually represent coordinate transformations between two coordinate systems
Room Door Table Chair Vase Scene Graph of an Environment
Vase Different Types of Representation Table Table top Leg Table top Leg Leg Leg Leg Leg Leg Leg 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 # 4 texture verticies vn 0 -1 -5.96046e-008 vn 0 1 5.96046e-008 vn 0 -4.65661e-008 1 vn 1 -3.94746e-014 0 vn 1 0 0 vn 1 -7.89492e-014 0 vn 0 0 -1 vn -1 0 0 # 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 mtllib office4.mtl # object floor g floor v 3.95775e-005 -0.00473949 -0.00475565 v 4.20004 -0.00473949 -0.00475565 v 3.95775e-005 -0.00473922 -4.50476 v 4.20004 -0.00473922 -4.50476 v 3.95775e-005 0.00526051 -0.00475565 v 4.20004 0.00526051 -0.00475565 v 3.95775e-005 0.00526077 -4.50476 v 4.20004 0.00526077 -4.50476 # 8 verticiesvt 1 0 vt 1 1 vt 0 1 vt 0 0
.mtl newmtl Fabric_Blue_Carpet Ka 0 0 0 Kd 0.231373 0.231373 0.392157 Ks 0.9 0.9 0.9 illum 2 Ns 2.14355 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 0 0 0 children { object: floor description file: myfloor.obj scale by 1.1 along y move to 0.0 0.5 -3.0 }
Loading World into SVE #include "sve.h" main(int argc, char *argv[]) { SVE_config config = SVE_NORMAL; //setting the configuration to normalSVE_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 programSVE_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 0.8 0.8 0.8 local-light TRUE position 10.0 10.0 10.0 component 2 type: light Data of component 2: no of attributes: 2 color 0.8 0.8 0.8 position 0.0 1.0 0.0
SOUND • Open Sound • int sound = SVE_audioOpenSound("belltree_up2.wav"); • Play Sound • SVE_audioReplaySound(sound, TRUE); • SVE_audioStopSound(sound);