AAAAAAAAAAAAAAAAAAAAAAAAH

This commit is contained in:
Kbz-8
2024-02-10 19:38:56 +01:00
parent f9e9538159
commit 54c4ae77f2
8 changed files with 134 additions and 93 deletions

View File

@ -1,4 +1,5 @@
import { Point } from "./Point.js"
import { renderCube } from "../../3D/cube.js"
class Segment
{
@ -17,16 +18,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)