a taste of virtual environment development - sve amy ulinski raj inugala

22
A Taste of Virtual Environment Development - SVE Amy Ulinski Raj Inugala

Post on 20-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

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

UserRoom

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

Door Table Chair

Vase

Different Types of Representation

Table top

LegLeg Leg

LegTable top

Leg Leg Leg

Leg

TableVase

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

.objmtllib 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 verticies vt 1 0 vt 1 1 vt 0 1 vt 0 0

# 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

.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

.worldSimple Virtual Object File Format version 2.0

object: meadow

description file: hello_world.objmove to 0 0 0children {

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 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 treeSVE_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);

LIGHTINGSimple Virtual Primitive File Format version 1.1number of components: 2

component 1 type: lightData of component 1:no of attributes:3color 0.8 0.8 0.8local-light TRUEposition 10.0 10.0 10.0

component 2 type: lightData of component 2:no of attributes:2color 0.8 0.8 0.8position 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);

MORE DEMOS…

Questions ???