ohzi-core 13.0.3 → 13.0.5
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.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/index.module.js +3055 -1
- package/build/index.module.js.map +1 -1
- package/package.json +1 -1
- package/src/Graphics.ts +10 -20
- package/src/materials/BlitMaterial.ts +1 -7
- package/src/render_utilities/Blitter.ts +2 -1
package/package.json
CHANGED
package/src/Graphics.ts
CHANGED
|
@@ -6,15 +6,14 @@ import { BaseRender } from './render_mode/BaseRender';
|
|
|
6
6
|
import { Blitter } from './render_utilities/Blitter';
|
|
7
7
|
import { DepthAndNormalsRenderer } from './render_utilities/DepthAndNormalsRenderer';
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
Material,
|
|
11
|
-
RenderTarget,
|
|
12
|
-
Scene,
|
|
13
|
-
TypedArray
|
|
9
|
+
import {
|
|
10
|
+
type Material,
|
|
11
|
+
type RenderTarget,
|
|
12
|
+
type Scene,
|
|
13
|
+
type TypedArray
|
|
14
14
|
} from 'three';
|
|
15
15
|
|
|
16
16
|
import type { Renderer } from 'three/webgpu';
|
|
17
|
-
import { WebGPURenderer } from 'three/webgpu';
|
|
18
17
|
import type { OrthographicCamera } from './OrthographicCamera';
|
|
19
18
|
import type { PerspectiveCamera } from './PerspectiveCamera';
|
|
20
19
|
import type { AbstractScene } from './scenes/AbstractScene';
|
|
@@ -22,13 +21,6 @@ import type { AbstractScene } from './scenes/AbstractScene';
|
|
|
22
21
|
export interface CoreAttributes {
|
|
23
22
|
xr_enabled: boolean;
|
|
24
23
|
}
|
|
25
|
-
export interface RendererAttributes {
|
|
26
|
-
alpha: boolean,
|
|
27
|
-
logarithmicDepthBuffer: boolean,
|
|
28
|
-
antialias: boolean,
|
|
29
|
-
preserveDrawingBuffer: boolean,
|
|
30
|
-
forceWebGL: boolean
|
|
31
|
-
}
|
|
32
24
|
class Graphics
|
|
33
25
|
{
|
|
34
26
|
_renderer: Renderer;
|
|
@@ -40,10 +32,10 @@ class Graphics
|
|
|
40
32
|
generate_depth_normal_texture: boolean;
|
|
41
33
|
no_render: BaseRender;
|
|
42
34
|
|
|
43
|
-
init({
|
|
44
|
-
{
|
|
35
|
+
init({ renderer, core_attributes, dpr }:
|
|
36
|
+
{ renderer: Renderer, core_attributes: CoreAttributes, dpr: number })
|
|
45
37
|
{
|
|
46
|
-
this._renderer =
|
|
38
|
+
this._renderer = renderer;
|
|
47
39
|
this.blitter = undefined;
|
|
48
40
|
this.canvas = undefined;
|
|
49
41
|
this.no_render = undefined;
|
|
@@ -52,13 +44,11 @@ class Graphics
|
|
|
52
44
|
this.depth_and_normals_renderer = undefined;
|
|
53
45
|
|
|
54
46
|
this.core_attributes = {
|
|
55
|
-
xr_enabled: false
|
|
47
|
+
xr_enabled: false,
|
|
56
48
|
};
|
|
57
49
|
|
|
58
50
|
Object.assign(this.core_attributes, core_attributes);
|
|
59
51
|
|
|
60
|
-
this._renderer = new WebGPURenderer(renderer_attributes);
|
|
61
|
-
|
|
62
52
|
if (this.core_attributes.xr_enabled)
|
|
63
53
|
{
|
|
64
54
|
this._renderer.xr.enabled = true;
|
|
@@ -244,7 +234,7 @@ class Graphics
|
|
|
244
234
|
}
|
|
245
235
|
}
|
|
246
236
|
|
|
247
|
-
material_pass(mat: Material, dst
|
|
237
|
+
material_pass(mat: Material, dst?: RenderTarget): void
|
|
248
238
|
{
|
|
249
239
|
this.blitter.material_pass(mat, dst);
|
|
250
240
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import frag from '../shaders/copy/copy.frag';
|
|
2
2
|
import vert from '../shaders/copy/copy.vert';
|
|
3
3
|
|
|
4
|
-
import { AlwaysDepth, NoBlending, ShaderMaterial,
|
|
4
|
+
import { AlwaysDepth, NoBlending, ShaderMaterial, Vector2 } from 'three';
|
|
5
5
|
|
|
6
6
|
class BlitMaterial extends ShaderMaterial
|
|
7
7
|
{
|
|
8
|
-
uniforms = {
|
|
9
|
-
_MainTex: { value: Texture },
|
|
10
|
-
_Resolution: { value: Vector2 },
|
|
11
|
-
_TargetResolution: { value: Vector2 }
|
|
12
|
-
};
|
|
13
|
-
|
|
14
8
|
constructor(frag_shader?: string, vert_shader?: string, defines?: Record<string, any>)
|
|
15
9
|
{
|
|
16
10
|
super({
|
|
@@ -31,6 +31,7 @@ class Blitter
|
|
|
31
31
|
const src_height = src.isRenderTarget === true ? src.height : src.image.height;
|
|
32
32
|
|
|
33
33
|
this._blit_quad.material.uniforms._MainTex.value = src_texture;
|
|
34
|
+
|
|
34
35
|
this._blit_quad.material.uniforms._Resolution.value.set(src_width, src_height);
|
|
35
36
|
|
|
36
37
|
if (dst)
|
|
@@ -89,7 +90,7 @@ class Blitter
|
|
|
89
90
|
this._blit_quad.material.dispose();
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
__render(dst_RT
|
|
93
|
+
__render(dst_RT?: any)
|
|
93
94
|
{
|
|
94
95
|
const RT = dst_RT === undefined ? null : dst_RT;
|
|
95
96
|
|