1.1.0 • Published 5 months ago

hmah-glsl-vector-js v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

GLSL Vector implementation in JavaScript!

npm.io

Usage

import { vec4, vec3, vec2 } from 'hmah-glsl-vector-js';

const raw = vec3(0, 1, 2);

const array = vec4([0, 1, 2, 3]);

const v1 = vec4({ x: 0, y: 1, z: 2, w: 3 });
const [x, y, z, w] = v1;

const colorRGBA = vec3({ r: 1, g: 0, b: 0, a: 1 });
const outputColor = vec4(colorRGBA.bgr, 1);

const textureCoord = vec2({ s: 0, t: 0 });

const a = vec4(1, 2, 3, 4);
const b = vec4(4, 5, 6, 7);
const c = a.clone().add(b); // new Vec4 with 5, 7, 9, 11 values
const d = a.add(b); // pointer to the modified a with 5, 7, 9, 11 values

TODO

  • Initialization
  • Clone
  • Add/Sub/Mul/Div/Mod
  • Equals
  • Cross/Dot ?
  • Complex tests

License

MIT

1.1.0

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago