Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React/regl client app for displaying point-in-polygon point clouds. #436

Open
wants to merge 158 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
077a38e
Update for branch-22.08
thomcom Aug 31, 2022
99d76ad
Modify edge mapper to use a table .join, with error handling, instead…
thomcom Sep 1, 2022
7f69939
Remove set_missing_fields_as_nulls workaround.
thomcom Sep 2, 2022
adda810
First bits of template for abstract request handling.
thomcom Sep 2, 2022
e685652
Add routes/gpu
thomcom Sep 2, 2022
5093b86
Add Series.repeat
thomcom Sep 6, 2022
0460c80
Create basic react app.
thomcom Oct 4, 2022
87f721e
Add ParticlesView
thomcom Oct 5, 2022
ed0fca5
Now add ParticlesView
thomcom Oct 5, 2022
38f6962
Rename directory.
thomcom Oct 5, 2022
9fdb562
Tweak background.
thomcom Oct 5, 2022
f267cc3
Map particles into view frustum.
thomcom Oct 5, 2022
ee4bf5d
Square up lookAt and point coordinates.
thomcom Oct 5, 2022
e9b2c03
Phase is gone and scale is an attribute of the pointbuffer.
thomcom Oct 5, 2022
744a294
Merge branch 'main' into feature/react-webgl-client-app
thomcom Oct 5, 2022
a8f6eb8
Merge branch 'main' into feature/api-server-abstraction
thomcom Oct 5, 2022
c302c01
Fix yarn.lock
thomcom Oct 5, 2022
290af21
Add event handling.
thomcom Oct 5, 2022
2036008
Add state reducer.
thomcom Oct 6, 2022
3247e81
Drop what looks like all the WebGL project residue in favor of regl.
thomcom Oct 6, 2022
4a27cf7
Hacking it up to encapsulate regl, not perfect yet.
thomcom Oct 6, 2022
3e787eb
Get rid of internal timer and use React timer. Seems bad performance.…
thomcom Oct 6, 2022
68e4b8c
Trying with create-react-app, start at working app.
thomcom Oct 6, 2022
8b50571
Minimum working.
thomcom Oct 7, 2022
09d0c89
Get texture and scalable/translateable points working with pure regl.
thomcom Oct 8, 2022
026df6f
Cube and points using same viewMatrix
thomcom Oct 10, 2022
e540ed9
getProjectionMatrix shared
thomcom Oct 10, 2022
9abbf3f
Reordering
thomcom Oct 10, 2022
3c37248
Fiddling with Frustum
thomcom Oct 10, 2022
5e4392c
Rename
thomcom Oct 10, 2022
98bf6c8
Got it! Loading an image into texture now from client only.
thomcom Oct 10, 2022
c671613
Improving map display geometry.
thomcom Oct 10, 2022
ff0db19
Properly positioned background image! Movement needs some tweaking.
thomcom Oct 10, 2022
722d98e
Move to random point generation.
thomcom Oct 11, 2022
630c930
Minor reformat.
thomcom Oct 11, 2022
d4e721f
Clean up and pass a couple of tests.
thomcom Oct 11, 2022
cc3cbab
Adding flexibility to gpu handler.
thomcom Oct 11, 2022
0eca0f4
Fiddling with dynamic dispatch
thomcom Oct 11, 2022
d06a559
Using autoformat.
thomcom Oct 11, 2022
ba4c867
Drop the abstract server.
thomcom Oct 12, 2022
e1bd2a1
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Oct 12, 2022
211497f
Substantially refactor index.js into points.js and background.js
thomcom Oct 12, 2022
a3a411d
Refactor matrices into their own module.
thomcom Oct 12, 2022
9b61542
Writing fetch for server routine now.
thomcom Oct 12, 2022
c7a8285
Client fetch requests to get live data from api-server.
thomcom Oct 13, 2022
1e1758f
Particles endpoints to send data to client.
thomcom Oct 13, 2022
de6b5fb
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Oct 13, 2022
e944033
Getting a reference on the coordinate system.
thomcom Oct 13, 2022
b730757
Lots of viewport refactoring.
thomcom Oct 14, 2022
316a6a6
Fix a couple errors.
thomcom Oct 14, 2022
29660bd
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Oct 14, 2022
246bdc2
Convert to orthoscaling to help figure out how to compute viewport.
thomcom Oct 14, 2022
6b4cfee
Still fiddling with matrices.
thomcom Oct 14, 2022
a1eb888
Prepare to refactor state.
thomcom Nov 8, 2022
df101a0
Refactoring for better matrix work.
thomcom Nov 9, 2022
87fa5c3
Correspondence matrix working.
thomcom Nov 9, 2022
33357b9
Get reverse world coordinates computation working. Now to add to server.
thomcom Nov 10, 2022
5288d6c
Refactor particles handler to take two routes.
thomcom Nov 10, 2022
dee37c8
Add lon/lat filtering to request.
thomcom Nov 10, 2022
eb9a4ef
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Nov 10, 2022
029b438
Lots of modifications to improve function.
thomcom Nov 16, 2022
8e19053
Tweaking for better filtering, memory safety.
thomcom Nov 16, 2022
ccc7355
Reduce input from stride 7 to stride 2 and drop color and z from shader.
thomcom Nov 17, 2022
60c48de
Drop z, w, r, g, b from particles request.
thomcom Nov 17, 2022
4e3fd89
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Nov 17, 2022
f223c37
Comment index.js
thomcom Nov 17, 2022
1940dc3
Clean up and comment throughout.
thomcom Nov 17, 2022
e8f6b59
Add logging for timed out currentDataframe.dispose() that causes a 500
thomcom Nov 17, 2022
7e51b88
Pass all tests and add some coverage, particles tests.
thomcom Nov 21, 2022
7401333
Add new test files.
thomcom Nov 21, 2022
4fdc5d7
Write unit tests for particles/get_shader_column in preparation of wr…
thomcom Nov 21, 2022
f28d277
Write npoints test and refactor endpoint.
thomcom Nov 22, 2022
f371cc7
Add quadtree loading route.
thomcom Nov 22, 2022
54d3d31
Add set_polygons_quadtree and refactor gpu_cache.
thomcom Nov 23, 2022
6b2a082
Set poly types.
thomcom Nov 23, 2022
43aef81
Write quadtree/get_points
thomcom Nov 23, 2022
63aee4d
Update modules/demo/api-server/package.json
thomcom Nov 30, 2022
bff76ab
Merge branch 'main' of github.com:rapidsai/node into feature/api-serv…
trxcllnt Nov 30, 2022
6228a61
Update package.json
thomcom Nov 30, 2022
bc7f5bd
Drop repeat
thomcom Nov 30, 2022
8d0f953
Merge branch 'feature/api-server-abstraction' of github.com:thomcom/n…
thomcom Nov 30, 2022
fe8679f
Really important comma needed to go.
thomcom Nov 30, 2022
25ed45c
Merge branch 'feature/api-server-abstraction' of github.com:thomcom/n…
trxcllnt Nov 30, 2022
dc09e42
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Jan 3, 2023
cadf534
For some reason the route path changed. Upstream changes?
thomcom Jan 3, 2023
68f3a9c
Trying to figure out issue with eslint improperly formatting in here.
thomcom Jan 3, 2023
2003516
Reorder exports to make clang-format happy.
thomcom Jan 3, 2023
9c1dc4e
Writing docs for api-server
thomcom Jan 4, 2023
1be7b71
Update modules/demo/api-server/routes/gpu/index.js
thomcom Jan 4, 2023
f687420
Update modules/demo/api-server/test/routes/graphology.test.js
thomcom Jan 4, 2023
5a5efb5
Update modules/demo/api-server/test/routes/graphology.test.js
thomcom Jan 4, 2023
499455f
Add docs, refactor gpu calls.
thomcom Jan 4, 2023
2d3ccb2
For some reason the route path changed. Upstream changes?
thomcom Jan 3, 2023
7ebef59
Trying to figure out issue with eslint improperly formatting in here.
thomcom Jan 3, 2023
ccb42f8
Reorder exports to make clang-format happy.
thomcom Jan 3, 2023
a537ad2
Writing docs for api-server
thomcom Jan 4, 2023
695832b
Add docs, refactor gpu calls.
thomcom Jan 4, 2023
3c87c51
Tweak params for new filename arg.
thomcom Jan 5, 2023
a390cf9
Modify renderer to display batches on a timer.
thomcom Jan 5, 2023
bd5cb9a
Refactor drawParticles to not be a default export.
thomcom Jan 5, 2023
086b45c
Add quadtree client requests.
thomcom Jan 9, 2023
4c3e0fb
Quadtree tweaks.
thomcom Jan 9, 2023
622c621
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Jan 10, 2023
4dbee63
Got quadtree working!
thomcom Jan 10, 2023
3f3c994
Attempting particlesEngine refactor to render a single buffer per frame.
thomcom Jan 11, 2023
1ce4f0c
Trying to get any points rendering again.
thomcom Jan 11, 2023
1d374c6
Get base case rendering again.
thomcom Jan 11, 2023
cc48170
Get quadtree working with dynamic buffer. Performance seems worse?
thomcom Jan 11, 2023
fd86741
Start cleaning up based on better architecture.
thomcom Jan 11, 2023
e8abfed
Cleaning up and getting ready for quad sampling.
thomcom Jan 13, 2023
fa9447c
Add quadtree count endpoint, plus clean up schema.
thomcom Jan 13, 2023
d22f934
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Jan 13, 2023
433db52
Add missing usa_map again and slightly move center of demo origin.
thomcom Jan 13, 2023
454fd58
Factor requests into their own file, cleaning up index.js
thomcom Jan 13, 2023
4c15438
Quadtree only now.
thomcom Jan 17, 2023
b174028
Endpoint to return just the first n points.
thomcom Jan 17, 2023
32b707b
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Jan 17, 2023
bf01060
Start requesting points in batches and store in a single buffer.
thomcom Jan 18, 2023
6b23188
Next and clear endpoints.
thomcom Jan 18, 2023
b9c8d01
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Jan 18, 2023
dce7210
Render quads in a random fashion.
thomcom Jan 19, 2023
52e509b
Fix failing test.
thomcom Jan 19, 2023
4d00f76
Important zoom level adjustments correct mouse movement relative to z…
thomcom Jan 20, 2023
a977149
A small scale cleaning factor.
thomcom Jan 20, 2023
11f9fb0
Improve quads data structure and use. Fix bug with count fetch api.
thomcom Jan 23, 2023
230d6a3
Fix bug with error in next endpoint.
thomcom Jan 23, 2023
23192f3
Merge branch 'feature/api-server-abstraction' into feature/react-webg…
thomcom Jan 23, 2023
8f6368e
Refactor to use better points per request.
thomcom Jan 23, 2023
669056b
Tweaking the quad queue.
thomcom Jan 25, 2023
f9df81b
Add particles to lerna and change to data folder for public data.
thomcom Jan 25, 2023
276a44f
ZZMerge branch 'main' into feature/react-webgl-client-app
thomcom Feb 9, 2023
9b8374a
Fiddling with coordinates in preparation for lambert conic projection.
thomcom Feb 17, 2023
0687e6e
Create React app.
thomcom Feb 23, 2023
04becbf
Create lambertConic projection function.
thomcom Feb 23, 2023
0e4a276
Now rendering particles on top of map.
thomcom Feb 23, 2023
5e9f58a
Get transform matrix from Map.
thomcom Feb 23, 2023
3379251
Add width and height to regl canvas that cures fuzziness.
thomcom Feb 23, 2023
a62a6bd
Add map ready handler to prevent rendering regl until matrices have b…
thomcom Feb 24, 2023
e326554
Messy refactor getting point loading running.
thomcom Feb 24, 2023
e8dd114
Using dynamic buffer.
thomcom Feb 24, 2023
f1e99e9
Got the map correspondence working.
thomcom Feb 27, 2023
6f13bc9
Move screen size to props.
thomcom Feb 27, 2023
b8e1106
Cleaning up state.
thomcom Feb 27, 2023
7334e57
Working point loading.
thomcom Feb 28, 2023
1653b2e
Create controls and pointBudget slider.
thomcom Feb 28, 2023
5d09bab
Update some rendering for the full dataset and add the first set of t…
thomcom Feb 28, 2023
b393f9c
Working on recompose and ixjs with @trxcllnt
thomcom Mar 1, 2023
f925c03
Unfortunately forgot to add tsx files previously.
thomcom Mar 1, 2023
bdc7c65
Also ix and types
thomcom Mar 1, 2023
cdb494a
Get points loading again.
thomcom Mar 1, 2023
4d0bb62
Add spinner.
thomcom Mar 1, 2023
f33f5ec
Spinner updates.
thomcom Mar 1, 2023
90dd9c6
Need tests.
thomcom Mar 1, 2023
5ad1e36
tsconfig.json
thomcom Mar 1, 2023
f419e8e
Add fzf
thomcom Mar 1, 2023
7a804aa
Clean up a little.
thomcom Mar 1, 2023
3c7ca1c
WithParticlesProps
thomcom May 12, 2023
b44ef89
Add prioritizer and budgeter.
thomcom May 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/cudf/src/column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Napi::Function Column::Init(Napi::Env const& env, Napi::Object exports) {
// column/filling.cpp
InstanceMethod<&Column::fill>("fill"),
InstanceMethod<&Column::fill_in_place>("fillInPlace"),
// column/repeat.cpp
InstanceMethod<&Column::repeat>("repeat"),
// column/binaryop.cpp
InstanceMethod<&Column::add>("add"),
InstanceMethod<&Column::sub>("sub"),
Expand Down
10 changes: 10 additions & 0 deletions modules/cudf/src/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ export interface Column<T extends DataType = any> {
*/
fill(value: Scalar<T>, begin?: number, end?: number, memoryResource?: MemoryResource): Column<T>;

/**
* Repeats the values of this n times.
*
* @param repeats The number of times to repeat the column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*/
repeat(value: Scalar<T>, begin?: number, end?: number, memoryResource?: MemoryResource):
Column<T>;

/**
* Fills a range of elements in-place in a column with a scalar value.
*
Expand Down
5 changes: 5 additions & 0 deletions modules/cudf/src/node_cudf/column.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,11 @@ struct Column : public EnvLocalObjectWrap<Column> {
cudf::scalar const& value,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

// column/filling/repeat.cpp
Column::wrapper_t repeat(
cudf::size_type repeats,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

// column/replace.cpp
Column::wrapper_t replace_nulls(
cudf::column_view const& replacement,
Expand Down
21 changes: 21 additions & 0 deletions modules/cudf/src/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,27 @@ export class AbstractSeries<T extends DataType = any> {
this._col.fill(new Scalar({type: this.type, value}), begin, end, memoryResource));
}

/**
* Repeats a Series n times, returning a new Series.
*
* @param repeats The number of times to repeat this.
*
* @example
* ```typescript
* import {Series} from '@rapidsai/cudf';
*
* // Float64Series
* Series.new([1, 2, 3]).repeat(2) // [1, 2, 3, 1, 2, 3]
* // StringSeries
* Series.new(["foo", "bar", "test"]).repeat(2) // ["foo", "bar", "test", "foo", "bar", "test"]
* // Bool8Series
* Series.new([true, true, true]).repeat(2) // [true, false, false, true, false, false]
* ```
*/
repeat(repeats: T['scalarType'], memoryResource?: MemoryResource): Series<T> {
return this.__construct(this._col.repeat(repeats, memoryResource));
}

/**
* Fills a range of elements in-place in a column with a scalar value.
*
Expand Down
2 changes: 1 addition & 1 deletion modules/demo/api-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Path = require('path');
// Change cwd to the example dir so relative file paths are resolved
process.chdir(__dirname);

const fastify = require.resolve('fastify-cli/cli.js');
const fastify = require.resolve('fastify-cli/cli.js')({logger: true});

const {spawnSync} = require('child_process');

Expand Down
84 changes: 84 additions & 0 deletions modules/demo/api-server/routes/gpu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) 2022, NVIDIA CORPORATION.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

const Fs = require('fs');
const {Utf8String, Int32, Uint32, Float32, DataFrame, Series, Float64} = require('@rapidsai/cudf');
const {RecordBatchStreamWriter, Field, Vector, List, Table} = require('apache-arrow');
const Path = require('path');
const {promisify} = require('util');
const Stat = promisify(Fs.stat);
const fastifyCors = require('@fastify/cors');
const fastify = require('fastify');

const arrowPlugin = require('fastify-arrow');
const gpu_cache = require('../../util/gpu_cache.js');
const root_schema = require('../../util/schema.js');

module.exports = async function(fastify, opts) {
fastify.register(arrowPlugin);
fastify.register(fastifyCors, {origin: '*'});
fastify.decorate('setDataframe', gpu_cache.setDataframe);
fastify.decorate('getDataframe', gpu_cache.getDataframe);
fastify.decorate('gpu', gpu_cache);

const get_handler =
async (request, reply) => {
const query = request.query;
request.log.info('Parsing Query:');
request.log.info(query);
request.log.info('Sending query to gpu_cache');
request.log.info('Updating result');
request.log.info('Sending cache.tick');
let result = {
'params': JSON.stringify(query),
success: true,
message: `gpu method:${request.method} placeholder`,
statusCode: 200
};
return result
}

const post_handler =
async (request, reply) => {
const query = request.query;
request.log.info('Parsing Query:');
request.log.info(query);
request.log.info('Sending query to gpu_cache');
request.log.info('Updating result');
request.log.info('Sending cache.tick');
let result = {
'params': JSON.stringify(query),
success: true,
message: `gpu method:${request.method} placeholder`,
statusCode: 200
};
return result
}

const get_schema = {
logLevel: 'debug',
schema: {
response: {
200: {
type: 'object',
properties:
{success: {type: 'boolean'}, message: {type: 'string'}, params: {type: 'string'}}
}
}
}
};

fastify.get('/', {...get_schema, handler: get_handler});
fastify.post('/', {...get_schema, handler: post_handler});
}
11 changes: 11 additions & 0 deletions modules/demo/api-server/util/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
'use strict';

const schema = {
gpu: {
description: 'An abstract interface to the node-rapids api, supported by a server.',
schema: {
'/': {
method: 'The name of the method to apply to gpu_cache data.',
caller: 'Either an object that has been stored in the gpu_cache or a static module name.',
arguments: 'Correctly specified arguments to the gpu_cache method.',
result: 'Either a result code specifying success or failure or an arrow data buffer.',
}
}
},
graphology: {
description: 'The graphology api provides GPU acceleration of graphology datasets.',
schema: {
Expand Down
63 changes: 63 additions & 0 deletions modules/demo/particles/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:import/errors",
"prettier",
"prettier/react"
],
"parserOptions": {
"ecmaVersion": 11,
"ecmaFeatures": {
"jsx": true
}
},
"globals": {
"benchmark": "readonly",
"suite": "readonly"
},
"env": {
"browser": true,
"es2020": true,
"node": true,
"mocha": true
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": [
"prettier",
"react"
],
"rules": {
"react/jsx-filename-extension": [
1,
{
"extensions": [
".jsx"
]
}
],
"react/prop-types": 0,
"no-multi-assign": 0,
"arrow-body-style": [
"error",
"as-needed"
],
"prettier/prettier": [
"error",
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120
}
],
"no-restricted-syntax": [
0,
"ForOfStatement"
],
"max-classes-per-file": 0
}
}
7 changes: 7 additions & 0 deletions modules/demo/particles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.vscode
node_modules
*.DS_Store
build
coverage
.nyc_output
yarn-error.log
21 changes: 21 additions & 0 deletions modules/demo/particles/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Mik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
58 changes: 58 additions & 0 deletions modules/demo/particles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# `react-webgl-app`

Boilerplate to create a minimal React & WebGL app.

![Example](public/images/example.png)

It is made using [rollup-react-app](https://github.com/mikbry/RollupReactApp). The WebGL code is an heavily modified example from [Mozilla](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Animating_objects_with_WebGL).

## Why
- Create a minimal from scratch React + WebGL app.
- No Three.js
- use React's hook

It will be enhanced with more examples and an article.

## How it works ?

### 1 - WebGL needs a canvas

`GLVIew` component renders a `<canvas />` element. GLView iis using the [React Effect Hook](https://reactjs.org/docs/hooks-effect.html) to make the animation works. The code is very simple:

```javascript
const GLView = ({ width, height, scene }) => {
const ref = useRef();

useEffect(() => {
const canvas = ref.current;
const webGL = new WebGL(canvas, width, height);
webGL.init(scene);
return () => {
webGL.close();
};
});

return <canvas ref={ref} width={width} height={height} />;
};
```

### 2 - All the GL stuff
`WebGL` is the engine where WebGL, shaders, model are intialized.

The rendering animation is done using:

```javascript
this.render = this.render.bind(this);
this.requestId = requestAnimationFrame(this.render);
```

### 3 - Where the magic plays
`scene.js`

All the model, shaders, are here and also the scene rendering.

## Community

Don't hesitate to test, use, contribute, ...

Made by [Mik BRY](http://twitter.com/mikbry)
1 change: 1 addition & 0 deletions modules/demo/particles/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
Loading