Comments (2)
Agree on having one renderer for DOM and one for GL. The diagram seems simplified though. This is what I see when reading the proposal.
+---------------+
| |
| State Context |
| |
+-------+-------+
|
+-----------------+------------------+
| a | | b
v | v
+----------+ | +----------+
| | | | |
| UI 1 | | c | UI 2 |
| | | | |
+-----+----+ | +----+-----+
| | |
Push data | d | Push data | e
+-----------------+------------------+
|
v
+-----------------+
| |
| Renderer |
| |
+-----------------+
Renderer could be either the DOMRenderer or GLRenderer because they are equivalent, they both require all state updates to get the current camera. We can only have one class instance requesting animation frames in the lib. Therefore it can’t be related to either of the renderers but needs to live somewhere else, e.g. somewhere close to state as in the diagram.
With this setup both of the UIs as well as the Renderer needs to subscribe to the current state observable (a, b and c). Pushing data to a service for the Renderer to render seems to be prone to race conditions and seems to introduce difficulties in determining if all UIs are done processing the state. The rendering would depend on the order of arrival of c, d and e.
Also the renderer can’t be aware of how to perform multistage rendering like in the current GLUI https://github.com/mapillary/mapillary-js/blob/master/src/ui/GlUI/GlUI.ts#L146 , only the UI itself can know this and therefor pushing just data for the Renderer to render is not enough. This will be more complicated with more UIs pushing.
For each frame loop two stages are generally run - the update stage where things are updated and the render stage where things are rendered. The render stage is only done if the update stage determines if there is a need to render. Another conceptual view on the new structure is the following.
+---------------+
| |
| State Context |
| |
+-------+-------+
|
| a
v
+-----------------+
| |
| Renderer |
| |
+-----------------+
^
|
+-----------------+-------------------+
| b | c
+-----+----+ +-----+----+
| | | |
| UI 1 | | UI 2 |
| | | |
+-----+----+ +----+-----+
Here the Renderer subscribes to the current state observable (a). The UIs register callbacks (b and c) to the Renderer. In the case of the GLRenderer this could be two callbacks - an animate/update callback, which takes the state and returns a boolean indicating if this UI needs rendering, as well as a render callback. The animate callbacks are always run before the rendering callbacks. The actual rendering is performed if any of the UIs determine it needs to render.
Irrespective of the architecture the GLRenderer itself needs to know when to clear, when to clear depth and possibly more things. The GLUIs needs to indicate if they are background objects or foreground objects and the rendering must take this into account when determining the order to render scenes/invoke render callbacks.
from mapillary-js.
A GLRenderer has been implemented and its API is enough for now. The architecture in the top image in the previous post has been used.
Modifications/additions will need to be done when raytracing is required for GL UIs.
from mapillary-js.
Related Issues (20)
- How to set latlng instead of mapId? HOT 2
- CORS Block after loading multiple image ids in viewer (Application request limit reached) HOT 4
- MapillaryJS not displaying any image, not even in demo section HOT 3
- Incorrect imagery display on Firefox HOT 8
- pixel coordinates to geo coordinates HOT 1
- 2x JS API moveCloseTo is stopped working HOT 1
- Mapillary JS viewer - Image Distortion - Failed to cache spatial edges HOT 1
- Images fail to load on Mapillary JS - Request limit? HOT 3
- Request order change in image search HOT 1
- Adding GLTFLoader in mapillary.module.js HOT 2
- Image graph module name HOT 2
- API for available photo locations HOT 1
- How the browser parses the geometry in the detection request HOT 1
- Is it possible to view 360 images in the viewer using procedural-data-provider? HOT 1
- 4.1.0 chunk load error on iOS Safari HOT 4
- Procedural Data Provider HOT 1
- 360 panorama image tiling HOT 3
- Image Cover Effect: Is it possible to force image to always "point" to the street? HOT 2
- Force equirectangular images on mapillary viewer HOT 2
- photo 360 filter by username HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapillary-js.