SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
(Js) Export your own
webGL Viewer
Firenze November 11, 2015
Alberto Mancini - Francesca Tosi
About us
FREELANCE
- SOFTWARE DEVELOPER (WEB&MOBILE)
- LINUX SYSADMIN
- DEVOPS
#JOOINK TEAM
#GDG-FIRENZE
#INTEL SOFTWARE INNOVATOR
#GWTCON
alberto@jooink.com
+AlbertoMancini
Alberto Mancini
About us
Francesca Tosi
FREELANCE
- WEB & MOBILE DEVELOPER
- SOFTWARE ENGINEER
- SOFTWARE ARCHITECT WITH A PASSION FOR
CLEAN CODE AND FINE TUNED DETAILS.
#JOOINK TEAM
#GDG-FIRENZE #GDG-ANCONA
#INTEL SOFTWARE INNOVATOR
#GWTCON
francesca@jooink.com
@francescatosi
About us
Computer Vision
&
Augmented
Reality
picshare.jooink.com
JSInterop for fun and profit
Aim
What we have to do
● Data is (already) managed and processed in a
serverside workflow.
● Data, meshes with arttributes and some
metadata, has proprietary format and is not
ready for web (huge size, repeated, not really
optimized)
● There’s already a web application (sort of)
that drive end-users interaction, should be
‘augmented’ with a 3D viewer.
Aim
Final Application
That sould be:
● performant (low bandwidth, caching
capable, lighting fast)
● extensible (new features are expected
to pop up)
● mobile (at least ‘tablet’) ready
● embeddable
Medical use-case:
Provide a self contained WebGL component in GWT
to be consumed in vanilla javascript.
What we
need
---
What we need:
● Manage 3D models in a Browser
● Get User Gestures (all devices)
● Get data/model from server and
manage them on client
● Compunting … WebWorkers
Manage 3D Models in a Browser
3D Models
Manage 3D Models
3D Models
Manage 3D Models
Manage 3D Models:
● WebGL on js → Three.js
● Three.js for GWT →
3D Models
Parallax3D
Parallax 3D:
● Mature project
● It has a lot of Controls* but … we need
something different
→ Natural Controls
*What a control is ?
3D Models
Parallax3D
Parallax 3D:
● Mature project
● It has a lot of Controls but … we need
something different
→ Natural Controls*
*What a Natural Control is ?
3D Models
Parallax3D
Parallax 3D:
● Rendering (the heavy part) is done via
WebGL so does not really matter
(performance wise) if you use parallax
or threejs so if you measure poor
performance isn’t parallax fault
… is your !!
Get User Gestures (Web/Mobile)
User
Gestures
---
● Mobile version of Viewer needs
gestures recognition
● Adapting Hammer.js v 2.0.4 for GWT
○ JsInterop
○ JSNI
https://github.com/jooink
User
Gestures
---
private Manager() {
if(!injected) {
injected=true;
ScriptInjector.fromString(...Hammer...)
.setWindow(...)
.inject();
}
}
Hammer res:
@Source("resources/hammer.min.js")
public TextResource hammer();
User
Gestures
We wrapped all the gestures/recognizers:
● Pan
● Pinch
● Press
● Rotate
● Swipe
● Tap
● ...
User
Gestures
---
● Demo
Provide a self contained component in GWT to be
consumed in vanilla javascript.
Js-Interop
The opposite way
● Fill a <div/>
● the js developers want to construct the
whole UI, load our code, ‘insert’ in a div
● drive the viewer via a Javascript API
● in the ‘div’ our code has full-control so
we have to respond to events and so
on.
Js-Interop
Thanks guys …
JSInterop rocks !!!
@JsType
public interface ViewerInteropInterface {
public void load(String caseId, ...);
void doThis();
void doThat();
}
public class Viewer implements
ViewerInteropInterface {
@JsExport("$wnd.my.viewer")
public Viewer(String containerId) {
}
}
Js-Interop
it’s just plain old js
<!doctype html>
<html>
<head>
<script type="text/javascript" language="javascript"
src="viewer/viewer.nocache.js"></script>
<script type="text/javascript">
window.addEventListener('viewerReady',
function() {
var viewer = new window.my.viewer('panel');
viewer.load(....);
}
);
</script>
</head>
<body>
<div id="panel"></div>
</body>
</html>
Js-Interop
we use the std
linker (and some
permutation
sometime)
public class Caster implements EntryPoint {
@Override
public void onModuleLoad() {
castReadyEvent();
}
private static final native void castReadyEvent() /*-{
$wnd.dispatchEvent(
new CustomEvent('viewerReady'));
}-*/;
}
Js-Interop
I’m lazy
SDM in eclipse
EntryPoint in separate module
Viewer ev = new Viewer("panel");
ev.load(...);
Data Layout from serverside in Java
to Clientside … in Java too ;-)
Data
Layout
● integrate with the serverside flow and
provide a data outlet to be consumed by the
viewer
● our response here is obviously Java (so we
write only once the code parsing the data
layout)
Data
Layout
● you can’t reinvent the wheel and (mesh)
compression algorithms are a “consolidated
wheel”
● So, we took for the low level compression
algorithms suitable (highily optimized) native
implementations and we plugged (with a
common api) in the code java and javascript
‘side’.
Computation client side:
Web Workers
Web
Workers
Web Workers provide a simple means for web
content to run scripts in background threads. The
worker thread can perform tasks without
interfering with the user interface. Once created,
a worker can send messages to the JavaScript
code that created it by posting messages to an
event handler specified by that code (and vice
versa.)
Web
Workers
var worker = new Worker(scriptUrl);
and then onMessage/postMessage
Security Madness (SDM)
External scripts sucks
Web
Workers
private static final native JavaScriptObject injectWorker(String code) /*-{
return (function(window) {
function WorkerFactory() {
var blob = new Blob([ code ], { type: 'application/javascript' } );
this.createAndStart = function(onerror,onmessage) {
var blobURL = URL.createObjectURL( blob );
var worker = new Worker( blobURL );
worker.addEventListener('error',onerror,false);
worker.addEventListener('message',onmessage,false);
URL.revokeObjectURL( blobURL );
return worker;
};
}
return new WorkerFactory();
})(window);
}-*/;
Web
Workers
Another Story
● another story, creating workers with
GWT
● gwt-ns, webworker linker
Does not works nicely with SDM,
unfortunately :(
That’s all!!!
Thanks.
francesca@jooink.com alberto@jooink.
com

Mais conteúdo relacionado

Mais procurados

Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Maurice De Beijer [MVP]
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web ToolkitDidier Girard
 
Android best practices 2015
Android best practices 2015Android best practices 2015
Android best practices 2015Sean Katz
 
Adventures with Angular 2
Adventures with Angular 2Adventures with Angular 2
Adventures with Angular 2Dragos Ionita
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??Laurent Duveau
 
Rapid Android Development for Hackathon
Rapid Android Development for HackathonRapid Android Development for Hackathon
Rapid Android Development for HackathonCodePolitan
 
The complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrrThe complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrrAfreenK
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la forceNicolas PENNEC
 
Design Patterns every Android developer should know
Design Patterns every Android developer should knowDesign Patterns every Android developer should know
Design Patterns every Android developer should knowmuratcanbur
 
Gerrit JavaScript Plugins
Gerrit JavaScript PluginsGerrit JavaScript Plugins
Gerrit JavaScript PluginsDariusz Łuksza
 
Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop Ahmed rebai
 
Reactjs workshop (1)
Reactjs workshop (1)Reactjs workshop (1)
Reactjs workshop (1)Ahmed rebai
 
ComponenKit and React Native
ComponenKit and React NativeComponenKit and React Native
ComponenKit and React NativeStanfy
 
Say Hello to React day2 presentation
Say Hello to React   day2 presentationSay Hello to React   day2 presentation
Say Hello to React day2 presentationSmile Gupta
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 
In defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin AlworthIn defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin AlworthGWTcon
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipsterJulien Dubois
 

Mais procurados (20)

Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
Android best practices 2015
Android best practices 2015Android best practices 2015
Android best practices 2015
 
Introducing GWT Polymer (vaadin)
Introducing GWT Polymer (vaadin)Introducing GWT Polymer (vaadin)
Introducing GWT Polymer (vaadin)
 
Adventures with Angular 2
Adventures with Angular 2Adventures with Angular 2
Adventures with Angular 2
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??
 
Rapid Android Development for Hackathon
Rapid Android Development for HackathonRapid Android Development for Hackathon
Rapid Android Development for Hackathon
 
The complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrrThe complete-beginners-guide-to-react dyrr
The complete-beginners-guide-to-react dyrr
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la force
 
jQuery plugin & testing with Jasmine
jQuery plugin & testing with JasminejQuery plugin & testing with Jasmine
jQuery plugin & testing with Jasmine
 
Design Patterns every Android developer should know
Design Patterns every Android developer should knowDesign Patterns every Android developer should know
Design Patterns every Android developer should know
 
Gerrit JavaScript Plugins
Gerrit JavaScript PluginsGerrit JavaScript Plugins
Gerrit JavaScript Plugins
 
Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop
 
Reactjs workshop (1)
Reactjs workshop (1)Reactjs workshop (1)
Reactjs workshop (1)
 
ComponenKit and React Native
ComponenKit and React NativeComponenKit and React Native
ComponenKit and React Native
 
Say Hello to React day2 presentation
Say Hello to React   day2 presentationSay Hello to React   day2 presentation
Say Hello to React day2 presentation
 
React Django Presentation
React Django PresentationReact Django Presentation
React Django Presentation
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
In defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin AlworthIn defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin Alworth
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 

Semelhante a (Js) Export your own WebGL Viewer

Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Fwdays
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
Introduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsIntroduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsLuca Galli
 
Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for startersBruce Li
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsJAX London
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWTArnaud Tournier
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendVlad Fedosov
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JSFestUA
 
Javascript - Ebook (A Quick Guide)
Javascript - Ebook (A Quick Guide)Javascript - Ebook (A Quick Guide)
Javascript - Ebook (A Quick Guide)sourav newatia
 
Catching-up web technologies - an endless story
Catching-up web technologies - an endless storyCatching-up web technologies - an endless story
Catching-up web technologies - an endless storyCleber Jorge Amaral
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webpjcozzi
 
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechVue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechDivante
 
3D Programming Basics: WebGL
3D Programming Basics: WebGL3D Programming Basics: WebGL
3D Programming Basics: WebGLGlobant
 

Semelhante a (Js) Export your own WebGL Viewer (20)

Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
 
Swt 2009
Swt 2009Swt 2009
Swt 2009
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
Introduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsIntroduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJs
 
Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for starters
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
 
Service worker API
Service worker APIService worker API
Service worker API
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
Javascript - Ebook (A Quick Guide)
Javascript - Ebook (A Quick Guide)Javascript - Ebook (A Quick Guide)
Javascript - Ebook (A Quick Guide)
 
Catching-up web technologies - an endless story
Catching-up web technologies - an endless storyCatching-up web technologies - an endless story
Catching-up web technologies - an endless story
 
React Workshop
React WorkshopReact Workshop
React Workshop
 
HTML5 Game Development frameworks overview
HTML5 Game Development frameworks overviewHTML5 Game Development frameworks overview
HTML5 Game Development frameworks overview
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open web
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
 
Dust.js
Dust.jsDust.js
Dust.js
 
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechVue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
 
3D Programming Basics: WebGL
3D Programming Basics: WebGL3D Programming Basics: WebGL
3D Programming Basics: WebGL
 

Mais de JooinK

Power-up your mobile & web App with WebRTC
Power-up your mobile & web App with WebRTCPower-up your mobile & web App with WebRTC
Power-up your mobile & web App with WebRTCJooinK
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.JooinK
 
Go native benchmark test su dispositivi x86: java, ndk, ipp e tbb
Go native  benchmark test su dispositivi x86: java, ndk, ipp e tbbGo native  benchmark test su dispositivi x86: java, ndk, ipp e tbb
Go native benchmark test su dispositivi x86: java, ndk, ipp e tbbJooinK
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2JooinK
 
Javascript as a target language - GWT kickoff - part1/2
Javascript as a target language - GWT kickoff - part1/2Javascript as a target language - GWT kickoff - part1/2
Javascript as a target language - GWT kickoff - part1/2JooinK
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationJooinK
 
Augmented experience: Augmented Reality
Augmented experience: Augmented RealityAugmented experience: Augmented Reality
Augmented experience: Augmented RealityJooinK
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK
 
Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012JooinK
 
JooinK Presentation
JooinK PresentationJooinK Presentation
JooinK PresentationJooinK
 

Mais de JooinK (10)

Power-up your mobile & web App with WebRTC
Power-up your mobile & web App with WebRTCPower-up your mobile & web App with WebRTC
Power-up your mobile & web App with WebRTC
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
 
Go native benchmark test su dispositivi x86: java, ndk, ipp e tbb
Go native  benchmark test su dispositivi x86: java, ndk, ipp e tbbGo native  benchmark test su dispositivi x86: java, ndk, ipp e tbb
Go native benchmark test su dispositivi x86: java, ndk, ipp e tbb
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
Javascript as a target language - GWT kickoff - part1/2
Javascript as a target language - GWT kickoff - part1/2Javascript as a target language - GWT kickoff - part1/2
Javascript as a target language - GWT kickoff - part1/2
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computation
 
Augmented experience: Augmented Reality
Augmented experience: Augmented RealityAugmented experience: Augmented Reality
Augmented experience: Augmented Reality
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013
 
Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012
 
JooinK Presentation
JooinK PresentationJooinK Presentation
JooinK Presentation
 

Último

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Último (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

(Js) Export your own WebGL Viewer

  • 1. (Js) Export your own webGL Viewer Firenze November 11, 2015 Alberto Mancini - Francesca Tosi
  • 2. About us FREELANCE - SOFTWARE DEVELOPER (WEB&MOBILE) - LINUX SYSADMIN - DEVOPS #JOOINK TEAM #GDG-FIRENZE #INTEL SOFTWARE INNOVATOR #GWTCON alberto@jooink.com +AlbertoMancini Alberto Mancini
  • 3. About us Francesca Tosi FREELANCE - WEB & MOBILE DEVELOPER - SOFTWARE ENGINEER - SOFTWARE ARCHITECT WITH A PASSION FOR CLEAN CODE AND FINE TUNED DETAILS. #JOOINK TEAM #GDG-FIRENZE #GDG-ANCONA #INTEL SOFTWARE INNOVATOR #GWTCON francesca@jooink.com @francescatosi
  • 5. JSInterop for fun and profit
  • 6. Aim What we have to do ● Data is (already) managed and processed in a serverside workflow. ● Data, meshes with arttributes and some metadata, has proprietary format and is not ready for web (huge size, repeated, not really optimized) ● There’s already a web application (sort of) that drive end-users interaction, should be ‘augmented’ with a 3D viewer.
  • 7. Aim Final Application That sould be: ● performant (low bandwidth, caching capable, lighting fast) ● extensible (new features are expected to pop up) ● mobile (at least ‘tablet’) ready ● embeddable
  • 8. Medical use-case: Provide a self contained WebGL component in GWT to be consumed in vanilla javascript.
  • 9. What we need --- What we need: ● Manage 3D models in a Browser ● Get User Gestures (all devices) ● Get data/model from server and manage them on client ● Compunting … WebWorkers
  • 10. Manage 3D Models in a Browser
  • 12. 3D Models Manage 3D Models Manage 3D Models: ● WebGL on js → Three.js ● Three.js for GWT →
  • 13. 3D Models Parallax3D Parallax 3D: ● Mature project ● It has a lot of Controls* but … we need something different → Natural Controls *What a control is ?
  • 14. 3D Models Parallax3D Parallax 3D: ● Mature project ● It has a lot of Controls but … we need something different → Natural Controls* *What a Natural Control is ?
  • 15. 3D Models Parallax3D Parallax 3D: ● Rendering (the heavy part) is done via WebGL so does not really matter (performance wise) if you use parallax or threejs so if you measure poor performance isn’t parallax fault … is your !!
  • 16. Get User Gestures (Web/Mobile)
  • 17.
  • 18. User Gestures --- ● Mobile version of Viewer needs gestures recognition ● Adapting Hammer.js v 2.0.4 for GWT ○ JsInterop ○ JSNI https://github.com/jooink
  • 19. User Gestures --- private Manager() { if(!injected) { injected=true; ScriptInjector.fromString(...Hammer...) .setWindow(...) .inject(); } } Hammer res: @Source("resources/hammer.min.js") public TextResource hammer();
  • 20. User Gestures We wrapped all the gestures/recognizers: ● Pan ● Pinch ● Press ● Rotate ● Swipe ● Tap ● ...
  • 22. Provide a self contained component in GWT to be consumed in vanilla javascript.
  • 23. Js-Interop The opposite way ● Fill a <div/> ● the js developers want to construct the whole UI, load our code, ‘insert’ in a div ● drive the viewer via a Javascript API ● in the ‘div’ our code has full-control so we have to respond to events and so on.
  • 24. Js-Interop Thanks guys … JSInterop rocks !!! @JsType public interface ViewerInteropInterface { public void load(String caseId, ...); void doThis(); void doThat(); } public class Viewer implements ViewerInteropInterface { @JsExport("$wnd.my.viewer") public Viewer(String containerId) { } }
  • 25. Js-Interop it’s just plain old js <!doctype html> <html> <head> <script type="text/javascript" language="javascript" src="viewer/viewer.nocache.js"></script> <script type="text/javascript"> window.addEventListener('viewerReady', function() { var viewer = new window.my.viewer('panel'); viewer.load(....); } ); </script> </head> <body> <div id="panel"></div> </body> </html>
  • 26. Js-Interop we use the std linker (and some permutation sometime) public class Caster implements EntryPoint { @Override public void onModuleLoad() { castReadyEvent(); } private static final native void castReadyEvent() /*-{ $wnd.dispatchEvent( new CustomEvent('viewerReady')); }-*/; }
  • 27. Js-Interop I’m lazy SDM in eclipse EntryPoint in separate module Viewer ev = new Viewer("panel"); ev.load(...);
  • 28. Data Layout from serverside in Java to Clientside … in Java too ;-)
  • 29. Data Layout ● integrate with the serverside flow and provide a data outlet to be consumed by the viewer ● our response here is obviously Java (so we write only once the code parsing the data layout)
  • 30. Data Layout ● you can’t reinvent the wheel and (mesh) compression algorithms are a “consolidated wheel” ● So, we took for the low level compression algorithms suitable (highily optimized) native implementations and we plugged (with a common api) in the code java and javascript ‘side’.
  • 32. Web Workers Web Workers provide a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface. Once created, a worker can send messages to the JavaScript code that created it by posting messages to an event handler specified by that code (and vice versa.)
  • 33. Web Workers var worker = new Worker(scriptUrl); and then onMessage/postMessage Security Madness (SDM) External scripts sucks
  • 34. Web Workers private static final native JavaScriptObject injectWorker(String code) /*-{ return (function(window) { function WorkerFactory() { var blob = new Blob([ code ], { type: 'application/javascript' } ); this.createAndStart = function(onerror,onmessage) { var blobURL = URL.createObjectURL( blob ); var worker = new Worker( blobURL ); worker.addEventListener('error',onerror,false); worker.addEventListener('message',onmessage,false); URL.revokeObjectURL( blobURL ); return worker; }; } return new WorkerFactory(); })(window); }-*/;
  • 35. Web Workers Another Story ● another story, creating workers with GWT ● gwt-ns, webworker linker Does not works nicely with SDM, unfortunately :(