ohzi-core 11.0.0 → 11.0.2
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/build/index.module.js +1 -1
- package/build/index.module.js.map +1 -1
- package/package.json +2 -1
- package/src/data_textures/RGBDataTexture.js +2 -2
- package/src/data_textures/RGBFloatDataTexture.js +2 -3
- package/src/materials/SSAOMaterial.js +2 -6
- package/src/primitives/Arrow.js +3 -6
- package/src/primitives/Sphere.js +2 -4
- package/src/render_mode/DeferredRender.js +5 -9
- package/src/static_batcher/GeometryBatch.js +2 -8
- package/src/utilities/OMath.js +3 -3
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { RGBAFormat } from 'three';
|
|
1
2
|
import { CustomDataTexture } from './CustomDataTexture';
|
|
2
|
-
import { RGBFormat } from 'three';
|
|
3
3
|
|
|
4
4
|
class RGBDataTexture extends CustomDataTexture
|
|
5
5
|
{
|
|
6
6
|
constructor(width, height)
|
|
7
7
|
{
|
|
8
8
|
const data = new Uint8Array(width * height * 3);
|
|
9
|
-
super(data, width, height,
|
|
9
|
+
super(data, width, height, RGBAFormat);
|
|
10
10
|
this.multiplier = 255;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import { FloatType, RGBAFormat } from 'three';
|
|
1
2
|
import { CustomDataTexture } from './CustomDataTexture';
|
|
2
|
-
import { FloatType } from 'three';
|
|
3
|
-
import { RGBFormat } from 'three';
|
|
4
3
|
|
|
5
4
|
class RGBFloatDataTexture extends CustomDataTexture
|
|
6
5
|
{
|
|
7
6
|
constructor(width, height)
|
|
8
7
|
{
|
|
9
8
|
const data = new Float32Array(width * height * 3);
|
|
10
|
-
super(data, width, height,
|
|
9
|
+
super(data, width, height, RGBAFormat, FloatType);
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -3,11 +3,7 @@ import { BlitMaterial } from '../materials/BlitMaterial';
|
|
|
3
3
|
import frag from '../shaders/ssao/ssao.frag';
|
|
4
4
|
import vert from '../shaders/ssao/ssao.vert';
|
|
5
5
|
|
|
6
|
-
import { Matrix4 } from 'three';
|
|
7
|
-
import { Vector3 } from 'three';
|
|
8
|
-
import { DataTexture } from 'three';
|
|
9
|
-
import { RGBFormat } from 'three';
|
|
10
|
-
import { RepeatWrapping } from 'three';
|
|
6
|
+
import { DataTexture, Matrix4, RGBAFormat, RepeatWrapping, Vector3 } from 'three';
|
|
11
7
|
|
|
12
8
|
import { OMath } from '../utilities/OMath';
|
|
13
9
|
class SSAOMaterial extends BlitMaterial
|
|
@@ -57,7 +53,7 @@ class SSAOMaterial extends BlitMaterial
|
|
|
57
53
|
rotation_kernel[i * 3 + 3] = 0;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
const rotation_texture = new DataTexture(rotation_kernel, 4, 4,
|
|
56
|
+
const rotation_texture = new DataTexture(rotation_kernel, 4, 4, RGBAFormat);
|
|
61
57
|
rotation_texture.wrapS = RepeatWrapping;
|
|
62
58
|
rotation_texture.wrapT = RepeatWrapping;
|
|
63
59
|
|
package/src/primitives/Arrow.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ConeBufferGeometry } from 'three';
|
|
3
|
-
import { MeshBasicMaterial } from 'three';
|
|
4
|
-
import { Vector3, Mesh } from 'three';
|
|
1
|
+
import { ConeGeometry, CylinderGeometry, Mesh, MeshBasicMaterial, Vector3 } from 'three';
|
|
5
2
|
|
|
6
3
|
import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
|
7
4
|
|
|
@@ -14,10 +11,10 @@ class Arrow extends Mesh
|
|
|
14
11
|
|
|
15
12
|
const cone_height = 0.4;
|
|
16
13
|
const cylinder_height = length - cone_height;
|
|
17
|
-
const cylinder_geo = new
|
|
14
|
+
const cylinder_geo = new CylinderGeometry(0.01, 0.01, cylinder_height, 32);
|
|
18
15
|
cylinder_geo.translate(0, cylinder_height / 2, 0);
|
|
19
16
|
|
|
20
|
-
const cone_geometry = new
|
|
17
|
+
const cone_geometry = new ConeGeometry(0.1, cone_height, 32);
|
|
21
18
|
cone_geometry.translate(0, cylinder_height + cone_height / 2, 0);
|
|
22
19
|
|
|
23
20
|
const buffer_geometry = BufferGeometryUtils.mergeBufferGeometries([cylinder_geo, cone_geometry]);
|
package/src/primitives/Sphere.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Mesh } from 'three';
|
|
2
|
-
import { SphereBufferGeometry } from 'three';
|
|
3
|
-
import { MeshBasicMaterial } from 'three';
|
|
1
|
+
import { Mesh, MeshBasicMaterial, SphereGeometry } from 'three';
|
|
4
2
|
|
|
5
3
|
class Sphere extends Mesh
|
|
6
4
|
{
|
|
@@ -8,7 +6,7 @@ class Sphere extends Mesh
|
|
|
8
6
|
{
|
|
9
7
|
color = color || '#FF0000';
|
|
10
8
|
radius = radius || 1;
|
|
11
|
-
const geometry = new
|
|
9
|
+
const geometry = new SphereGeometry(radius, 64, 64);
|
|
12
10
|
const material = new MeshBasicMaterial({ color: color });
|
|
13
11
|
super(geometry, material);
|
|
14
12
|
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { CameraManager } from '../CameraManager';
|
|
2
|
-
import {
|
|
2
|
+
import { Graphics } from '../Graphics';
|
|
3
3
|
import { OScreen } from '../OScreen';
|
|
4
|
-
import {
|
|
4
|
+
import { SceneManager } from '../SceneManager';
|
|
5
5
|
import { DeferredRendererComposeMaterial } from '../materials/DeferredRendererComposeMaterial';
|
|
6
|
-
import { Graphics } from '../Graphics';
|
|
7
6
|
import { DeferredPointLightMaterial } from '../materials/deferred/DeferredPointLightMaterial';
|
|
7
|
+
import { BaseRender } from '../render_mode/BaseRender';
|
|
8
8
|
|
|
9
|
-
import { WebGLRenderTarget } from 'three';
|
|
10
|
-
import { Scene } from 'three';
|
|
11
|
-
import { Mesh } from 'three';
|
|
12
|
-
import { SphereBufferGeometry } from 'three';
|
|
13
|
-
import { Matrix4 } from 'three';
|
|
9
|
+
import { Matrix4, Mesh, Scene, SphereGeometry, WebGLRenderTarget } from 'three';
|
|
14
10
|
|
|
15
11
|
class DeferredRender extends BaseRender
|
|
16
12
|
{
|
|
@@ -29,7 +25,7 @@ class DeferredRender extends BaseRender
|
|
|
29
25
|
const light_intensity = 1;
|
|
30
26
|
const light_brightest_component = 1;
|
|
31
27
|
const radius_needed_for_intensity = Math.sqrt(4 * light_intensity * (light_brightest_component * (256.0 / 5.0))) / (2 * light_intensity);
|
|
32
|
-
const sphere = new Mesh(new
|
|
28
|
+
const sphere = new Mesh(new SphereGeometry(radius_needed_for_intensity), new DeferredPointLightMaterial(light_intensity));
|
|
33
29
|
// sphere.position.y = 2;
|
|
34
30
|
// this.scene_lights.add(sphere);
|
|
35
31
|
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import { Vector2 } from 'three';
|
|
2
|
-
import { ShaderMaterial } from 'three';
|
|
3
|
-
import { Mesh } from 'three';
|
|
4
|
-
import { DataTexture } from 'three';
|
|
5
|
-
import { RGBAFormat } from 'three';
|
|
6
|
-
import { RGBFormat } from 'three';
|
|
7
|
-
import { FloatType } from 'three';
|
|
1
|
+
import { DataTexture, FloatType, Mesh, RGBAFormat, ShaderMaterial, Vector2 } from 'three';
|
|
8
2
|
|
|
9
3
|
class GeometryBatch
|
|
10
4
|
{
|
|
@@ -242,7 +236,7 @@ class GeometryBatch
|
|
|
242
236
|
__create_rgb_texture(width)
|
|
243
237
|
{
|
|
244
238
|
const data = new Uint8Array(3 * width * width);
|
|
245
|
-
return new DataTexture(data, width, width,
|
|
239
|
+
return new DataTexture(data, width, width, RGBAFormat);
|
|
246
240
|
}
|
|
247
241
|
|
|
248
242
|
__create_rgba_texture(width)
|
package/src/utilities/OMath.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Vector3 } from 'three';
|
|
2
|
-
|
|
3
1
|
class OMath
|
|
4
2
|
{
|
|
5
3
|
constructor()
|
|
@@ -48,7 +46,9 @@ class OMath
|
|
|
48
46
|
|
|
49
47
|
static project_points_on_plane(points, plane)
|
|
50
48
|
{
|
|
51
|
-
const projected_point =
|
|
49
|
+
const projected_point = points[0].clone();
|
|
50
|
+
projected_point.set(0, 0, 0);
|
|
51
|
+
|
|
52
52
|
const points_on_plane = [];
|
|
53
53
|
for (let i = 0; i < points.length; i++)
|
|
54
54
|
{
|