three-render-objects 1.26.5 → 1.26.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ three-render-objects
|
|
|
3
3
|
|
|
4
4
|
[![NPM package][npm-img]][npm-url]
|
|
5
5
|
[![Build Size][build-size-img]][build-size-url]
|
|
6
|
-
[![
|
|
6
|
+
[![NPM Downloads][npm-downloads-img]][npm-downloads-url]
|
|
7
7
|
|
|
8
8
|
This module offers a convenient way to render [ThreeJS](https://threejs.org/) objects onto a WebGL canvas, with built-in interaction capabilities:
|
|
9
9
|
* hover/click events
|
|
@@ -15,28 +15,28 @@ All the renderer/scene/camera scaffolding is already included and any instance o
|
|
|
15
15
|
|
|
16
16
|
## Quick start
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```js
|
|
19
19
|
import ThreeRenderObjects from 'three-render-objects';
|
|
20
20
|
```
|
|
21
21
|
or
|
|
22
|
-
```
|
|
23
|
-
|
|
22
|
+
```js
|
|
23
|
+
const ThreeRenderObjects = require('three-render-objects');
|
|
24
24
|
```
|
|
25
25
|
or even
|
|
26
|
-
```
|
|
26
|
+
```html
|
|
27
27
|
<script src="//unpkg.com/three-render-objects"></script>
|
|
28
28
|
```
|
|
29
29
|
then
|
|
30
|
-
```
|
|
30
|
+
```js
|
|
31
31
|
const myCanvas = ThreeRenderObjects();
|
|
32
32
|
myCanvas(<myDOMElement>)
|
|
33
|
-
|
|
33
|
+
.objects(<myData>);
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## API reference
|
|
37
37
|
|
|
38
38
|
### Initialisation
|
|
39
|
-
```
|
|
39
|
+
```js
|
|
40
40
|
ThreeRenderObjects({ configOptions })(<domElement>)
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -104,9 +104,9 @@ ThreeRenderObjects({ configOptions })(<domElement>)
|
|
|
104
104
|
| <b>getSceneCoords</b>(<i>x</i>, <i>y</i>, <i>distance</i>) | Utility method to translate viewport distance coordinates to the scene 3D domain. Given a set of `x`,`y` viewport coordinates and distance from the camera, returns the current equivalent `{x, y, z}` in 3D scene coordinates. If no distance is provided, defaults to `0`. |
|
|
105
105
|
| <b>intersectingObjects</b>(<i>x</i>, <i>y</i>) | Utility method to retrieve the list of objects under the line of sight of the given viewport coordinates. Returns an array of [intersectObject](https://threejs.org/docs/#api/en/core/Raycaster.intersectObject), sorted by distance (from closest to farthest). |
|
|
106
106
|
|
|
107
|
-
[npm-img]: https://img.shields.io/npm/v/three-render-objects
|
|
107
|
+
[npm-img]: https://img.shields.io/npm/v/three-render-objects
|
|
108
108
|
[npm-url]: https://npmjs.org/package/three-render-objects
|
|
109
|
-
[build-size-img]: https://img.shields.io/bundlephobia/minzip/three-render-objects
|
|
109
|
+
[build-size-img]: https://img.shields.io/bundlephobia/minzip/three-render-objects
|
|
110
110
|
[build-size-url]: https://bundlephobia.com/result?p=three-render-objects
|
|
111
|
-
[
|
|
112
|
-
[
|
|
111
|
+
[npm-downloads-img]: https://img.shields.io/npm/dt/three-render-objects
|
|
112
|
+
[npm-downloads-url]: https://www.npmtrends.com/three-render-objects
|
|
@@ -46,7 +46,7 @@ function styleInject(css, ref) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
49
|
+
var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
50
50
|
styleInject(css_248z);
|
|
51
51
|
|
|
52
52
|
function _defineProperty(obj, key, value) {
|
|
@@ -614,8 +614,8 @@ var threeRenderObjects = Kapsule__default["default"]({
|
|
|
614
614
|
update: function update(state, changedProps) {
|
|
615
615
|
// resize canvas
|
|
616
616
|
if (state.width && state.height && (changedProps.hasOwnProperty('width') || changedProps.hasOwnProperty('height'))) {
|
|
617
|
-
state.container.style.width = state.width;
|
|
618
|
-
state.container.style.height = state.height;
|
|
617
|
+
state.container.style.width = "".concat(state.width, "px");
|
|
618
|
+
state.container.style.height = "".concat(state.height, "px");
|
|
619
619
|
[state.renderer, state.postProcessingComposer].concat(_toConsumableArray(state.extraRenderers)).forEach(function (r) {
|
|
620
620
|
return r.setSize(state.width, state.height);
|
|
621
621
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.26.
|
|
1
|
+
// Version 1.26.8 three-render-objects - https://github.com/vasturiano/three-render-objects
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['three'], factory) :
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
35
|
+
var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
36
36
|
styleInject(css_248z);
|
|
37
37
|
|
|
38
38
|
function _defineProperty(obj, key, value) {
|
|
@@ -660,9 +660,6 @@
|
|
|
660
660
|
_state = STATE.PAN;
|
|
661
661
|
break;
|
|
662
662
|
|
|
663
|
-
default:
|
|
664
|
-
_state = STATE.NONE;
|
|
665
|
-
|
|
666
663
|
}
|
|
667
664
|
|
|
668
665
|
}
|
|
@@ -825,7 +822,7 @@
|
|
|
825
822
|
|
|
826
823
|
case 2:
|
|
827
824
|
_state = STATE.TOUCH_ZOOM_PAN;
|
|
828
|
-
_moveCurr.copy( getMouseOnCircle( event.pageX - _movePrev.
|
|
825
|
+
_moveCurr.copy( getMouseOnCircle( event.pageX - _movePrev.x, event.pageY - _movePrev.y ) );
|
|
829
826
|
_movePrev.copy( _moveCurr );
|
|
830
827
|
break;
|
|
831
828
|
|
|
@@ -2427,7 +2424,7 @@
|
|
|
2427
2424
|
* Full-screen textured quad shader
|
|
2428
2425
|
*/
|
|
2429
2426
|
|
|
2430
|
-
|
|
2427
|
+
const CopyShader = {
|
|
2431
2428
|
|
|
2432
2429
|
uniforms: {
|
|
2433
2430
|
|
|
@@ -2457,8 +2454,9 @@
|
|
|
2457
2454
|
|
|
2458
2455
|
void main() {
|
|
2459
2456
|
|
|
2460
|
-
|
|
2461
|
-
gl_FragColor
|
|
2457
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
2458
|
+
gl_FragColor.a *= opacity;
|
|
2459
|
+
|
|
2462
2460
|
|
|
2463
2461
|
}`
|
|
2464
2462
|
|
|
@@ -2703,18 +2701,12 @@
|
|
|
2703
2701
|
|
|
2704
2702
|
if ( renderTarget === undefined ) {
|
|
2705
2703
|
|
|
2706
|
-
const parameters = {
|
|
2707
|
-
minFilter: three$1.LinearFilter,
|
|
2708
|
-
magFilter: three$1.LinearFilter,
|
|
2709
|
-
format: three$1.RGBAFormat
|
|
2710
|
-
};
|
|
2711
|
-
|
|
2712
2704
|
const size = renderer.getSize( new three$1.Vector2() );
|
|
2713
2705
|
this._pixelRatio = renderer.getPixelRatio();
|
|
2714
2706
|
this._width = size.width;
|
|
2715
2707
|
this._height = size.height;
|
|
2716
2708
|
|
|
2717
|
-
renderTarget = new three$1.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio
|
|
2709
|
+
renderTarget = new three$1.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio );
|
|
2718
2710
|
renderTarget.texture.name = 'EffectComposer.rt1';
|
|
2719
2711
|
|
|
2720
2712
|
} else {
|
|
@@ -5352,8 +5344,8 @@
|
|
|
5352
5344
|
update: function update(state, changedProps) {
|
|
5353
5345
|
// resize canvas
|
|
5354
5346
|
if (state.width && state.height && (changedProps.hasOwnProperty('width') || changedProps.hasOwnProperty('height'))) {
|
|
5355
|
-
state.container.style.width = state.width;
|
|
5356
|
-
state.container.style.height = state.height;
|
|
5347
|
+
state.container.style.width = "".concat(state.width, "px");
|
|
5348
|
+
state.container.style.height = "".concat(state.height, "px");
|
|
5357
5349
|
[state.renderer, state.postProcessingComposer].concat(_toConsumableArray(state.extraRenderers)).forEach(function (r) {
|
|
5358
5350
|
return r.setSize(state.width, state.height);
|
|
5359
5351
|
});
|