blobt 4 years ago
parent
commit
62d54d3a1b
  1. 10
      src/App.tsx
  2. 8
      src/render/math/Mat4.ts
  3. 8
      src/render/math/Vec3.ts

10
src/App.tsx

@ -1,9 +1,17 @@
import React from 'react'; import React from 'react';
import './App.css'; import './App.css';
import { vec3, vec4 } from "./render/math"
function App() { function App() {
let a: vec3 = new vec3([1, 1, 1]);
let b: vec3 = new vec3([3, 2, 1]);
let c: vec3 = new vec3([2, 3, 1]);
let d: vec3 = new vec3([1, 2, 3]);
let ab: vec3 = vec3.difference(b, a);
ab.print();
return ( return (
<div className="App"> <div className="App">
sasa sasa

8
src/render/math/Mat4.ts

@ -70,10 +70,10 @@ export class mat4 {
if (dest === null) { if (dest === null) {
dest = new vec4(); dest = new vec4();
} }
dest.x = this.values[index * 4 + 0],
dest.y = this.values[index * 4 + 1],
dest.z = this.values[index * 4 + 2],
dest.w = this.values[index * 4 + 3]
dest.x = this.values[index * 4 + 0];
dest.y = this.values[index * 4 + 1];
dest.z = this.values[index * 4 + 2];
dest.w = this.values[index * 4 + 3];
return dest; return dest;
} }

8
src/render/math/Vec3.ts

@ -202,6 +202,14 @@ export class vec3 {
return length; return length;
} }
public print(): void {
console.log("[ " +
this.x + " " +
this.y + " " +
this.z
+" ]");
}
/** /**
* *
* @param vector * @param vector

Loading…
Cancel
Save