ohzi-core 6.5.3 → 6.6.0
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 +1 -1
- package/src/Debug.js +2 -2
- package/src/Graphics.js +20 -20
- package/src/Initializer.js +2 -2
- package/src/OScreen.js +74 -0
- package/src/Screen.js +17 -32
- package/src/Time.js +1 -1
- package/src/UI.js +4 -4
- package/src/components/UIElement.js +9 -9
- package/src/editor/ObjectPicker.js +4 -4
- package/src/index.js +2 -0
- package/src/materials/UIElementMaterial.js +3 -1
- package/src/render_mode/BloomRender.js +7 -6
- package/src/render_mode/DeferredRender.js +4 -4
- package/src/render_mode/NormalAORender.js +6 -6
- package/src/render_mode/OutlineRender.js +6 -6
- package/src/render_mode/PlanarReflectionsRender.js +2 -2
- package/src/render_mode/TransparencyMixRender.js +11 -11
- package/src/render_mode/UnrealBloomRender.js +6 -6
- package/src/render_utilities/DepthAndNormalsRenderer.js +4 -4
- package/src/render_utilities/ViewPositionRenderer.js +5 -5
- package/src/utilities/CameraUtilities.js +13 -13
- package/types/OScreen.d.ts +18 -0
- package/types/index.d.ts +1 -0
- package/types/resource_loader/AudioLoader.d.ts +1 -1
package/package.json
CHANGED
package/src/Debug.js
CHANGED
|
@@ -5,7 +5,7 @@ import SceneManager from './SceneManager';
|
|
|
5
5
|
import Cube from './primitives/Cube';
|
|
6
6
|
import Sphere from './primitives/Sphere';
|
|
7
7
|
import Arrow from './primitives/Arrow';
|
|
8
|
-
import
|
|
8
|
+
import OScreen from './OScreen';
|
|
9
9
|
import ScreenSpaceTextureMaterial from './materials/ScreenSpaceTextureMaterial';
|
|
10
10
|
import { Vector3 } from 'three';
|
|
11
11
|
import { LineBasicMaterial } from 'three';
|
|
@@ -248,7 +248,7 @@ class Debug
|
|
|
248
248
|
{
|
|
249
249
|
for (let i = 0; i < this.display_texture_meshes.length; i++)
|
|
250
250
|
{
|
|
251
|
-
this.display_texture_meshes[i].material.set_screen_size(
|
|
251
|
+
this.display_texture_meshes[i].material.set_screen_size(OScreen.width, OScreen.height);
|
|
252
252
|
}
|
|
253
253
|
if (this.scene.children.length > 0)
|
|
254
254
|
{
|
package/src/Graphics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Configuration from './Configuration';
|
|
2
2
|
import BaseRender from './render_mode/BaseRender';
|
|
3
|
-
import
|
|
3
|
+
import OScreen from './OScreen';
|
|
4
4
|
import CameraManager from './CameraManager';
|
|
5
5
|
import SceneManager from './SceneManager';
|
|
6
6
|
import Capabilities from './Capabilities';
|
|
@@ -64,7 +64,7 @@ class Graphics
|
|
|
64
64
|
|
|
65
65
|
this._renderer.setPixelRatio(1);
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
OScreen.dpr = Configuration.dpr;
|
|
68
68
|
|
|
69
69
|
if (!this.is_webgl2)
|
|
70
70
|
{
|
|
@@ -123,14 +123,14 @@ class Graphics
|
|
|
123
123
|
this.current_render_mode.render();
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
OScreen.update();
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
__update_current_camera()
|
|
130
130
|
{
|
|
131
131
|
if (CameraManager.current)
|
|
132
132
|
{
|
|
133
|
-
CameraManager.current.aspect =
|
|
133
|
+
CameraManager.current.aspect = OScreen.aspect_ratio;
|
|
134
134
|
CameraManager.current.updateProjectionMatrix();
|
|
135
135
|
CameraManager.current.updateMatrix();
|
|
136
136
|
CameraManager.current.updateMatrixWorld(true);
|
|
@@ -206,14 +206,14 @@ class Graphics
|
|
|
206
206
|
{
|
|
207
207
|
for (const entry of entries)
|
|
208
208
|
{
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
OScreen.dpr = Configuration.dpr;
|
|
210
|
+
OScreen.update_position(entry.contentRect.x, entry.contentRect.y);
|
|
211
|
+
OScreen.update_size(entry.contentRect.width, entry.contentRect.height);
|
|
212
212
|
|
|
213
|
-
this.canvas.width =
|
|
214
|
-
this.canvas.height =
|
|
213
|
+
this.canvas.width = OScreen.render_width;
|
|
214
|
+
this.canvas.height = OScreen.render_height;
|
|
215
215
|
|
|
216
|
-
this._renderer.setViewport(0, 0,
|
|
216
|
+
this._renderer.setViewport(0, 0, OScreen.render_width, OScreen.render_height);
|
|
217
217
|
|
|
218
218
|
this.__update_current_camera();
|
|
219
219
|
}
|
|
@@ -241,12 +241,12 @@ class Graphics
|
|
|
241
241
|
this.blitter.blit_clear_with_material(dst_RT, mat);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
take_screenshot(blob_callback, width =
|
|
244
|
+
take_screenshot(blob_callback, width = OScreen.width, height = OScreen.height)
|
|
245
245
|
{
|
|
246
246
|
// const ctx = this;
|
|
247
247
|
|
|
248
|
-
const old_width =
|
|
249
|
-
const old_height =
|
|
248
|
+
const old_width = OScreen.width;
|
|
249
|
+
const old_height = OScreen.height;
|
|
250
250
|
|
|
251
251
|
const new_width = width;
|
|
252
252
|
const new_height = height;
|
|
@@ -257,7 +257,7 @@ class Graphics
|
|
|
257
257
|
const divisions_x = parseInt(Math.ceil(new_width / tile_width));
|
|
258
258
|
const divisions_y = parseInt(Math.ceil(new_height / tile_height));
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
OScreen.update_size(tile_width, tile_height);
|
|
261
261
|
|
|
262
262
|
this._renderer.setPixelRatio(1);
|
|
263
263
|
|
|
@@ -269,7 +269,7 @@ class Graphics
|
|
|
269
269
|
ctx_2D.canvas.width = new_width;
|
|
270
270
|
ctx_2D.canvas.height = new_height;
|
|
271
271
|
|
|
272
|
-
CameraManager.current.aspect =
|
|
272
|
+
CameraManager.current.aspect = OScreen.aspect_ratio;
|
|
273
273
|
CameraManager.current.updateMatrix();
|
|
274
274
|
CameraManager.current.updateMatrixWorld(true);
|
|
275
275
|
|
|
@@ -278,11 +278,11 @@ class Graphics
|
|
|
278
278
|
for (let y = 0; y < divisions_y; y++)
|
|
279
279
|
{
|
|
280
280
|
CameraManager.current.setViewOffset(new_width, new_height,
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
OScreen.width * x, OScreen.height * y,
|
|
282
|
+
OScreen.width, OScreen.height);
|
|
283
283
|
this.current_render_mode.render();
|
|
284
284
|
|
|
285
|
-
ctx_2D.drawImage(this._renderer.domElement,
|
|
285
|
+
ctx_2D.drawImage(this._renderer.domElement, OScreen.width * x, OScreen.height * y);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
@@ -292,11 +292,11 @@ class Graphics
|
|
|
292
292
|
|
|
293
293
|
CameraManager.current.clearViewOffset();
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
OScreen.update_size(old_width, old_height);
|
|
296
296
|
this._renderer.setPixelRatio(Configuration.dpr);
|
|
297
297
|
this._renderer.setSize(old_width, old_height, false);
|
|
298
298
|
|
|
299
|
-
CameraManager.current.aspect =
|
|
299
|
+
CameraManager.current.aspect = OScreen.aspect_ratio;
|
|
300
300
|
CameraManager.current.updateMatrix();
|
|
301
301
|
CameraManager.current.updateMatrixWorld(true);
|
|
302
302
|
}
|
package/src/Initializer.js
CHANGED
|
@@ -7,10 +7,10 @@ import EventManager from './EventManager';
|
|
|
7
7
|
import Graphics from './Graphics';
|
|
8
8
|
import Input from './Input';
|
|
9
9
|
import OS from './OS';
|
|
10
|
+
import OScreen from './OScreen';
|
|
10
11
|
import ReflectionPlaneContext from './ReflectionPlaneContext';
|
|
11
12
|
import ResourceContainer from './ResourceContainer';
|
|
12
13
|
import SceneManager from './SceneManager';
|
|
13
|
-
import Screen from './Screen';
|
|
14
14
|
import GeometryBatcher from './static_batcher/GeometryBatcher';
|
|
15
15
|
import Time from './Time';
|
|
16
16
|
import UI from './UI';
|
|
@@ -36,7 +36,7 @@ class Initializer
|
|
|
36
36
|
ReflectionPlaneContext.init();
|
|
37
37
|
ResourceContainer.init();
|
|
38
38
|
SceneManager.init();
|
|
39
|
-
|
|
39
|
+
OScreen.init();
|
|
40
40
|
Time.init();
|
|
41
41
|
UI.init();
|
|
42
42
|
|
package/src/OScreen.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Vector2 } from 'three';
|
|
2
|
+
|
|
3
|
+
class OScreen
|
|
4
|
+
{
|
|
5
|
+
init()
|
|
6
|
+
{
|
|
7
|
+
this.width = 1;
|
|
8
|
+
this.height = 1;
|
|
9
|
+
|
|
10
|
+
this.position = new Vector2();
|
|
11
|
+
|
|
12
|
+
this.render_width = 1;
|
|
13
|
+
this.render_height = 1;
|
|
14
|
+
this.width_height = new Vector2(this.width, this.height);
|
|
15
|
+
|
|
16
|
+
this.dpr = 1;
|
|
17
|
+
this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
update_position(x, y)
|
|
21
|
+
{
|
|
22
|
+
this.position.set(x, y);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
update()
|
|
26
|
+
{
|
|
27
|
+
this.size_changed = false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update_size(width, height)
|
|
31
|
+
{
|
|
32
|
+
this.width = width;
|
|
33
|
+
this.height = height;
|
|
34
|
+
|
|
35
|
+
this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
|
|
36
|
+
|
|
37
|
+
this.width_height.x = width;
|
|
38
|
+
this.width_height.y = height;
|
|
39
|
+
|
|
40
|
+
this.render_width = width * this.dpr;
|
|
41
|
+
this.render_height = height * this.dpr;
|
|
42
|
+
|
|
43
|
+
this.size_changed = true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
apply_pixel_density_v2(vector2)
|
|
47
|
+
{
|
|
48
|
+
vector2.multiplyScalar(1 / this.dpr);
|
|
49
|
+
|
|
50
|
+
return vector2;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
apply_pixel_density(value)
|
|
54
|
+
{
|
|
55
|
+
return value * (1 / this.dpr);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get_pixel_size()
|
|
59
|
+
{
|
|
60
|
+
return this.pixel_size;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get aspect_ratio()
|
|
64
|
+
{
|
|
65
|
+
return this.width / this.height;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get portrait()
|
|
69
|
+
{
|
|
70
|
+
return this.width < this.height;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default new OScreen();
|
package/src/Screen.js
CHANGED
|
@@ -1,68 +1,53 @@
|
|
|
1
|
-
import
|
|
1
|
+
import OScreen from './OScreen';
|
|
2
2
|
|
|
3
3
|
class Screen
|
|
4
4
|
{
|
|
5
5
|
init()
|
|
6
6
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.position = new Vector2();
|
|
11
|
-
|
|
12
|
-
this.render_width = 1;
|
|
13
|
-
this.render_height = 1;
|
|
14
|
-
this.width_height = new Vector2(this.width, this.height);
|
|
15
|
-
|
|
16
|
-
this.dpr = 1;
|
|
17
|
-
this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
|
|
7
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
8
|
+
OScreen.init();
|
|
18
9
|
}
|
|
19
10
|
|
|
20
11
|
update_position(x, y)
|
|
21
12
|
{
|
|
22
|
-
|
|
13
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
14
|
+
OScreen.update_position(x, y);
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
update()
|
|
26
18
|
{
|
|
27
|
-
|
|
19
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
20
|
+
OScreen.update();
|
|
28
21
|
}
|
|
29
22
|
|
|
30
23
|
update_size(width, height)
|
|
31
24
|
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
|
|
36
|
-
|
|
37
|
-
this.width_height.x = width;
|
|
38
|
-
this.width_height.y = height;
|
|
39
|
-
|
|
40
|
-
this.render_width = width * this.dpr;
|
|
41
|
-
this.render_height = height * this.dpr;
|
|
42
|
-
|
|
43
|
-
this.size_changed = true;
|
|
25
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
26
|
+
OScreen.update_size(width, height);
|
|
44
27
|
}
|
|
45
28
|
|
|
46
29
|
apply_pixel_density_v2(vector2)
|
|
47
30
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return vector2;
|
|
31
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
32
|
+
return OScreen.apply_pixel_density_v2(vector2);
|
|
51
33
|
}
|
|
52
34
|
|
|
53
35
|
apply_pixel_density(value)
|
|
54
36
|
{
|
|
55
|
-
|
|
37
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
38
|
+
return OScreen.apply_pixel_density(value);
|
|
56
39
|
}
|
|
57
40
|
|
|
58
41
|
get_pixel_size()
|
|
59
42
|
{
|
|
60
|
-
|
|
43
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
44
|
+
return OScreen.get_pixel_size();
|
|
61
45
|
}
|
|
62
46
|
|
|
63
47
|
get aspect_ratio()
|
|
64
48
|
{
|
|
65
|
-
|
|
49
|
+
console.warn('Screen Singleton is deprecated. Please use OScreen.');
|
|
50
|
+
return OScreen.aspect_ratio;
|
|
66
51
|
}
|
|
67
52
|
}
|
|
68
53
|
|
package/src/Time.js
CHANGED
|
@@ -36,7 +36,7 @@ class Time
|
|
|
36
36
|
this.__elapsed_time = this.___time.getElapsedTime();
|
|
37
37
|
|
|
38
38
|
this.delta_buffer.shift();
|
|
39
|
-
this.delta_buffer.push(this.__raw_delta_time);
|
|
39
|
+
this.delta_buffer.push(this.__raw_delta_time < 0.32 ? this.__raw_delta_time : 0.032);
|
|
40
40
|
|
|
41
41
|
this.__calculate_delta_time();
|
|
42
42
|
}
|
package/src/UI.js
CHANGED
|
@@ -55,10 +55,10 @@ class UI
|
|
|
55
55
|
|
|
56
56
|
update()
|
|
57
57
|
{
|
|
58
|
-
// this.ss_camera.left = -
|
|
59
|
-
// this.ss_camera.right =
|
|
60
|
-
// this.ss_camera.top =
|
|
61
|
-
// this.ss_camera.right = -
|
|
58
|
+
// this.ss_camera.left = -OScreen.width / 2;
|
|
59
|
+
// this.ss_camera.right = OScreen.width / 2;
|
|
60
|
+
// this.ss_camera.top = OScreen.top / 2;
|
|
61
|
+
// this.ss_camera.right = -OScreen.bottom / 2;
|
|
62
62
|
this.ss_camera.updateProjectionMatrix();
|
|
63
63
|
|
|
64
64
|
this._tmp_normalized_pos.copy(Input.NDC);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
2
|
+
import OScreen from '../OScreen';
|
|
3
3
|
|
|
4
4
|
import UIElementMaterial from '../materials/UIElementMaterial';
|
|
5
5
|
|
|
@@ -132,7 +132,7 @@ export default class UIElement extends Mesh
|
|
|
132
132
|
|
|
133
133
|
update_state(normalized_mouse_pos)
|
|
134
134
|
{
|
|
135
|
-
this.material.uniforms._ScreenSize.value.set(
|
|
135
|
+
this.material.uniforms._ScreenSize.value.set(OScreen.width, OScreen.height);
|
|
136
136
|
this.get_size(this.material.uniforms._TextureSize.value);
|
|
137
137
|
|
|
138
138
|
this.cached_NDC_position.copy(this.position_strategy.get_pos_NDC(this.position));
|
|
@@ -157,8 +157,8 @@ export default class UIElement extends Mesh
|
|
|
157
157
|
|
|
158
158
|
to_screen_position(projected_pos)
|
|
159
159
|
{
|
|
160
|
-
projected_pos.x = (projected_pos.x * 0.5 + 0.5) *
|
|
161
|
-
projected_pos.y = (projected_pos.y * 0.5 + 0.5) *
|
|
160
|
+
projected_pos.x = (projected_pos.x * 0.5 + 0.5) * OScreen.width + this.pixel_offset.x;
|
|
161
|
+
projected_pos.y = (projected_pos.y * 0.5 + 0.5) * OScreen.height + this.pixel_offset.y;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
get_screen_space_position()
|
|
@@ -170,8 +170,8 @@ export default class UIElement extends Mesh
|
|
|
170
170
|
|
|
171
171
|
set_screen_space_position(screen_pos)
|
|
172
172
|
{
|
|
173
|
-
this.position.x = (screen_pos.x /
|
|
174
|
-
this.position.y = (screen_pos.y /
|
|
173
|
+
this.position.x = (screen_pos.x / OScreen.width) * 2 - 1;
|
|
174
|
+
this.position.y = (screen_pos.y / OScreen.height) * 2 - 1;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
dispose()
|
|
@@ -180,7 +180,7 @@ export default class UIElement extends Mesh
|
|
|
180
180
|
{
|
|
181
181
|
this.material.uniforms._MainTex.value.dispose();
|
|
182
182
|
}
|
|
183
|
-
Screen.remove_screen_material(this.material);
|
|
183
|
+
// Screen.remove_screen_material(this.material);
|
|
184
184
|
this.geometry.dispose();
|
|
185
185
|
this.material.dispose();
|
|
186
186
|
}
|
|
@@ -189,11 +189,11 @@ export default class UIElement extends Mesh
|
|
|
189
189
|
{
|
|
190
190
|
if (vector2)
|
|
191
191
|
{
|
|
192
|
-
return vector2.copy(this.texture_size).multiplyScalar(this.size /
|
|
192
|
+
return vector2.copy(this.texture_size).multiplyScalar(this.size / OScreen.dpr);
|
|
193
193
|
}
|
|
194
194
|
else
|
|
195
195
|
{
|
|
196
|
-
return new Vector2().copy(this.texture_size).multiplyScalar(this.size /
|
|
196
|
+
return new Vector2().copy(this.texture_size).multiplyScalar(this.size / OScreen.dpr);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import RenderLayers from '../RenderLayers';
|
|
2
|
-
import
|
|
2
|
+
import OScreen from '../OScreen';
|
|
3
3
|
|
|
4
4
|
import { Color } from 'three';
|
|
5
5
|
import { WebGLRenderTarget } from 'three';
|
|
@@ -16,7 +16,7 @@ export default class ObjectPicker
|
|
|
16
16
|
this.camera_layers = camera.layers;
|
|
17
17
|
|
|
18
18
|
this.clear_color = new Color('#000000');
|
|
19
|
-
this.picking_texture = new WebGLRenderTarget(
|
|
19
|
+
this.picking_texture = new WebGLRenderTarget(OScreen.width, OScreen.height);
|
|
20
20
|
this.tmp_scene_auto_update = undefined;
|
|
21
21
|
|
|
22
22
|
this.tmp_mouse_pos = new Vector2();
|
|
@@ -66,8 +66,8 @@ export default class ObjectPicker
|
|
|
66
66
|
{
|
|
67
67
|
this.tmp_mouse_pos.copy(mouse_NDC);
|
|
68
68
|
this.tmp_mouse_pos.multiplyScalar(0.5);
|
|
69
|
-
this.tmp_mouse_pos.x = (this.tmp_mouse_pos.x + 0.5) *
|
|
70
|
-
this.tmp_mouse_pos.y = (this.tmp_mouse_pos.y + 0.5) *
|
|
69
|
+
this.tmp_mouse_pos.x = (this.tmp_mouse_pos.x + 0.5) * OScreen.width;
|
|
70
|
+
this.tmp_mouse_pos.y = (this.tmp_mouse_pos.y + 0.5) * OScreen.height;
|
|
71
71
|
this.renderer.readRenderTargetPixels(this.picking_texture, this.tmp_mouse_pos.x, this.tmp_mouse_pos.y, 1, 1, this.readback_buffer);
|
|
72
72
|
|
|
73
73
|
return (this.readback_buffer[2]) | (this.readback_buffer[1] << 8) | (this.readback_buffer[0] << 16);
|
package/src/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import OS from './OS';
|
|
|
26
26
|
import PerspectiveCamera from './PerspectiveCamera';
|
|
27
27
|
import RenderLoop from './RenderLoop';
|
|
28
28
|
import SceneManager from './SceneManager';
|
|
29
|
+
import OScreen from './OScreen';
|
|
29
30
|
import Screen from './Screen';
|
|
30
31
|
import SimpleTextDrawer from './canvas_drawer/SimpleTextDrawer';
|
|
31
32
|
import Time from './Time';
|
|
@@ -132,6 +133,7 @@ export {
|
|
|
132
133
|
PerspectiveCamera,
|
|
133
134
|
RenderLoop,
|
|
134
135
|
SceneManager,
|
|
136
|
+
OScreen,
|
|
135
137
|
Screen,
|
|
136
138
|
SimpleTextDrawer,
|
|
137
139
|
Time,
|
|
@@ -5,13 +5,15 @@ import BaseShaderMaterial from '../materials/BaseShaderMaterial';
|
|
|
5
5
|
import { Vector2 } from 'three';
|
|
6
6
|
import { Vector3 } from 'three';
|
|
7
7
|
|
|
8
|
+
import OScreen from '../OScreen';
|
|
9
|
+
|
|
8
10
|
export default class UIElementMaterial extends BaseShaderMaterial
|
|
9
11
|
{
|
|
10
12
|
constructor(intensity = 1)
|
|
11
13
|
{
|
|
12
14
|
super(vert, frag, {
|
|
13
15
|
_MainTex: { value: undefined },
|
|
14
|
-
_ScreenSize: { value: new Vector2(
|
|
16
|
+
_ScreenSize: { value: new Vector2(OScreen.width, OScreen.height) },
|
|
15
17
|
_TextureSize: { value: new Vector2() },
|
|
16
18
|
_PixelOffset: { value: new Vector2(0, 0) },
|
|
17
19
|
_NDC: { value: new Vector3() },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import BaseRender from '../render_mode/BaseRender';
|
|
3
3
|
import BloomComposeMaterial from '../materials/BloomComposeMaterial';
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@ import Blurrer from '../render_utilities/Blurrer';
|
|
|
8
8
|
import Graphics from '../Graphics';
|
|
9
9
|
import CameraManager from '../CameraManager';
|
|
10
10
|
import SceneManager from '../SceneManager';
|
|
11
|
+
import OScreen from '../OScreen';
|
|
11
12
|
|
|
12
13
|
export default class BloomRender extends BaseRender
|
|
13
14
|
{
|
|
@@ -27,8 +28,8 @@ export default class BloomRender extends BaseRender
|
|
|
27
28
|
{
|
|
28
29
|
this.blurrer = new Blurrer();
|
|
29
30
|
// this.blurrer = new DualFilteringBlurrer()
|
|
30
|
-
this.main_RT = new WebGLRenderTarget(
|
|
31
|
-
this.blur_RT = new WebGLRenderTarget(
|
|
31
|
+
this.main_RT = new WebGLRenderTarget(OScreen.render_width, OScreen.render_height);
|
|
32
|
+
this.blur_RT = new WebGLRenderTarget(OScreen.render_width, OScreen.render_height);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
render()
|
|
@@ -51,10 +52,10 @@ export default class BloomRender extends BaseRender
|
|
|
51
52
|
|
|
52
53
|
__check_RT_size()
|
|
53
54
|
{
|
|
54
|
-
if (this.main_RT.width !==
|
|
55
|
+
if (this.main_RT.width !== OScreen.render_width || this.main_RT.height !== OScreen.render_height)
|
|
55
56
|
{
|
|
56
|
-
this.main_RT.setSize(
|
|
57
|
-
this.blur_RT.setSize(
|
|
57
|
+
this.main_RT.setSize(OScreen.render_width, OScreen.render_height);
|
|
58
|
+
this.blur_RT.setSize(OScreen.render_width, OScreen.render_height);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CameraManager from '../CameraManager';
|
|
2
2
|
import SceneManager from '../SceneManager';
|
|
3
|
-
import
|
|
3
|
+
import OScreen from '../OScreen';
|
|
4
4
|
import BaseRender from '../render_mode/BaseRender';
|
|
5
5
|
import DeferredRendererComposeMaterial from '../materials/DeferredRendererComposeMaterial';
|
|
6
6
|
import Graphics from '../Graphics';
|
|
@@ -19,7 +19,7 @@ export default class DeferredRender extends BaseRender
|
|
|
19
19
|
super();
|
|
20
20
|
|
|
21
21
|
this.compose_mat = new DeferredRendererComposeMaterial();
|
|
22
|
-
this.main_rt = new WebGLRenderTarget(
|
|
22
|
+
this.main_rt = new WebGLRenderTarget(OScreen.width, OScreen.height, {
|
|
23
23
|
// magFilter: NearestFilter,
|
|
24
24
|
// minFilter: NearestFilter
|
|
25
25
|
});
|
|
@@ -104,9 +104,9 @@ export default class DeferredRender extends BaseRender
|
|
|
104
104
|
|
|
105
105
|
__check_RT_size()
|
|
106
106
|
{
|
|
107
|
-
if (this.main_rt.width !==
|
|
107
|
+
if (this.main_rt.width !== OScreen.width || this.main_rt.height !== OScreen.height)
|
|
108
108
|
{
|
|
109
|
-
this.main_rt.setSize(
|
|
109
|
+
this.main_rt.setSize(OScreen.width, OScreen.height);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CameraManager from '../CameraManager';
|
|
2
2
|
import SceneManager from '../SceneManager';
|
|
3
|
-
import
|
|
3
|
+
import OScreen from '../OScreen';
|
|
4
4
|
import BaseRender from '../render_mode/BaseRender';
|
|
5
5
|
import Configuration from '../Configuration';
|
|
6
6
|
import SSAOMaterial from '../materials/SSAOMaterial';
|
|
@@ -23,9 +23,9 @@ export default class NormalAORender extends BaseRender
|
|
|
23
23
|
|
|
24
24
|
this.ssaa = Configuration.use_ssaa ? 2 : 1;
|
|
25
25
|
|
|
26
|
-
this.main_RT = new WebGLRenderTarget(
|
|
26
|
+
this.main_RT = new WebGLRenderTarget(OScreen.width * this.ssaa, OScreen.height * this.ssaa);
|
|
27
27
|
|
|
28
|
-
this.SSAO_RT = new WebGLRenderTarget(
|
|
28
|
+
this.SSAO_RT = new WebGLRenderTarget(OScreen.width, OScreen.height);
|
|
29
29
|
|
|
30
30
|
this.blurrer = new Blurrer();
|
|
31
31
|
Graphics.generateDepthNormalTexture = true;
|
|
@@ -62,10 +62,10 @@ export default class NormalAORender extends BaseRender
|
|
|
62
62
|
|
|
63
63
|
__check_RT_size()
|
|
64
64
|
{
|
|
65
|
-
if (this.main_RT.width !==
|
|
65
|
+
if (this.main_RT.width !== OScreen.width * this.ssaa || this.main_RT.height !== OScreen.height * this.ssaa)
|
|
66
66
|
{
|
|
67
|
-
this.main_RT.setSize(
|
|
68
|
-
this.SSAO_RT.setSize(
|
|
67
|
+
this.main_RT.setSize(OScreen.width * this.ssaa, OScreen.height * this.ssaa);
|
|
68
|
+
this.SSAO_RT.setSize(OScreen.width, OScreen.height);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import OScreen from '../OScreen';
|
|
2
2
|
import RenderLayers from '../RenderLayers';
|
|
3
3
|
import compose_frag from '../shaders/box_blur/compose.frag';
|
|
4
4
|
import box_blur_frag from '../shaders/box_blur/box_blur.frag';
|
|
@@ -18,9 +18,9 @@ export default class OutlineRender
|
|
|
18
18
|
{
|
|
19
19
|
constructor(webgl)
|
|
20
20
|
{
|
|
21
|
-
this.main_rt = new WebGLRenderTarget(
|
|
22
|
-
this.rt1 = new WebGLRenderTarget(
|
|
23
|
-
this.rt2 = new WebGLRenderTarget(
|
|
21
|
+
this.main_rt = new WebGLRenderTarget(OScreen.width, OScreen.height);
|
|
22
|
+
this.rt1 = new WebGLRenderTarget(OScreen.width, OScreen.height);
|
|
23
|
+
this.rt2 = new WebGLRenderTarget(OScreen.width, OScreen.height);
|
|
24
24
|
|
|
25
25
|
this.compose_material = this.__get_compose_material();
|
|
26
26
|
this.copy_material = this.__get_copy_material();
|
|
@@ -101,7 +101,7 @@ export default class OutlineRender
|
|
|
101
101
|
uniforms: {
|
|
102
102
|
_MainTex: { value: undefined },
|
|
103
103
|
_SampleDir: { value: new Vector2() },
|
|
104
|
-
_Screen: { value: new Vector2(
|
|
104
|
+
_Screen: { value: new Vector2(OScreen.width, OScreen.height) }
|
|
105
105
|
},
|
|
106
106
|
vertexShader: copy_vert,
|
|
107
107
|
fragmentShader: box_blur_frag,
|
|
@@ -116,7 +116,7 @@ export default class OutlineRender
|
|
|
116
116
|
uniforms: {
|
|
117
117
|
_MainTex: { value: undefined },
|
|
118
118
|
_Blur: { value: undefined },
|
|
119
|
-
_Screen: { value: new Vector2(
|
|
119
|
+
_Screen: { value: new Vector2(OScreen.width, OScreen.height) }
|
|
120
120
|
},
|
|
121
121
|
vertexShader: copy_vert,
|
|
122
122
|
fragmentShader: compose_frag,
|
|
@@ -3,7 +3,7 @@ import basic_color_vert from '../shaders/basic_color/basic_color.vert';
|
|
|
3
3
|
import SceneManager from '../SceneManager';
|
|
4
4
|
import CameraManager from '../CameraManager';
|
|
5
5
|
import ReflectionPlaneContext from '../ReflectionPlaneContext';
|
|
6
|
-
import
|
|
6
|
+
import OScreen from '../OScreen';
|
|
7
7
|
import BaseRender from '../render_mode/BaseRender';
|
|
8
8
|
|
|
9
9
|
import { ShaderMaterial } from 'three';
|
|
@@ -65,7 +65,7 @@ export default class PlanarReflectionsRender extends BaseRender
|
|
|
65
65
|
{
|
|
66
66
|
if (CameraManager.current)
|
|
67
67
|
{
|
|
68
|
-
CameraManager.current.aspect =
|
|
68
|
+
CameraManager.current.aspect = OScreen.aspect_ratio;
|
|
69
69
|
CameraManager.current.updateProjectionMatrix();
|
|
70
70
|
CameraManager.current.updateMatrix();
|
|
71
71
|
CameraManager.current.updateMatrixWorld(true);
|