@woosh/meep-engine 2.33.22 → 2.33.26

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.
Files changed (288) hide show
  1. package/core/bvh2/BinaryNode.js +1 -1
  2. package/core/bvh2/aabb3/AABB3.js +18 -0
  3. package/core/bvh2/aabb3/AABB3Math.js +1 -1
  4. package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
  5. package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
  6. package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
  7. package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -1
  8. package/core/bvh2/traversal/__detailed_box_volume_intersection.js +31 -11
  9. package/core/collection/ArrayUtils.js +1 -1
  10. package/core/collection/array/arrayQuickSort.js +9 -6
  11. package/core/collection/array/array_swap.js +22 -0
  12. package/core/collection/array/binarySearchHighIndex.js +1 -1
  13. package/core/collection/array/computeHashArray.js +22 -0
  14. package/core/collection/array/computeHashIntegerArray.js +15 -0
  15. package/core/collection/array/copyArray.js +2 -2
  16. package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
  17. package/core/color/Color.js +2 -1
  18. package/core/function/FunctionCompiler.js +2 -1
  19. package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
  20. package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +10 -2
  21. package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
  22. package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
  23. package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
  24. package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
  25. package/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
  26. package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +13 -14
  27. package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
  28. package/core/geom/3d/shape/AbstractShape3D.js +65 -0
  29. package/core/geom/3d/shape/TransformedShape3D.js +181 -0
  30. package/core/geom/3d/shape/TransformedShape3D.spec.js +33 -0
  31. package/core/geom/3d/shape/UnionShape3D.js +255 -0
  32. package/core/geom/3d/shape/UnitCubeShape3D.js +101 -0
  33. package/core/geom/3d/shape/UnitCubeShape3D.spec.js +42 -0
  34. package/core/geom/3d/shape/UnitSphereShape3D.js +55 -0
  35. package/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +48 -0
  36. package/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
  37. package/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
  38. package/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
  39. package/core/geom/AABB2.js +1 -1
  40. package/core/geom/ConicRay.js +3 -1
  41. package/core/geom/LineSegment.js +0 -78
  42. package/core/geom/Matrix4.js +7 -8
  43. package/core/geom/Plane.js +14 -9
  44. package/core/geom/Rectangle.js +2 -1
  45. package/core/geom/Vector1.js +1 -1
  46. package/core/geom/Vector3.js +2 -1
  47. package/core/geom/Vector4.js +2 -1
  48. package/core/geom/random/randomPointInBox.js +7 -3
  49. package/core/geom/random/randomPointInPoint.js +6 -3
  50. package/core/geom/random/randomPointInSphere.js +9 -5
  51. package/core/geom/random/randomPointOnBox.js +7 -3
  52. package/core/geom/random/randomPointOnSphere.js +6 -3
  53. package/core/geom/v3_length.js +8 -3
  54. package/core/graph/graph_k_means_cluster.js +1 -1
  55. package/core/json/resolvePathByArray.js +2 -2
  56. package/core/math/MathUtils.js +0 -354
  57. package/core/math/MathUtils.spec.js +7 -1
  58. package/core/math/gaussian.js +9 -0
  59. package/core/math/hash/computeHashFloat.js +17 -0
  60. package/core/math/hash/computeHashFloatArray.js +34 -0
  61. package/core/math/hash/computeObjectHash.js +54 -0
  62. package/core/math/intersects1D.js +19 -0
  63. package/core/math/interval/NumericInterval.js +2 -2
  64. package/core/math/isValueBetween.js +10 -0
  65. package/core/math/isValueBetweenInclusive.js +10 -0
  66. package/core/math/noise/curl_noise_3dt.js +1 -1
  67. package/core/math/noise/sdnoise.js +10 -10
  68. package/core/math/overlap1D.js +19 -0
  69. package/core/math/pingpong.js +17 -0
  70. package/core/math/random/makeRangedRandom.js +19 -0
  71. package/core/math/random/randomFloatBetween.js +14 -0
  72. package/core/math/random/randomFromArray.js +19 -0
  73. package/core/math/random/randomGaussian.js +15 -0
  74. package/core/math/random/randomIntegerBetween.js +14 -0
  75. package/core/math/random/roundFair.js +15 -0
  76. package/core/math/separation1D.js +21 -0
  77. package/core/math/solveQuadratic.js +25 -0
  78. package/core/model/BoundedValue.js +1 -1
  79. package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
  80. package/core/model/node-graph/node/Port.js +1 -1
  81. package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
  82. package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
  83. package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
  84. package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
  85. package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
  86. package/core/model/stat/LinearModifier.js +1 -1
  87. package/core/primitives/array/computeIntegerArrayHash.js +1 -1
  88. package/{engine/graphics/render/forward_plus/materials → core/primitives/strings}/insert_after.js +3 -0
  89. package/core/primitives/strings/insert_after_or_replace.js +27 -0
  90. package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
  91. package/editor/view/ecs/EntityEditor.js +2 -2
  92. package/editor/view/ecs/components/particles/ParticleEmitterController.js +2 -2
  93. package/engine/EngineHarness.js +1 -0
  94. package/engine/animation/AnimationUtils.js +5 -5
  95. package/engine/animation/curve/AnimationCurve.js +72 -0
  96. package/engine/animation/curve/Keyframe.js +27 -0
  97. package/engine/animation/keyed2/AnimationTrack.js +27 -3
  98. package/engine/asset/Asset.js +1 -1
  99. package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
  100. package/engine/asset/loaders/GLTFAssetLoader.js +10 -0
  101. package/engine/asset/loaders/image/ImageRGBADataAsset.js +8 -1
  102. package/engine/asset/loaders/material/computeImageBitmapEquality.js +11 -0
  103. package/engine/asset/loaders/material/computeImageBitmapHash.js +22 -28
  104. package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
  105. package/engine/asset/loaders/material/computeTextureHash.js +2 -1
  106. package/engine/ecs/EntityBuilder.js +25 -5
  107. package/engine/ecs/animation/Animation.js +2 -1
  108. package/engine/ecs/animation/InverseKinematics.js +2 -1
  109. package/engine/ecs/attachment/AttachmentBinding.js +8 -0
  110. package/engine/ecs/attachment/AttachmentSystem.js +4 -0
  111. package/engine/ecs/attachment/TransformAttachmentBinding.js +14 -44
  112. package/engine/ecs/components/Tag.js +27 -6
  113. package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
  114. package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
  115. package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
  116. package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
  117. package/engine/ecs/foliage/ecs/Foliage2.js +1 -1
  118. package/engine/ecs/fow/FogOfWar.js +4 -0
  119. package/engine/ecs/fow/FogOfWarSystem.js +2 -0
  120. package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
  121. package/engine/ecs/gui/GUIElement.js +1 -1
  122. package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
  123. package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -0
  124. package/engine/ecs/gui/position/ViewportPosition.js +2 -1
  125. package/engine/ecs/system/AbstractContextSystem.js +1 -1
  126. package/engine/ecs/systems/RangedAttackSystem.js +1 -1
  127. package/engine/ecs/systems/SteeringSystem.js +1 -1
  128. package/engine/ecs/systems/TagSystem.js +17 -0
  129. package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
  130. package/engine/ecs/tooltip/TooltipComponent.js +15 -0
  131. package/engine/ecs/transform/Transform.js +19 -6
  132. package/engine/ecs/util/hideEntityGracefully.js +18 -0
  133. package/engine/graphics/GraphicsEngine.js +11 -23
  134. package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
  135. package/engine/graphics/composit/CompositLayer.js +17 -4
  136. package/engine/graphics/composit/CompositingStages.js +8 -0
  137. package/engine/graphics/composit/LayerCompositer.js +35 -6
  138. package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
  139. package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
  140. package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
  141. package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
  142. package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
  143. package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
  144. package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
  145. package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
  146. package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
  147. package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
  148. package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +11 -7
  149. package/engine/graphics/ecs/light/Light.d.ts +1 -1
  150. package/engine/graphics/ecs/light/Light.js +5 -0
  151. package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +5 -1
  152. package/engine/graphics/ecs/mesh/Mesh.js +2 -1
  153. package/engine/graphics/ecs/mesh-v2/DrawMode.js +5 -0
  154. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
  155. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +32 -18
  156. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
  157. package/engine/graphics/ecs/path/testPathDisplaySystem.js +98 -98
  158. package/engine/graphics/ecs/trail2d/Trail2D.js +17 -4
  159. package/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +2 -3
  160. package/engine/graphics/ecs/trail2d/Trail2DSystem.js +34 -118
  161. package/engine/graphics/geometry/AttributeSpec.js +105 -0
  162. package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
  163. package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
  164. package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
  165. package/engine/graphics/micron/buildPatchwork.js +1 -1
  166. package/engine/graphics/micron/format/MicronGeometry.js +3 -3
  167. package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
  168. package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
  169. package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
  170. package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
  171. package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +5 -5
  172. package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
  173. package/engine/graphics/particles/ParticleEmitterLibrary.js +3 -0
  174. package/engine/graphics/particles/ecs/{ParticleEmitterSystem2.js → ParticleEmitterSystem.js} +17 -9
  175. package/engine/graphics/particles/particular/engine/ParticularEngine.js +12 -4
  176. package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +84 -0
  177. package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +106 -169
  178. package/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +5 -0
  179. package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +14 -3
  180. package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +141 -14
  181. package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +8 -7
  182. package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
  183. package/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
  184. package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
  185. package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
  186. package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
  187. package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
  188. package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +24 -0
  189. package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +262 -71
  190. package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
  191. package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +80 -46
  192. package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
  193. package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
  194. package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
  195. package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
  196. package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
  197. package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
  198. package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
  199. package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
  200. package/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +141 -0
  201. package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +478 -0
  202. package/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
  203. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +935 -0
  204. package/engine/graphics/particles/particular/group/Operation.js +18 -0
  205. package/engine/graphics/particles/particular/group/OperationType.js +9 -0
  206. package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
  207. package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
  208. package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
  209. package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
  210. package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
  211. package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
  212. package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
  213. package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
  214. package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
  215. package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
  216. package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +13 -7
  217. package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
  218. package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
  219. package/engine/graphics/render/forward_plus/LightManager.js +126 -95
  220. package/engine/graphics/render/forward_plus/PointLight.js +9 -0
  221. package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
  222. package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
  223. package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
  224. package/engine/graphics/render/forward_plus/computeFrustumCorners.js +14 -32
  225. package/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
  226. package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +32 -0
  227. package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +51 -0
  228. package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +25 -0
  229. package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +31 -120
  230. package/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +35 -0
  231. package/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +4 -5
  232. package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
  233. package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +10 -3
  234. package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +595 -60
  235. package/engine/graphics/render/forward_plus/prototypeLightManager.js +256 -136
  236. package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
  237. package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
  238. package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
  239. package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +73 -0
  240. package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
  241. package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
  242. package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
  243. package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
  244. package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
  245. package/engine/graphics/render/layers/RenderLayerUtils.js +7 -4
  246. package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
  247. package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
  248. package/engine/graphics/shaders/TerrainShader.js +4 -5
  249. package/engine/graphics/shadows/ShadowMapRenderer.js +8 -2
  250. package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
  251. package/engine/graphics/texture/atlas/TextureAtlas.js +2 -2
  252. package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
  253. package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
  254. package/engine/graphics/texture/sampler/Sampler2D.js +8 -7
  255. package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
  256. package/engine/graphics/texture/sampler/scaleSampler2D.js +7 -10
  257. package/engine/graphics/trail/x/RibbonMaterialX.js +3 -3
  258. package/engine/graphics/trail/x/RibbonX.js +17 -2
  259. package/engine/graphics/trail/x/RibbonXPlugin.js +51 -1
  260. package/engine/graphics/util/composeMatrix4.js +33 -23
  261. package/engine/graphics/util/decompose_matrix_4_array.js +61 -0
  262. package/engine/grid/components/GridObstacle.js +3 -10
  263. package/engine/intelligence/behavior/ecs/BehaviorComponent.js +30 -14
  264. package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
  265. package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
  266. package/engine/knowledge/database/StaticKnowledgeDataTable.js +6 -1
  267. package/engine/navigation/ecs/components/Path.js +1 -6
  268. package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
  269. package/engine/reference/v2/Reference.js +6 -0
  270. package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
  271. package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
  272. package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
  273. package/engine/ui/notification/notificationGenerator.js +1 -1
  274. package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
  275. package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
  276. package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
  277. package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
  278. package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
  279. package/generation/theme/ThemeEngine.js +2 -2
  280. package/misc/makeMaterialIconCached.js +2 -2
  281. package/package.json +3 -3
  282. package/view/View.js +4 -2
  283. package/view/elements/image/HTMLElementCacheKey.js +2 -1
  284. package/view/elements/radial/RadialText.js +2 -1
  285. package/view/minimap/gl/MinimapMarkersGL.js +6 -100
  286. package/view/minimap/gl/buildMaterial.js +94 -0
  287. package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
  288. package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -345
@@ -1,4 +1,3 @@
1
- import { min2 } from "../../../../../core/math/min2.js";
2
1
  import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
3
2
  import { EngineHarness } from "../../../../EngineHarness.js";
4
3
  import { EngineConfiguration } from "../../../../EngineConfiguration.js";
@@ -44,7 +43,15 @@ import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSy
44
43
  import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
45
44
  import { InverseKinematicsSystem } from "../../../../ecs/animation/InverseKinematicsSystem.js";
46
45
  import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
47
- import { Line, LineBasicMaterial, MeshStandardMaterial, TorusKnotBufferGeometry } from "three";
46
+ import {
47
+ BoxBufferGeometry,
48
+ Group,
49
+ Mesh as ThreeMesh,
50
+ MeshBasicMaterial,
51
+ MeshStandardMaterial,
52
+ OctahedronBufferGeometry,
53
+ TorusKnotBufferGeometry
54
+ } from "three";
48
55
  import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
49
56
  import { makeEngineOptionsModel } from "../../../../../../model/game/options/makeEngineOptionsModel.js";
50
57
  import { enableEditor } from "../../../../../editor/enableEditor.js";
@@ -59,26 +66,28 @@ import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/Behavio
59
66
  import { Light } from "../../../ecs/light/Light.js";
60
67
  import { LightType } from "../../../ecs/light/LightType.js";
61
68
  import { parseColor } from "../../../../../core/color/ColorUtils.js";
62
- import { randomFloatBetween } from "../../../../../core/math/MathUtils.js";
63
69
  import Renderable from "../../../../ecs/components/Renderable.js";
64
70
  import { makeHelperSphereGeometry } from "../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
65
- import GUIElement from "../../../../ecs/gui/GUIElement.js";
66
- import View from "../../../../../view/View.js";
67
- import { buildLightClusterWidget } from "../debug/buildLightClusterWidget.js";
68
- import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
69
71
  import TopDownCameraController from "../../../ecs/camera/topdown/TopDownCameraController.js";
70
72
  import ThreeFactory from "../../../three/ThreeFactory.js";
71
73
  import { obtainTerrain } from "../../../../../../model/game/scenes/SceneUtils.js";
72
- import Vector4 from "../../../../../core/geom/Vector4.js";
73
74
  import { JsonAssetLoader } from "../../../../asset/loaders/JsonAssetLoader.js";
74
75
  import { TextureAssetLoader } from "../../../../asset/loaders/texture/TextureAssetLoader.js";
75
76
  import { GameAssetType } from "../../../../asset/GameAssetType.js";
76
77
  import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
77
78
  import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
78
- import { MicronRenderPlugin } from "../../../micron/plugin/MicronRenderPlugin.js";
79
- import { buildCubeURLs } from "../../../texture/cubemap/buildCubeURLs.js";
80
-
79
+ import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
80
+ import { ParticleEmitter } from "../../../particles/particular/engine/emitter/ParticleEmitter.js";
81
+ import { ParticleEmitterSystem } from "../../../particles/ecs/ParticleEmitterSystem.js";
82
+ import { ShadedGeometrySystem } from "../../../ecs/mesh-v2/ShadedGeometrySystem.js";
83
+ import { FogOfWar } from "../../../../ecs/fow/FogOfWar.js";
84
+ import { FogOfWarRevealer } from "../../../../ecs/fow/FogOfWarRevealer.js";
85
+ import Team from "../../../../../../model/game/ecs/component/Team.js";
86
+
87
+ const geo_light_center_octahedron = new BoxBufferGeometry(0.1, 0.1, 0.1);
81
88
  const engineHarness = new EngineHarness();
89
+ const sphere_geometry = new OctahedronBufferGeometry(1, 5);
90
+ const sphere_geometry_shell = makeHelperSphereGeometry(1);
82
91
 
83
92
  function makeConfig(engine) {
84
93
 
@@ -125,7 +134,7 @@ function makeConfig(engine) {
125
134
  new ClingToTerrainSystem(),
126
135
  new TerrainSystem(graphics, assetManager),
127
136
  new WaterSystem(graphics),
128
- new Trail2DSystem(graphics, assetManager),
137
+ new Trail2DSystem(engine),
129
138
  new Foliage2System(assetManager, graphics),
130
139
  new ViewportPositionSystem(graphics.viewport.size),
131
140
  new GridPosition2TransformSystem(),
@@ -137,22 +146,24 @@ function makeConfig(engine) {
137
146
  new InputSystem(devices),
138
147
  new MeshHighlightSystem(engine),
139
148
  new LightSystem(engine, {
140
- shadowResolution: 1024
149
+ shadowResolution: 2048
141
150
  }),
142
151
  new AnimationControllerSystem(),
143
152
  new AnimationGraphSystem(graphics.viewport.size),
144
153
  headsUpDisplaySystem,
154
+ new ParticleEmitterSystem(engine),
145
155
  new FogOfWarSystem(graphics),
146
156
  new FogOfWarRevealerSystem(0),
147
157
  new BehaviorSystem(engine),
148
158
  new SerializationMetadataSystem(),
149
159
  new InverseKinematicsSystem(),
150
160
  new PathDisplaySystem(engine),
161
+ new ShadedGeometrySystem(engine)
151
162
  );
152
163
 
153
164
  // Plugins
154
165
  config.addPlugin(ForwardPlusRenderingPlugin);
155
- config.addPlugin(MicronRenderPlugin);
166
+ // config.addPlugin(MicronRenderPlugin);
156
167
 
157
168
  // Knowledge
158
169
 
@@ -198,19 +209,30 @@ function makeLight(position, radius, color, intensity = 1) {
198
209
  light.distance.set(radius);
199
210
  light.intensity.set(intensity);
200
211
 
201
- const sphere_material = new LineBasicMaterial({
202
- depthTest: true,
203
- depthWrite: false,
212
+ const color_uint = light.color.toUint();
213
+ const visual_group = new Group();
214
+
215
+ const mesh_center_0 = new ThreeMesh(sphere_geometry, new MeshBasicMaterial({
216
+ color: color_uint
217
+ }));
218
+ mesh_center_0.scale.setScalar(0.1);
219
+ mesh_center_0.matrixAutoUpdate = false;
220
+
221
+ visual_group.add(mesh_center_0);
222
+
223
+ const mesh_center_1 = new ThreeMesh(sphere_geometry, new MeshBasicMaterial({
224
+ color: color_uint,
204
225
  transparent: true,
205
- linewidth: 1,
206
- fog: false,
207
- color: light.color.toUint(),
208
- opacity: min2(light.intensity.getValue(), 1)
209
- });
226
+ opacity: 0.06
227
+ }));
228
+ mesh_center_1.scale.setScalar(0.3);
229
+ mesh_center_1.matrixAutoUpdate = false;
210
230
 
211
- const geometry = makeHelperSphereGeometry(radius);
231
+ visual_group.add(mesh_center_1);
232
+
233
+ const renderable = new Renderable(visual_group);
234
+ renderable.matrixAutoUpdate = true;
212
235
 
213
- const renderable = new Renderable(new Line(geometry, sphere_material));
214
236
  return new EntityBuilder()
215
237
  .add(Transform.fromJSON({
216
238
  position: {
@@ -219,8 +241,9 @@ function makeLight(position, radius, color, intensity = 1) {
219
241
  z: position[2]
220
242
  }
221
243
  }))
244
+ // .add(center_geo)
222
245
  .add(light)
223
- // .add(renderable)
246
+ .add(renderable)
224
247
  }
225
248
 
226
249
 
@@ -266,13 +289,13 @@ function setup_scene_0(engine, ecd) {
266
289
 
267
290
  console.log(terrain);
268
291
 
269
- terrain.overlay.size.set(50, 50);
270
- for (let i = 0; i < 50; i++) {
271
- for (let j = 0; j < 50; j++) {
272
-
273
- terrain.overlay.paintPoint(i, j, new Vector4(random(), random(), random(), 0.9));
274
- }
275
- }
292
+ // terrain.overlay.size.set(50, 50);
293
+ // for (let i = 0; i < 50; i++) {
294
+ // for (let j = 0; j < 50; j++) {
295
+ //
296
+ // terrain.overlay.paintPoint(i, j, new Vector4(random(), random(), random(), 0.9));
297
+ // }
298
+ // }
276
299
 
277
300
  /**
278
301
  *
@@ -286,7 +309,7 @@ function setup_scene_0(engine, ecd) {
286
309
  "y": 1,
287
310
  "z": -0.3141130871587056
288
311
  },
289
- "pitch": -0.47999999999999965,
312
+ "pitch": 0.47999999999999965,
290
313
  "yaw": 4.279999999999975,
291
314
  "roll": 0,
292
315
  "distance": 28,
@@ -299,16 +322,16 @@ function setup_scene_0(engine, ecd) {
299
322
  camera_controller.target.add(offset);
300
323
 
301
324
 
302
- for (let i = 0; i < 200; i++) {
325
+ for (let i = 0; i < 10; i++) {
303
326
 
304
327
  const builder = makeLight([
305
328
  randomFloatBetween(random, -18, 18) + offset.x,
306
- randomFloatBetween(random, 0, 10) + offset.y,
329
+ randomFloatBetween(random, 0.5, 13) + offset.y,
307
330
  randomFloatBetween(random, -10, 10) + offset.z
308
331
  ],
309
- randomFloatBetween(random, 3, 5),
332
+ randomFloatBetween(random, 5, 5),
310
333
  `hsv(${random().toFixed(4)}, 1, 1)`,
311
- 1
334
+ 5
312
335
  );
313
336
 
314
337
  const light = builder.getComponent(Light);
@@ -330,7 +353,154 @@ function setup_scene_0(engine, ecd) {
330
353
  .build(ecd);
331
354
  }
332
355
 
333
- for (let i = 0; i < 0; i++) {
356
+ new EntityBuilder()
357
+ .add(ParticleEmitter.fromJSON({
358
+ "parameters": [
359
+ {
360
+ "name": "scale",
361
+ "itemSize": 1,
362
+ "defaultTrackValue": {
363
+ "itemSize": 1,
364
+ "data": [
365
+ 1
366
+ ],
367
+ "positions": [
368
+ 0
369
+ ]
370
+ }
371
+ },
372
+ {
373
+ "name": "color",
374
+ "itemSize": 4,
375
+ "defaultTrackValue": {
376
+ "itemSize": 4,
377
+ "data": [
378
+ 1,
379
+ 1,
380
+ 1,
381
+ 1
382
+ ],
383
+ "positions": [
384
+ 0
385
+ ]
386
+ }
387
+ }
388
+ ],
389
+ "preWarm": true,
390
+ "readDepth": true,
391
+ "softDepth": true,
392
+ "depthSort": true,
393
+ "velocityAlign": false,
394
+ "receiveLight": true,
395
+ "blendingMode": 0,
396
+ "layers": [
397
+ {
398
+ "imageURL": "data/textures/particle/smokeparticle.png",
399
+ "particleLife": {
400
+ "min": 3,
401
+ "max": 5
402
+ },
403
+ "particleSize": {
404
+ "min": 0.05,
405
+ "max": 0.1
406
+ },
407
+ "particleRotation": {
408
+ "min": 0,
409
+ "max": 0
410
+ },
411
+ "particleRotationSpeed": {
412
+ "min": 0,
413
+ "max": 0
414
+ },
415
+ "emissionShape": 1,
416
+ "emissionFrom": 1,
417
+ "emissionRate": 5000,
418
+ "emissionImmediate": 0,
419
+ "parameterTracks": [
420
+ {
421
+ "name": "color",
422
+ "track": {
423
+ "itemSize": 4,
424
+ "data": [
425
+ 1,
426
+ 1,
427
+ 1,
428
+ 0,
429
+
430
+ 1,
431
+ 1,
432
+ 1,
433
+ 0.7,
434
+
435
+ 1,
436
+ 1,
437
+ 1,
438
+ 0.7,
439
+
440
+ 1,
441
+ 1,
442
+ 1,
443
+ 0,
444
+ ],
445
+ "positions": [
446
+ 0,
447
+ 0.2,
448
+ 0.8,
449
+ 1
450
+ ]
451
+ }
452
+ },
453
+ {
454
+ "name": "scale",
455
+ "track": {
456
+ "itemSize": 1,
457
+ "data": [
458
+ 1
459
+ ],
460
+ "positions": [
461
+ 0
462
+ ]
463
+ }
464
+ }
465
+ ],
466
+ "position": {
467
+ "x": 0,
468
+ "y": 0,
469
+ "z": 0
470
+ },
471
+ "scale": {
472
+ "x": 1,
473
+ "y": 1,
474
+ "z": 1
475
+ },
476
+ "particleVelocityDirection": {
477
+ "direction": {
478
+ "x": 0,
479
+ "y": 1,
480
+ "z": 0
481
+ },
482
+ "angle": 1.8
483
+ },
484
+ "particleSpeed": {
485
+ "min": 0.03,
486
+ "max": 0.2
487
+ },
488
+ "steps": [
489
+ {
490
+ "type": "FixedPhysics",
491
+ "parameters": []
492
+ }
493
+ ]
494
+ }
495
+ ]
496
+ }))
497
+ .add(Transform.fromJSON({
498
+ position: new Vector3(offset.x, offset.y + 7, offset.z),
499
+ scale: new Vector3(40, 14, 26)
500
+ }))
501
+ .build(ecd);
502
+
503
+ for (let i = 0; i < 100; i++) {
334
504
 
335
505
  const builder = makeLight([
336
506
  randomFloatBetween(random, -18, 18) + offset.x,
@@ -365,6 +535,370 @@ function setup_scene_0(engine, ecd) {
365
535
  .build(ecd);
366
536
  }
367
537
 
538
+ /**
539
+ * @param {Engine} engine
540
+ * @param {EntityComponentDataset} ecd
541
+ */
542
+ function setup_scene_3(engine, ecd) {
543
+
544
+ const random = seededRandom(0);
545
+ //
546
+ // const light_key = new Light();
547
+ // light_key.intensity.set(0.1);
548
+ // light_key.type.set(LightType.DIRECTION);
549
+ // light_key.castShadow.set(true);
550
+ //
551
+ // const key_light_transform = new Transform();
552
+ // key_light_transform.position.set(10, 10, 0);
553
+ // key_light_transform.lookAt(new Vector3(0, 0, 0));
554
+ //
555
+ // new EntityBuilder()
556
+ // .add(light_key)
557
+ // .add(key_light_transform)
558
+ // .build(ecd);
559
+
560
+ const light_fill = new Light();
561
+ light_fill.intensity.set(0.03);
562
+ light_fill.type.set(LightType.AMBIENT);
563
+ light_fill.castShadow.set(false);
564
+
565
+ const fill_light_transform = new Transform();
566
+ fill_light_transform.position.set(40, 15, 30);
567
+ fill_light_transform.lookAt(new Vector3(30, 0, 20));
568
+
569
+ new EntityBuilder()
570
+ .add(light_fill)
571
+ .add(fill_light_transform)
572
+ .build(ecd);
573
+
574
+
575
+ const camera = CameraSystem.getFirstActiveCamera(ecd);
576
+
577
+ camera.component.fov.set(30);
578
+ camera.component.object.fov = 30;
579
+
580
+ // camera.component.autoClip = false;
581
+ // camera.component.object.near = 2;
582
+ // camera.component.object.far = 40;
583
+
584
+ EngineHarness.buildTerrain({
585
+ engine,
586
+ enableWater: false,
587
+ resolution: 4,
588
+ size: new Vector2(40, 40),
589
+ diffuse0: "data/textures/materials/terrain_township_set/1024/Grass_3.png"
590
+ });
591
+
592
+ const terrain = obtainTerrain(ecd, (terrain, entity) => {
593
+
594
+ const fow = new FogOfWar();
595
+
596
+ fow.scale.set(2);
597
+ fow.color.set(0.1, 0.1, 0.1, 1);
598
+
599
+ // ecd.addComponentToEntity(entity, fow);
600
+ });
601
+
602
+ console.log(terrain);
603
+
604
+ // terrain.overlay.size.set(50, 50);
605
+ // for (let i = 0; i < 50; i++) {
606
+ // for (let j = 0; j < 50; j++) {
607
+ //
608
+ // terrain.overlay.paintPoint(i, j, new Vector4(random(), random(), random(), 0.9));
609
+ // }
610
+ // }
611
+
612
+ /**
613
+ *
614
+ * @type {TopDownCameraController|undefined}
615
+ */
616
+ const camera_controller = ecd.getComponent(camera.entity, TopDownCameraController);
617
+
618
+
619
+ const offset = new Vector3(40, 0, 40);
620
+
621
+ camera_controller.fromJSON({
622
+ "target": offset,
623
+ "pitch": 0.7399999999999984,
624
+ "yaw": 2.283185307179597,
625
+ "roll": 0,
626
+ "distance": 37,
627
+ "distanceMin": 0,
628
+ "distanceMax": 1000
629
+ });
630
+
631
+ const volume_dim = new Vector3(15, 2, 15);
632
+
633
+ for (let i = 0; i < 0; i++) {
634
+
635
+ const builder = makeLight([
636
+ randomFloatBetween(random, -volume_dim.x / 2, volume_dim.x / 2) + offset.x,
637
+ randomFloatBetween(random, -volume_dim.y * 0.3, +volume_dim.y * 0.3) + offset.y,
638
+ randomFloatBetween(random, -volume_dim.z / 2, volume_dim.z / 2) + offset.z
639
+ ],
640
+ randomFloatBetween(random, 10, 10),
641
+ `hsv(${random().toFixed(4)}, 1, 1)`,
642
+ 5
643
+ );
644
+
645
+ const light = builder.getComponent(Light);
646
+
647
+ const b = new OrbitingBehavior();
648
+
649
+ const size = light.distance.getValue();
650
+
651
+ b.radius = randomFloatBetween(random, size, size * 3);
652
+ b.easing = 0;
653
+ b.rate = (random() < 0.5 ? 1 : -1) * randomFloatBetween(random, 2, 3) / b.radius;
654
+
655
+ const transform = builder.getComponent(Transform);
656
+
657
+ b.offset.copy(transform.position);
658
+
659
+
660
+ builder
661
+ .add(BehaviorComponent.fromOne(b))
662
+ // .add(BehaviorComponent.looping_function(()=>{
663
+ //
664
+ // }))
665
+ .build(ecd);
666
+ }
667
+
668
+ new EntityBuilder()
669
+ .add(ParticleEmitter.fromJSON({
670
+ "parameters": [
671
+ {
672
+ "name": "scale",
673
+ "itemSize": 1,
674
+ "defaultTrackValue": {
675
+ "itemSize": 1,
676
+ "data": [
677
+ 1
678
+ ],
679
+ "positions": [
680
+ 0
681
+ ]
682
+ }
683
+ },
684
+ {
685
+ "name": "color",
686
+ "itemSize": 4,
687
+ "defaultTrackValue": {
688
+ "itemSize": 4,
689
+ "data": [
690
+ 1,
691
+ 1,
692
+ 1,
693
+ 1
694
+ ],
695
+ "positions": [
696
+ 0
697
+ ]
698
+ }
699
+ }
700
+ ],
701
+ "preWarm": true,
702
+ "readDepth": true,
703
+ "softDepth": true,
704
+ "depthSort": true,
705
+ "velocityAlign": false,
706
+ "receiveLight": true,
707
+ "blendingMode": 0,
708
+ "layers": [
709
+ {
710
+ "imageURL": "data/textures/particle/UETools/Cloud_04.png",
711
+ "particleLife": {
712
+ "min": 11,
713
+ "max": 11
714
+ },
715
+ "particleSize": {
716
+ "min": 0.05,
717
+ "max": 0.05
718
+ },
719
+ "particleRotation": {
720
+ "min": 0,
721
+ "max": 3.14
722
+ },
723
+ "particleRotationSpeed": {
724
+ "min": 0,
725
+ "max": 0
726
+ },
727
+ "emissionShape": 1,
728
+ "emissionFrom": 1,
729
+ "emissionRate": 1000,
730
+ "emissionImmediate": 0,
731
+ "parameterTracks": [
732
+ {
733
+ "name": "color",
734
+ "track": {
735
+ "itemSize": 4,
736
+ "data": [
737
+ 1,
738
+ 1,
739
+ 1,
740
+ 0.1,
741
+
742
+ 1,
743
+ 1,
744
+ 1,
745
+ 0.7,
746
+
747
+ 1,
748
+ 1,
749
+ 1,
750
+ 0.7,
751
+
752
+ 1,
753
+ 1,
754
+ 1,
755
+ 0,
756
+ ],
757
+ "positions": [
758
+ 0,
759
+ 0.1,
760
+ 0.8,
761
+ 1
762
+ ]
763
+ }
764
+ },
765
+ {
766
+ "name": "scale",
767
+ "track": {
768
+ "itemSize": 1,
769
+ "data": [
770
+ 1.5,
771
+ 1,
772
+ 1,
773
+ 0.2
774
+ ],
775
+ "positions": [
776
+ 0,
777
+ 0.1,
778
+ 0.8,
779
+ 1
780
+ ]
781
+ }
782
+ }
783
+ ],
784
+ "position": {
785
+ "x": 0,
786
+ "y": 2.3,
787
+ "z": 0
788
+ },
789
+ "scale": {
790
+ "x": 1,
791
+ "y": 0.5,
792
+ "z": 1
793
+ },
794
+ "particleVelocityDirection": {
795
+ "direction": {
796
+ "x": 0,
797
+ "y": -1,
798
+ "z": 0
799
+ },
800
+ "angle": 0
801
+ },
802
+ "particleSpeed": {
803
+ "min": 0.2,
804
+ "max": 0.7
805
+ },
806
+ "steps": [
807
+ {
808
+ "type": "FixedPhysics",
809
+ "parameters": []
810
+ }
811
+ ]
812
+ }
813
+ ]
814
+ }))
815
+ .add(Transform.fromJSON({
816
+ position: new Vector3(offset.x, offset.y + volume_dim.y / 2, offset.z),
817
+ scale: new Vector3(volume_dim.x, volume_dim.y, volume_dim.z)
818
+ }))
819
+ .build(ecd);
820
+
821
+ const light_grid_size = 6;
822
+ for (let i = 0; i < light_grid_size; i++) {
823
+ for (let j = 0; j < light_grid_size; j++) {
824
+
825
+ const builder = makeLight([
826
+ ((i / (light_grid_size - 1)) - 0.5) * volume_dim.x + offset.x,
827
+ volume_dim.y * 0.5 + offset.y,
828
+ ((j / (light_grid_size - 1)) - 0.5) * volume_dim.z + offset.z
829
+ ],
830
+ 3,
831
+ `hsv(${random().toFixed(4)}, 0.8, 1)`,
832
+ 10
833
+ );
834
+
835
+
836
+ builder
837
+ .build(ecd);
838
+ }
839
+ }
840
+
841
+
842
+ new EntityBuilder()
843
+ .add(Transform.fromJSON({
844
+ position: offset,
845
+ scale: {
846
+ x: 4.5,
847
+ y: 4.5,
848
+ z: 4.5
849
+ }
850
+ }))
851
+ .add(FogOfWarRevealer.fromJSON({
852
+ radius: 5
853
+ }))
854
+ .add(new Team(0))
855
+ .add(Mesh.fromJSON({
856
+ url: 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf',
857
+ castShadow: true,
858
+ receiveShadow: true
859
+ }))
860
+ .build(ecd);
861
+
862
+ const tree_grid_size = 5;
863
+
864
+ for (let i = 0; i < tree_grid_size; i++) {
865
+ for (let j = 0; j < tree_grid_size; j++) {
866
+
867
+ // const p = new Vector3(
868
+ // offset.x + ((i / (tree_grid_size - 1)) - 0.5) * (volume_dim.x * 0.9),
869
+ // offset.y,
870
+ // offset.z + ((j / (tree_grid_size - 1)) - 0.5) * (volume_dim.z * 0.9)
871
+ // );
872
+
873
+ const p = new Vector3(
874
+ offset.x + randomFloatBetween(random, -volume_dim.x * 0.5, volume_dim.x * 0.5),
875
+ offset.y,
876
+ offset.x + randomFloatBetween(random, -volume_dim.z * 0.5, volume_dim.z * 0.5),
877
+ );
878
+
879
+ if (p.distanceTo(offset) < 3) {
880
+ continue;
881
+ }
882
+
883
+ new EntityBuilder()
884
+ .add(Transform.fromJSON({
885
+ position: p,
886
+ scale: {
887
+ x: 1,
888
+ y: 1,
889
+ z: 1
890
+ }
891
+ }))
892
+ .add(Mesh.fromJSON({
893
+ url: 'data/models/LowPolyTownshipSet/Tree_1/Tree_1.gltf',
894
+ castShadow: true,
895
+ receiveShadow: true
896
+ }))
897
+ .build(ecd);
898
+ }
899
+ }
900
+ }
901
+
368
902
  /**
369
903
  * @param {Engine} engine
370
904
  * @param {EntityComponentDataset} ecd
@@ -586,7 +1120,7 @@ function main(engine) {
586
1120
  // pitch: -0.5,
587
1121
  // yaw: 2.2,
588
1122
  // distance: 3
589
- pitch: 0.9,
1123
+ pitch: -0.9,
590
1124
  yaw: 3.1,
591
1125
  distance: 20,
592
1126
  enableLights: false
@@ -595,10 +1129,10 @@ function main(engine) {
595
1129
 
596
1130
  engine.graphics.renderer.setClearColor('rgba(99,99,99,1)');
597
1131
 
598
- setup_scene_0(engine, ecd);
1132
+ setup_scene_3(engine, ecd);
599
1133
  // setup_scene_1(engine, ecd);
600
1134
 
601
- engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
1135
+ // engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
602
1136
 
603
1137
  /**
604
1138
  *
@@ -606,26 +1140,27 @@ function main(engine) {
606
1140
  */
607
1141
  const plugin = engine.plugins.getPlugin(ForwardPlusRenderingPlugin);
608
1142
  const lm = plugin.getLightManager();
609
- lm.setTileMapResolution(24, 14, 14);
1143
+ lm.setTileMapResolution(14, 8, 14);
610
1144
 
611
1145
  console.log(lm);
612
-
613
- const v = new View();
614
- const clusterWidget = buildLightClusterWidget(lm, engine.graphics.camera);
615
- v.el = clusterWidget.domElement;
616
- v.size.setSilent(256, 256);
617
- v.css({
618
- pointerEvents: 'auto'
619
- });
620
-
621
- new EntityBuilder()
622
- .add(ViewportPosition.fromJSON({
623
- anchor: Vector2.one,
624
- offset: new Vector2(-0, -0),
625
- position: new Vector2(1, 1)
626
- }))
627
- .add(GUIElement.fromView(v))
628
- .build(ecd);
1146
+ window.lm = lm;
1147
+
1148
+ // const v = new View();
1149
+ // const clusterWidget = buildLightClusterWidget(lm, engine.graphics.camera);
1150
+ // v.el = clusterWidget.domElement;
1151
+ // v.size.setSilent(256, 256);
1152
+ // v.css({
1153
+ // pointerEvents: 'auto'
1154
+ // });
1155
+
1156
+ // new EntityBuilder()
1157
+ // .add(ViewportPosition.fromJSON({
1158
+ // anchor: Vector2.one,
1159
+ // offset: new Vector2(-0, -0),
1160
+ // position: new Vector2(1, 1)
1161
+ // }))
1162
+ // .add(GUIElement.fromView(v))
1163
+ // .build(ecd);
629
1164
 
630
1165
  engine.graphics.on.preRender.add(
631
1166
  /**
@@ -657,7 +1192,7 @@ function main(engine) {
657
1192
  // camera.updateProjectionMatrix();
658
1193
  // camera.updateMatrixWorld(true);
659
1194
 
660
- clusterWidget.update();
1195
+ // clusterWidget.update();
661
1196
 
662
1197
  });
663
1198