Skip to content

Commit

Permalink
refactor(shader-ast-js): update modulo handling
Browse files Browse the repository at this point in the history
- reflecting changes in thi.ng/math
  • Loading branch information
postspectacular committed Apr 24, 2021
1 parent 6679b52 commit 63eb749
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions packages/shader-ast-js/src/env/float.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
clamp,
deg,
fmod,
fract,
mix,
mod,
rad,
smoothStep,
step,
Expand Down Expand Up @@ -34,8 +34,8 @@ export const FLOAT: JSBuiltinsFloat<number> = {
min: Math.min,
mix,
mixn: mix,
mod: fmod,
modn: fmod,
mod,
modn: mod,
pow: Math.pow,
radians: rad,
sign: Math.sign,
Expand Down
12 changes: 6 additions & 6 deletions packages/shader-ast-js/src/env/ivec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
bitXorI2,
divI2,
divNI2,
fmod2,
fmodN2,
lshiftI2,
mod2,
modN2,
mulI2,
mulNI2,
rshiftI2,
subI2,
subNI2,
} from "@thi.ng/vectors";
import { VEC2 } from "./vec2";
import type { JSBuiltinsIntVec } from "../api";
import { VEC2 } from "./vec2";

export const IVEC2: JSBuiltinsIntVec = {
...VEC2,
Expand All @@ -27,9 +27,9 @@ export const IVEC2: JSBuiltinsIntVec = {
div: (a, b) => divI2([], a, b),
divvn: (a, b) => divNI2([], a, b),
divnv: (a, b) => divI2(null, [a, a], b),
modi: (a, b) => mod2([], a, b),
modivn: (a, b) => modN2([], a, b),
modinv: (a, b) => mod2(null, [a, a], b),
modi: (a, b) => fmod2([], a, b),
modivn: (a, b) => fmodN2([], a, b),
modinv: (a, b) => fmod2(null, [a, a], b),
mul: (a, b) => mulI2([], a, b),
mulvn: (a, b) => mulNI2([], a, b),
mulnv: (a, b) => mulNI2([], b, a),
Expand Down
12 changes: 6 additions & 6 deletions packages/shader-ast-js/src/env/ivec3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
bitXorI3,
divI3,
divNI3,
fmod3,
fmodN3,
lshiftI3,
mod3,
modN3,
mulI3,
mulNI3,
rshiftI3,
subI3,
subNI3,
} from "@thi.ng/vectors";
import { VEC3 } from "./vec3";
import type { JSBuiltinsIntVec } from "../api";
import { VEC3 } from "./vec3";

export const IVEC3: JSBuiltinsIntVec = {
...VEC3,
Expand All @@ -27,9 +27,9 @@ export const IVEC3: JSBuiltinsIntVec = {
div: (a, b) => divI3([], a, b),
divvn: (a, b) => divNI3([], a, b),
divnv: (a, b) => divI3(null, [a, a, a], b),
modi: (a, b) => mod3([], a, b),
modivn: (a, b) => modN3([], a, b),
modinv: (a, b) => mod3(null, [a, a, a], b),
modi: (a, b) => fmod3([], a, b),
modivn: (a, b) => fmodN3([], a, b),
modinv: (a, b) => fmod3(null, [a, a, a], b),
mul: (a, b) => mulI3([], a, b),
mulvn: (a, b) => mulNI3([], a, b),
mulnv: (a, b) => mulNI3([], b, a),
Expand Down
12 changes: 6 additions & 6 deletions packages/shader-ast-js/src/env/ivec4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
bitXorI4,
divI4,
divNI4,
fmod4,
fmodN4,
lshiftI4,
mod4,
modN4,
mulI4,
mulNI4,
rshiftI4,
subI4,
subNI4,
} from "@thi.ng/vectors";
import { VEC4 } from "./vec4";
import type { JSBuiltinsIntVec } from "../api";
import { VEC4 } from "./vec4";

export const IVEC4: JSBuiltinsIntVec = {
...VEC4,
Expand All @@ -27,9 +27,9 @@ export const IVEC4: JSBuiltinsIntVec = {
div: (a, b) => divI4([], a, b),
divvn: (a, b) => divNI4([], a, b),
divnv: (a, b) => divI4(null, [a, a, a, a], b),
modi: (a, b) => mod4([], a, b),
modivn: (a, b) => modN4([], a, b),
modinv: (a, b) => mod4(null, [a, a, a, a], b),
modi: (a, b) => fmod4([], a, b),
modivn: (a, b) => fmodN4([], a, b),
modinv: (a, b) => fmod4(null, [a, a, a, a], b),
mul: (a, b) => mulI4([], a, b),
mulvn: (a, b) => mulNI4([], a, b),
mulnv: (a, b) => mulNI4([], b, a),
Expand Down
12 changes: 6 additions & 6 deletions packages/shader-ast-js/src/env/uvec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
bitXorU2,
divNU2,
divU2,
fmod2,
fmodN2,
lshiftU2,
mod2,
modN2,
mulNU2,
mulU2,
rshiftU2,
subNU2,
subU2,
} from "@thi.ng/vectors";
import { VEC2 } from "./vec2";
import type { JSBuiltinsIntVec } from "../api";
import { VEC2 } from "./vec2";

export const UVEC2: JSBuiltinsIntVec = {
...VEC2,
Expand All @@ -27,9 +27,9 @@ export const UVEC2: JSBuiltinsIntVec = {
div: (a, b) => divU2([], a, b),
divvn: (a, b) => divNU2([], a, b),
divnv: (a, b) => divU2(null, [a, a], b),
modi: (a, b) => mod2([], a, b),
modivn: (a, b) => modN2([], a, b),
modinv: (a, b) => mod2(null, [a, a], b),
modi: (a, b) => fmod2([], a, b),
modivn: (a, b) => fmodN2([], a, b),
modinv: (a, b) => fmod2(null, [a, a], b),
mul: (a, b) => mulU2([], a, b),
mulvn: (a, b) => mulNU2([], a, b),
mulnv: (a, b) => mulNU2([], b, a),
Expand Down
12 changes: 6 additions & 6 deletions packages/shader-ast-js/src/env/uvec3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
bitXorU3,
divNU3,
divU3,
fmod3,
fmodN3,
lshiftU3,
mod3,
modN3,
mulNU3,
mulU3,
rshiftU3,
subNU3,
subU3,
} from "@thi.ng/vectors";
import { VEC3 } from "./vec3";
import type { JSBuiltinsIntVec } from "../api";
import { VEC3 } from "./vec3";

export const UVEC3: JSBuiltinsIntVec = {
...VEC3,
Expand All @@ -27,9 +27,9 @@ export const UVEC3: JSBuiltinsIntVec = {
div: (a, b) => divU3([], a, b),
divvn: (a, b) => divNU3([], a, b),
divnv: (a, b) => divU3(null, [a, a, a], b),
modi: (a, b) => mod3([], a, b),
modivn: (a, b) => modN3([], a, b),
modinv: (a, b) => mod3(null, [a, a, a], b),
modi: (a, b) => fmod3([], a, b),
modivn: (a, b) => fmodN3([], a, b),
modinv: (a, b) => fmod3(null, [a, a, a], b),
mul: (a, b) => mulU3([], a, b),
mulvn: (a, b) => mulNU3([], a, b),
mulnv: (a, b) => mulNU3([], b, a),
Expand Down
12 changes: 6 additions & 6 deletions packages/shader-ast-js/src/env/uvec4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
bitXorU4,
divNU4,
divU4,
fmod4,
fmodN4,
lshiftU4,
mod4,
modN4,
mulNU4,
mulU4,
rshiftU4,
subNU4,
subU4,
} from "@thi.ng/vectors";
import { VEC4 } from "./vec4";
import type { JSBuiltinsIntVec } from "../api";
import { VEC4 } from "./vec4";

export const UVEC4: JSBuiltinsIntVec = {
...VEC4,
Expand All @@ -27,9 +27,9 @@ export const UVEC4: JSBuiltinsIntVec = {
div: (a, b) => divU4([], a, b),
divvn: (a, b) => divNU4([], a, b),
divnv: (a, b) => divU4(null, [a, a, a, a], b),
modi: (a, b) => mod4([], a, b),
modivn: (a, b) => modN4([], a, b),
modinv: (a, b) => mod4(null, [a, a, a, a], b),
modi: (a, b) => fmod4([], a, b),
modivn: (a, b) => fmodN4([], a, b),
modinv: (a, b) => fmod4(null, [a, a, a, a], b),
mul: (a, b) => mulU4([], a, b),
mulvn: (a, b) => mulNU4([], a, b),
mulnv: (a, b) => mulNU4([], b, a),
Expand Down
8 changes: 4 additions & 4 deletions packages/shader-ast-js/src/env/vec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
exp_22,
faceForward,
floor2,
fmod2,
fmodN2,
fract2,
gt2,
gte2,
Expand All @@ -34,6 +32,8 @@ import {
min2,
mix2,
mixN2,
mod2,
modN2,
mul2,
mulN2,
neg,
Expand Down Expand Up @@ -91,8 +91,8 @@ export const VEC2: JSBuiltinsVec = {
min: (a, b) => min2([], a, b),
mix: (a, b, t) => mix2([], a, b, t),
mixn: (a, b, t) => mixN2([], a, b, t),
mod: (a, b) => fmod2([], a, b),
modn: (a, b) => fmodN2([], a, b),
mod: (a, b) => mod2([], a, b),
modn: (a, b) => modN2([], a, b),
mul: (a, b) => mul2([], a, b),
mulnv: (a, b) => mulN2([], b, a),
mulvn: (a, b) => mulN2([], a, b),
Expand Down
8 changes: 4 additions & 4 deletions packages/shader-ast-js/src/env/vec3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import {
exp_23,
faceForward,
floor3,
fmod3,
fmodN3,
fract3,
gt3,
gte3,
Expand All @@ -35,6 +33,8 @@ import {
min3,
mix3,
mixN3,
mod3,
modN3,
mul3,
mulN3,
neg,
Expand Down Expand Up @@ -93,8 +93,8 @@ export const VEC3: JSBuiltinsVec3 = {
min: (a, b) => min3([], a, b),
mix: (a, b, t) => mix3([], a, b, t),
mixn: (a, b, t) => mixN3([], a, b, t),
mod: (a, b) => fmod3([], a, b),
modn: (a, b) => fmodN3([], a, b),
mod: (a, b) => mod3([], a, b),
modn: (a, b) => modN3([], a, b),
mul: (a, b) => mul3([], a, b),
mulnv: (a, b) => mulN3([], b, a),
mulvn: (a, b) => mulN3([], a, b),
Expand Down
8 changes: 4 additions & 4 deletions packages/shader-ast-js/src/env/vec4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
exp_24,
faceForward,
floor4,
fmod4,
fmodN4,
fract4,
gt4,
gte4,
Expand All @@ -34,6 +32,8 @@ import {
min4,
mix4,
mixN4,
mod4,
modN4,
mul4,
mulN4,
neg,
Expand Down Expand Up @@ -91,8 +91,8 @@ export const VEC4: JSBuiltinsVec = {
min: (a, b) => min4([], a, b),
mix: (a, b, t) => mix4([], a, b, t),
mixn: (a, b, t) => mixN4([], a, b, t),
mod: (a, b) => fmod4([], a, b),
modn: (a, b) => fmodN4([], a, b),
mod: (a, b) => mod4([], a, b),
modn: (a, b) => modN4([], a, b),
mul: (a, b) => mul4([], a, b),
mulnv: (a, b) => mulN4([], b, a),
mulvn: (a, b) => mulN4([], a, b),
Expand Down

0 comments on commit 63eb749

Please sign in to comment.