AAAAAAAAAAAAAAAAAAAAAAAAH

This commit is contained in:
Kbz-8
2024-02-10 19:38:56 +01:00
committed by AdrienLSH
parent acff70d414
commit 7f5bd7c6ba
8 changed files with 135 additions and 104 deletions

View File

@ -1,4 +1,5 @@
import { Point } from "./Point.js";
import { Point } from "./Point.js"
import { renderCube } from "../../3D/cube.js"
class Segment
{
@ -41,16 +42,19 @@ class Segment
*/
draw(ctx)
{
if(this.gl instanceof CanvasRenderingContext2D)
if(ctx instanceof CanvasRenderingContext2D)
{
ctx.moveTo(this.start.x, this.start.y);
ctx.lineTo(this.stop.x, this.stop.y);
}
else if(this.gl instanceof WebGLRenderingContext)
else if(ctx instanceof WebGLRenderingContext)
{
renderCube(ctx, this.start.x, -3, this.start.y, 0, 0.5, 0.5, 0.5);
}
else
{
alert('Unknown rendering context type');
}
}
from_json(data)