From 62d54d3a1bf55b205c44ce978f0c06dabe23e33b Mon Sep 17 00:00:00 2001 From: blobt Date: Sat, 24 Apr 2021 20:15:01 +0800 Subject: [PATCH] tmp --- package.json | 2 +- src/App.tsx | 12 ++++++++++-- src/render/math/Mat4.ts | 8 ++++---- src/render/math/Vec3.ts | 8 ++++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e8a49ce8..7ae0b6e5 100755 --- a/package.json +++ b/package.json @@ -40,4 +40,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index d569f254..daaf1822 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,9 +1,17 @@ import React from 'react'; import './App.css'; - +import { vec3, vec4 } from "./render/math" 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 (
sasa diff --git a/src/render/math/Mat4.ts b/src/render/math/Mat4.ts index 344c970c..c51db468 100755 --- a/src/render/math/Mat4.ts +++ b/src/render/math/Mat4.ts @@ -70,10 +70,10 @@ export class mat4 { if (dest === null) { 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; } diff --git a/src/render/math/Vec3.ts b/src/render/math/Vec3.ts index 10654bba..d1573664 100755 --- a/src/render/math/Vec3.ts +++ b/src/render/math/Vec3.ts @@ -202,6 +202,14 @@ export class vec3 { return length; } + public print(): void { + console.log("[ " + + this.x + " " + + this.y + " " + + this.z + +" ]"); + } + /** * 向量缩放 * @param vector