@1pizzateam/roostr 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/roostr.js +8 -13
  2. package/package.json +2 -2
package/dist/roostr.js CHANGED
@@ -3148,21 +3148,16 @@ class Sphere extends BasicMesh {
3148
3148
  const sy = scale.y;
3149
3149
  const sz = scale.z;
3150
3150
  if (sx !== 1 || sy !== 1 || sz !== 1) {
3151
- for (let i = 0; i < this.vertices.length; i += 3) {
3152
- this.vertices[i] *= sx;
3153
- this.vertices[i + 1] *= sy;
3154
- this.vertices[i + 2] *= sz;
3155
- }
3156
- if (sx !== sy || sy !== sz)
3151
+ new Mat4x3().scale(scale).transformPoints(this.vertices);
3152
+ if (sx !== sy || sy !== sz) {
3153
+ new Mat4x3().scale(new Vec3(1 / sx, 1 / sy, 1 / sz)).transformDirections(this.normals);
3157
3154
  for (let i = 0; i < this.normals.length; i += 3) {
3158
- const nx = this.normals[i] / sx;
3159
- const ny = this.normals[i + 1] / sy;
3160
- const nz = this.normals[i + 2] / sz;
3161
- const len = Math.hypot(nx, ny, nz) || 1.0;
3162
- this.normals[i] = nx / len;
3163
- this.normals[i + 1] = ny / len;
3164
- this.normals[i + 2] = nz / len;
3155
+ const len = Math.hypot(this.normals[i], this.normals[i + 1], this.normals[i + 2]) || 1.0;
3156
+ this.normals[i] /= len;
3157
+ this.normals[i + 1] /= len;
3158
+ this.normals[i + 2] /= len;
3165
3159
  }
3160
+ }
3166
3161
  }
3167
3162
  }
3168
3163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1pizzateam/roostr",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "WebGL 3D engine written in TypeScript",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -62,6 +62,6 @@
62
62
  "typescript": "6.0.3"
63
63
  },
64
64
  "dependencies": {
65
- "@1pizzateam/spock": "4.5.0"
65
+ "@1pizzateam/spock": "4.6.0"
66
66
  }
67
67
  }