Top Banner
rest3d 3D REST style http://rest3d.org Rémi Arnaud
19

6 10-presentation

Dec 14, 2014

Download

Technology

Remi Arnaud

First presentation of the rest3d working group. Presented by Rémi Arnaud, during the WebGL camp #3 http://www.webglcamp.com
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 6 10-presentation

rest3d

3D REST stylehttp://rest3d.org

Rémi Arnaud

Page 2: 6 10-presentation

What is REST ?

Roy Fielding dissertation (2000) http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

• Representational State Transfer (REST) is an architecture, not a standard.

• REST is based on http, xml, uri standards• REST is everywhere already

– twitter API http://dev.twitter.com/doc– Dropbox API https://www.dropbox.com/developers/docs– Google MAP API Web services

http://code.google.com/apis/maps/documentation/webservices/index.html

– ….

Page 3: 6 10-presentation

6 constraints for a RESTful API Client–server Clients are separated from servers by a uniform interface. Clients are not concerned with data

storage, Servers are not concerned with the user interface or user state. Servers and clients may also be replaced and developed independently, as long as the interface is not altered.

Stateless Client context is not stored on the server between requests. Each request from any client contains all of the information necessary to service the request, and any session state is held in the client. The server can be stateful; this constraint merely requires that server-side state be addressable by URL as a resource

Cacheable As on the World Wide Web, clients are able to cache responses. Responses must therefore, implicitly or explicitly, define themselves as cacheable, or not, to prevent clients reusing stale or inappropriate data in response to further requests. Well-managed caching partially or completely eliminates some client–server interactions, further improving scalability and performance.

Layered system A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way. Intermediary servers may improve system scalability by enabling load balancing and by providing shared caches. They may also enforce security policies.

Code on demand Servers are able to temporarily extend or customize the functionality of a client by transferring logic to it that it can execute. Examples of this may include client-side scripts such as JavaScript.

Uniform interface The uniform interface between clients and servers simplifies and decouples the architecture, which enables each part to evolve independently. The four guiding principles of this interface are: Identification of resources (e.g. URI), Manipulation of resources, Self-descriptive messages, Hypermedia as the engine of application state

http:

//htt

p://

en.w

ikip

edia

.org

/wik

i/Re

pres

enta

tiona

l_St

ate_

Tran

sfer

Page 4: 6 10-presentation

methods

Resource GET POST PUT DELETE

collection List documents and sub-collections

Replace (or create) collection

Create a new sub-collection

Delete the entire collection

document Retrieve a document

Replace (or create) document

Replace (or create) document

Delete the document

PUT and DELETE are defined to be idempotent - multiple identical requests should have the same effect as a single requestPOST is not necessarily idempotent, and therefore sending an identical POST request multiple times may further affect state or cause further side effectsSee also HEAD, OPTIONS and TRACE methods

Potential use:

http:

//w

ww

.w3.

org/

Prot

ocol

s/rf

c261

6/rf

c261

6-se

c9.h

tml

Page 5: 6 10-presentation

What is REST 3D ?

Cloud Storage

Web Server Client application

http://rest3d request

Response document

3D as a web service

Page 6: 6 10-presentation

Multiple services – same API

Cloud Storage

Web Server

Cloud Storage

Web Server

Cloud Storage

Web Server

Client application

Page 7: 6 10-presentation

Multiple applications

Client application

Cloud Storage

Web Server

Cloud Storage

Web Server

Cloud Storage

Web Server

Client application

Client application

Page 8: 6 10-presentation

rest 3d methods

Resource GET POST PUT DELETE

collection Retrieve the content of a scene, or list a content repository

Replace (or create) an model in a scene / repository

Add a new model in the scene / repository

Delete model from scene / repository

document Retrieve a 3D model, or a subset of the model

Add an element to a 3D model, or modify model

Replace or create a model or a subset of a model

Remove a subset of a model

Potential use model:

http:

//w

ww

.w3.

org/

Prot

ocol

s/rf

c261

6/rf

c261

6-se

c9.h

tml

Page 9: 6 10-presentation

Use case 1 – content gathering

Program interface to content repositories. Current state requires human in the loop, and content creation tool to explore the model.• http://sketchup.google.com/3dwarehouse/• http://www.3dvia.com/• http://www.3dcadbrowser.com/• http://www.3d02.com/• http://www.turbosquid.com/• …

Page 10: 6 10-presentation

Use case 1 – content gathering search – return models matching with metadata search browse – Avoid downloading all the 3D models that matches the

search, this feature provides information about the models such as number of polygons, date, tool used to create the model, …

traverse – explore the model hierarchy, and sub parts or/and categories.

dependencies - list all the dependencies, for instance the list of textures, shaders, or other parts of the model

filter – select only the parts needed by the client. Allows for texture/3D LOD selection, paging…

download – get selected subset of the model in a specific format.

Page 11: 6 10-presentation

Use case 2 – collaborative browsing/viewing

search – return models matching with metadata search

scene – Create a scene and position the models in the scene

viewer – extend the client with a viewer application (<embed>) of the created scene.

collaborate – enable multiple applications/users to interact with the scene

store – store the created scene for others to discover link– provide a URL to the scene

Page 12: 6 10-presentation

Use case 3 – content repository

Content gathering API plus:create– add models to the content repositoryupdate – modify an existing modelversion – server list all the different versions available, with

metadatadiff / merge – provide tools to show the difference between

versionsprocess – provide tools to process the models, mesh

optimization, texture atlas, convert – covert a model from one format to another as a

web service.

Page 13: 6 10-presentation

insert your use case here

Join the discussion:http://groups.google.com/group/3d-rest

Page 14: 6 10-presentation

Typical xml ‘model’htt

p://

scen

ejso

rg.ip

age.

com

/dist

/cur

r/ex

tr/e

xam

ples

/tr

on-t

ank/

extr

as/t

ron-

tank

-mod

el.d

ae

Page 15: 6 10-presentation

XML & XHTML

• Embed 3D in html page– http://www.xml3d.org/– http://www.x3dom.org/

• Dynamically load 3D into DOM – (o3d) http://capstone.azurenet.net/web3d/demo/

var float_array=textValue.split(" ").map(parseFloat); DOM (jquery) allow for fast tree parsing/modificationsDirect XML export (POST/PUT) to server

Page 16: 6 10-presentation

Typical json ‘model’htt

ps:/

/gith

ub.c

om/m

rdoo

b/th

ree.

js/b

lob/

mas

ter/

exam

ples

/obj

/Suz

anne

.js

myData = JSON.parse(text, function (key, value) { if (value && typeof value === 'object') {… return value; }});

Need convention for attributes vs value, not easy to go back to XML

Page 17: 6 10-presentation

Typed Arrayhtt

p://

ww

w.k

hron

os.o

rg/r

egist

ry/t

yped

arra

y/sp

ecs/

late

st/

Page 18: 6 10-presentation

Typed Array loading• function onLoad()

{ var canvas = document.getElementById("lesson01-canvas"); initGL(canvas); var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "cube.bm", true); xmlhttp.responseType = "arraybuffer"; xmlhttp.onload = function() { var buffer = xmlhttp.response; gl.bindBuffer(gl.ARRAY_BUFFER, buffer); // Reading Data var v1 = new Float32Array(buffer); alert(v[0]); // This works fine. } xmlhttp.send(); }

Page 19: 6 10-presentation

Leaving the REST to YOU?

Official web pagewww.rest3d.org

Join the discussion:http://groups.google.com/group/3d-rest