Computer Graphics Group Script node Jiří Žára. Computer Graphics Group Contents 1.Script node 2.Motion generators 2Script node.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 11 VRML Animation and Interaction.
Sue Wills July Objects The JavaScript language is completely centered around objects, and because of this, it is known as an Object Oriented Programming.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Javascript It’s not JAVA. What do these all have in common?
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 1 – Introduction to VRML.
Event Routing §Some VRML nodes generate events in response to environmental changes or user interaction. Event routing gives authors a mechanism, separate.
© 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.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
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
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
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.
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.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
UFCEKG-20-2 Data, Schemas & Applications Lecture 4 Server Side Scripting & PHP.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 3 – Object Definition in VRML.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
Computer Graphics Group David Sedláček. Computer Graphics Group 2X3D Contents 1.DOM manipulation 2.Events 3.Animation 4.Prototypes 5.Augmented Reality.
Working with Cookies Managing Data in a Web Site Using JavaScript Cookies* *Check and comply with the current legislation regarding handling cookies.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
H3D API Training  Part 3.3: Python – H3D integration.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Introduction to Applets CS 3505 Client Side Scripting with applets.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
1 Virtual Reality Modeling Language (VRML97) ©Anthony Steed
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
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,
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
111/16/ :14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates.
H3D API Training Part 3.2: Fields; Event Handling.
Virtual Reality Modeling Language 97. What’s VRML? Virtual Reality Modeling Language 2D/3D graphics Audio:.wav,.mid Video: MPEG-1 Interactivity: time-
Web Development 101 Presented by John Valance
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
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
© 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!
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
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.
JavaScript and Ajax Week 10 Web site:
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
LiLa – Library of Labs A simple to use tool to build interactive 3D for Open Wonderland Oktober 2011 Co-funden by the community programm eContentplus.
MPEG-4 Binary Information for Scenes (BIFS)
Department of Computer Science University College London
Introduction to JavaScript
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Introduction to JavaScript
Lecture 3. Virtual Worlds : Representation,Creation and Simulation
Presentation transcript:

Computer Graphics Group Script node Jiří Žára

Computer Graphics Group Contents 1.Script node 2.Motion generators 2Script node

Computer Graphics Group Sensors, Timers, Interpolators –Defined parameters –Defined behavior Script node –Custom parameters –Custom behavior 3 Dynamic nodes Script node eventOut eventIn field behavior Script node

Computer Graphics Group Script node Container for programming language code Supported languages: –Java –ECMAScript (JavaScript) Code can be written –Directly to wrl file (only JavaScript) –To a separate file (parameter url) 4

Computer Graphics Group Script node When to use a Script node? Engine part for controlling animation Logic part for processing input conditions Manipulation with the scene hierarchy (add child nodes) Interaction with the VRML browser Communication with a server across the network (only Java) 5

Computer Graphics Group interpreted object-based language syntax similar to Java non-strict conversion between data types variable number of args. in functions built-in objects: Array, Boolean, Date, Function, Math, Number, String. 6 ECMAScript

Computer Graphics Group 7 Script interface exposedField is not allowed! local variable with default value when received, a function with the same name is called. Params: [value(s), time stamp] sent when variable with the same name is set JavaScript code, path to JavaScript file or path to Java class field eventIn eventOut url

Computer Graphics Group Script node Example: Data convertor # Convert SFBool to SFInt32 Script { eventIn SFBool set_bool eventOut SFInt32 value_changed url "javascript: function set_bool (value, time) { if (value) value_changed = 1; else value_changed = 0; } // this is a comment! " } Live example 8

Computer Graphics Group Script node Two more params. of Script node SFBool mustEvaluate FALSE If FALSE, the browser may delay sending input events to the script until its outputs are needed by the browser. SFBool directOutput FALSE If FALSE, the script may only affect the rest of the world via events sent through its eventOuts If TRUE, the script may send events directly to any node to which it has access TRUEs causes poor performance 9

Computer Graphics Group Script node Example: directOutput TRUE DEF DIRECT Script { field SFNode object IS/USE … # any Shape node eventIn SFBool set_highlight field SFColor bright directOutput TRUE url "javascript: function set_highlight (value) { if (value) bright[0]=bright[1]=bright[2]= 0.3; else bright.r =bright.g =bright.b = 0; object.appearance.material.emissiveColor = bright; }" } Live example 10

Computer Graphics Group Script node ECMAScript functions for Script initialize () called once, after loading the world shutdown () called once, before the world is left eventsProcessed () called when any eventIn is received, accumulation of small changes 11

Computer Graphics Group Script node Motion generators PROTO nodes with: script(s) and/or interpolator(s) children influenced by interpolators Examples: 1) shuttle motion generator (interpolator) 2) sin function motion (script) 12

Computer Graphics Group Script node Example 1: Shuttle Timer fraction_changed translation Transform PositionInterpolator value_changed set_fraction Script keyPositions keyValue (computes initial key values only) height 13

Computer Graphics Group Script node Shuttle PROTO header PROTO Shuttle [ field SFTime time 4 field SFFloat height 2 field MFNode object [ ] ] { DEF TRANSF Transform { children IS object } DEF TIMER TimeSensor { cycleInterval IS time loop TRUE # forever } DEF MOTION PositionInterpolator { key [ 0,.25,.75, 1 ] keyValue [ 0 0 0, 0 1 0, , ] } 14

Computer Graphics Group Script node Script for Shuttle DEF INIT-VALUES Script { field SFFloat height IS height eventOut MFVec3f keyPositions url "javascript: function initialize ( ) { z = new SFVec3f (); top = new SFVec3f (0, height, 0); down = new SFVec3f (0, -height, 0); keyPositions = new MFVec3f (z, top, down, z); }" } ROUTE … TO... } # end of PROTO Shuttle Live example 15

Computer Graphics Group Script node Example 2: Sin function Timer fraction_changed translation Transform Script translation set_fraction A script fully replaces an interpolator height 16

Computer Graphics Group Script node Sin PROTO header PROTO Sin [ field SFTime time 4 field SFFloat height 2 field MFNode object [ ] # = the same interface as Shuttle ] { DEF TRANSF Transform { children IS object } DEF TIMER TimeSensor { cycleInterval IS time loop TRUE # forever } 17

Computer Graphics Group Script node Example 2: Script for Sin DEF MOTION Script { field SFFloat height IS height eventIn SFFloat set_fraction eventOut SFVec3f translation url "javascript: function set_fraction (x) { translation = new SFVec3f (0, height * Math.sin (2*x*Math.PI), 0); }" } ROUTE … TO … } # end of PROTO Sin Live example 18

Computer Graphics Group … end of this part 19