@woosh/meep-engine 2.39.43 → 2.40.1
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/core/binary/BinaryBuffer.js +14 -1
- package/core/bvh2/aabb3/AABB3.js +0 -133
- package/core/bvh2/aabb3/aabb3_intersects_line_segment.js +1 -1
- package/core/geom/3d/matrix/MATRIX_4_IDENTITY.js +9 -0
- package/core/geom/Quaternion.js +8 -8
- package/core/geom/Quaternion.spec.js +13 -0
- package/core/geom/Vector1.d.ts +2 -0
- package/core/parser/simple/DataType.js +2 -2
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +28 -4
- package/editor/view/EditorView.js +25 -22
- package/editor/view/ecs/components/common/NumberController.js +56 -9
- package/engine/EngineHarness.js +2 -4
- package/engine/asset/loaders/image/png/PNG.js +6 -0
- package/engine/asset/loaders/image/png/PNGReader.js +82 -2
- package/engine/asset/loaders/image/png/crc.js +66 -0
- package/engine/ecs/speaker/VoiceSystem.js +1 -1
- package/engine/ecs/terrain/ecs/Terrain.js +58 -36
- package/engine/ecs/terrain/ecs/TerrainSystem.js +22 -4
- package/engine/ecs/terrain/tiles/TerrainTile.js +109 -131
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +100 -121
- package/engine/graphics/ecs/camera/Camera.js +1 -1
- package/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +4 -4
- package/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +0 -78
- package/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +0 -9
- package/engine/graphics/render/forward_plus/LightManager.js +25 -0
- package/engine/graphics/render/forward_plus/data/TextureBackedMemoryRegion.js +6 -2
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +6 -11
- package/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +268 -2
- package/engine/graphics/texture/atlas/AtlasPatch.js +12 -6
- package/engine/intelligence/behavior/util/LogMessageBehavior.js +29 -0
- package/engine/logging/ConsoleLoggerBackend.js +15 -0
- package/engine/logging/Logger.js +24 -1
- package/engine/logging/LoggerBackend.js +1 -0
- package/engine/physics/fluid/FluidField.js +9 -0
- package/engine/physics/fluid/effector/AbstractFluidEffector.js +6 -0
- package/engine/physics/fluid/effector/GlobalFluidEffector.js +12 -0
- package/engine/physics/fluid/effector/WakeFluidEffector.js +8 -0
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ export class Camera {
|
|
|
33
33
|
* Whether clipping planes should be automatically calculated or not
|
|
34
34
|
* @type {boolean}
|
|
35
35
|
*/
|
|
36
|
-
this.autoClip =
|
|
36
|
+
this.autoClip = false;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Tunable parameter to prevent clipping planes from thrashing. Clipping planes must move by a certain portion of the current span before frustum gets shrunken
|
|
@@ -9,11 +9,11 @@ export class FPLightBinding extends LightBinding {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* @param {LightContext} ctx
|
|
13
13
|
* @return {ForwardPlusRenderingPlugin}
|
|
14
14
|
* @private
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
getPlugin(ctx) {
|
|
17
17
|
return ctx.system.__plugin.getValue();
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -22,7 +22,7 @@ export class FPLightBinding extends LightBinding {
|
|
|
22
22
|
*
|
|
23
23
|
* @type {ForwardPlusRenderingPlugin}
|
|
24
24
|
*/
|
|
25
|
-
const fp = this.
|
|
25
|
+
const fp = this.getPlugin(ctx);
|
|
26
26
|
|
|
27
27
|
const lightManager = fp.getLightManager();
|
|
28
28
|
|
|
@@ -52,7 +52,7 @@ export class FPLightBinding extends LightBinding {
|
|
|
52
52
|
*
|
|
53
53
|
* @type {ForwardPlusRenderingPlugin}
|
|
54
54
|
*/
|
|
55
|
-
const fp = this.
|
|
55
|
+
const fp = this.getPlugin(ctx);
|
|
56
56
|
|
|
57
57
|
const lightManager = fp.getLightManager();
|
|
58
58
|
|
|
@@ -71,25 +71,6 @@ function bindGeometryFaceNormal(indices, normals, index) {
|
|
|
71
71
|
vNormal.set(nx, ny, nz);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
function computeSampleFaceIndex(width, x, y) {
|
|
75
|
-
|
|
76
|
-
//get fraction of x and y
|
|
77
|
-
const xF = x % 1;
|
|
78
|
-
const yF = y % 1;
|
|
79
|
-
|
|
80
|
-
//get whole part of x and y
|
|
81
|
-
const xW = x | 0;
|
|
82
|
-
const yW = y | 0;
|
|
83
|
-
|
|
84
|
-
//figure out which quad it is in
|
|
85
|
-
const iQuad = yW * (width - 1) + xW;
|
|
86
|
-
|
|
87
|
-
//figure out triangle
|
|
88
|
-
const index = iQuad * 2 + ((xF + yF) | 0);
|
|
89
|
-
|
|
90
|
-
return index;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
74
|
|
|
94
75
|
function extractFaceIndexFromLeaf_default(leaf) {
|
|
95
76
|
return leaf.object;
|
|
@@ -172,65 +153,6 @@ export class BVHGeometryRaycaster {
|
|
|
172
153
|
}
|
|
173
154
|
}
|
|
174
155
|
|
|
175
|
-
/**
|
|
176
|
-
*
|
|
177
|
-
* @param {number} x
|
|
178
|
-
* @param {number} y
|
|
179
|
-
* @param callback
|
|
180
|
-
* @param missCallback
|
|
181
|
-
* @returns {boolean}
|
|
182
|
-
*/
|
|
183
|
-
raycastVertical(x, y, callback, missCallback) {
|
|
184
|
-
const position = this.position;
|
|
185
|
-
const scale = this.scale;
|
|
186
|
-
|
|
187
|
-
//transform position to geometry coordinate system
|
|
188
|
-
const resolution = this.resolution;
|
|
189
|
-
|
|
190
|
-
const size = this.size;
|
|
191
|
-
|
|
192
|
-
const width = size.x * resolution;
|
|
193
|
-
const height = size.y * resolution;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const gX = ((x - position.x * scale.x) / scale.x) * resolution * ((width - 1) / width);
|
|
197
|
-
const gY = ((y - position.y * scale.y) / scale.y) * resolution * ((height - 1) / height);
|
|
198
|
-
|
|
199
|
-
const index = computeSampleFaceIndex(width, gX, gY);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const geometry = this.geometry;
|
|
203
|
-
|
|
204
|
-
const geometryIndices = geometry.getIndex().array;
|
|
205
|
-
const geometryVertices = geometry.getAttribute('position').array;
|
|
206
|
-
const geometryNormals = geometry.getAttribute('normal').array;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (index * 3 >= geometryIndices.length) {
|
|
210
|
-
missCallback();
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
bindGeometryFace(geometryIndices, geometryVertices, index);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
this.direction.set(0, -1, 0);
|
|
218
|
-
this.origin.set(x, 1000, y);
|
|
219
|
-
|
|
220
|
-
const hitFound = rayTriangleIntersection(hit, this.origin, this.direction, vA, vB, vC);
|
|
221
|
-
|
|
222
|
-
if (!hitFound) {
|
|
223
|
-
missCallback();
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
bindGeometryFaceNormal(geometryIndices, geometryNormals, index);
|
|
228
|
-
|
|
229
|
-
callback(hit, vNormal, geometry);
|
|
230
|
-
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
156
|
/**
|
|
235
157
|
*
|
|
236
158
|
* @param {SurfacePoint3} hit
|
|
@@ -6,8 +6,6 @@ import { array_copy } from "../../../../../core/collection/array/copyArray.js";
|
|
|
6
6
|
import { mat4 } from "gl-matrix";
|
|
7
7
|
import { Group, Matrix4, Mesh } from "three";
|
|
8
8
|
import { mergeBufferGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
9
|
-
import { groupArrayBy } from "../../../../../core/collection/ArrayUtils.js";
|
|
10
|
-
import { collectIteratorValueToArray } from "../../../../../core/collection/IteratorUtils.js";
|
|
11
9
|
|
|
12
10
|
class GeometryContext {
|
|
13
11
|
constructor() {
|
|
@@ -299,13 +297,6 @@ export function merge_geometry_hierarchy(input, context = new Context()) {
|
|
|
299
297
|
}
|
|
300
298
|
});
|
|
301
299
|
|
|
302
|
-
const materials = collectIteratorValueToArray([], material_cache.materialCache.data.keys());
|
|
303
|
-
|
|
304
|
-
const color_groups = groupArrayBy(materials, (m => m.color.getHex()));
|
|
305
|
-
|
|
306
|
-
console.warn(color_groups);
|
|
307
|
-
|
|
308
|
-
|
|
309
300
|
const contexts_merge_stage_0 = [];
|
|
310
301
|
|
|
311
302
|
merge_by_material(contexts, contexts_merge_stage_0, 0);
|
|
@@ -303,6 +303,31 @@ export class LightManager {
|
|
|
303
303
|
this.__visible_bvh_needs_update = true;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Please set this to false if you have a lot of overlapping decals in the scene
|
|
308
|
+
* Overlapping decals can provide filtering artifacts due to incorrect mipmap level detection by WebGL
|
|
309
|
+
* see article: https://0fps.net/2013/07/09/texture-atlases-wrapping-and-mip-mapping/
|
|
310
|
+
* NOTE: the technique mentioned in the article above is not implemented, as it would require significant increase in number of texture fetches
|
|
311
|
+
* @param {boolean} v
|
|
312
|
+
*/
|
|
313
|
+
set decal_filtering_enabled(v) {
|
|
314
|
+
const t = this.__decal_atlas_texture;
|
|
315
|
+
|
|
316
|
+
if (t.generateMipmaps === v) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
t.generateMipmaps = v;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
*
|
|
325
|
+
* @return {boolean}
|
|
326
|
+
*/
|
|
327
|
+
get decal_filtering_enabled() {
|
|
328
|
+
return this.__decal_atlas_texture.generateMipmaps;
|
|
329
|
+
}
|
|
330
|
+
|
|
306
331
|
__update_decal_atlas_texture() {
|
|
307
332
|
const sampler = this.__decal_atlas.sampler;
|
|
308
333
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { DataTexture, NearestFilter, RedFormat, UnsignedByteType } from "three";
|
|
1
|
+
import { ClampToEdgeWrapping, DataTexture, NearestFilter, RedFormat, UnsignedByteType } from "three";
|
|
2
2
|
import { DataType } from "../../../../../core/collection/table/DataType.js";
|
|
3
3
|
import { assert } from "../../../../../core/assert.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
DataType2TypedArrayConstructorMapping
|
|
6
|
+
} from "../../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
|
|
5
7
|
import { max2 } from "../../../../../core/math/max2.js";
|
|
6
8
|
import { NumericType } from "./NumericType.js";
|
|
7
9
|
import { computeDataType } from "./computeDataType.js";
|
|
@@ -63,6 +65,8 @@ export class TextureBackedMemoryRegion {
|
|
|
63
65
|
this.__texture.format = RedFormat;
|
|
64
66
|
this.__texture.magFilter = NearestFilter;
|
|
65
67
|
this.__texture.minFilter = NearestFilter;
|
|
68
|
+
this.__texture.wrapS = ClampToEdgeWrapping;
|
|
69
|
+
this.__texture.wrapT = ClampToEdgeWrapping;
|
|
66
70
|
this.__texture.generateMipmaps = false;
|
|
67
71
|
|
|
68
72
|
/**
|
|
@@ -53,30 +53,25 @@ export const FP_SHADER_CHUNK_ACCUMULATION = `
|
|
|
53
53
|
vec4 local_position = decal_transform_matrix*vec4(v_world_position, 1.0);
|
|
54
54
|
|
|
55
55
|
if(max3(abs(local_position.xyz)) < 0.5){
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
|
|
58
57
|
// we're inside decal volume
|
|
59
58
|
vec4 light_data_4 = texelFetch(fp_t_light_data, address_to_data_texture_coordinates(light_address+4u), 0);
|
|
60
|
-
|
|
59
|
+
|
|
61
60
|
// compute normal of the decal
|
|
62
61
|
vec4 decal_normal = normalize( viewMatrix*decal_transform_matrix*vec4(0.0, 0.0, 1.0, 0.0) );
|
|
63
62
|
float decal_surface_dot = dot(decal_normal.xyz, geometry.normal);
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
// we fade out decals when the projection angle to the surface gets too steep
|
|
66
65
|
// 0.7 is cos(45deg) and 0.5 is cos(60deg), dot returns cos of angle between two normals
|
|
67
66
|
float decal_surface_angle_fade = smoothstep(-0.5,-0.7,decal_surface_dot);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
|
|
71
68
|
vec2 decal_uv = (local_position.xy + 0.5)*light_data_4.zw + light_data_4.xy;
|
|
72
69
|
|
|
73
|
-
//material.diffuseColor = material.diffuseColor*(0.8) + vec3(decal_uv + 0.5, 0.0)*0.2; // display UV
|
|
74
70
|
|
|
75
|
-
|
|
76
71
|
vec4 decal_color = texture(fp_t_decal_atlas, decal_uv);
|
|
72
|
+
|
|
77
73
|
float decal_alpha = decal_color.a * decal_surface_angle_fade;
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
|
|
80
75
|
material.diffuseColor = material.diffuseColor*(1.0-decal_alpha) + decal_color.xyz*decal_alpha;
|
|
81
76
|
|
|
82
77
|
}
|
|
@@ -65,6 +65,7 @@ import { StaticKnowledgeDatabase } from "../../../../knowledge/database/StaticKn
|
|
|
65
65
|
import { Localization } from "../../../../../core/Localization.js";
|
|
66
66
|
import '../../../../../../../../css/game.scss'
|
|
67
67
|
import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
|
|
68
|
+
import { debugAtlas } from "../../../particles/particular/engine/shader/debugAtlas.js";
|
|
68
69
|
|
|
69
70
|
document.body.style.margin = 0;
|
|
70
71
|
|
|
@@ -871,6 +872,270 @@ data/textures/icons/sci-fi-nathan/v6/Proc normal_2.png`
|
|
|
871
872
|
camera.position.set(0, 0, 10);
|
|
872
873
|
}
|
|
873
874
|
|
|
875
|
+
async function prepare_scene_decal_2() {
|
|
876
|
+
|
|
877
|
+
const am = new AssetManager(null);
|
|
878
|
+
|
|
879
|
+
await am.registerLoader("image", new ImageRGBADataLoader());
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
const decal_urls = `data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_13_t.png
|
|
883
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_01_t.png
|
|
884
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_02_t.png
|
|
885
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_03_t.png
|
|
886
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_04_t.png
|
|
887
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_05_t.png
|
|
888
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_06_t.png
|
|
889
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_07_t.png
|
|
890
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_08_t.png
|
|
891
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_09_t.png
|
|
892
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_10_t.png
|
|
893
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_11_t.png
|
|
894
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_12_t.png
|
|
895
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_13_t.png
|
|
896
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_14_t.png
|
|
897
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_01_t.png
|
|
898
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_02_t.png
|
|
899
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_03_t.png
|
|
900
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_04_t.png
|
|
901
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_05_t.png
|
|
902
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_06_t.png
|
|
903
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_07_t.png
|
|
904
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_08_t.png
|
|
905
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_09_t.png
|
|
906
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_10_b.png
|
|
907
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_11_t.png
|
|
908
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/bag_12_t.png
|
|
909
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_01_t.png
|
|
910
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_02_t.png
|
|
911
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_03_t.png
|
|
912
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_04_t.png
|
|
913
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_05_t.png
|
|
914
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_06_t.png
|
|
915
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_07_t.png
|
|
916
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_08_t.png
|
|
917
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_09_t.png
|
|
918
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_10_t.png
|
|
919
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_11_t.png
|
|
920
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_12_t.png
|
|
921
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_13_t.png
|
|
922
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_14_t.png
|
|
923
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_15_t.png
|
|
924
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_16_t.png
|
|
925
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/book_17_t.png
|
|
926
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_01_t.png
|
|
927
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_02_t.png
|
|
928
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_03_t.png
|
|
929
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_04_t.png
|
|
930
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_05_t.png
|
|
931
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_06_t.png
|
|
932
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_07_t.png
|
|
933
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_08_t.png
|
|
934
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_09_t.png
|
|
935
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_10_t.png
|
|
936
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_11_t.png
|
|
937
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/orb_12_t.png
|
|
938
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_01_t.png
|
|
939
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_02_t.png
|
|
940
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_03_t.png
|
|
941
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_04_t.png
|
|
942
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_05_t.png
|
|
943
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_06_t.png
|
|
944
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_07_t.png
|
|
945
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_08_t.png
|
|
946
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_09_t.png
|
|
947
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_10_t.png
|
|
948
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_11_t.png
|
|
949
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/potion_12_t.png
|
|
950
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_01_t.png
|
|
951
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_02_t.png
|
|
952
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_03_t.png
|
|
953
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_04_t.png
|
|
954
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_05_t.png
|
|
955
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_06_t.png
|
|
956
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_07_t.png
|
|
957
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_08_t.png
|
|
958
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_09_t.png
|
|
959
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_10_t.png
|
|
960
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_11_t.png
|
|
961
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/rune_12_t.png
|
|
962
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_01_t.png
|
|
963
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_02_t.png
|
|
964
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_03_t.png
|
|
965
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_04_t.png
|
|
966
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_05_t.png
|
|
967
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_06_t.png
|
|
968
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_07_t.png
|
|
969
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_08_t.png
|
|
970
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_09_t.png
|
|
971
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_10_t.png
|
|
972
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_11_t.png
|
|
973
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_12_t.png
|
|
974
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/scroll_13_t.png
|
|
975
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_01_t.png
|
|
976
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_02_t.png
|
|
977
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_03_t.png
|
|
978
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_04_t.png
|
|
979
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_05_t.png
|
|
980
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_06_t.png
|
|
981
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_07_t.png
|
|
982
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_08_t.png
|
|
983
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_09_t.png
|
|
984
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_10_t.png
|
|
985
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_11_t.png
|
|
986
|
+
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_12_t.png
|
|
987
|
+
data/textures/icons/sci-fi-nathan/v6/Proc normal_3.png
|
|
988
|
+
data/textures/icons/sci-fi-nathan/v6/Proc strong_1.png
|
|
989
|
+
data/textures/icons/sci-fi-nathan/v6/Proc strong_2.png
|
|
990
|
+
data/textures/icons/sci-fi-nathan/v6/Proc strong_3.png
|
|
991
|
+
data/textures/icons/sci-fi-nathan/v6/Proc very strong_1.png
|
|
992
|
+
data/textures/icons/sci-fi-nathan/v6/Proc very strong_2.png
|
|
993
|
+
data/textures/icons/sci-fi-nathan/v6/Proc very strong_3.png
|
|
994
|
+
data/textures/icons/sci-fi-nathan/v6/Proc very weak_1.png
|
|
995
|
+
data/textures/icons/sci-fi-nathan/v6/Proc very weak_2.png
|
|
996
|
+
data/textures/icons/sci-fi-nathan/v6/Proc very weak_3.png
|
|
997
|
+
data/textures/icons/sci-fi-nathan/v6/Proc weak_1.png
|
|
998
|
+
data/textures/icons/sci-fi-nathan/v6/Proc weak_2.png
|
|
999
|
+
data/textures/icons/sci-fi-nathan/v6/Proc weak_3.png
|
|
1000
|
+
data/textures/icons/sci-fi-nathan/v6/Core normal_1.png
|
|
1001
|
+
data/textures/icons/sci-fi-nathan/v6/Core normal_2.png
|
|
1002
|
+
data/textures/icons/sci-fi-nathan/v6/Core normal_3.png
|
|
1003
|
+
data/textures/icons/sci-fi-nathan/v6/Core strong_1.png
|
|
1004
|
+
data/textures/icons/sci-fi-nathan/v6/Core strong_2.png
|
|
1005
|
+
data/textures/icons/sci-fi-nathan/v6/Core strong_3.png
|
|
1006
|
+
data/textures/icons/sci-fi-nathan/v6/Core very strong_1.png
|
|
1007
|
+
data/textures/icons/sci-fi-nathan/v6/Core very strong_2.png
|
|
1008
|
+
data/textures/icons/sci-fi-nathan/v6/Core very strong_3.png
|
|
1009
|
+
data/textures/icons/sci-fi-nathan/v6/Core very weak_1.png
|
|
1010
|
+
data/textures/icons/sci-fi-nathan/v6/Core very weak_2.png
|
|
1011
|
+
data/textures/icons/sci-fi-nathan/v6/Core very weak_3.png
|
|
1012
|
+
data/textures/icons/sci-fi-nathan/v6/Core weak_1.png
|
|
1013
|
+
data/textures/icons/sci-fi-nathan/v6/Core weak_2.png
|
|
1014
|
+
data/textures/icons/sci-fi-nathan/v6/Core weak_3.png
|
|
1015
|
+
data/textures/icons/sci-fi-nathan/v6/Memory normal_1.png
|
|
1016
|
+
data/textures/icons/sci-fi-nathan/v6/Memory normal_2.png
|
|
1017
|
+
data/textures/icons/sci-fi-nathan/v6/Memory normal_3.png
|
|
1018
|
+
data/textures/icons/sci-fi-nathan/v6/Memory strong_1.png
|
|
1019
|
+
data/textures/icons/sci-fi-nathan/v6/Memory strong_2.png
|
|
1020
|
+
data/textures/icons/sci-fi-nathan/v6/Memory strong_3.png
|
|
1021
|
+
data/textures/icons/sci-fi-nathan/v6/Memory very strong_1.png
|
|
1022
|
+
data/textures/icons/sci-fi-nathan/v6/Memory very strong_2.png
|
|
1023
|
+
data/textures/icons/sci-fi-nathan/v6/Memory very strong_3.png
|
|
1024
|
+
data/textures/icons/sci-fi-nathan/v6/Memory very weak_1.png
|
|
1025
|
+
data/textures/icons/sci-fi-nathan/v6/Memory very weak_2.png
|
|
1026
|
+
data/textures/icons/sci-fi-nathan/v6/Memory very weak_3.png
|
|
1027
|
+
data/textures/icons/sci-fi-nathan/v6/Memory weak_1.png
|
|
1028
|
+
data/textures/icons/sci-fi-nathan/v6/Memory weak_2.png
|
|
1029
|
+
data/textures/icons/sci-fi-nathan/v6/Memory weak_3.png
|
|
1030
|
+
data/textures/icons/sci-fi-nathan/v6/Module normal_1.png
|
|
1031
|
+
data/textures/icons/sci-fi-nathan/v6/Module normal_2.png
|
|
1032
|
+
data/textures/icons/sci-fi-nathan/v6/Module normal_3.png
|
|
1033
|
+
data/textures/icons/sci-fi-nathan/v6/Module strong_1.png
|
|
1034
|
+
data/textures/icons/sci-fi-nathan/v6/Module strong_2.png
|
|
1035
|
+
data/textures/icons/sci-fi-nathan/v6/Module strong_3.png
|
|
1036
|
+
data/textures/icons/sci-fi-nathan/v6/Module very strong_1.png
|
|
1037
|
+
data/textures/icons/sci-fi-nathan/v6/Module very strong_2.png
|
|
1038
|
+
data/textures/icons/sci-fi-nathan/v6/Module very strong_3.png
|
|
1039
|
+
data/textures/icons/sci-fi-nathan/v6/Module very weak_1.png
|
|
1040
|
+
data/textures/icons/sci-fi-nathan/v6/Module very weak_2.png
|
|
1041
|
+
data/textures/icons/sci-fi-nathan/v6/Module very weak_3.png
|
|
1042
|
+
data/textures/icons/sci-fi-nathan/v6/Module weak_1.png
|
|
1043
|
+
data/textures/icons/sci-fi-nathan/v6/Module weak_2.png
|
|
1044
|
+
data/textures/icons/sci-fi-nathan/v6/Module weak_3.png
|
|
1045
|
+
data/textures/icons/sci-fi-nathan/v6/Power normal_1.png
|
|
1046
|
+
data/textures/icons/sci-fi-nathan/v6/Power normal_2.png
|
|
1047
|
+
data/textures/icons/sci-fi-nathan/v6/Power normal_3.png
|
|
1048
|
+
data/textures/icons/sci-fi-nathan/v6/Power strong_1.png
|
|
1049
|
+
data/textures/icons/sci-fi-nathan/v6/Power strong_2.png
|
|
1050
|
+
data/textures/icons/sci-fi-nathan/v6/Power strong_3.png
|
|
1051
|
+
data/textures/icons/sci-fi-nathan/v6/Power very strong_1.png
|
|
1052
|
+
data/textures/icons/sci-fi-nathan/v6/Power very strong_2.png
|
|
1053
|
+
data/textures/icons/sci-fi-nathan/v6/Power very strong_3.png
|
|
1054
|
+
data/textures/icons/sci-fi-nathan/v6/Power very weak_1.png
|
|
1055
|
+
data/textures/icons/sci-fi-nathan/v6/Power very weak_2.png
|
|
1056
|
+
data/textures/icons/sci-fi-nathan/v6/Power very weak_3.png
|
|
1057
|
+
data/textures/icons/sci-fi-nathan/v6/Power weak_1.png
|
|
1058
|
+
data/textures/icons/sci-fi-nathan/v6/Power weak_2.png
|
|
1059
|
+
data/textures/icons/sci-fi-nathan/v6/Power weak_3.png
|
|
1060
|
+
data/textures/icons/sci-fi-nathan/v6/Proc normal_1.png
|
|
1061
|
+
data/textures/icons/sci-fi-nathan/v6/Proc normal_2.png
|
|
1062
|
+
data/textures/utility/sampling-test.png`
|
|
1063
|
+
.split('\n')
|
|
1064
|
+
.map(a => a.trim());
|
|
1065
|
+
|
|
1066
|
+
const samplers = [];
|
|
1067
|
+
const promises = [];
|
|
1068
|
+
|
|
1069
|
+
for (let i = 0; i < decal_urls.length; i++) {
|
|
1070
|
+
const promise = am.promise(decal_urls[i], 'image');
|
|
1071
|
+
promises.push(promise);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const assets = await Promise.all(promises);
|
|
1075
|
+
|
|
1076
|
+
for (let i = 0; i < assets.length; i++) {
|
|
1077
|
+
const asset = assets[i];
|
|
1078
|
+
|
|
1079
|
+
samplers[i] = asset.create();
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const canvas_size = 5;
|
|
1083
|
+
|
|
1084
|
+
const random = seededRandom();
|
|
1085
|
+
|
|
1086
|
+
const COUNT = 1024;
|
|
1087
|
+
|
|
1088
|
+
const ROW_WIDTH = Math.ceil(Math.sqrt(COUNT));
|
|
1089
|
+
const size = canvas_size / ROW_WIDTH;
|
|
1090
|
+
|
|
1091
|
+
for (let i = 0; i < COUNT; i++) {
|
|
1092
|
+
|
|
1093
|
+
const q = new Quaternion();
|
|
1094
|
+
// q.fromEulerAnglesXYZ(0, (90 + randomFloatBetween(random, -60, 60)) * DEG2RAD, 0);
|
|
1095
|
+
q.fromEulerAnglesXYZ(0, (-180) * DEG2RAD, 0);
|
|
1096
|
+
|
|
1097
|
+
const sampler = randomFromArray(random, samplers);
|
|
1098
|
+
// const sampler = samplers[i % samplers.length];
|
|
1099
|
+
|
|
1100
|
+
// const size = randomFloatBetween(random, 1, 3);
|
|
1101
|
+
//const size = 0.5;
|
|
1102
|
+
|
|
1103
|
+
// const position = [
|
|
1104
|
+
// randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), randomFloatBetween(random, -canvas_size * 0.5, canvas_size * 0.5), -4
|
|
1105
|
+
// ];
|
|
1106
|
+
|
|
1107
|
+
const x = ((i % ROW_WIDTH)) / ROW_WIDTH - 0.5 + 0.5 / ROW_WIDTH;
|
|
1108
|
+
const y = Math.floor(i / ROW_WIDTH) / ROW_WIDTH - 0.5 + 0.5 / ROW_WIDTH;
|
|
1109
|
+
const position = [
|
|
1110
|
+
x * canvas_size, y * canvas_size, -4
|
|
1111
|
+
];
|
|
1112
|
+
|
|
1113
|
+
addDecal({
|
|
1114
|
+
position: position,
|
|
1115
|
+
scale: [
|
|
1116
|
+
size, size, 1.5
|
|
1117
|
+
],
|
|
1118
|
+
rotation: q,
|
|
1119
|
+
sampler: sampler,
|
|
1120
|
+
scene,
|
|
1121
|
+
light_manager: lm
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
addBox([0, 0, -4], [canvas_size, canvas_size, 1], [0, 0, 0]);
|
|
1127
|
+
//
|
|
1128
|
+
// addKnot([0, 0, -4], 2, [0, 0, 0])
|
|
1129
|
+
|
|
1130
|
+
scene.add(new AmbientLight(0xFFFFFF, 0.8));
|
|
1131
|
+
|
|
1132
|
+
camera.near = 1;
|
|
1133
|
+
camera.far = 30;
|
|
1134
|
+
|
|
1135
|
+
camera.lookAt(0, 0, -5);
|
|
1136
|
+
camera.position.set(0, 0, 10);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
874
1139
|
|
|
875
1140
|
async function prepare_scene_9() {
|
|
876
1141
|
|
|
@@ -1296,8 +1561,9 @@ function draw_camera_view_planes() {
|
|
|
1296
1561
|
// prepare_scene_2();
|
|
1297
1562
|
// prepare_scene_decal_0();
|
|
1298
1563
|
// prepare_scene_decal_1();
|
|
1564
|
+
prepare_scene_decal_2();
|
|
1299
1565
|
// prepare_scene_9();
|
|
1300
|
-
prepare_scene_2();
|
|
1566
|
+
// prepare_scene_2();
|
|
1301
1567
|
// prepare_scene_0();
|
|
1302
1568
|
animate();
|
|
1303
1569
|
|
|
@@ -1353,7 +1619,7 @@ const debugger_button = new ButtonView({
|
|
|
1353
1619
|
}
|
|
1354
1620
|
});
|
|
1355
1621
|
|
|
1356
|
-
|
|
1622
|
+
debugAtlas(lm.__decal_atlas.atlas, { scale: new Vector2(0.125, 0.125) });
|
|
1357
1623
|
|
|
1358
1624
|
debugger_button.link();
|
|
1359
1625
|
|
|
@@ -65,15 +65,21 @@ export class AtlasPatch {
|
|
|
65
65
|
*/
|
|
66
66
|
updateUV(canvasWidth, canvasHeight) {
|
|
67
67
|
|
|
68
|
+
const position = this.position;
|
|
68
69
|
const size = this.size;
|
|
70
|
+
const uv = this.uv;
|
|
69
71
|
|
|
70
|
-
const
|
|
72
|
+
const x0 = position.x;
|
|
73
|
+
const y0 = position.y;
|
|
74
|
+
|
|
75
|
+
const sx = size.x;
|
|
76
|
+
const sy = size.y;
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
uv.set(
|
|
79
|
+
x0 / canvasWidth,
|
|
80
|
+
y0 / canvasHeight,
|
|
81
|
+
sx / canvasWidth,
|
|
82
|
+
sy / canvasHeight
|
|
77
83
|
);
|
|
78
84
|
|
|
79
85
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Behavior } from "../Behavior.js";
|
|
2
|
+
import { BehaviorStatus } from "../BehaviorStatus.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Prints given message into the console
|
|
6
|
+
*/
|
|
7
|
+
export class LogMessageBehavior extends Behavior {
|
|
8
|
+
constructor(message = "") {
|
|
9
|
+
super();
|
|
10
|
+
|
|
11
|
+
this.message = message;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {String} message
|
|
17
|
+
* @return {LogMessageBehavior}
|
|
18
|
+
*/
|
|
19
|
+
static from(message) {
|
|
20
|
+
return new LogMessageBehavior(message);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
tick(timeDelta) {
|
|
24
|
+
console.log(this.message);
|
|
25
|
+
|
|
26
|
+
// done
|
|
27
|
+
return BehaviorStatus.Succeeded;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LoggerBackend } from "./LoggerBackend.js";
|
|
2
2
|
import { LogLevel } from "./LogLevel.js";
|
|
3
3
|
|
|
4
|
+
let instance;
|
|
5
|
+
|
|
4
6
|
export class ConsoleLoggerBackend extends LoggerBackend {
|
|
5
7
|
log(level, message) {
|
|
6
8
|
switch (level) {
|
|
@@ -19,4 +21,17 @@ export class ConsoleLoggerBackend extends LoggerBackend {
|
|
|
19
21
|
console.log(message);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Singleton instance
|
|
27
|
+
* NOTE: you can still create additional instances if you find that useful
|
|
28
|
+
* @return {ConsoleLoggerBackend}
|
|
29
|
+
*/
|
|
30
|
+
static get INSTANCE() {
|
|
31
|
+
if (instance === undefined) {
|
|
32
|
+
instance = new ConsoleLoggerBackend();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return instance;
|
|
36
|
+
}
|
|
22
37
|
}
|