Add classic renderer

This commit is contained in:
2022-02-08 00:23:21 +08:00
parent c7c40bddea
commit a7aae62233
4 changed files with 100 additions and 12 deletions
+9 -9
View File
@@ -1,6 +1,5 @@
import { Component, ReactNode, createRef } from "react";
import { GLCanvas } from "@GLRender/GLCanvas";
import { Group } from "@Model/Group";
import { ClassicRenderer } from "@GLRender/ClassicRenderer";
import { Entry } from "../Entry/Entry";
import "./Laboratory.scss";
@@ -17,18 +16,19 @@ class Laboratory extends Component {
throw new Error("Laboratory: 无法获取到 Canvas 容器节点");
}
if (this.canvasContRef.current.getElementsByTagName("canvas").length > 0) {
if (this.canvasContRef.current.querySelector("*")) {
throw new Error("Laboratory: 重复引用 canvas 节点");
}
const glCanvas = new GLCanvas(undefined, {
autoResize: true,
mouseEvent: true,
eventLog: false
const canvas = document.createElement("canvas");
const renderer = new ClassicRenderer(canvas, {
clasName: "canvas"
});
glCanvas.dom.className = "canvas";
this.canvasContRef.current.appendChild(glCanvas.dom);
console.log(renderer);
this.canvasContRef.current.appendChild(renderer.canvas.dom);
}
}