Adding Functionality To WebBased VR - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Adding Functionality To WebBased VR

Description:

Use telephone network, satellite links, private links. Connected using IP ... DHTML, XML, vrmlscript, javascript. Java Applets. Flash, Shockwave. Cached locally ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 26
Provided by: rho2
Category:

less

Transcript and Presenter's Notes

Title: Adding Functionality To WebBased VR


1
Adding Functionality To Web-Based VR
  • Basic Concepts
  • Client server model
  • Client-side static
  • Client-side scripting
  • Server-side scripting

2
Web / Network Structure
  • Web consists of a series of interlinked data
    repositories
  • Linked via hubs and routers
  • Use telephone network, satellite links, private
    links
  • Connected using IP addresses
  • IP addresses mapped to location by DNS

3
Client /Server
  • Aserver refers to a computer that offers a
    service that can be obtained over the network
  • workstation becomes a client'' when it sends a
    request to a server and waits for a response

4
The World Wide Web
  • Many Clients
  • Many Servers
  • Many means of linking

5
Overall WWW Client - Server model
6
HTTP Protocol
  • The protocol is basically stateless, a
    transaction consists of
  • Connection - The establishment of a connection by
    the client to the server
  • Request - The sending, by the client, of a
    request message to the server
  • Response - The sending, by the server, of a
    response to the client
  • Close - The closing of the connection by either
    both parties.

7
Dynamic v Static
Server
Server
Server sends data - data cached locally
Client sends request
Client sends request
Server sends data cached locally - contains
variable data
Client
Client
Client handles input by user browser invokes
actions
8
Client side processing
  • Static Web page
  • HTML
  • Cached Locally
  • Dynamic Web Page
  • DHTML, XML, vrmlscript, javascript
  • Java Applets
  • Flash, Shockwave
  • Cached locally
  • Browser deals with locally

9
Server Side processing
  • Client sends request back to server with user
    request
  • Server interprets reconfigures data
  • Returns new client-interpretable instructions for
    browser to refresh local copy
  • CGI, ASP, Java Servlets

10
Teleprocessing
  • Request from client changes underlying data on
    server
  • Web 3D model changed for other users
  • Database update e.g.
  • User 1 looks up book - 3 copies orders 1
  • User 2 looks up book 2 copies

11
Adding action to 3D worlds
  • Communicate changes form one state to another
  • Execution model
  • Java uses a class structure to show
  • state
  • Behaviour
  • The state in 3D is the geometry etc.
  • Behaviour is defined by the events

12
Requirements
  • VRML to store geometry
  • Java to drive the behaviours
  • How do we link them together?

13
Scene Graph
  • VRML file has a a set of nodes organised into set
    of hierarchies
  • Nodes
  • Nodes exist to define geometry and to control the
    scene
  • Use Routes to link nodes together

14
Static v Dynamic
  • VRML enables changes of state where a route is
    pre-defined and non-variable I.e. static
  • Activation is required to create a dynamic scene
  • VRML provides simple methods of activation via a
    sensor

15
Dynamic Behaviours
  • To create real dynamic worlds a bridge between
    VRML and Java is required
  • Script Node

16
What is a dynamic behaviour
  • Behaviours involving
  • Query state
  • make decisions based on state
  • change scene based on decisions
  • E.g. If door is open go thro else turn left (or
    right !!)
  • Script node allows arbitrary plugging of code
    into the VRML scene

17
Script Node
Script exposedField MFString url
field SFBool directOutput
FALSE field SFBool mustEvaluate
FALSE And any number of eventIn
eventTypeName eventName field
fieldTypeName fieldName initialValue eventOut
eventTypeName eventName
18
Setting Up a script node
  • Must have a pointer to the sourc e file
    containing the program code
  • URL to allow web handling
  • Script
  • url httpbob.home/ExampleClient.class"
  • eventIn SFRotation orientation
  • field SFNode target USE TARGET

19
  • Also contains
  • user-defined fields
  • Event in fields pass control to the referenced
    class
  • Any field referenced can be altered by the code
    referred to in the class
  • Event out generates an event to be sent to
    connected nodes

20
Script Node is a messenger
  • Events sent to script are
  • packaged
  • sent to script (java class)
  • script updates script node fields
  • out fields of script node route event to other
    nodes in the usual way

21
Event Class
  • Gets information about the incoming event
  • getName (name of event field in script node
  • getValue (reference to VRML field)
  • getTimeStamp (time at which event was generated
    in VRML field)

22
Example
  • VRML V2.0 utf8
  • Transform
  • children
  • DEF TS TouchSensor TouchSensor
  • Shape
  • appearance Appearance
  • material DEF SphereColor Material
    diffuseColor 1 0 0 red
  • geometry Sphere

23
Contd.
  • 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_diff
    useColor

24
Java Class
  • 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()
25
Using JavaScript with VRML
  • The Script
  • DEF toggle Script
  • field SFBool active FALSE
  • eventIn SFBool isClicked
  • eventOut SFBool click_changed
  • url "vrmlscript
  • function isClicked()
  • if (active 0)
  • active 1
  • else
  • active 0
  • click_changed active
  • "

Uses Script Node
Write a Comment
User Comments (0)
About PowerShow.com