1 VR assignment#2 WTK SDK Introduction By Jin-Bey Yu 2001/11/12.

Slides:



Advertisements
Similar presentations
Introduction Games have always been a fundamental part of human life. Space storm “ عاصفة الفضاء” is a 3D SCI-FI game that consists of two stages presented.
Advertisements

CS 450 Module R4. R4 Overview Due on March 11 th along with R3. R4 is a small yet critical part of the MPX system. In this module, you will add the functionality.
More Java Drawing in 2D Animations with Timer. Drawing Review A simple two-dimensional coordinate system exists for each graphics context or drawing surface.
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Graphics Pipeline.
Chapter 4: Trees Part II - AVL Tree
2.3. B OUNDING V OLUMES Bounding volumes of use for collision detection.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear.
1Notes  Assignment 0 marks should be ready by tonight (hand back in class on Monday)
Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
Java 3D Pablo Figueroa University of Alberta April 2000.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
1 Data Structures Data Structures Topic #2. 2 Today’s Agenda Data Abstraction –Given what we talked about last time, we need to step through an example.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
Sep 30, I3I3DG&VR CE00539-m Interactive 3D Graphics and Virtual Reality Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
2 What is pyGame? A set of Python modules to make it easier to write games. –home page: –documentation:
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
Comp 249 Programming Methodology Chapter 15 Linked Data Structure - Part B Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
SDL Programming Introduction. Initialization 2  The first thing you must do is initialize SDL  int SDL_Init( SDL_INIT_EVERYTHING )  This will return.
Basic Assembly Constraints and Concepts
Multimedia ! Graphics ! Animation ! Sound Tip Of the Day 4 Tip of the Day: When using graphic methods at Form Load, the AutoRedraw property of the container.
Introduction to WTK Jin-Bey Yu 2001/10/04. What is WTK Library With over 1000 functions written in C that enable you to rapidly develop virtual reality.
 2007 Pearson Education, Inc. All rights reserved C Data Structures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
(C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
Chapter 14 Dynamic Data Structures Instructor: Kun-Mao Chao ( 台大資工 趙坤茂 )
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Graphics Concepts CS 2302, Fall /3/20142 Drawing Paths.
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Lecture 11 Dynamic link libraries. Differences between static libraries and DLLs In static library code is added to the executable. In DLL, the code is.
Pointers OVERVIEW.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
Starting at Binary Trees
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Character Setup In addition to rigging for character models, rigging artists are also responsible for setting up animation controls for anything that is.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 2 – Basic VRML.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Chapter 11: Data Files and File Processing Files and streams Creating a sequential access file Reading data from a sequential access file Using fgetc()
XNA Basic Displaying Image & Collision Detect. What’s format image that XNA support? XNA support only.bmp.png and.jpg image..PNG have transparent region.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Applying Actions 강 신 진
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Starting Out with Games & Graphics in C++ Tony Gaddis Chapter 8 The.
Planning Tracking Motions for an Intelligent Virtual Camera Tsai-Yen Li & Tzong-Hann Yu Presented by Chris Varma May 22, 2002.
Basic Assembly © 2012 Project Lead The Way, Inc.Introduction to Engineering Design.
WORKSHOP 15 PARASOLID MODELING NAS120, Workshop 15, November 2003 WS15-1.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Linked Lists Outline Introduction Self-Referential Structures.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Chapter 12 – Data Structures
12 C Data Structures.
© University of Wisconsin, CS559 Fall 2004
KD Tree A binary search tree where every node is a
Chapter 5 Working with Images
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Review Session Biggest discrepancy questions
HP ALM Test Lab Module To protect the confidential and proprietary information included in this material, it may not be disclosed or provided to any third.
Computer Graphics Lecture 15.
Heaps By JJ Shepherd.
Presentation transcript:

1 VR assignment#2 WTK SDK Introduction By Jin-Bey Yu 2001/11/12

2 3D Sound (1/4) WTsounddevice *WTsounddevice_open( int type, int nplayable, WTviewpoint *listener) Arguments: typeWTSOUNDDEVICE_DS WTSOUNDDEVICE_WINMM WTSOUNDDEVICE_DWSTK WTSOUNDDEVICE_VSI WTSOUNDDEVICE_SGI WTSOUNDDEVICE_CRE nplayable The number of sounds you would like to play at once. viewpoint The viewpoint assigned to the listener. FLAG WTsounddevice_close(WTsounddevice *device)

3 3D Sound (2/4) FLAG WTsounddevice_setlistener ( WTsounddevice *device, WTviewpoint *viewpoint); This function specifies a viewpoint as a listener. The device argument specifies the device for which the listener is set. The viewpoint argument specifies the location of the listener. It returns TRUE if successful, FALSE if unsuccessful. WTviewpoint *WTsounddevice_getlistener ( WTsounddevice *device); This function gets the viewpoint that is being used as a listener by a device. The device argument specifies the device from which to get the listener. This function returns the viewpoint used as listener or NULL if unsuccessful.

4 3D Sound (3/4) WTsound *WTsound_load ( WTsounddevice *device, char *source); This function creates a new sound from a source. The device argument specifies the sound device from which to load the sound. The source argument specifies the name of source (filename, resource name, or sample name). FLAG WTsound_play (WTsound *sound); This function cues a sound to begin playing. When a sound is finished playing, it returns to the beginning of the sample. The sound argument specifies the name of the sound to play. void WTsound_stop (WTsound *sound); This function stops a currently playing sound. The sound argument specifies the name ofthe sound to stop playing.

5 3D Sound (4/4) void WTsound_setposition ( WTsound *sound, WTp3 position); This function sets a sound's position in 3D space. This setting overrides object and viewpoint attachments for placing sounds. The sound argument specifies which sound is specified. The position argument specifies the new position for the sound.

6 Texture Change (1/3) FLAG WTgeometry_settexture( WTgeometry *geom, char * bitmap, FLAG shaded, FLAG transparent); This function applies a texture bitmap to each polygon surface of a geometry (using the WTpoly_settexture function). It returns TRUE if successful and FALSE otherwise. FLAG WTgeometry_changetexture( WTgeometry *geom, char *bitmap, FLAG shaded,FLAG transparent); This function changes all textured polygons of the specified geometry to use the new texture bitmap instead of their current texture. The new bitmap is specified by the bitmap argument. The shading and transparent flags are applied in a fashion similar to WTgeometry_settexture.

7 Texture Change (2/3) unsigned char *WTtexture_load(char *bitmap, int *w, int *h); This function reads in a texture bitmap named bitmap and returns a pointer to the image file and the width and height of the texture. The return values of this function can then be used as parameters to the WTtexture_replace function. FLAG WTtexture_cache(char *bitmap, FLAG enable); This function controls the caching of a texture. When the enable flag is TRUE, the specified texture bitmap ( bitmap ) is loaded (if not already loaded), then marked as cached. When the enable flag is FALSE the texture is marked as not cached and is deleted if no polygons reference this texture. This function is useful for texture animations so that the texture does not have to be reloaded from disk during every pass of the animation.

8 Texture Change (3/3) void WTpoly_rotatetexture(WTpoly *poly, float angle); void WTpoly_scaletexture(WTpoly *poly, float factor); void WTpoly_translatetexture(WTpoly *poly, WTp2 displacement); A texture after scalingA texture after translation

9 Collision Detection (1/5) Bounding Box parameters: extents, radius and midpoint

10 Collision Detection (2/5) The location of that instance of the geometry (remember, there is only one actual geometry) depends on the path (node path) you take through the scene graph tree to reach it. These are two things you can do with node paths –Perform intersection tests in the scene graph –Pick graphical entities rendered into WTK windows

11 Collision Detection (3/5) WTnodepath *WTnodepath_new( WTnode *node, WTnode*ancestor, int which); This function creates a new node path. A node path must be fully specified by giving three arguments to this function: the node that the instance references the ancestor of that node (the ancestor is the root node above) the occurrence number which. The which parameter is the number of that instance of the node FLAG WTnodepath_getextents(WTnodepath *path, float ext[2][3]); This function places the center and extents of the node path in the specified floating point array (given by ext ). The extents box of a node path is the smallest rectangular box that encloses all the geometries of the node path and which is aligned with the world coordinate axes.

12 Collision Detection (4/5) FLAG WTnodepath_intersectpoly( WTnodepath *nodepath1, WTnodepath *nodepath2); This function tests for the intersection of any polygons in two node paths (nodepath1 and nodepath2) and their sub-trees. It returns TRUE if there is an intersection, FALSE otherwise. FLAG WTnodepath_intersectbbox( WTnodepath *nodepath1, WTnodepath *nodepath2); This function tests for the intersection of two node paths, n1 and n2, based on their bounding boxes. Remember that these bounding boxes are the bounding boxes of the entire sub-tree of the scene graph beginning at the bottom-most node of the node path.

13 Collision Detection (5/5) WTnodepath *WTnodepath_intersectnode( WTnodepath *nodepath, WTnode *node, int which); This function performs a bounding box intersection test between the specified node path and the numbered occurrence of the specified node (and its sub-tree). If they do not intersect, it returns NULL. If they do intersect, then this function traverses down the specified node’s sub- tree in search of the node whose bounding box has the smallest extents and yet still intersects the bounding box of the specified node path. Then a node path to that node is created and a pointer to it is returned.

14 Interaction (1/3) WTpoly *WTscreen_pickpoly( int screennum, WTp2 pt, WTnodepath **nodepath, WTp3 p); This function obtains a pointer to the frontmost polygon rendered at the specified 2D screen point on the specified screen. –Screen coordinates are specified as 2D floating point values, with (0.0, 0.0) representing the top-left corner of the screen, and the bottom-right corner of the screen represented by (screen width, screen height). –The WTp3 obtained is the 3D point in world coordinates at which the selected polygon was intersected. –The WTnodepath pointer, indicating the node path to which the selected polygon belongs.

15 Interaction (2/3) WTtask *WTtask_new( void *objptr, WTtask_function fptr, float priority); This function creates a new WTtask and activates it, so that it is automatically executed as the simulation runs. Tasks created by this function are executed in the simulation loop. –The objptr is a pointer to the WTK object. The same object can perform more than one task. –The fptr is the task function ( WTtask_function ) that is executed as the WTK simulation runs. –The priority specifies the order in which tasks are executed within the tasks slot in the simulation loop. Lower-numbered tasks are executed before higher-numbered ones.

16 Interaction (3/3) FLAG WTtask_delete(WTtask *task); This function deletes a task (destroys it). Deleting a task both removes it from the simulation so that it is no longer executed as the simulation runs, and also frees the memory associated with the WTtask object passed in. The task pointer passed in is invalid after this function is called.

17 Constrained Motion (1/3) These are three things you can constrain the motion 1.Arrange the Scene Grpah to fit our requirements 2.Assign tasks for objects 3.Use Motion Links to constain the motion of the objects Some ways to use motion links

18 Constrained Motions (2/3) WTmotionlink *WTmotionlink_new( void *source, void *target, int from_type, int to_type); Source Pointer to either a sensor or a path. Target Pointer to either a viewpoint, a movable, a transform node,or a node path leading to either a transform node or a movable node. from_type The type of the source WTSOURCE_SENSOR,WTSOURCE_PATH to_type The type of the target WTTARGET_VIEWPOINT,WTTARGET_MOVABLE, WTTARGET_TRANSFORM,WTTARGET_NODEPATH

19 Constrained Motions (3/3) FLAG WTmotionlink_addconstraint( WTmotionlink *link, int dof, float min, float max); Use this function to add a constraint to a motion link so that the position and/or orientation of the motion link’s target is constrained. The dof specifies the degrees of freedom (DOF) WTCONSTRAIN_X, WTCONSTRAIN_Y, WTCONSTRAIN_Z, WTCONSTRAIN_XROT, WTCONSTRAIN_YROT, WTCONSTRAIN_ZROT. The min and max specify the range within which the target of the motion link is constrained (within that DOF).

20 Lighting (1/2) Ambient light node Directed light node Point light node Spot light node

21 Lighting (2/2) FLAG WTlightnode_load(WTnode *parent,char *filename); FLAG WTlightnode_setposition(WTnode *light,WTp3 p); void WTlightnode_setdirection(WTnode *light,WTp3 dir); void WTlightnode_setintensity(WTnode *light,float x); void WTlightnode_setambient(WTnode *l,float r,float g,float b); void WTlightnode_setdiffuse(WTnode *light,float r,float g,float b); void WTlightnode_setspecular(WTnode *l,float r,float g,float b); void WTlightnode_setattenuation(WTnode *light, float atten0,float atten1,float atten2); T he attenuation factor: 1.0/(atten0 + atten1*dist + atten2*dist*dist) void WTlightnode_setangle(WTnode *light,float angle); void WTlightnode_setexponent(WTnode *light, float val);