Event Routing §Some VRML nodes generate events in response to environmental changes or user interaction. Event routing gives authors a mechanism, separate.

Slides:



Advertisements
Similar presentations
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 11 VRML Animation and Interaction.
Advertisements

17.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 17 – VRML: A Rough Guide.
3D sprog X3D: Et 3D sprog til at definere realtime 3D grafik der kan formidles via WWW. – XML integreret – Baseret på VRML – Relativt nyt så der findes.
VIEW Mike Brundage Ivan Sopin. Overview of X3D X3D is an open standards file format and run-time architecture to represent and communicate 3D scenes and.
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
VRML 97 Formato per la definizione di oggetti 3D. La versione VRML 1 viene da una semplificazione degli scene graphs di OpenInventor. La versione 2.0 (97)
Chapter 9 Code optimization Section 0 overview 1.Position of code optimizer 2.Purpose of code optimizer to get better efficiency –Run faster –Take less.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 1 – Introduction to VRML.
Welcome to 3D §The 3D graphics pipeline §Rigid-body transform §Homogeneous coordinates §Viewing transformation §Projection §Illumination.
© Richard Jones, 2009 CO641 Computer Graphics 1 CO641 Computer Graphics and Animation X3d / VRML Richard Jones SW107
Viewpoint { eventIn SFBool set_bind exposedField SFFloat fieldOfView # (0,  ) exposedField SFBool jump TRUE exposedField SFRotation orientation.
Introduction to VRML By Salman Yussof Diego Iglesias.
Adding Functionality To Web-Based VR Basic Concepts Client – server model Client-side static Client-side scripting Server-side scripting.
What Is VRML? VRML is: Stands for Virtual Reality Modeling Language A simple text language for describing 3-D shapes and interactive environments VRML.
Multimedia and the WWW Howell Istance and Chris Hand, Napier University.
An Overview of VRML §Scene Graph Structure VRML files describe 3D objects and worlds using a hierarchical scene graph. Entities in the scene graph are.
© De Montfort University, D Graphics and VRML Howell Istance and Chris Hand* De Montfort University * now at
Java 3D Pablo Figueroa University of Alberta April 2000.
Cse591 Spring 981 VRML Basics The basic elements of VRML files are nodes. Every type of node has a set of fields associated with it. –Common single-valued.
Event Routing §Some VRML nodes generate events in response to environmental changes or user interaction. Event routing gives authors a mechanism, separate.
University College Dublin1 Scope ROOT Light SourceTransform Light SourceSphere.
3D on-line representations Jan Valcik → introduction, main idea → VRML 97 → building of virtual worlds → VRML 97 at work → X3D → MUDVR → animations, navigation.
Viewpoint and Animation Example: Bus. Sensors DEF BusTimer TimeSensor { cycleInterval 120 loop FALSE} DEF BusSensor ProximitySensor {center
VRML Virtual Reality Modeling Language. What Are We Going to See? What is VRML? Syntax of the language Features Examples.
Lahti International Week 2006 Introduction to X3D Lesson 2: Animating your models.
2  Problem Definition  Project Purpose – Building Obfuscator  Obfuscation Quality  Obfuscation Using Opaque Predicates  Future Planning.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 3 – Object Definition in VRML.
Lecturer: Ghadah Aldehim
VRML Dr. Alun Moon What is VRML The Virtual Reality Modeling Language (VRML) is a file format for describing interactive 3D objects.
VRML - 1 Virtual Reality Modeling Language (VRML) Peter O’Grady.
JSP Java Server Pages Softsmith Infotech.
H3D API Training  Part 3.3: Python – H3D integration.
VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and.
History of VRML and Its Development Process. Learning Objectives Understand the history of VRML Understand the purpose and functions of VRML Learn how.
1 Virtual Reality Modeling Language (VRML97) ©Anthony Steed
IBM TSpaces Lab 1 Introduction. Summary TSpaces Overview Basic Definitions Basic primitive operations Reading/writing tuples in tuplespace HelloWorld.
Computer Graphics Group Script node Jiří Žára. Computer Graphics Group Contents 1.Script node 2.Motion generators 2Script node.
H3D API Training Part 2.1: X3D. Outline  Scene graphs  X3D – XML syntax  X3D components overview.
Interactive Textures as Spatial User Interfaces in X3D Web3D 2010 Symposium Sabine Webel Y. Jung, M. Olbrich, T. Drevensek, T. Franke, M.Roth, D.Fellner,
VRML virtual reality modeling language. what is it? standardised (sort of) notation for virtual reality over the web text file (use normal text editor)
111/16/ :14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates.
1 UNIT 13 The World Wide Web Lecturer: Kholood Baselm.
Virtual Reality Modeling Language 97. What’s VRML? Virtual Reality Modeling Language 2D/3D graphics Audio:.wav,.mid Video: MPEG-1 Interactivity: time-
111/22/ :40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.
VRML Anthony Steed Department of Computer Science University College London ©Anthony Steed
X3D Extensible 3D (X3D) Part 1: Architecture and base components.
Interface Opportunities for 3D Data and Media User Interface Software TechNote Panel Virginia Tech CS Fall 2002 Nicholas F. Polys Umur Yilmaz Will Lee.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 2 – Basic VRML.
Intro to VRML Let’s build something! The source code examples in this tutorial WORK!
DESIGNING 3D WEB USING VRML Bob Hobbs Introduction to Virtual Reality and Simulation CE
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 6 – Texture Maps.
Programming Session 6 LBSC 690 Information Technology.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 5 – Animation in VRML.
1 UNIT 13 The World Wide Web. Introduction 2 Agenda The World Wide Web Search Engines Video Streaming 3.
1 UNIT 13 The World Wide Web. Introduction 2 The World Wide Web: ▫ Commonly referred to as WWW or the Web. ▫ Is a service on the Internet. It consists.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 4 – Object Manipulation in VRML.
DLP for Virtual Environments (I)
CGS 3066: Web Programming and Design Spring 2017
MPEG-4 Binary Information for Scenes (BIFS)
Department of Computer Science University College London
VIRTUAL REALITY IN ROBOTICS
Chapter 27 WWW and HTTP.
Lecture 3. Virtual Worlds : Representation,Creation and Simulation
Presentation transcript:

Event Routing §Some VRML nodes generate events in response to environmental changes or user interaction. Event routing gives authors a mechanism, separate from the scene graph hierarchy, through which these events can be propagated to effect changes in other nodes. §Once generated, events are sent to their routed destinations in time order and processed by the receiving node. This processing can change the state of the node, generate additional events, or change the structure of the scene graph. §Script nodes allow arbitrary, author-defined event processing. An event received by a Script node causes the execution of a script function which has the ability to send events through the normal event-routing mechanism. §The ideal event model processes all events instantaneously in the order that they are generated. §A timestamp, the time at which an event is delivered to a node, serves two purposes. First, it is a conceptual device used to describe the chronological flow of the event mechanism. It ensures that deterministic results can be achieved by real-world implementations which must address processing delays and asynchronous interaction with external devices. Second, timestamps are also made available to Script nodes to allow events to be processed based on the order of user actions or the elapsed time between events.

Events & Routes (Interacting with the Scene) §A class of nodes, called sensors reacts to user events in some prescribed ways. §TouchSensor, ProximitySensor §a sensor is wired to a Script node that runs a program TouchSensor Node Sound Node eventOut eventIn Rout

#VRML V2.0 utf8 #Event routing Group { children [ Shape { appearance Appearance { material Material { } } geometry Cone { } } DEF TS TouchSensor { } # define the sensor "TS" DEF DL DirectionalLight { # define the light "DL" color on FALSE } ] ROUTE TS.isOver TO DL.set_on }

Animation and User Interaction §The translation field of the Transformation node is an exposedfield §set_:incoming event l set_translation §_changed:outgoing event l translation_changed §ROUTE Xform1.translation_changed TO Xform2.set_translation §ROUTE Xform1.translation TO Xform2.translation

ROUTE §Routing should be done in same type (field) §a set_ or _changed event is the same type as the exposed field it’s associated with §use DEF & USE Group { children [ DEF LIGHT_CONTROL TouchSensor {} Inline { url [“lightswitch.wrl]}]} DEF Light PointLight { location on FALSE} Inline {url [“table.wrl”]} ROUTELIGHT_CONTROL.isActive TO Light.on

The Animation Event Path §Trigger : generates an event. Usually sensors §Logic : processing on the event. Usually script nodes §Timer : startTime of TimeSensor node, then generates time events §Engine : route time events to nodes that animate. Usually interpolator node TriggerLogicTimerEngineTarget

The Animation Event Path §Target : The browser sends the Engine’s output to a relevant node in the scene hierarchy, whose field values changes accordingly TriggerLogicTimerEngineTarget TriggerTarget

Pointing-device Sensors §The geometry corresponding to a sensor must be a sibling of the sensor §The objects controlled by the sensor can be anywhere §TouchSensor l isOver l isActive (on click) l isActive + hitPoint_changed (on drop) l touchTime (press remaining on same object)

Using a TouchSensor node §Trigger sends a time event to the Target (the audio clip) Group { children [ DEF PUSH TouchSensor {} Inline { url [“doorbell.geom.wrl”]}]} Sound { source DEF BUSS AudioClip {url [“doorbell.wav”]} maxFront50 minFront5} ROUTE PUSH.touchTimeTO BUZZ.startTime

Drag Sensors §Interpretation of 2D dragging l CylinderSensor : rotating around local y axis spinning a globe l PlaneSensor : translating in the local xy plane #VRML V2.0utf8 GROUP { children [ DEF SKULL_DRAG PlaneSensor { minPosition0 0 maxPosition5 0 } DEF SKULL Transform { translation0 0 0 children [ Inline {url [“skull.wrl”]}]}]} ROUTE SKULL_DRAG.translation_changed TO SKULL.translation

ProximitySensor §Generates events whenever the user enters or leaves a defined box-shaped region §Sizes for box shapes can be difficult to estimate --> so, placing a Box node of the same size at the same location will give a good idea of the exact region

Timers §Time Sensor is triggered/initiated by setting startTime §cycleInterval sets the interval of animation §fraction_changed is used to calculate time elapse among the given interval TriggerLogicTimerEngineTarget Viewpoint {position } DEF DETECTORProximitySensor {size } DEF TIMERTimeSensor {cycleInterval2} DEF LIGHTPointLight { intensity0 location3 3 3} Inline{url[“chacmool.wrl”]}#objects to be lit ROUTEDETECTOR.enterTimeTOTIMER.startTime ROUTETIME.fraction_changed TO LIGHT.intensity

Engines §Convert the output of a time sensor into a change in some other type of value §interpolator & keyframe l PositionInterpolator l OrientationInterpolator l ColorInterpolator l ScalarInterpolator l CoordinateInterpolator TriggerLogicTimerEngineTarget DEF Spark_moverPositionInterpolator{ key[0,1] keyvalue [0 0 0, 0.8, 5,0]} ROUTETIME.fraction_changed TO Spark_mover.set_fraction ROUTE Spark_mover.value_changed TO Spark.translation

Example (bike rider - bike.wrl) #VRML V2.0 utf8 DEF BIKE Transform { translation children [DEF FW Transform { translation children [ Inline { url "wheel2.wrl"}]} DEF BW Transform { translation children [ Inline { url "wheel2.wrl"}]} DEF FR Transform { translation children [ Inline { url "frame.wrl"}]} ]} DEF RIDER Transform { translation children [ Inline { url "rider2.wrl"}]} DEF T TimeSensor { loop TRUE enabled TRUE cycleInterval 5 stopTime -1} DEF P PositionInterpolator { key [ 0, 0.25, 0.5, 0.75, 1] keyValue [ , , 0 3 0, 2 0 0, 5 0 0]} ROUTE T.fraction_changed TO P.set_fraction ROUTE P.value_changed TO BIKE.translation ROUTE BIKE.translation TO RIDER.translation

More examples §rider.wrl §frame.wrl §wheel.wrl

Scripting (Script node) §Bridge between VRML & programming languages. l Acting as the Engine stage to control animation l Processing input to act as the Logic stage l Interacting with the browser in certain ways binding the browser to a Viewpoint node to animate the viewer along a path l Manipulating the scene hierarchy l communicating with a server or another VRML world across a network

What to know about Scripting §How the script node acts as a bridge between VRML & JAVA §Basic JAVA classes that interact with and manipulate VRML §How to compile and run java program

The script node act as a gateway to the script itself A node Scene translation color size rotation Script node url eventOut eventin another node translation color size rotation JAVA code

Example (ChangeColor.wrl) #VRML V2.0 utf8 Transform { children [ DEF TS TouchSensor {} # TouchSensor Shape { appearance Appearance { material DEF SphereColor Material { diffuseColor } # red } geometry Sphere {} } ] } DEF ColorScript Script { url "ChangeColor.class" eventIn SFBool clicked eventOut SFColor newColor field SFBool on FALSE } # Routing ROUTE TS.isActive TO ColorScript.clicked ROUTE ColorScript.newColor TO SphereColor.set_diffuseColor

Example (ChangeColor.java) import vrml.*; import vrml.field.*; import vrml.node.*; public class ChangeColor extends Script { private SFBool on; // status of on-off float red[] = { 1, 0, 0 }; // RGB(Red) float blue[] = { 0, 0, 1 }; // RGB(Blue) private SFColor newColor ; public void initialize() { newColor = (SFColor) getEventOut("newColor"); on = (SFBool) getField("on"); } public void processEvent(Event e) { ConstSFBool v = (ConstSFBool)e.getValue(); if(v.getValue()){ if (on.getValue()) { newColor.setValue(red); // set red to 'newColor' } else { newColor.setValue(blue); // set blue to 'newColor' } on.setValue(!on.getValue()); // = !on.getValue(); } } }

Example II (mover.wrl) #VRML V2.0 utf8 DEF MOVER Transform { translation children [ DEF TS TouchSensor {} # TouchSensor Shape { appearance Appearance { material DEF SphereColor Material { diffuseColor } # red } geometry Sphere {} } ]} DEF MoveIt Script { url "MoveIt.class" eventIn SFBool clicked field SFNode node USE MOVER field SFBool on FALSE } # Routing ROUTE TS.isActive TO MoveIt.clicked

Example II (moveit.java) import vrml.*; import vrml.field.*; import vrml.node.*; public class MoveIt extends Script { private SFBool on; // status of on-off float red[] = { 1, 0, 0 }; // RGB(Red) float blue[] = { 0, 0, 1 }; // RGB(Blue) private SFNode theNode ; private SFVec3f position; public void initialize() { theNode = (SFNode) getField("node"); } public void processEvent(Event e) { ConstSFBool v = (ConstSFBool)e.getValue(); Node node; if(v.getValue()){ node = (Node)(theNode.getValue()); position = (SFVec3f)(node.getExposedField("translation")); position.setValue((position.getX() + 5), 0, 0); } } }

JAVA & The script node §getSize() §getValue() §get1Value(int index) §setValue(value) §set1Value(int index, value) §addValue(value) §insertValue(int index, value) §deleteValue(int index) §clearValue()

Compiling a JAVA script §Download vrml package (vrml.*) §put it in a directory where your classpath can reach