Repository: playcanvas/engine
Pull request #4702 (2022-10-07 15:15:10)

Refactoring to remove dependency of WebglGraphicsDevice on shader chunks
- all chunks are inlined, and the prevision related ones are removed from chunks completely


Patch:
diff --git a/examples/webgpu-temp/index.html b/examples/webgpu-temp/index.html
index 3be70ee73..ce9c1a28a 100644
--- a/examples/webgpu-temp/index.html
+++ b/examples/webgpu-temp/index.html
@@ -37,9 +37,9 @@
         import { 
             TRACEID_RENDER_FRAME, TRACEID_RENDER_PASS, TRACEID_RENDER_PASS_DETAIL, TRACEID_SHADER_ALLOC, TRACEID_TEXTURE_ALLOC
         } from "../../src/core/constants.js";
-        import { Color } from "../../src/math/color.js";
-        import { Vec3 } from "../../src/math/vec3.js";
-        import { Quat } from "../../src/math/quat.js";
+        import { Color } from "../../src/core/math/color.js";
+        import { Vec3 } from "../../src/core/math/vec3.js";
+        import { Quat } from "../../src/core/math/quat.js";
         import { StandardMaterial } from "../../src/scene/materials/standard-material.js";
         import { BLEND_ADDITIVE, BLEND_SUBTRACTIVE, BLEND_SCREEN, BLEND_NORMAL, BLEND_NONE } from "../../src/scene/constants.js";
 
diff --git a/src/anim/controller/anim-blend-tree-1d.js b/src/anim/controller/anim-blend-tree-1d.js
index 5d3d5f7bc..86710ed1b 100644
--- a/src/anim/controller/anim-blend-tree-1d.js
+++ b/src/anim/controller/anim-blend-tree-1d.js
@@ -1,4 +1,4 @@
-import { math } from '../../math/math.js';
+import { math } from '../../core/math/math.js';
 
 import { AnimBlendTree } from './anim-blend-tree.js';
 
diff --git a/src/anim/controller/anim-blend-tree-2d-cartesian.js b/src/anim/controller/anim-blend-tree-2d-cartesian.js
index c895752ad..259aa46cb 100644
--- a/src/anim/controller/anim-blend-tree-2d-cartesian.js
+++ b/src/anim/controller/anim-blend-tree-2d-cartesian.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../math/vec2.js';
-import { math } from '../../math/math.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { math } from '../../core/math/math.js';
 
 import { AnimBlendTree } from './anim-blend-tree.js';
 
diff --git a/src/anim/controller/anim-blend-tree-2d-directional.js b/src/anim/controller/anim-blend-tree-2d-directional.js
index 6016a604e..0c05a20fc 100644
--- a/src/anim/controller/anim-blend-tree-2d-directional.js
+++ b/src/anim/controller/anim-blend-tree-2d-directional.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../math/vec2.js';
-import { math } from '../../math/math.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { math } from '../../core/math/math.js';
 
 import { AnimBlendTree } from './anim-blend-tree.js';
 
diff --git a/src/anim/controller/anim-node.js b/src/anim/controller/anim-node.js
index 340b46a10..2b312e56b 100644
--- a/src/anim/controller/anim-node.js
+++ b/src/anim/controller/anim-node.js
@@ -1,4 +1,4 @@
-import { Vec2 } from '../../math/vec2.js';
+import { Vec2 } from '../../core/math/vec2.js';
 
 /**
  * AnimNodes are used to represent a single animation track in the current state. Each state can
diff --git a/src/anim/evaluator/anim-cache.js b/src/anim/evaluator/anim-cache.js
index 2489da9d3..596424bb9 100644
--- a/src/anim/evaluator/anim-cache.js
+++ b/src/anim/evaluator/anim-cache.js
@@ -1,4 +1,4 @@
-import { math } from '../../math/math.js';
+import { math } from '../../core/math/math.js';
 
 import { INTERPOLATION_CUBIC, INTERPOLATION_LINEAR, INTERPOLATION_STEP } from '../constants.js';
 
diff --git a/src/anim/evaluator/anim-target-value.js b/src/anim/evaluator/anim-target-value.js
index 0b31636fb..1ebd8f11d 100644
--- a/src/anim/evaluator/anim-target-value.js
+++ b/src/anim/evaluator/anim-target-value.js
@@ -1,7 +1,7 @@
-import { Quat } from '../../math/quat.js';
+import { Quat } from '../../core/math/quat.js';
 import { ANIM_LAYER_ADDITIVE, ANIM_LAYER_OVERWRITE } from '../controller/constants.js';
 import { AnimEvaluator } from '../evaluator/anim-evaluator.js';
-import { math } from '../../math/math.js';
+import { math } from '../../core/math/math.js';
 
 /**
  * Used to store and update the value of an animation target. This combines the values of multiple
diff --git a/src/animation/skeleton.js b/src/animation/skeleton.js
index 6286808f0..97ad3309b 100644
--- a/src/animation/skeleton.js
+++ b/src/animation/skeleton.js
@@ -1,6 +1,6 @@
 import { Debug } from '../core/debug.js';
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /** @typedef {import('./animation.js').Animation} Animation */
 /** @typedef {import('../scene/graph-node.js').GraphNode} GraphNode */
diff --git a/src/audio/channel.js b/src/audio/channel.js
index 8166073dd..57e81540c 100644
--- a/src/audio/channel.js
+++ b/src/audio/channel.js
@@ -1,4 +1,4 @@
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 
 import { hasAudioContext } from './capabilities.js';
 
diff --git a/src/audio/channel3d.js b/src/audio/channel3d.js
index de9fb277b..bc2b69d01 100644
--- a/src/audio/channel3d.js
+++ b/src/audio/channel3d.js
@@ -1,7 +1,7 @@
 import { Debug } from '../core/debug.js';
 
-import { math } from '../math/math.js';
-import { Vec3 } from '../math/vec3.js';
+import { math } from '../core/math/math.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { DISTANCE_EXPONENTIAL, DISTANCE_INVERSE, DISTANCE_LINEAR } from './constants.js';
 import { hasAudioContext } from './capabilities.js';
diff --git a/src/math/color.js b/src/core/math/color.js
similarity index 99%
rename from src/math/color.js
rename to src/core/math/color.js
index d1c216082..cab932f6c 100644
--- a/src/math/color.js
+++ b/src/core/math/color.js
@@ -1,4 +1,4 @@
-import { math } from '../math/math.js';
+import { math } from './math.js';
 
 /**
  * Representation of an RGBA color.
diff --git a/src/math/constants.js b/src/core/math/constants.js
similarity index 100%
rename from src/math/constants.js
rename to src/core/math/constants.js
diff --git a/src/math/curve-evaluator.js b/src/core/math/curve-evaluator.js
similarity index 100%
rename from src/math/curve-evaluator.js
rename to src/core/math/curve-evaluator.js
diff --git a/src/math/curve-set.js b/src/core/math/curve-set.js
similarity index 100%
rename from src/math/curve-set.js
rename to src/core/math/curve-set.js
diff --git a/src/math/curve.js b/src/core/math/curve.js
similarity index 99%
rename from src/math/curve.js
rename to src/core/math/curve.js
index cf63f4aab..791ece42f 100644
--- a/src/math/curve.js
+++ b/src/core/math/curve.js
@@ -1,4 +1,4 @@
-import { extend } from '../core/core.js';
+import { extend } from '../core.js';
 
 import { CURVE_SMOOTHSTEP } from './constants.js';
 import { CurveEvaluator } from './curve-evaluator.js';
diff --git a/src/math/float-packing.js b/src/core/math/float-packing.js
similarity index 100%
rename from src/math/float-packing.js
rename to src/core/math/float-packing.js
diff --git a/src/math/mat3.js b/src/core/math/mat3.js
similarity index 100%
rename from src/math/mat3.js
rename to src/core/math/mat3.js
diff --git a/src/math/mat4.js b/src/core/math/mat4.js
similarity index 100%
rename from src/math/mat4.js
rename to src/core/math/mat4.js
diff --git a/src/math/math.js b/src/core/math/math.js
similarity index 100%
rename from src/math/math.js
rename to src/core/math/math.js
diff --git a/src/math/quat.js b/src/core/math/quat.js
similarity index 100%
rename from src/math/quat.js
rename to src/core/math/quat.js
diff --git a/src/math/random.js b/src/core/math/random.js
similarity index 100%
rename from src/math/random.js
rename to src/core/math/random.js
diff --git a/src/math/vec2.js b/src/core/math/vec2.js
similarity index 100%
rename from src/math/vec2.js
rename to src/core/math/vec2.js
diff --git a/src/math/vec3.js b/src/core/math/vec3.js
similarity index 100%
rename from src/math/vec3.js
rename to src/core/math/vec3.js
diff --git a/src/math/vec4.js b/src/core/math/vec4.js
similarity index 100%
rename from src/math/vec4.js
rename to src/core/math/vec4.js
diff --git a/src/deprecated/deprecated.js b/src/deprecated/deprecated.js
index 9056003a5..908b951bb 100644
--- a/src/deprecated/deprecated.js
+++ b/src/deprecated/deprecated.js
@@ -3,12 +3,12 @@ import { string } from '../core/string.js';
 import { Timer, now } from '../core/time.js';
 import { Debug } from '../core/debug.js';
 
-import { math } from '../math/math.js';
-import { Color } from '../math/color.js';
-import { Mat4 } from '../math/mat4.js';
-import { Vec2 } from '../math/vec2.js';
-import { Vec3 } from '../math/vec3.js';
-import { Vec4 } from '../math/vec4.js';
+import { math } from '../core/math/math.js';
+import { Color } from '../core/math/color.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Vec2 } from '../core/math/vec2.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Vec4 } from '../core/math/vec4.js';
 
 import { BoundingBox } from '../shape/bounding-box.js';
 import { BoundingSphere } from '../shape/bounding-sphere.js';
diff --git a/src/font/canvas-font.js b/src/font/canvas-font.js
index 297e89986..83d027de6 100644
--- a/src/font/canvas-font.js
+++ b/src/font/canvas-font.js
@@ -1,7 +1,7 @@
 import { string } from '../core/string.js';
 import { EventHandler } from '../core/event-handler.js';
 
-import { Color } from '../math/color.js';
+import { Color } from '../core/math/color.js';
 
 import {
     ADDRESS_CLAMP_TO_EDGE,
diff --git a/src/framework/app-base.js b/src/framework/app-base.js
index 952973d58..84936e18a 100644
--- a/src/framework/app-base.js
+++ b/src/framework/app-base.js
@@ -9,11 +9,11 @@ import { EventHandler } from '../core/event-handler.js';
 import { Debug } from '../core/debug.js';
 import { TRACEID_RENDER_FRAME } from '../core/constants.js';
 
-import { math } from '../math/math.js';
-import { Color } from '../math/color.js';
-import { Vec3 } from '../math/vec3.js';
-import { Mat4 } from '../math/mat4.js';
-import { Quat } from '../math/quat.js';
+import { math } from '../core/math/math.js';
+import { Color } from '../core/math/color.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Quat } from '../core/math/quat.js';
 
 import { http } from '../net/http.js';
 
diff --git a/src/framework/components/anim/component-binder.js b/src/framework/components/anim/component-binder.js
index 0d692b822..fffb9a799 100644
--- a/src/framework/components/anim/component-binder.js
+++ b/src/framework/components/anim/component-binder.js
@@ -2,11 +2,11 @@ import { AnimTarget } from '../../../anim/evaluator/anim-target.js';
 import { DefaultAnimBinder } from '../../../anim/binder/default-anim-binder.js';
 import { AnimBinder } from '../../../anim/binder/anim-binder.js';
 
-import { Color } from '../../../math/color.js';
-import { Quat } from '../../../math/quat.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Color } from '../../../core/math/color.js';
+import { Quat } from '../../../core/math/quat.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 const v2 = new Vec2();
 const v3 = new Vec3();
diff --git a/src/framework/components/anim/component-layer.js b/src/framework/components/anim/component-layer.js
index dbc739780..616fab605 100644
--- a/src/framework/components/anim/component-layer.js
+++ b/src/framework/components/anim/component-layer.js
@@ -2,7 +2,7 @@ import { Debug } from '../../../core/debug.js';
 import { AnimTrack } from '../../../anim/evaluator/anim-track.js';
 import { AnimTransition } from '../../../anim/controller/anim-transition.js';
 import { ANIM_LAYER_OVERWRITE } from '../../../anim/controller/constants.js';
-import { math } from '../../../math/math.js';
+import { math } from '../../../core/math/math.js';
 
 /** @typedef {import('./component.js').AnimComponent} AnimComponent */
 /** @typedef {import('../../../asset/asset.js').Asset} Asset */
diff --git a/src/framework/components/button/component.js b/src/framework/components/button/component.js
index d981b3a57..2b26f2595 100644
--- a/src/framework/components/button/component.js
+++ b/src/framework/components/button/component.js
@@ -1,7 +1,7 @@
 import { now } from '../../../core/time.js';
 
-import { math } from '../../../math/math.js';
-import { Color } from '../../../math/color.js';
+import { math } from '../../../core/math/math.js';
+import { Color } from '../../../core/math/color.js';
 
 import { EntityReference } from '../../utils/entity-reference.js';
 
@@ -11,7 +11,7 @@ import { BUTTON_TRANSITION_MODE_SPRITE_CHANGE, BUTTON_TRANSITION_MODE_TINT } fro
 import { ELEMENTTYPE_GROUP } from '../element/constants.js';
 
 /** @typedef {import('../../../asset/asset.js').Asset} Asset */
-/** @typedef {import('../../../math/vec4.js').Vec4} Vec4 */
+/** @typedef {import('../../../core/math/vec4.js').Vec4} Vec4 */
 /** @typedef {import('../../entity.js').Entity} Entity */
 /** @typedef {import('./system.js').ButtonComponentSystem} ButtonComponentSystem */
 
diff --git a/src/framework/components/button/data.js b/src/framework/components/button/data.js
index 6769f5931..a7845451a 100644
--- a/src/framework/components/button/data.js
+++ b/src/framework/components/button/data.js
@@ -1,5 +1,5 @@
-import { Color } from '../../../math/color.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { BUTTON_TRANSITION_MODE_TINT } from './constants.js';
 
diff --git a/src/framework/components/camera/component.js b/src/framework/components/camera/component.js
index 31872cdf1..ad6a4d79c 100644
--- a/src/framework/components/camera/component.js
+++ b/src/framework/components/camera/component.js
@@ -7,10 +7,10 @@ import { PostEffectQueue } from './post-effect-queue.js';
 import { Debug } from '../../../core/debug.js';
 
 /** @typedef {import('../../../graphics/render-target.js').RenderTarget} RenderTarget */
-/** @typedef {import('../../../math/color.js').Color} Color */
-/** @typedef {import('../../../math/mat4.js').Mat4} Mat4 */
-/** @typedef {import('../../../math/vec3.js').Vec3} Vec3 */
-/** @typedef {import('../../../math/vec4.js').Vec4} Vec4 */
+/** @typedef {import('../../../core/math/color.js').Color} Color */
+/** @typedef {import('../../../core/math/mat4.js').Mat4} Mat4 */
+/** @typedef {import('../../../core/math/vec3.js').Vec3} Vec3 */
+/** @typedef {import('../../../core/math/vec4.js').Vec4} Vec4 */
 /** @typedef {import('../../../scene/layer.js').Layer} Layer */
 /** @typedef {import('../../../shape/frustum.js').Frustum} Frustum */
 /** @typedef {import('../../../xr/xr-manager.js').XrErrorCallback} XrErrorCallback */
diff --git a/src/framework/components/camera/system.js b/src/framework/components/camera/system.js
index 0dd606d1a..c77ab230b 100644
--- a/src/framework/components/camera/system.js
+++ b/src/framework/components/camera/system.js
@@ -1,6 +1,6 @@
 import { sortPriority } from '../../../core/sort.js';
-import { Color } from '../../../math/color.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { Component } from '../component.js';
 import { ComponentSystem } from '../system.js';
diff --git a/src/framework/components/collision/component.js b/src/framework/components/collision/component.js
index 33d771abe..ee44716fe 100644
--- a/src/framework/components/collision/component.js
+++ b/src/framework/components/collision/component.js
@@ -2,7 +2,7 @@ import { Asset } from '../../../asset/asset.js';
 
 import { Component } from '../component.js';
 
-/** @typedef {import('../../../math/vec3.js').Vec3} Vec3 */
+/** @typedef {import('../../../core/math/vec3.js').Vec3} Vec3 */
 /** @typedef {import('../../../scene/model.js').Model} Model */
 /** @typedef {import('../../entity.js').Entity} Entity */
 /** @typedef {import('./system.js').CollisionComponentSystem} CollisionComponentSystem */
diff --git a/src/framework/components/collision/data.js b/src/framework/components/collision/data.js
index 21b45a024..a09e901ee 100644
--- a/src/framework/components/collision/data.js
+++ b/src/framework/components/collision/data.js
@@ -1,4 +1,4 @@
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 class CollisionComponentData {
     constructor() {
diff --git a/src/framework/components/collision/system.js b/src/framework/components/collision/system.js
index ecfc40d5b..4458de1a8 100644
--- a/src/framework/components/collision/system.js
+++ b/src/framework/components/collision/system.js
@@ -1,8 +1,8 @@
 import { Debug } from '../../../core/debug.js';
 
-import { Mat4 } from '../../../math/mat4.js';
-import { Quat } from '../../../math/quat.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { Mat4 } from '../../../core/math/mat4.js';
+import { Quat } from '../../../core/math/quat.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { SEMANTIC_POSITION } from '../../../graphics/constants.js';
 
diff --git a/src/framework/components/element/component.js b/src/framework/components/element/component.js
index 4fef19059..d7e3bb26d 100644
--- a/src/framework/components/element/component.js
+++ b/src/framework/components/element/component.js
@@ -1,9 +1,9 @@
 import { Debug } from '../../../core/debug.js';
 
-import { Mat4 } from '../../../math/mat4.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Mat4 } from '../../../core/math/mat4.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { FUNC_ALWAYS, FUNC_EQUAL, STENCILOP_INCREMENT, STENCILOP_REPLACE } from '../../../graphics/constants.js';
 
@@ -19,7 +19,7 @@ import { ELEMENTTYPE_GROUP, ELEMENTTYPE_IMAGE, ELEMENTTYPE_TEXT, FITMODE_STRETCH
 import { ImageElement } from './image-element.js';
 import { TextElement } from './text-element.js';
 
-/** @typedef {import('../../../math/color.js').Color} Color */
+/** @typedef {import('../../../core/math/color.js').Color} Color */
 /** @typedef {import('../../../font/canvas-font.js').CanvasFont} CanvasFont */
 /** @typedef {import('../../../font/font.js').Font} Font */
 /** @typedef {import('../../../graphics/texture.js').Texture} Texture */
diff --git a/src/framework/components/element/element-drag-helper.js b/src/framework/components/element/element-drag-helper.js
index acc2db43a..aa632dd05 100644
--- a/src/framework/components/element/element-drag-helper.js
+++ b/src/framework/components/element/element-drag-helper.js
@@ -1,9 +1,9 @@
 import { platform } from '../../../core/platform.js';
 import { EventHandler } from '../../../core/event-handler.js';
 
-import { Quat } from '../../../math/quat.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { Quat } from '../../../core/math/quat.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { ElementComponent } from './component.js';
 import { Ray } from '../../../shape/ray.js';
diff --git a/src/framework/components/element/image-element.js b/src/framework/components/element/image-element.js
index 5e952d90a..a2ed9d6b5 100644
--- a/src/framework/components/element/image-element.js
+++ b/src/framework/components/element/image-element.js
@@ -1,10 +1,10 @@
 import { Debug } from '../../../core/debug.js';
 
-import { math } from '../../../math/math.js';
-import { Color } from '../../../math/color.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { math } from '../../../core/math/math.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import {
     BUFFER_STATIC,
diff --git a/src/framework/components/element/system.js b/src/framework/components/element/system.js
index c640a3970..85680c100 100644
--- a/src/framework/components/element/system.js
+++ b/src/framework/components/element/system.js
@@ -1,6 +1,6 @@
-import { Color } from '../../../math/color.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import {
     PIXELFORMAT_R8_G8_B8_A8
diff --git a/src/framework/components/element/text-element.js b/src/framework/components/element/text-element.js
index 112bb8052..783bc3ff4 100644
--- a/src/framework/components/element/text-element.js
+++ b/src/framework/components/element/text-element.js
@@ -1,9 +1,9 @@
 import { Debug } from '../../../core/debug.js';
 import { string } from '../../../core/string.js';
 
-import { math } from '../../../math/math.js';
-import { Color } from '../../../math/color.js';
-import { Vec2 } from '../../../math/vec2.js';
+import { math } from '../../../core/math/math.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec2 } from '../../../core/math/vec2.js';
 
 import { BoundingBox } from '../../../shape/bounding-box.js';
 
diff --git a/src/framework/components/joint/component.js b/src/framework/components/joint/component.js
index e9d05d44e..15bed41c7 100644
--- a/src/framework/components/joint/component.js
+++ b/src/framework/components/joint/component.js
@@ -1,9 +1,9 @@
 import { Debug } from '../../../core/debug.js';
 
-import { math } from '../../../math/math.js';
-import { Mat4 } from '../../../math/mat4.js';
-import { Quat } from '../../../math/quat.js';
-import { Vec2 } from '../../../math/vec2.js';
+import { math } from '../../../core/math/math.js';
+import { Mat4 } from '../../../core/math/mat4.js';
+import { Quat } from '../../../core/math/quat.js';
+import { Vec2 } from '../../../core/math/vec2.js';
 
 import { Component } from '../component.js';
 
diff --git a/src/framework/components/layout-group/component.js b/src/framework/components/layout-group/component.js
index 118c9b52a..d934bd33a 100644
--- a/src/framework/components/layout-group/component.js
+++ b/src/framework/components/layout-group/component.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { ORIENTATION_HORIZONTAL } from '../../../scene/constants.js';
 
diff --git a/src/framework/components/layout-group/layout-calculator.js b/src/framework/components/layout-group/layout-calculator.js
index 08f27fe93..0019af381 100644
--- a/src/framework/components/layout-group/layout-calculator.js
+++ b/src/framework/components/layout-group/layout-calculator.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL } from '../../../scene/constants.js';
 
diff --git a/src/framework/components/layout-group/system.js b/src/framework/components/layout-group/system.js
index f4072d0f5..523f16d3e 100644
--- a/src/framework/components/layout-group/system.js
+++ b/src/framework/components/layout-group/system.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { Component } from '../component.js';
 import { ComponentSystem } from '../system.js';
diff --git a/src/framework/components/light/component.js b/src/framework/components/light/component.js
index 9c74482d8..cf7bd0184 100644
--- a/src/framework/components/light/component.js
+++ b/src/framework/components/light/component.js
@@ -1,6 +1,6 @@
-import { math } from '../../../math/math.js';
-import { Color } from '../../../math/color.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { math } from '../../../core/math/math.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import {
     BLUR_GAUSSIAN,
@@ -16,7 +16,7 @@ import { Asset } from '../../../asset/asset.js';
 
 import { Component } from '../component.js';
 
-/** @typedef {import('../../../math/vec2.js').Vec2} Vec2 */
+/** @typedef {import('../../../core/math/vec2.js').Vec2} Vec2 */
 /** @typedef {import('../../entity.js').Entity} Entity */
 /** @typedef {import('./system.js').LightComponentSystem} LightComponentSystem */
 
diff --git a/src/framework/components/light/system.js b/src/framework/components/light/system.js
index f673a6734..6cc6bea55 100644
--- a/src/framework/components/light/system.js
+++ b/src/framework/components/light/system.js
@@ -1,5 +1,5 @@
-import { Color } from '../../../math/color.js';
-import { Vec2 } from '../../../math/vec2.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec2 } from '../../../core/math/vec2.js';
 
 import { LIGHTSHAPE_PUNCTUAL } from '../../../scene/constants.js';
 import { Light, lightTypes } from '../../../scene/light.js';
diff --git a/src/framework/components/model/system.js b/src/framework/components/model/system.js
index dc00372e0..497666f83 100644
--- a/src/framework/components/model/system.js
+++ b/src/framework/components/model/system.js
@@ -1,6 +1,6 @@
 import { extend } from '../../../core/core.js';
 
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { BoundingBox } from '../../../shape/bounding-box.js';
 
diff --git a/src/framework/components/particle-system/component.js b/src/framework/components/particle-system/component.js
index 5333033be..06326b4d1 100644
--- a/src/framework/components/particle-system/component.js
+++ b/src/framework/components/particle-system/component.js
@@ -6,9 +6,9 @@ import { Asset } from '../../../asset/asset.js';
 
 import { Component } from '../component.js';
 
-/** @typedef {import('../../../math/curve.js').Curve} Curve */
-/** @typedef {import('../../../math/curve-set.js').CurveSet} CurveSet */
-/** @typedef {import('../../../math/vec3.js').Vec3} Vec3 */
+/** @typedef {import('../../../core/math/curve.js').Curve} Curve */
+/** @typedef {import('../../../core/math/curve-set.js').CurveSet} CurveSet */
+/** @typedef {import('../../../core/math/vec3.js').Vec3} Vec3 */
 /** @typedef {import('../../entity.js').Entity} Entity */
 /** @typedef {import('./system.js').ParticleSystemComponentSystem} ParticleSystemComponentSystem */
 
diff --git a/src/framework/components/particle-system/data.js b/src/framework/components/particle-system/data.js
index a51481ab9..ed74e82a7 100644
--- a/src/framework/components/particle-system/data.js
+++ b/src/framework/components/particle-system/data.js
@@ -1,4 +1,4 @@
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { BLEND_NORMAL, EMITTERSHAPE_BOX, LAYERID_WORLD, PARTICLEMODE_GPU, PARTICLEORIENTATION_SCREEN } from '../../../scene/constants.js';
 
diff --git a/src/framework/components/particle-system/system.js b/src/framework/components/particle-system/system.js
index 1a552a765..ed7370a49 100644
--- a/src/framework/components/particle-system/system.js
+++ b/src/framework/components/particle-system/system.js
@@ -1,6 +1,6 @@
-import { Curve } from '../../../math/curve.js';
-import { CurveSet } from '../../../math/curve-set.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { Curve } from '../../../core/math/curve.js';
+import { CurveSet } from '../../../core/math/curve-set.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { LIGHTTYPE_DIRECTIONAL } from '../../../scene/constants.js';
 
diff --git a/src/framework/components/render/system.js b/src/framework/components/render/system.js
index ea6a2b67a..dbc20fc9d 100644
--- a/src/framework/components/render/system.js
+++ b/src/framework/components/render/system.js
@@ -1,4 +1,4 @@
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { BoundingBox } from '../../../shape/bounding-box.js';
 
diff --git a/src/framework/components/rigid-body/component.js b/src/framework/components/rigid-body/component.js
index 4b2621dc5..766982402 100644
--- a/src/framework/components/rigid-body/component.js
+++ b/src/framework/components/rigid-body/component.js
@@ -1,7 +1,7 @@
 import { Debug } from '../../../core/debug.js';
 
-import { Quat } from '../../../math/quat.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { Quat } from '../../../core/math/quat.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import {
     BODYFLAG_KINEMATIC_OBJECT, BODYTYPE_STATIC,
diff --git a/src/framework/components/rigid-body/system.js b/src/framework/components/rigid-body/system.js
index c71633155..4b5b74c19 100644
--- a/src/framework/components/rigid-body/system.js
+++ b/src/framework/components/rigid-body/system.js
@@ -2,7 +2,7 @@ import { now } from '../../../core/time.js';
 import { ObjectPool } from '../../../core/object-pool.js';
 import { Debug } from '../../../core/debug.js';
 
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { Component } from '../component.js';
 import { ComponentSystem } from '../system.js';
diff --git a/src/framework/components/screen/component.js b/src/framework/components/screen/component.js
index 9f0820771..8b5d7fa22 100644
--- a/src/framework/components/screen/component.js
+++ b/src/framework/components/screen/component.js
@@ -1,7 +1,7 @@
 import { Debug } from '../../../core/debug.js';
 
-import { Mat4 } from '../../../math/mat4.js';
-import { Vec2 } from '../../../math/vec2.js';
+import { Mat4 } from '../../../core/math/mat4.js';
+import { Vec2 } from '../../../core/math/vec2.js';
 
 import { Entity } from '../../entity.js';
 
diff --git a/src/framework/components/screen/system.js b/src/framework/components/screen/system.js
index 091f037fa..8c330d805 100644
--- a/src/framework/components/screen/system.js
+++ b/src/framework/components/screen/system.js
@@ -1,6 +1,6 @@
 import { IndexedList } from '../../../core/indexed-list.js';
 
-import { Vec2 } from '../../../math/vec2.js';
+import { Vec2 } from '../../../core/math/vec2.js';
 
 import { Component } from '../component.js';
 import { ComponentSystem } from '../system.js';
diff --git a/src/framework/components/script-legacy/system.js b/src/framework/components/script-legacy/system.js
index 857cc4547..148654e45 100644
--- a/src/framework/components/script-legacy/system.js
+++ b/src/framework/components/script-legacy/system.js
@@ -2,12 +2,12 @@ import { extend } from '../../../core/core.js';
 import { events } from '../../../core/events.js';
 import { Debug } from '../../../core/debug.js';
 
-import { Color } from '../../../math/color.js';
-import { Curve } from '../../../math/curve.js';
-import { CurveSet } from '../../../math/curve-set.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { Color } from '../../../core/math/color.js';
+import { Curve } from '../../../core/math/curve.js';
+import { CurveSet } from '../../../core/math/curve-set.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import { Entity } from '../../entity.js';
 
diff --git a/src/framework/components/scroll-view/component.js b/src/framework/components/scroll-view/component.js
index ff88b7716..90d18433d 100644
--- a/src/framework/components/scroll-view/component.js
+++ b/src/framework/components/scroll-view/component.js
@@ -1,8 +1,8 @@
 import { Debug } from '../../../core/debug.js';
 
-import { math } from '../../../math/math.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { math } from '../../../core/math/math.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL } from '../../../scene/constants.js';
 
diff --git a/src/framework/components/scroll-view/system.js b/src/framework/components/scroll-view/system.js
index a8bb5f823..4b3a92676 100644
--- a/src/framework/components/scroll-view/system.js
+++ b/src/framework/components/scroll-view/system.js
@@ -4,7 +4,7 @@ import { ComponentSystem } from '../system.js';
 import { ScrollViewComponent } from './component.js';
 import { ScrollViewComponentData } from './data.js';
 
-import { Vec2 } from '../../../math/vec2.js';
+import { Vec2 } from '../../../core/math/vec2.js';
 
 /** @typedef {import('../../app-base.js').AppBase} AppBase */
 
diff --git a/src/framework/components/scrollbar/component.js b/src/framework/components/scrollbar/component.js
index 51b290814..6c8abd8e8 100644
--- a/src/framework/components/scrollbar/component.js
+++ b/src/framework/components/scrollbar/component.js
@@ -1,4 +1,4 @@
-import { math } from '../../../math/math.js';
+import { math } from '../../../core/math/math.js';
 
 import { ORIENTATION_HORIZONTAL } from '../../../scene/constants.js';
 
diff --git a/src/framework/components/sound/slot.js b/src/framework/components/sound/slot.js
index c925ca493..f8a8e7dfc 100644
--- a/src/framework/components/sound/slot.js
+++ b/src/framework/components/sound/slot.js
@@ -1,8 +1,8 @@
 import { EventHandler } from '../../../core/event-handler.js';
 import { Debug } from '../../../core/debug.js';
 
-import { math } from '../../../math/math.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { math } from '../../../core/math/math.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { Asset } from '../../../asset/asset.js';
 
diff --git a/src/framework/components/sprite/component.js b/src/framework/components/sprite/component.js
index 6696a5f94..fa0f4efca 100644
--- a/src/framework/components/sprite/component.js
+++ b/src/framework/components/sprite/component.js
@@ -1,9 +1,9 @@
 import { Debug } from '../../../core/debug.js';
 
-import { math } from '../../../math/math.js';
-import { Color } from '../../../math/color.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec4 } from '../../../math/vec4.js';
+import { math } from '../../../core/math/math.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec4 } from '../../../core/math/vec4.js';
 
 import {
     LAYERID_WORLD,
diff --git a/src/framework/components/sprite/sprite-animation-clip.js b/src/framework/components/sprite/sprite-animation-clip.js
index bbaab4d20..90e3e4fd5 100644
--- a/src/framework/components/sprite/sprite-animation-clip.js
+++ b/src/framework/components/sprite/sprite-animation-clip.js
@@ -1,6 +1,6 @@
 import { EventHandler } from '../../../core/event-handler.js';
 
-import { math } from '../../../math/math.js';
+import { math } from '../../../core/math/math.js';
 
 import { Asset } from '../../../asset/asset.js';
 
diff --git a/src/framework/components/sprite/system.js b/src/framework/components/sprite/system.js
index a3a3c3e33..aa6a2d884 100644
--- a/src/framework/components/sprite/system.js
+++ b/src/framework/components/sprite/system.js
@@ -1,4 +1,4 @@
-import { Color } from '../../../math/color.js';
+import { Color } from '../../../core/math/color.js';
 
 import {
     CULLFACE_NONE,
diff --git a/src/framework/components/system.js b/src/framework/components/system.js
index eda676fa4..de64803f8 100644
--- a/src/framework/components/system.js
+++ b/src/framework/components/system.js
@@ -1,9 +1,9 @@
 import { EventHandler } from '../../core/event-handler.js';
 
-import { Color } from '../../math/color.js';
-import { Vec2 } from '../../math/vec2.js';
-import { Vec3 } from '../../math/vec3.js';
-import { Vec4 } from '../../math/vec4.js';
+import { Color } from '../../core/math/color.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Vec4 } from '../../core/math/vec4.js';
 
 /** @typedef {import('../app-base.js').AppBase} AppBase */
 /** @typedef {import('./component.js').Component} Component */
diff --git a/src/framework/components/zone/component.js b/src/framework/components/zone/component.js
index d5e3d97d9..794d09f88 100644
--- a/src/framework/components/zone/component.js
+++ b/src/framework/components/zone/component.js
@@ -1,4 +1,4 @@
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { Component } from '../component.js';
 
diff --git a/src/framework/components/zone/system.js b/src/framework/components/zone/system.js
index a71b059e8..a8a7a7a53 100644
--- a/src/framework/components/zone/system.js
+++ b/src/framework/components/zone/system.js
@@ -1,4 +1,4 @@
-import { Vec3 } from '../../../math/vec3.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { Component } from '../component.js';
 import { ComponentSystem } from '../system.js';
diff --git a/src/graphics/env-lighting.js b/src/graphics/env-lighting.js
index 30edd260a..e9fa1dce2 100644
--- a/src/graphics/env-lighting.js
+++ b/src/graphics/env-lighting.js
@@ -1,4 +1,4 @@
-import { Vec4 } from '../math/vec4.js';
+import { Vec4 } from '../core/math/vec4.js';
 import { Texture } from './texture.js';
 import { reprojectTexture } from './reproject-texture.js';
 import {
diff --git a/src/graphics/post-effect.js b/src/graphics/post-effect.js
index 0705f11ef..9b4180b07 100644
--- a/src/graphics/post-effect.js
+++ b/src/graphics/post-effect.js
@@ -3,7 +3,7 @@ import { VertexBuffer } from './vertex-buffer.js';
 import { VertexFormat } from './vertex-format.js';
 
 /** @typedef {import('../math/vec4.js').Vec4} Vec4 */
-/** @typedef {import('./graphics-device.js').GraphicsDevice} GraphicsDevice */
+/** @typedef {import('../core/math/vec4.jsce.js').GraphicsDevice} GraphicsDevice */
 /** @typedef {import('./render-target.js').RenderTarget} RenderTarget */
 /** @typedef {import('./shader.js').Shader} Shader */
 
diff --git a/src/graphics/prefilter-cubemap.js b/src/graphics/prefilter-cubemap.js
index 948c3dbaf..e6f3eac00 100644
--- a/src/graphics/prefilter-cubemap.js
+++ b/src/graphics/prefilter-cubemap.js
@@ -1,5 +1,5 @@
 import { Debug } from '../core/debug.js';
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import {
     PIXELFORMAT_R8_G8_B8_A8, TEXTURETYPE_DEFAULT, TEXTURETYPE_RGBM
diff --git a/src/graphics/program-lib/chunks/chunks.js b/src/graphics/program-lib/chunks/chunks.js
index b811ac855..7331026b8 100644
--- a/src/graphics/program-lib/chunks/chunks.js
+++ b/src/graphics/program-lib/chunks/chunks.js
@@ -133,8 +133,6 @@ import particle_softVS from './particle/vert/particle_soft.js';
 import particle_stretchVS from './particle/vert/particle_stretch.js';
 import particle_TBNVS from './particle/vert/particle_TBN.js';
 import particle_wrapVS from './particle/vert/particle_wrap.js';
-import precisionTestPS from './common/frag/precisionTest.js';
-import precisionTest2PS from './common/frag/precisionTest2.js';
 import reflDirPS from './lit/frag/reflDir.js';
 import reflDirAnisoPS from './lit/frag/reflDirAniso.js';
 import reflectionCCPS from './lit/frag/reflectionCC.js';
@@ -340,8 +338,6 @@ const shaderChunks = {
     particle_stretchVS,
     particle_TBNVS,
     particle_wrapVS,
-    precisionTestPS,
-    precisionTest2PS,
     reflDirPS,
     reflDirAnisoPS,
     reflectionCCPS,
diff --git a/src/graphics/render-pass.js b/src/graphics/render-pass.js
index 4207af93e..cf4e65ae5 100644
--- a/src/graphics/render-pass.js
+++ b/src/graphics/render-pass.js
@@ -1,4 +1,4 @@
-import { Color } from '../math/color.js';
+import { Color } from '../core/math/color.js';
 import { DebugGraphics } from '../graphics/debug-graphics.js';
 
 /** @typedef {import('../graphics/render-target.js').RenderTarget} RenderTarget */
diff --git a/src/graphics/reproject-texture.js b/src/graphics/reproject-texture.js
index 333a2dd46..d6976ad05 100644
--- a/src/graphics/reproject-texture.js
+++ b/src/graphics/reproject-texture.js
@@ -3,8 +3,8 @@ import {
     FILTER_NEAREST,
     TEXTUREPROJECTION_OCTAHEDRAL, TEXTUREPROJECTION_CUBE
 } from './constants.js';
-import { Vec3 } from '../math/vec3.js';
-import { random } from '../math/random.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { random } from '../core/math/random.js';
 import { createShaderFromCode } from './program-lib/utils.js';
 import { drawQuadWithShader } from './simple-post-effect.js';
 import { ChunkUtils } from './program-lib/chunk-utils.js';
@@ -16,7 +16,7 @@ import { Texture } from './texture.js';
 import { DebugGraphics } from './debug-graphics.js';
 import { DeviceCache } from './device-cache.js';
 
-/** @typedef {import('../math/vec4.js').Vec4} Vec4 */
+/** @typedef {import('../core/math/vec4.js').Vec4} Vec4 */
 
 const getProjectionName = (projection) => {
     switch (projection) {
diff --git a/src/graphics/simple-post-effect.js b/src/graphics/simple-post-effect.js
index 98a189bdc..82074804f 100644
--- a/src/graphics/simple-post-effect.js
+++ b/src/graphics/simple-post-effect.js
@@ -4,7 +4,7 @@ import { VertexFormat } from './vertex-format.js';
 import { DebugGraphics } from './debug-graphics.js';
 import { DeviceCache } from './device-cache.js';
 
-/** @typedef {import('../math/vec4.js').Vec4} Vec4 */
+/** @typedef {import('../core/math/vec4.js').Vec4} Vec4 */
 /** @typedef {import('./graphics-device.js').GraphicsDevice} GraphicsDevice */
 /** @typedef {import('./render-target.js').RenderTarget} RenderTarget */
 /** @typedef {import('./shader.js').Shader} Shader */
diff --git a/src/graphics/texture.js b/src/graphics/texture.js
index 036ff7e1e..8a9a68695 100644
--- a/src/graphics/texture.js
+++ b/src/graphics/texture.js
@@ -1,6 +1,6 @@
 import { Debug } from '../core/debug.js';
 import { TRACEID_TEXTURE_ALLOC, TRACEID_VRAM_TEXTURE } from '../core/constants.js';
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 
 import {
     ADDRESS_REPEAT,
diff --git a/src/graphics/uniform-buffer-format.js b/src/graphics/uniform-buffer-format.js
index a693c98e1..fe7fcd974 100644
--- a/src/graphics/uniform-buffer-format.js
+++ b/src/graphics/uniform-buffer-format.js
@@ -1,5 +1,5 @@
 import { Debug } from '../core/debug.js';
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 import {
     uniformTypeToName, bindGroupNames,
     UNIFORMTYPE_BOOL, UNIFORMTYPE_INT, UNIFORMTYPE_FLOAT, UNIFORMTYPE_VEC2, UNIFORMTYPE_VEC3,
diff --git a/src/graphics/vertex-format.js b/src/graphics/vertex-format.js
index 5f24c8f97..85aae6f40 100644
--- a/src/graphics/vertex-format.js
+++ b/src/graphics/vertex-format.js
@@ -1,7 +1,7 @@
 import { Debug } from '../core/debug.js';
 import { hashCode } from '../core/hash.js';
 
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 
 import {
     SEMANTIC_TEXCOORD0, SEMANTIC_TEXCOORD1, SEMANTIC_ATTR12, SEMANTIC_ATTR13, SEMANTIC_ATTR14, SEMANTIC_ATTR15,
diff --git a/src/graphics/webgl/webgl-graphics-device.js b/src/graphics/webgl/webgl-graphics-device.js
index 4bf7be290..7ae28808c 100644
--- a/src/graphics/webgl/webgl-graphics-device.js
+++ b/src/graphics/webgl/webgl-graphics-device.js
@@ -25,7 +25,6 @@ import {
 import { GraphicsDevice } from '../graphics-device.js';
 import { createShaderFromCode } from '../program-lib/utils.js';
 import { drawQuadWithShader } from '../simple-post-effect.js';
-import { shaderChunks } from '../program-lib/chunks/chunks.js';
 import { RenderTarget } from '../render-target.js';
 import { Texture } from '../texture.js';
 import { DebugGraphics } from '../debug-graphics.js';
@@ -35,7 +34,7 @@ import { WebglIndexBuffer } from './webgl-index-buffer.js';
 import { WebglShader } from './webgl-shader.js';
 import { WebglTexture } from './webgl-texture.js';
 import { WebglRenderTarget } from './webgl-render-target.js';
-import { Color } from '../../math/color.js';
+import { Color } from '../../core/math/color.js';
 
 /** @typedef {import('../index-buffer.js').IndexBuffer} IndexBuffer */
 /** @typedef {import('../shader.js').Shader} Shader */
@@ -44,6 +43,46 @@ import { Color } from '../../math/color.js';
 
 const invalidateAttachments = [];
 
+const _fullScreenQuadVS = /* glsl */`
+attribute vec2 vertex_position;
+varying vec2 vUv0;
+void main(void)
+{
+    gl_Position = vec4(vertex_position, 0.5, 1.0);
+    vUv0 = vertex_position.xy*0.5+0.5;
+}
+`;
+
+const _precisionTest1PS = /* glsl */`
+void main(void) { 
+    gl_FragColor = vec4(2147483648.0);
+}
+`;
+
+const _precisionTest2PS = /* glsl */`
+uniform sampler2D source;
+vec4 packFloat(float depth) {
+    const vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);
+    const vec4 bit_mask  = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
+    vec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);
+    res -= res.xxyz * bit_mask;
+    return res;
+}
+void main(void) {
+    float c = texture2D(source, vec2(0.0)).r;
+    float diff = abs(c - 2147483648.0) / 2147483648.0;
+    gl_FragColor = packFloat(diff);
+}
+`;
+
+const _outputTexture2D = /* glsl */`
+varying vec2 vUv0;
+uniform sampler2D source;
+void main(void) {
+    gl_FragColor = texture2D(source, vUv0);
+}
+`;
+
 function testRenderable(gl, pixelFormat) {
     let result = true;
 
@@ -109,8 +148,8 @@ function testTextureFloatHighPrecision(device) {
     if (!device.textureFloatRenderable)
         return false;
 
-    const test1 = createShaderFromCode(device, shaderChunks.fullscreenQuadVS, shaderChunks.precisionTestPS, "ptest1");
-    const test2 = createShaderFromCode(device, shaderChunks.fullscreenQuadVS, shaderChunks.precisionTest2PS, "ptest2");
+    const test1 = createShaderFromCode(device, _fullScreenQuadVS, _precisionTest1PS, "ptest1");
+    const test2 = createShaderFromCode(device, _fullScreenQuadVS, _precisionTest2PS, "ptest2");
 
     const textureOptions = {
         format: PIXELFORMAT_RGBA32F,
@@ -1258,9 +1297,7 @@ class WebglGraphicsDevice extends GraphicsDevice {
      */
     getCopyShader() {
         if (!this._copyShader) {
-            const vs = shaderChunks.fullscreenQuadVS;
-            const fs = shaderChunks.outputTex2DPS;
-            this._copyShader = createShaderFromCode(this, vs, fs, "outputTex2D");
+            this._copyShader = createShaderFromCode(this, _fullScreenQuadVS, _outputTexture2D, "outputTex2D");
         }
         return this._copyShader;
     }
diff --git a/src/index.js b/src/index.js
index aa69fea09..c59577138 100644
--- a/src/index.js
+++ b/src/index.js
@@ -35,17 +35,17 @@ export { Tracing } from './core/tracing.js';
 export { http, Http } from './net/http.js';
 
 // MATH
-export * from './math/constants.js';
-export { math } from './math/math.js';
-export { Color } from './math/color.js';
-export { Curve } from './math/curve.js';
-export { CurveSet } from './math/curve-set.js';
-export { Mat3 } from './math/mat3.js';
-export { Mat4 } from './math/mat4.js';
-export { Quat } from './math/quat.js';
-export { Vec2 } from './math/vec2.js';
-export { Vec3 } from './math/vec3.js';
-export { Vec4 } from './math/vec4.js';
+export * from './core/math/constants.js';
+export { math } from './core/math/math.js';
+export { Color } from './core/math/color.js';
+export { Curve } from './core/math/curve.js';
+export { CurveSet } from './core/math/curve-set.js';
+export { Mat3 } from './core/math/mat3.js';
+export { Mat4 } from './core/math/mat4.js';
+export { Quat } from './core/math/quat.js';
+export { Vec2 } from './core/math/vec2.js';
+export { Vec3 } from './core/math/vec3.js';
+export { Vec4 } from './core/math/vec4.js';
 
 // SHAPE
 export { BoundingBox } from './shape/bounding-box.js';
diff --git a/src/input/element-input.js b/src/input/element-input.js
index efa2d4f2d..5a8c4ea5f 100644
--- a/src/input/element-input.js
+++ b/src/input/element-input.js
@@ -1,7 +1,7 @@
 import { platform } from '../core/platform.js';
 
-import { Vec3 } from '../math/vec3.js';
-import { Vec4 } from '../math/vec4.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Vec4 } from '../core/math/vec4.js';
 
 import { Ray } from '../shape/ray.js';
 
diff --git a/src/net/http.js b/src/net/http.js
index bf030c639..643c79771 100644
--- a/src/net/http.js
+++ b/src/net/http.js
@@ -3,7 +3,7 @@ import { now } from '../core/time.js';
 import { path } from '../core/path.js';
 import { URI } from '../core/uri.js';
 
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 
 /**
  * Callback used by {@link Http#get}, {@link Http#post}, {@link Http#put}, {@link Http#del}, and
diff --git a/src/resources/animation.js b/src/resources/animation.js
index c340f7a58..4d9502aa0 100644
--- a/src/resources/animation.js
+++ b/src/resources/animation.js
@@ -1,7 +1,7 @@
 import { path } from '../core/path.js';
 
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { http, Http } from '../net/http.js';
 
diff --git a/src/resources/parser/glb-parser.js b/src/resources/parser/glb-parser.js
index 21cd7363c..6b93954f0 100644
--- a/src/resources/parser/glb-parser.js
+++ b/src/resources/parser/glb-parser.js
@@ -3,11 +3,11 @@ import { Debug } from '../../core/debug.js';
 
 import { http } from '../../net/http.js';
 
-import { math } from '../../math/math.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Vec2 } from '../../math/vec2.js';
-import { Vec3 } from '../../math/vec3.js';
-import { Color } from '../../math/color.js';
+import { math } from '../../core/math/math.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Color } from '../../core/math/color.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 
diff --git a/src/resources/parser/json-model.js b/src/resources/parser/json-model.js
index 0619ee941..32777df5a 100644
--- a/src/resources/parser/json-model.js
+++ b/src/resources/parser/json-model.js
@@ -1,7 +1,7 @@
 import { Debug } from '../../core/debug.js';
 
-import { Mat4 } from '../../math/mat4.js';
-import { Vec3 } from '../../math/vec3.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Vec3 } from '../../core/math/vec3.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 
diff --git a/src/resources/parser/material/json-standard-material.js b/src/resources/parser/material/json-standard-material.js
index 5b5f53c7c..ceb16668e 100644
--- a/src/resources/parser/material/json-standard-material.js
+++ b/src/resources/parser/material/json-standard-material.js
@@ -1,6 +1,6 @@
-import { Color } from '../../../math/color.js';
-import { Vec2 } from '../../../math/vec2.js';
-import { Vec3 } from '../../../math/vec3.js';
+import { Color } from '../../../core/math/color.js';
+import { Vec2 } from '../../../core/math/vec2.js';
+import { Vec3 } from '../../../core/math/vec3.js';
 
 import { Texture } from '../../../graphics/texture.js';
 
diff --git a/src/resources/texture-atlas.js b/src/resources/texture-atlas.js
index 30e7a805d..aa451de85 100644
--- a/src/resources/texture-atlas.js
+++ b/src/resources/texture-atlas.js
@@ -2,8 +2,8 @@ import { path } from '../core/path.js';
 
 import { http } from '../net/http.js';
 
-import { Vec2 } from '../math/vec2.js';
-import { Vec4 } from '../math/vec4.js';
+import { Vec2 } from '../core/math/vec2.js';
+import { Vec4 } from '../core/math/vec4.js';
 
 import {
     ADDRESS_CLAMP_TO_EDGE, ADDRESS_MIRRORED_REPEAT, ADDRESS_REPEAT,
diff --git a/src/scene/area-light-luts.js b/src/scene/area-light-luts.js
index 00d6328c5..562699320 100644
--- a/src/scene/area-light-luts.js
+++ b/src/scene/area-light-luts.js
@@ -1,4 +1,4 @@
-import { FloatPacking } from '../math/float-packing.js';
+import { FloatPacking } from '../core/math/float-packing.js';
 import { Texture } from '../graphics/texture.js';
 import { DeviceCache } from '../graphics/device-cache.js';
 
diff --git a/src/scene/batching/batch-manager.js b/src/scene/batching/batch-manager.js
index e6e7ab2b8..cc88b7164 100644
--- a/src/scene/batching/batch-manager.js
+++ b/src/scene/batching/batch-manager.js
@@ -1,8 +1,8 @@
 import { now } from '../../core/time.js';
 import { Debug } from '../../core/debug.js';
 
-import { Vec3 } from '../../math/vec3.js';
-import { Mat3 } from '../../math/mat3.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Mat3 } from '../../core/math/mat3.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 
diff --git a/src/scene/camera.js b/src/scene/camera.js
index b3131677f..550be6065 100644
--- a/src/scene/camera.js
+++ b/src/scene/camera.js
@@ -1,8 +1,8 @@
-import { Color } from '../math/color.js';
-import { Mat4 } from '../math/mat4.js';
-import { Vec3 } from '../math/vec3.js';
-import { Vec4 } from '../math/vec4.js';
-import { math } from '../math/math.js';
+import { Color } from '../core/math/color.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Vec4 } from '../core/math/vec4.js';
+import { math } from '../core/math/math.js';
 
 import { Frustum } from '../shape/frustum.js';
 
diff --git a/src/scene/graph-node.js b/src/scene/graph-node.js
index ceb170860..27490a2fb 100644
--- a/src/scene/graph-node.js
+++ b/src/scene/graph-node.js
@@ -2,10 +2,10 @@ import { EventHandler } from '../core/event-handler.js';
 import { Tags } from '../core/tags.js';
 import { Debug } from '../core/debug.js';
 
-import { Mat3 } from '../math/mat3.js';
-import { Mat4 } from '../math/mat4.js';
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Mat3 } from '../core/math/mat3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 const scaleCompensatePosTransform = new Mat4();
 const scaleCompensatePos = new Vec3();
diff --git a/src/scene/immediate/immediate-batch.js b/src/scene/immediate/immediate-batch.js
index eaa18b04b..92dca939f 100644
--- a/src/scene/immediate/immediate-batch.js
+++ b/src/scene/immediate/immediate-batch.js
@@ -1,4 +1,4 @@
-import { Mat4 } from '../../math/mat4.js';
+import { Mat4 } from '../../core/math/mat4.js';
 
 import { PRIMITIVE_LINES } from '../../graphics/constants.js';
 import { Mesh } from '../../scene/mesh.js';
diff --git a/src/scene/light.js b/src/scene/light.js
index 9b637acab..c512a6794 100644
--- a/src/scene/light.js
+++ b/src/scene/light.js
@@ -1,9 +1,9 @@
-import { math } from '../math/math.js';
-import { Color } from '../math/color.js';
-import { Mat4 } from '../math/mat4.js';
-import { Vec2 } from '../math/vec2.js';
-import { Vec3 } from '../math/vec3.js';
-import { Vec4 } from '../math/vec4.js';
+import { math } from '../core/math/math.js';
+import { Color } from '../core/math/color.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Vec2 } from '../core/math/vec2.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Vec4 } from '../core/math/vec4.js';
 
 import {
     BLUR_GAUSSIAN,
diff --git a/src/scene/lighting/light-texture-atlas.js b/src/scene/lighting/light-texture-atlas.js
index d8dfaff60..3c74a1bbf 100644
--- a/src/scene/lighting/light-texture-atlas.js
+++ b/src/scene/lighting/light-texture-atlas.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../math/vec2.js';
-import { Vec4 } from '../../math/vec4.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { Vec4 } from '../../core/math/vec4.js';
 
 import { RenderTarget } from '../../graphics/render-target.js';
 
diff --git a/src/scene/lighting/lighting-params.js b/src/scene/lighting/lighting-params.js
index d49e754a3..39f472f14 100644
--- a/src/scene/lighting/lighting-params.js
+++ b/src/scene/lighting/lighting-params.js
@@ -1,5 +1,5 @@
-import { Vec3 } from '../../math/vec3.js';
-import { math } from '../../math/math.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { math } from '../../core/math/math.js';
 import { SHADOW_PCF3 } from '../constants.js';
 
 /**
diff --git a/src/scene/lighting/lights-buffer.js b/src/scene/lighting/lights-buffer.js
index fa00d439b..91a40208d 100644
--- a/src/scene/lighting/lights-buffer.js
+++ b/src/scene/lighting/lights-buffer.js
@@ -1,6 +1,6 @@
-import { Vec3 } from '../../math/vec3.js';
+import { Vec3 } from '../../core/math/vec3.js';
 import { PIXELFORMAT_R8_G8_B8_A8, PIXELFORMAT_RGBA32F, ADDRESS_CLAMP_TO_EDGE, TEXTURETYPE_DEFAULT, FILTER_NEAREST } from '../../graphics/constants.js';
-import { FloatPacking } from '../../math/float-packing.js';
+import { FloatPacking } from '../../core/math/float-packing.js';
 import { LIGHTSHAPE_PUNCTUAL, LIGHTTYPE_SPOT, MASK_AFFECT_LIGHTMAPPED, MASK_AFFECT_DYNAMIC } from '../constants.js';
 import { Texture } from '../../graphics/texture.js';
 import { LightCamera } from '../renderer/light-camera.js';
diff --git a/src/scene/lighting/world-clusters-debug.js b/src/scene/lighting/world-clusters-debug.js
index 66e1b350a..a6a2218ea 100644
--- a/src/scene/lighting/world-clusters-debug.js
+++ b/src/scene/lighting/world-clusters-debug.js
@@ -1,6 +1,6 @@
-import { Color } from '../../math/color.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Vec3 } from '../../math/vec3.js';
+import { Color } from '../../core/math/color.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Vec3 } from '../../core/math/vec3.js';
 
 import { PRIMITIVE_TRIANGLES } from '../../graphics/constants.js';
 
diff --git a/src/scene/lighting/world-clusters.js b/src/scene/lighting/world-clusters.js
index 17f88ddad..2cbbacef0 100644
--- a/src/scene/lighting/world-clusters.js
+++ b/src/scene/lighting/world-clusters.js
@@ -1,5 +1,5 @@
-import { Vec3 } from '../../math/vec3.js';
-import { math } from '../../math/math.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { math } from '../../core/math/math.js';
 import { BoundingBox } from '../../shape/bounding-box.js';
 import { PIXELFORMAT_R8_G8_B8_A8 } from '../../graphics/constants.js';
 import { LIGHTTYPE_DIRECTIONAL, MASK_AFFECT_DYNAMIC, MASK_AFFECT_LIGHTMAPPED } from '../constants.js';
diff --git a/src/scene/lightmapper/bake-light-ambient.js b/src/scene/lightmapper/bake-light-ambient.js
index 8bd11e54d..037165b67 100644
--- a/src/scene/lightmapper/bake-light-ambient.js
+++ b/src/scene/lightmapper/bake-light-ambient.js
@@ -1,6 +1,6 @@
-import { Vec3 } from '../../math/vec3.js';
-import { random } from '../../math/random.js';
-import { Color } from '../../math/color.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { random } from '../../core/math/random.js';
+import { Color } from '../../core/math/color.js';
 import { Entity } from '../../framework/entity.js';
 import { SHADOW_PCF3 } from '../constants.js';
 import { BakeLight } from './bake-light.js';
diff --git a/src/scene/lightmapper/bake-light-simple.js b/src/scene/lightmapper/bake-light-simple.js
index 5354765e0..e751045e9 100644
--- a/src/scene/lightmapper/bake-light-simple.js
+++ b/src/scene/lightmapper/bake-light-simple.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../../math/vec2.js';
-import { random } from '../../math/random.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { random } from '../../core/math/random.js';
 import { LIGHTTYPE_DIRECTIONAL } from '../constants.js';
 import { BakeLight } from './bake-light.js';
 
diff --git a/src/scene/lightmapper/lightmapper.js b/src/scene/lightmapper/lightmapper.js
index 77490fcaf..1fd35dc3b 100644
--- a/src/scene/lightmapper/lightmapper.js
+++ b/src/scene/lightmapper/lightmapper.js
@@ -1,9 +1,9 @@
 import { now } from '../../core/time.js';
 import { Debug } from '../../core/debug.js';
 
-import { math } from '../../math/math.js';
-import { Color } from '../../math/color.js';
-import { Vec3 } from '../../math/vec3.js';
+import { math } from '../../core/math/math.js';
+import { Color } from '../../core/math/color.js';
+import { Vec3 } from '../../core/math/vec3.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 
diff --git a/src/scene/materials/basic-material.js b/src/scene/materials/basic-material.js
index 3f91ab618..3c81a0fbb 100644
--- a/src/scene/materials/basic-material.js
+++ b/src/scene/materials/basic-material.js
@@ -1,5 +1,5 @@
 import { Debug } from '../../core/debug.js';
-import { Color } from '../../math/color.js';
+import { Color } from '../../core/math/color.js';
 import {
     SHADERDEF_INSTANCING, SHADERDEF_MORPH_NORMAL, SHADERDEF_MORPH_POSITION, SHADERDEF_MORPH_TEXTURE_BASED,
     SHADERDEF_SCREENSPACE, SHADERDEF_SKIN
diff --git a/src/scene/materials/standard-material-options-builder.js b/src/scene/materials/standard-material-options-builder.js
index 2b8d8dd2d..103d283e2 100644
--- a/src/scene/materials/standard-material-options-builder.js
+++ b/src/scene/materials/standard-material-options-builder.js
@@ -15,7 +15,7 @@ import {
     SPECULAR_PHONG
 } from '../constants.js';
 
-import { Quat } from '../../math/quat.js';
+import { Quat } from '../../core/math/quat.js';
 
 const arraysEqual = (a, b) => {
     if (a.length !== b.length) {
diff --git a/src/scene/materials/standard-material.js b/src/scene/materials/standard-material.js
index e904ea2f1..224be54bc 100644
--- a/src/scene/materials/standard-material.js
+++ b/src/scene/materials/standard-material.js
@@ -1,9 +1,9 @@
 import { Debug } from '../../core/debug.js';
 
-import { Color } from '../../math/color.js';
-import { Vec2 } from '../../math/vec2.js';
-import { Quat } from '../../math/quat.js';
-import { math } from '../../math/math.js';
+import { Color } from '../../core/math/color.js';
+import { Vec2 } from '../../core/math/vec2.js';
+import { Quat } from '../../core/math/quat.js';
+import { math } from '../../core/math/math.js';
 
 import { _matTex2D, standard } from '../../graphics/program-lib/programs/standard.js';
 import { EnvLighting } from '../../graphics/env-lighting.js';
diff --git a/src/scene/mesh-instance.js b/src/scene/mesh-instance.js
index 47c6999ef..54ad7b989 100644
--- a/src/scene/mesh-instance.js
+++ b/src/scene/mesh-instance.js
@@ -28,7 +28,7 @@ import { LightmapCache } from './lightmapper/lightmap-cache.js';
 /** @typedef {import('../graphics/bind-group-format.js').BindGroupFormat} BindGroupFormat */
 /** @typedef {import('../graphics/uniform-buffer-format.js').UniformBufferFormat} UniformBufferFormat */
 /** @typedef {import('../graphics/graphics-device.js').GraphicsDevice} GraphicsDevice */
-/** @typedef {import('../math/vec3.js').Vec3} Vec3 */
+/** @typedef {import('../core/math/vec3.js').Vec3} Vec3 */
 /** @typedef {import('./materials/material.js').Material} Material */
 /** @typedef {import('./mesh.js').Mesh} Mesh */
 /** @typedef {import('./scene.js').Scene} Scene */
diff --git a/src/scene/mesh.js b/src/scene/mesh.js
index 1d836ad6f..0c7825b19 100644
--- a/src/scene/mesh.js
+++ b/src/scene/mesh.js
@@ -1,6 +1,6 @@
 import { Debug } from '../core/debug.js';
 import { RefCountedObject } from '../core/ref-counted-object.js';
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { BoundingBox } from '../shape/bounding-box.js';
 
diff --git a/src/scene/morph.js b/src/scene/morph.js
index 79e57e772..be334eb3f 100644
--- a/src/scene/morph.js
+++ b/src/scene/morph.js
@@ -1,7 +1,7 @@
 import { Debug } from '../core/debug.js';
 import { RefCountedObject } from '../core/ref-counted-object.js';
-import { Vec3 } from '../math/vec3.js';
-import { FloatPacking } from '../math/float-packing.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { FloatPacking } from '../core/math/float-packing.js';
 import { BoundingBox } from '../shape/bounding-box.js';
 import { Texture } from '../graphics/texture.js';
 import { VertexBuffer } from '../graphics/vertex-buffer.js';
diff --git a/src/scene/particle-system/cpu-updater.js b/src/scene/particle-system/cpu-updater.js
index 39241cd5a..19d400885 100644
--- a/src/scene/particle-system/cpu-updater.js
+++ b/src/scene/particle-system/cpu-updater.js
@@ -1,6 +1,6 @@
-import { math } from '../../math/math.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Vec3 } from '../../math/vec3.js';
+import { math } from '../../core/math/math.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Vec3 } from '../../core/math/vec3.js';
 
 import { EMITTERSHAPE_BOX, EMITTERSHAPE_SPHERE, PARTICLESORT_NONE } from '../../scene/constants.js';
 
diff --git a/src/scene/particle-system/gpu-updater.js b/src/scene/particle-system/gpu-updater.js
index 4ae244e82..a110bca85 100644
--- a/src/scene/particle-system/gpu-updater.js
+++ b/src/scene/particle-system/gpu-updater.js
@@ -1,7 +1,7 @@
-import { math } from '../../math/math.js';
-import { Mat3 } from '../../math/mat3.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Vec3 } from '../../math/vec3.js';
+import { math } from '../../core/math/math.js';
+import { Mat3 } from '../../core/math/mat3.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Vec3 } from '../../core/math/vec3.js';
 
 import { CULLFACE_NONE } from '../../graphics/constants.js';
 import { drawQuadWithShader } from '../../graphics/simple-post-effect.js';
diff --git a/src/scene/particle-system/particle-emitter.js b/src/scene/particle-system/particle-emitter.js
index c69473356..c8d0271cd 100644
--- a/src/scene/particle-system/particle-emitter.js
+++ b/src/scene/particle-system/particle-emitter.js
@@ -1,15 +1,15 @@
 import { now } from '../../core/time.js';
 import { Debug } from '../../core/debug.js';
 
-import { math } from '../../math/math.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Quat } from '../../math/quat.js';
-import { Vec3 } from '../../math/vec3.js';
+import { math } from '../../core/math/math.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Quat } from '../../core/math/quat.js';
+import { Vec3 } from '../../core/math/vec3.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 
-import { Curve } from '../../math/curve.js';
-import { CurveSet } from '../../math/curve-set.js';
+import { Curve } from '../../core/math/curve.js';
+import { CurveSet } from '../../core/math/curve-set.js';
 
 import {
     ADDRESS_CLAMP_TO_EDGE,
diff --git a/src/scene/picker.js b/src/scene/picker.js
index 768798753..98737a0d6 100644
--- a/src/scene/picker.js
+++ b/src/scene/picker.js
@@ -1,4 +1,4 @@
-import { Color } from '../math/color.js';
+import { Color } from '../core/math/color.js';
 
 import { ADDRESS_CLAMP_TO_EDGE, CLEARFLAG_DEPTH, FILTER_NEAREST, PIXELFORMAT_R8_G8_B8_A8 } from '../graphics/constants.js';
 import { GraphicsDevice } from '../graphics/graphics-device.js';
diff --git a/src/scene/procedural.js b/src/scene/procedural.js
index f6891f852..8f1e8b9b6 100644
--- a/src/scene/procedural.js
+++ b/src/scene/procedural.js
@@ -1,5 +1,5 @@
-import { Vec2 } from '../math/vec2.js';
-import { Vec3 } from '../math/vec3.js';
+import { Vec2 } from '../core/math/vec2.js';
+import { Vec3 } from '../core/math/vec3.js';
 import { Debug } from '../core/debug.js';
 
 import {
diff --git a/src/scene/renderer/cookie-renderer.js b/src/scene/renderer/cookie-renderer.js
index cde6ed416..1257bfbbe 100644
--- a/src/scene/renderer/cookie-renderer.js
+++ b/src/scene/renderer/cookie-renderer.js
@@ -1,5 +1,5 @@
-import { Vec4 } from '../../math/vec4.js';
-import { Mat4 } from '../../math/mat4.js';
+import { Vec4 } from '../../core/math/vec4.js';
+import { Mat4 } from '../../core/math/mat4.js';
 
 import { ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_R8_G8_B8_A8 } from '../../graphics/constants.js';
 import { Texture } from '../../graphics/texture.js';
diff --git a/src/scene/renderer/forward-renderer.js b/src/scene/renderer/forward-renderer.js
index 9db4af254..f9a13a613 100644
--- a/src/scene/renderer/forward-renderer.js
+++ b/src/scene/renderer/forward-renderer.js
@@ -1,10 +1,10 @@
 import { now } from '../../core/time.js';
 import { Debug, DebugHelper } from '../../core/debug.js';
 
-import { Mat3 } from '../../math/mat3.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Vec3 } from '../../math/vec3.js';
-import { Color } from '../../math/color.js';
+import { Mat3 } from '../../core/math/mat3.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Color } from '../../core/math/color.js';
 
 import { BoundingSphere } from '../../shape/bounding-sphere.js';
 
diff --git a/src/scene/renderer/light-camera.js b/src/scene/renderer/light-camera.js
index c57d0ed8d..160283c0c 100644
--- a/src/scene/renderer/light-camera.js
+++ b/src/scene/renderer/light-camera.js
@@ -1,6 +1,6 @@
-import { Quat } from '../../math/quat.js';
-import { Vec3 } from '../../math/vec3.js';
-import { Mat4 } from '../../math/mat4.js';
+import { Quat } from '../../core/math/quat.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Mat4 } from '../../core/math/mat4.js';
 
 import { ASPECT_MANUAL, LIGHTTYPE_DIRECTIONAL, LIGHTTYPE_OMNI, LIGHTTYPE_SPOT, PROJECTION_ORTHOGRAPHIC, PROJECTION_PERSPECTIVE } from '../constants.js';
 import { Camera } from '../camera.js';
diff --git a/src/scene/renderer/shadow-renderer.js b/src/scene/renderer/shadow-renderer.js
index 809342894..1d178d579 100644
--- a/src/scene/renderer/shadow-renderer.js
+++ b/src/scene/renderer/shadow-renderer.js
@@ -1,10 +1,10 @@
 import { Debug } from '../../core/debug.js';
 
-import { math } from '../../math/math.js';
-import { Vec3 } from '../../math/vec3.js';
-import { Vec4 } from '../../math/vec4.js';
-import { Mat4 } from '../../math/mat4.js';
-import { Color } from '../../math/color.js';
+import { math } from '../../core/math/math.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Vec4 } from '../../core/math/vec4.js';
+import { Mat4 } from '../../core/math/mat4.js';
+import { Color } from '../../core/math/color.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 
diff --git a/src/scene/renderer/static-meshes.js b/src/scene/renderer/static-meshes.js
index 18f3ed248..77e02fecf 100644
--- a/src/scene/renderer/static-meshes.js
+++ b/src/scene/renderer/static-meshes.js
@@ -1,6 +1,6 @@
 import { now } from '../../core/time.js';
-import { Vec3 } from '../../math/vec3.js';
-import { Mat4 } from '../../math/mat4.js';
+import { Vec3 } from '../../core/math/vec3.js';
+import { Mat4 } from '../../core/math/mat4.js';
 
 import { BoundingBox } from '../../shape/bounding-box.js';
 import { BoundingSphere } from '../../shape/bounding-sphere.js';
diff --git a/src/scene/scene.js b/src/scene/scene.js
index 9e4f7f468..91a0ad38c 100644
--- a/src/scene/scene.js
+++ b/src/scene/scene.js
@@ -1,9 +1,9 @@
 import { EventHandler } from '../core/event-handler.js';
 
-import { Color } from '../math/color.js';
-import { Vec3 } from '../math/vec3.js';
-import { Quat } from '../math/quat.js';
-import { math } from '../math/math.js';
+import { Color } from '../core/math/color.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Quat } from '../core/math/quat.js';
+import { math } from '../core/math/math.js';
 
 import { BAKE_COLORDIR, FOG_NONE, GAMMA_SRGB, LAYERID_IMMEDIATE } from './constants.js';
 import { Sky } from './sky.js';
diff --git a/src/scene/skin-instance.js b/src/scene/skin-instance.js
index 4147fd83e..9fb7f7e11 100644
--- a/src/scene/skin-instance.js
+++ b/src/scene/skin-instance.js
@@ -1,6 +1,6 @@
 import { Debug } from '../core/debug.js';
-import { math } from '../math/math.js';
-import { Mat4 } from '../math/mat4.js';
+import { math } from '../core/math/math.js';
+import { Mat4 } from '../core/math/mat4.js';
 
 import { FILTER_NEAREST, PIXELFORMAT_RGBA32F } from '../graphics/constants.js';
 import { Texture } from '../graphics/texture.js';
diff --git a/src/scene/skin.js b/src/scene/skin.js
index 13c480622..d5e74a533 100644
--- a/src/scene/skin.js
+++ b/src/scene/skin.js
@@ -1,5 +1,5 @@
 /** @typedef {import('../graphics/graphics-device.js').GraphicsDevice} GraphicsDevice */
-/** @typedef {import('../math/mat4.js').Mat4} Mat4 */
+/** @typedef {import('../core/math/mat4.js').Mat4} Mat4 */
 
 /**
  * A skin contains data about the bones in a hierarchy that drive a skinned mesh animation.
diff --git a/src/scene/sky.js b/src/scene/sky.js
index b4efecdb4..ec1bb68ea 100644
--- a/src/scene/sky.js
+++ b/src/scene/sky.js
@@ -1,7 +1,7 @@
-import { Mat3 } from '../math/mat3.js';
-import { Mat4 } from '../math/mat4.js';
-import { Vec3 } from '../math/vec3.js';
-import { Quat } from '../math/quat.js';
+import { Mat3 } from '../core/math/mat3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Quat } from '../core/math/quat.js';
 
 import { CULLFACE_FRONT } from '../graphics/constants.js';
 
diff --git a/src/scene/sprite.js b/src/scene/sprite.js
index cbbc5ca3b..00ade81fc 100644
--- a/src/scene/sprite.js
+++ b/src/scene/sprite.js
@@ -1,6 +1,6 @@
 import { EventHandler } from '../core/event-handler.js';
 
-import { Vec2 } from '../math/vec2.js';
+import { Vec2 } from '../core/math/vec2.js';
 
 import { SPRITE_RENDERMODE_SIMPLE, SPRITE_RENDERMODE_SLICED, SPRITE_RENDERMODE_TILED } from './constants.js';
 import { createMesh } from './procedural.js';
diff --git a/src/scene/texture-atlas.js b/src/scene/texture-atlas.js
index 4422dc745..269fe99ee 100644
--- a/src/scene/texture-atlas.js
+++ b/src/scene/texture-atlas.js
@@ -1,7 +1,7 @@
 import { EventHandler } from '../core/event-handler.js';
 
-/** @typedef {import('../math/vec2.js').Vec2} Vec2 */
-/** @typedef {import('../math/vec4.js').Vec4} Vec4 */
+/** @typedef {import('../core/math/vec2.js').Vec2} Vec2 */
+/** @typedef {import('../core/math/vec4.js').Vec4} Vec4 */
 /** @typedef {import('../graphics/texture.js').Texture} Texture */
 
 /**
diff --git a/src/script/script-attributes.js b/src/script/script-attributes.js
index 5cb680abd..02bbc0668 100644
--- a/src/script/script-attributes.js
+++ b/src/script/script-attributes.js
@@ -1,11 +1,11 @@
 import { Debug } from '../core/debug.js';
 
-import { Color } from '../math/color.js';
-import { Curve } from '../math/curve.js';
-import { CurveSet } from '../math/curve-set.js';
-import { Vec2 } from '../math/vec2.js';
-import { Vec3 } from '../math/vec3.js';
-import { Vec4 } from '../math/vec4.js';
+import { Color } from '../core/math/color.js';
+import { Curve } from '../core/math/curve.js';
+import { CurveSet } from '../core/math/curve-set.js';
+import { Vec2 } from '../core/math/vec2.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Vec4 } from '../core/math/vec4.js';
 
 import { GraphNode } from '../scene/graph-node.js';
 
diff --git a/src/shape/bounding-box.js b/src/shape/bounding-box.js
index eed6f6c7f..22d0eba10 100644
--- a/src/shape/bounding-box.js
+++ b/src/shape/bounding-box.js
@@ -1,7 +1,7 @@
 import { Debug } from '../core/debug.js';
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
-/** @typedef {import('../math/mat4.js').Mat4} Mat4 */
+/** @typedef {import('../core/math/mat4.js').Mat4} Mat4 */
 /** @typedef {import('./bounding-sphere.js').BoundingSphere} BoundingSphere */
 /** @typedef {import('./ray.js').Ray} Ray */
 
diff --git a/src/shape/bounding-sphere.js b/src/shape/bounding-sphere.js
index 04abe2832..0fa252677 100644
--- a/src/shape/bounding-sphere.js
+++ b/src/shape/bounding-sphere.js
@@ -1,5 +1,5 @@
 import { Debug } from '../core/debug.js';
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /** @typedef {import('./ray.js').Ray} Ray */
 
diff --git a/src/shape/frustum.js b/src/shape/frustum.js
index 65ab490c1..6f7f7c27b 100644
--- a/src/shape/frustum.js
+++ b/src/shape/frustum.js
@@ -1,7 +1,7 @@
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 import { PROJECTION_PERSPECTIVE } from '../scene/constants.js';
 
-/** @typedef {import('../math/mat4.js').Mat4} Mat4 */
+/** @typedef {import('../core/math/mat4.js').Mat4} Mat4 */
 /** @typedef {import('./bounding-sphere.js').BoundingSphere} BoundingSphere */
 
 const _frustumPoints = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];
diff --git a/src/shape/oriented-box.js b/src/shape/oriented-box.js
index bb0fbce28..79c61c262 100644
--- a/src/shape/oriented-box.js
+++ b/src/shape/oriented-box.js
@@ -1,6 +1,6 @@
 import { Debug } from '../core/debug.js';
-import { Mat4 } from '../math/mat4.js';
-import { Vec3 } from '../math/vec3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { BoundingBox } from './bounding-box.js';
 import { BoundingSphere } from './bounding-sphere.js';
diff --git a/src/shape/plane.js b/src/shape/plane.js
index d2b5b9a8c..307913e0b 100644
--- a/src/shape/plane.js
+++ b/src/shape/plane.js
@@ -1,4 +1,4 @@
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /** @typedef {import('./ray.js').Ray} Ray */
 
diff --git a/src/shape/ray.js b/src/shape/ray.js
index 1a117b3af..44e024a46 100644
--- a/src/shape/ray.js
+++ b/src/shape/ray.js
@@ -1,5 +1,5 @@
 import { Debug } from '../core/debug.js';
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /**
  * An infinite ray.
diff --git a/src/sound/instance.js b/src/sound/instance.js
index 37b987b60..60dcebea5 100644
--- a/src/sound/instance.js
+++ b/src/sound/instance.js
@@ -1,6 +1,6 @@
 import { EventHandler } from '../core/event-handler.js';
 
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 
 import { hasAudioContext } from '../audio/capabilities.js';
 
diff --git a/src/sound/instance3d.js b/src/sound/instance3d.js
index 552aecc57..6298accef 100644
--- a/src/sound/instance3d.js
+++ b/src/sound/instance3d.js
@@ -1,7 +1,7 @@
 import { Debug } from '../core/debug.js';
 
-import { math } from '../math/math.js';
-import { Vec3 } from '../math/vec3.js';
+import { math } from '../core/math/math.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { DISTANCE_EXPONENTIAL, DISTANCE_INVERSE, DISTANCE_LINEAR } from '../audio/constants.js';
 import { hasAudioContext } from '../audio/capabilities.js';
diff --git a/src/sound/listener.js b/src/sound/listener.js
index d8c1b274c..38a1e0d3d 100644
--- a/src/sound/listener.js
+++ b/src/sound/listener.js
@@ -1,7 +1,7 @@
 import { Debug } from '../core/debug.js';
 
-import { Vec3 } from '../math/vec3.js';
-import { Mat4 } from '../math/mat4.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Mat4 } from '../core/math/mat4.js';
 
 /** @typedef {import('./manager.js').SoundManager} SoundManager */
 
diff --git a/src/sound/manager.js b/src/sound/manager.js
index 0df218fc5..5e92c4c7c 100644
--- a/src/sound/manager.js
+++ b/src/sound/manager.js
@@ -2,7 +2,7 @@ import { Debug } from '../core/debug.js';
 
 import { EventHandler } from '../core/event-handler.js';
 
-import { math } from '../math/math.js';
+import { math } from '../core/math/math.js';
 
 import { hasAudioContext } from '../audio/capabilities.js';
 import { Channel } from '../audio/channel.js';
diff --git a/src/xr/xr-depth-sensing.js b/src/xr/xr-depth-sensing.js
index adf37128e..d295fdd46 100644
--- a/src/xr/xr-depth-sensing.js
+++ b/src/xr/xr-depth-sensing.js
@@ -1,6 +1,6 @@
 import { platform } from '../core/platform.js';
 import { EventHandler } from '../core/event-handler.js';
-import { Mat4 } from '../math/mat4.js';
+import { Mat4 } from '../core/math/mat4.js';
 import { Texture } from '../graphics/texture.js';
 import { ADDRESS_CLAMP_TO_EDGE, PIXELFORMAT_L8_A8, FILTER_LINEAR } from '../graphics/constants.js';
 import { XRDEPTHSENSINGUSAGE_CPU, XRDEPTHSENSINGUSAGE_GPU } from './constants.js';
diff --git a/src/xr/xr-hand.js b/src/xr/xr-hand.js
index f3787c7a2..14c678f9f 100644
--- a/src/xr/xr-hand.js
+++ b/src/xr/xr-hand.js
@@ -6,7 +6,7 @@ import { XRHAND_LEFT } from './constants.js';
 import { XrFinger } from './xr-finger.js';
 import { XrJoint } from './xr-joint.js';
 
-import { Vec3 } from '../math/vec3.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /** @typedef {import('./xr-input-source.js').XrInputSource} XrInputSource */
 /** @typedef {import('./xr-manager.js').XrManager} XrManager */
diff --git a/src/xr/xr-input-source.js b/src/xr/xr-input-source.js
index 2403d31fa..bb6d5f7d1 100644
--- a/src/xr/xr-input-source.js
+++ b/src/xr/xr-input-source.js
@@ -1,8 +1,8 @@
 import { EventHandler } from '../core/event-handler.js';
 
-import { Mat4 } from '../math/mat4.js';
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { Ray } from '../shape/ray.js';
 
diff --git a/src/xr/xr-joint.js b/src/xr/xr-joint.js
index 1408f1c1f..9eacf0b7f 100644
--- a/src/xr/xr-joint.js
+++ b/src/xr/xr-joint.js
@@ -1,7 +1,7 @@
 import { platform } from '../core/platform.js';
-import { Mat4 } from '../math/mat4.js';
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /** @typedef {import('./xr-finger.js').XrFinger} XrFinger */
 /** @typedef {import('./xr-hand.js').XrHand} XrHand */
diff --git a/src/xr/xr-light-estimation.js b/src/xr/xr-light-estimation.js
index e82b46e00..2a7e457ed 100644
--- a/src/xr/xr-light-estimation.js
+++ b/src/xr/xr-light-estimation.js
@@ -1,9 +1,9 @@
 import { EventHandler } from '../core/event-handler.js';
 
-import { Color } from '../math/color.js';
-import { Mat4 } from '../math/mat4.js';
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Color } from '../core/math/color.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 import { XRTYPE_AR } from './constants.js';
 
diff --git a/src/xr/xr-manager.js b/src/xr/xr-manager.js
index d51d7e049..3e5cff1b0 100644
--- a/src/xr/xr-manager.js
+++ b/src/xr/xr-manager.js
@@ -1,11 +1,11 @@
 import { platform } from '../core/platform.js';
 import { EventHandler } from '../core/event-handler.js';
 
-import { Mat3 } from '../math/mat3.js';
-import { Mat4 } from '../math/mat4.js';
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
-import { Vec4 } from '../math/vec4.js';
+import { Mat3 } from '../core/math/mat3.js';
+import { Mat4 } from '../core/math/mat4.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Vec4 } from '../core/math/vec4.js';
 
 import { XRTYPE_INLINE, XRTYPE_VR, XRTYPE_AR, XRDEPTHSENSINGUSAGE_CPU, XRDEPTHSENSINGFORMAT_L8A8 } from './constants.js';
 import { XrHitTest } from './xr-hit-test.js';
diff --git a/src/xr/xr-plane.js b/src/xr/xr-plane.js
index c857233ff..1b0d87283 100644
--- a/src/xr/xr-plane.js
+++ b/src/xr/xr-plane.js
@@ -1,6 +1,6 @@
 import { EventHandler } from '../core/event-handler.js';
-import { Vec3 } from '../math/vec3.js';
-import { Quat } from '../math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Quat } from '../core/math/quat.js';
 
 /** @typedef {import('./xr-plane-detection.js').XrPlaneDetection} XrPlaneDetection */
 
diff --git a/src/xr/xr-tracked-image.js b/src/xr/xr-tracked-image.js
index b2a5ca557..a0ebac2d4 100644
--- a/src/xr/xr-tracked-image.js
+++ b/src/xr/xr-tracked-image.js
@@ -1,6 +1,6 @@
 import { EventHandler } from '../core/event-handler.js';
-import { Vec3 } from '../math/vec3.js';
-import { Quat } from '../math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
+import { Quat } from '../core/math/quat.js';
 
 /**
  * The tracked image interface that is created by the Image Tracking system and is provided as a


Test patch:
diff --git a/src/graphics/program-lib/chunks/common/frag/precisionTest.js b/src/graphics/program-lib/chunks/common/frag/precisionTest.js
deleted file mode 100644
index 4305440a6..000000000
--- a/src/graphics/program-lib/chunks/common/frag/precisionTest.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default /* glsl */`
-void main(void) {
-    gl_FragColor = vec4(2147483648.0);
-}
-`;
diff --git a/src/graphics/program-lib/chunks/common/frag/precisionTest2.js b/src/graphics/program-lib/chunks/common/frag/precisionTest2.js
deleted file mode 100644
index 941ce53c7..000000000
--- a/src/graphics/program-lib/chunks/common/frag/precisionTest2.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export default /* glsl */`
-uniform sampler2D source;
-
-vec4 packFloat(float depth) {
-    const vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);
-    const vec4 bit_mask  = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
-
-    vec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);
-    res -= res.xxyz * bit_mask;
-    return res;
-}
-
-void main(void) {
-    float c = texture2D(source, vec2(0.0)).r;
-    float diff = abs(c - 2147483648.0) / 2147483648.0;
-    gl_FragColor = packFloat(diff);
-}
-`;
diff --git a/src/xr/xr-hit-test-source.js b/src/xr/xr-hit-test-source.js
index 6b3fc9029..98d3392e6 100644
--- a/src/xr/xr-hit-test-source.js
+++ b/src/xr/xr-hit-test-source.js
@@ -1,7 +1,7 @@
 import { EventHandler } from '../core/event-handler.js';
 
-import { Quat } from '../math/quat.js';
-import { Vec3 } from '../math/vec3.js';
+import { Quat } from '../core/math/quat.js';
+import { Vec3 } from '../core/math/vec3.js';
 
 /** @typedef {import('./xr-manager.js').XrManager} XrManager */
 
diff --git a/test/README.md b/test/README.md
index 99ed36594..8ef8e35c0 100644
--- a/test/README.md
+++ b/test/README.md
@@ -26,7 +26,7 @@ npm run test:coverage
 The PlayCanvas Engine is made up of ES Modules. Each module should have a corresponding unit test module. For example:
 
 ```
-/src/math/vec3.js
+/src/core/math/vec3.js
 ```
 
 ...has the corresponding unit test module:
diff --git a/test/framework/components/layout-group/layout-calculator.test.mjs b/test/framework/components/layout-group/layout-calculator.test.mjs
index 4ad46668e..81f138dca 100644
--- a/test/framework/components/layout-group/layout-calculator.test.mjs
+++ b/test/framework/components/layout-group/layout-calculator.test.mjs
@@ -4,8 +4,8 @@ import { FITTING_BOTH, FITTING_NONE, FITTING_SHRINK, FITTING_STRETCH } from '../
 import { Application } from '../../../../src/framework/application.js';
 import { Entity } from '../../../../src/framework/entity.js';
 import { LayoutCalculator } from '../../../../src/framework/components/layout-group/layout-calculator.js';
-import { Vec2 } from '../../../../src/math/vec2.js';
-import { Vec4 } from '../../../../src/math/vec4.js';
+import { Vec2 } from '../../../../src/core/math/vec2.js';
+import { Vec4 } from '../../../../src/core/math/vec4.js';
 
 import { HTMLCanvasElement } from '@playcanvas/canvas-mock';
 
diff --git a/test/framework/components/system.test.mjs b/test/framework/components/system.test.mjs
index a8bdb15bf..e203d71b3 100644
--- a/test/framework/components/system.test.mjs
+++ b/test/framework/components/system.test.mjs
@@ -1,9 +1,9 @@
 import { Application } from '../../../src/framework/application.js';
-import { Color } from '../../../src/math/color.js';
+import { Color } from '../../../src/core/math/color.js';
 import { ComponentSystem } from '../../../src/framework/components/system.js';
-import { Vec2 } from '../../../src/math/vec2.js';
-import { Vec3 } from '../../../src/math/vec3.js';
-import { Vec4 } from '../../../src/math/vec4.js';
+import { Vec2 } from '../../../src/core/math/vec2.js';
+import { Vec3 } from '../../../src/core/math/vec3.js';
+import { Vec4 } from '../../../src/core/math/vec4.js';
 
 import { HTMLCanvasElement } from '@playcanvas/canvas-mock';
 
diff --git a/test/framework/entity.test.mjs b/test/framework/entity.test.mjs
index 30dac4124..1e75e6f9b 100644
--- a/test/framework/entity.test.mjs
+++ b/test/framework/entity.test.mjs
@@ -1,5 +1,5 @@
 import { createScript } from '../../src/script/script.js';
-import { Color } from '../../src/math/color.js';
+import { Color } from '../../src/core/math/color.js';
 
 import { AnimComponent } from '../../src/framework/components/anim/component.js';
 import { AnimationComponent } from '../../src/framework/components/animation/component.js';
diff --git a/test/math/color.test.mjs b/test/math/color.test.mjs
index d6381d797..5ae74a926 100644
--- a/test/math/color.test.mjs
+++ b/test/math/color.test.mjs
@@ -1,4 +1,4 @@
-import { Color } from '../../src/math/color.js';
+import { Color } from '../../src/core/math/color.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/curve-set.test.mjs b/test/math/curve-set.test.mjs
index c7e2d033b..fa2acffe8 100644
--- a/test/math/curve-set.test.mjs
+++ b/test/math/curve-set.test.mjs
@@ -1,5 +1,5 @@
-import { CURVE_LINEAR, CURVE_SMOOTHSTEP, CURVE_SPLINE, CURVE_STEP } from '../../src/math/constants.js';
-import { CurveSet } from '../../src/math/curve-set.js';
+import { CURVE_LINEAR, CURVE_SMOOTHSTEP, CURVE_SPLINE, CURVE_STEP } from '../../src/core/math/constants.js';
+import { CurveSet } from '../../src/core/math/curve-set.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/curve.test.mjs b/test/math/curve.test.mjs
index 0198a3c06..e4e02014e 100644
--- a/test/math/curve.test.mjs
+++ b/test/math/curve.test.mjs
@@ -1,5 +1,5 @@
-import { CURVE_LINEAR, CURVE_SMOOTHSTEP, CURVE_SPLINE, CURVE_STEP } from '../../src/math/constants.js';
-import { Curve } from '../../src/math/curve.js';
+import { CURVE_LINEAR, CURVE_SMOOTHSTEP, CURVE_SPLINE, CURVE_STEP } from '../../src/core/math/constants.js';
+import { Curve } from '../../src/core/math/curve.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/mat4.test.mjs b/test/math/mat4.test.mjs
index b9c1293b0..032a8fc0c 100644
--- a/test/math/mat4.test.mjs
+++ b/test/math/mat4.test.mjs
@@ -1,7 +1,7 @@
-import { Mat4 } from '../../src/math/mat4.js';
-import { Quat } from '../../src/math/quat.js';
-import { Vec3 } from '../../src/math/vec3.js';
-import { Vec4 } from '../../src/math/vec4.js';
+import { Mat4 } from '../../src/core/math/mat4.js';
+import { Quat } from '../../src/core/math/quat.js';
+import { Vec3 } from '../../src/core/math/vec3.js';
+import { Vec4 } from '../../src/core/math/vec4.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/math.test.mjs b/test/math/math.test.mjs
index ad26d682a..c4ac40ca4 100644
--- a/test/math/math.test.mjs
+++ b/test/math/math.test.mjs
@@ -1,4 +1,4 @@
-import { math } from '../../src/math/math.js';
+import { math } from '../../src/core/math/math.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/quat.test.mjs b/test/math/quat.test.mjs
index bf3b34361..94a70544e 100644
--- a/test/math/quat.test.mjs
+++ b/test/math/quat.test.mjs
@@ -1,6 +1,6 @@
-import { Mat4 } from '../../src/math/mat4.js';
-import { Quat } from '../../src/math/quat.js';
-import { Vec3 } from '../../src/math/vec3.js';
+import { Mat4 } from '../../src/core/math/mat4.js';
+import { Quat } from '../../src/core/math/quat.js';
+import { Vec3 } from '../../src/core/math/vec3.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/vec2.test.mjs b/test/math/vec2.test.mjs
index e95471089..498c28ffe 100644
--- a/test/math/vec2.test.mjs
+++ b/test/math/vec2.test.mjs
@@ -1,4 +1,4 @@
-import { Vec2 } from '../../src/math/vec2.js';
+import { Vec2 } from '../../src/core/math/vec2.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/vec3.test.mjs b/test/math/vec3.test.mjs
index 644245766..a439e98a7 100644
--- a/test/math/vec3.test.mjs
+++ b/test/math/vec3.test.mjs
@@ -1,4 +1,4 @@
-import { Vec3 } from '../../src/math/vec3.js';
+import { Vec3 } from '../../src/core/math/vec3.js';
 
 import { expect } from 'chai';
 
diff --git a/test/math/vec4.test.mjs b/test/math/vec4.test.mjs
index bdf7fa0d7..b841d8090 100644
--- a/test/math/vec4.test.mjs
+++ b/test/math/vec4.test.mjs
@@ -1,4 +1,4 @@
-import { Vec4 } from '../../src/math/vec4.js';
+import { Vec4 } from '../../src/core/math/vec4.js';
 
 import { expect } from 'chai';
 
diff --git a/test/scene/graph-node.test.mjs b/test/scene/graph-node.test.mjs
index e30faa061..1741c1d22 100644
--- a/test/scene/graph-node.test.mjs
+++ b/test/scene/graph-node.test.mjs
@@ -1,8 +1,8 @@
 import { GraphNode } from '../../src/scene/graph-node.js';
-import { Mat4 } from '../../src/math/mat4.js';
-import { Quat } from '../../src/math/quat.js';
+import { Mat4 } from '../../src/core/math/mat4.js';
+import { Quat } from '../../src/core/math/quat.js';
 import { Tags } from '../../src/core/tags.js';
-import { Vec3 } from '../../src/math/vec3.js';
+import { Vec3 } from '../../src/core/math/vec3.js';
 
 import { expect } from 'chai';
 
diff --git a/test/scene/materials/basic-material.test.mjs b/test/scene/materials/basic-material.test.mjs
index e71776f11..e4cb48b00 100644
--- a/test/scene/materials/basic-material.test.mjs
+++ b/test/scene/materials/basic-material.test.mjs
@@ -1,5 +1,5 @@
 import { BasicMaterial } from '../../../src/scene/materials/basic-material.js';
-import { Color } from '../../../src/math/color.js';
+import { Color } from '../../../src/core/math/color.js';
 import { Material } from '../../../src/scene/materials/material.js';
 
 import { expect } from 'chai';
diff --git a/test/scene/materials/standard-material.test.mjs b/test/scene/materials/standard-material.test.mjs
index 67cf73916..6e8bfd5a1 100644
--- a/test/scene/materials/standard-material.test.mjs
+++ b/test/scene/materials/standard-material.test.mjs
@@ -1,8 +1,8 @@
 import { CUBEPROJ_NONE, DETAILMODE_MUL, FRESNEL_SCHLICK, SPECOCC_AO, SPECULAR_BLINN } from '../../../src/scene/constants.js';
-import { Color } from '../../../src/math/color.js';
+import { Color } from '../../../src/core/math/color.js';
 import { Material } from '../../../src/scene/materials/material.js';
 import { StandardMaterial } from '../../../src/scene/materials/standard-material.js';
-import { Vec2 } from '../../../src/math/vec2.js';
+import { Vec2 } from '../../../src/core/math/vec2.js';
 
 import { expect } from 'chai';