1 / 17

Introduction to WTK

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 applications. Resemble virtual world Object in this world may have reality-world properties and behavior

azizi
Download Presentation

Introduction to WTK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to WTK Jin-Bey Yu 2001/10/04

  2. What is WTK • Library • With over 1000 functions written in C that enable you to rapidly develop virtual reality applications. • Resemble virtual world • Object in this world may have reality-world properties and behavior • Structured in an object-oriented way • Functions are object-oriented in their naming convention, and are organized into over 20 classes.

  3. Scene Graph Architecture

  4. What WTK Does • Rendering • Reading input sensors • Importing geometries • Simulation • Incorporates the philosophy of OpenVRTM (portable across platforms) • Supports a variety of input and output devices.

  5. Overview of the WTK Classes • Universe • The container of all WTK object • Geometries • Graphical object that are visible in a simulation • Nodes • Building blocks from scene graphs • Polygons • Vertices • Lights

  6. Overview of the WTK Classes (const.) • Viewpoints • Define the position and orientation of the view. • Windows • Display user’s scene. • Sensors • Manipulate object motion • Path • Object that allow geometric or viewpoint to follow.

  7. Overview of the WTK Classes (const.) • Tasks • assign behaviors (such as movement) • Motion links • Associate a senor (or a path) with an target • Sound • User interface • Networking • asynchronously communicate over an Ethernet • Serial port

  8. Other Features • Materials and Translucency • Complete control of coloring geometries • Task Objects • Specify the behavior of any geometry, node • Performance Optimizations for Rendering • Atmospheric Effects • fog, haze, and cloud layers • Constraints • Available on the translations and rotations

  9. Other Features (const.) • Textures from Memory • Support for Many Sensors • Support for 3D Text • Support for Many File Formats • WRL, FLT, DXF, NFF, OBJ, 3DS, BFF, SLP, and GEO file formats.

  10. Simulation Loop

  11. 使用環境 • 作業系統: 95/98/NT • MicroSoft visual C++ 6.0 • WTK Release 7.0 • 其他工具: 3D Studio MAX • 3D加速卡(optional)

  12. 事前設定 • 安裝 • 將 WorldToolKit_Release7 目錄下的 Wtk.lib-cracked取代安裝後的Lib目錄下的Wtk.lib • 將wtkcodes複製到(你的)執行檔目錄。 • VC設定 • Tools ->Options ->Directories下請加入WTK的Include和Lib目錄的位置 • Project -> Settings • ->Link ->General->modules 請加入wtk.lib opengl32.lib • ->Link ->Input -> Ignore libraries 請填上 libcd.lib

  13. Example #include "wt.h" WTnode *root; WTviewpoint *view; void main (int argc, char* argv[]) { WTsensor *sensor; WTuniverse_new(WTDISPLAY_DEFAULT, WTWINDOW_DEFAULT); root = WTuniverse_getrootnodes(); sensor = WTmouse_new(); view = WTuniverse_getviewpoints(); WTviewpoint_addsensor(view, sensor); WTkeyboard_open(); /* set universe action function */ WTuniverse_setactions(actions); WTuniverse_setbgrgb(0, 0, 0); setup_scene(); WTuniverse_ready(); WTuniverse_go(); WTuniverse_delete(); }

  14. Example (const.) void actions() { int key ; key = WTkeyboard_getkey(); if (key) handle_key(key); } void handle_key(int k) { WTp3 pos; switch (k) { case '1' : WTviewpoint_getposition(view, pos); WTmessage("%f, %f, %f\n", pos[X], pos[Y], pos[Z]); break; default: break; } }

  15. Example (const.) void setup_scene() { WTgeometry *cylinder, *sphere; WTnode *myLOD, *n1, *n2, *tel; float lodrange[2] = {10.0, 30.0}; WTp3 pos; WTlight_load("lights"); tel = WTnode_load(root, "Tel.3DS", 0.01f); cylinder = WTgeometry_newcylinder(10.0, 0.3, 3, FALSE, FALSE); sphere = WTgeometry_newsphere(1.0, 8, 16, FALSE, FALSE); myLOD = WTlodnode_new(root); n1 = WTgeometrynode_new(myLOD, cylinder); n2 = WTgeometrynode_new(myLOD, sphere); pos[X] = 0; pos[Y] = 7.5; pos[Z] = 0; WTlodnode_setcenter(myLOD, pos); WTlodnode_setrange(myLOD, lodrange, 2); }

  16. WTK light format • Directed light parameters d[irected] [dir <X> <Y> <Z>] [ int <V>] [amb <R> <G> <B>] [diff <R> <G> <B>] [spec <R> <G> <B>] • Point light parameters p[oint] [pos <X> <Y> <Z>] [ int <V>] [att <X> <Y> <Z>] [amb <R> <G> <B>] [diff <R> <G> <B>] [spec <R> <G> <B>] • Spot light parameters s[pot][pos <X> <Y> <Z>][dir <X> <Y> <Z>][int <V>][angle[rad] <V>] [exp <V>] [att <a0><a1><a2>][amb<R><G><B>][diff<R><G><B>][spec<R><G><B>] • Ambient light parameters a[mbient] [int <V>] [amb <R> <G> <B>]

  17. Relative Resource • Ftp • cggmpc3.csie.nctu.edu.tw:21 • username/password: vr2001/vr2001 • WTK release7 • 3D Studio Max R3 • Bryce 4.0 • Poser 4.0

More Related