2021-07-25 21:24:34 +00:00
|
|
|
// requires a global list called draws, apparently
|
2021-07-23 21:40:46 +00:00
|
|
|
@lazyglobal off.
|
|
|
|
|
2021-07-25 21:24:34 +00:00
|
|
|
parameter vec is V(0,0,0).
|
2021-07-23 21:59:51 +00:00
|
|
|
|
2021-07-25 21:24:34 +00:00
|
|
|
function RenderVectorWithComponents {
|
|
|
|
parameter vec.
|
|
|
|
parameter prefix is "".
|
|
|
|
|
|
|
|
if prefix <> "" {
|
|
|
|
set prefix to prefix + " ".
|
|
|
|
}
|
2021-07-23 21:40:46 +00:00
|
|
|
|
2021-07-25 21:24:34 +00:00
|
|
|
local dv is 0.
|
|
|
|
local dx is 0.
|
|
|
|
local dy is 0.
|
|
|
|
local dz is 0.
|
|
|
|
set dv to VecDraw(V(0,0,0), vec, WHITE, prefix + "v", 1.0, true).
|
|
|
|
draws:add(dv).
|
|
|
|
set dx to VecDraw(V(0,0,0), V(vec:X,0,0), RED, prefix + "x", 1.0, true).
|
|
|
|
draws:add(dx).
|
|
|
|
set dy to VecDraw(V(0,0,0), V(0,vec:Y,0), GREEN, prefix + "y", 1.0, true).
|
|
|
|
draws:add(dy).
|
|
|
|
set dz to VecDraw(V(0,0,0), V(0,0,vec:Z), BLUE, prefix + "z", 1.0, true).
|
|
|
|
draws:add(dz).
|
|
|
|
}
|
|
|
|
|
|
|
|
function RenderVectorShipRelative {
|
2021-07-23 21:40:46 +00:00
|
|
|
parameter vec.
|
2021-07-25 21:24:34 +00:00
|
|
|
parameter prefix is "".
|
2021-07-23 21:40:46 +00:00
|
|
|
|
2021-07-25 21:24:34 +00:00
|
|
|
if prefix <> "" {
|
|
|
|
set prefix to prefix + " ".
|
|
|
|
}
|
|
|
|
|
|
|
|
// this seems backwards, but velocity vectors at least seem to work this way.
|
|
|
|
local axes is 0. lock axes to lookdirup(SHIP:FACING:FOREVECTOR, SHIP:UP:FOREVECTOR).
|
|
|
|
local dv is 0.
|
|
|
|
local dx is 0.
|
|
|
|
local dy is 0.
|
|
|
|
local dz is 0.
|
|
|
|
|
|
|
|
set dv to VecDraw(V(0,0,0), vec, WHITE, prefix + "v", 1.0, true).
|
|
|
|
draws:add(dv).
|
|
|
|
|
|
|
|
set dx to VecDraw(V(0,0,0), V(vec:X,0,0), RED, prefix + "x", 1.0, true).
|
|
|
|
draws:add(dx).
|
|
|
|
|
|
|
|
set dy to VecDraw(V(0,0,0), V(0,vec:Y,0), GREEN, prefix + "y", 1.0, true).
|
|
|
|
draws:add(dy).
|
|
|
|
|
|
|
|
set dz to VecDraw(V(0,0,0), V(0,0,vec:Z), BLUE, prefix + "z", 1.0, true).
|
|
|
|
draws:add(dz).
|
|
|
|
}
|
|
|
|
|
|
|
|
function RenderDirAxes {
|
|
|
|
parameter dir.
|
|
|
|
parameter prefix is "".
|
|
|
|
|
|
|
|
if prefix <> "" {
|
|
|
|
set prefix to prefix + " ".
|
|
|
|
}
|
|
|
|
|
|
|
|
local dx is 0.
|
|
|
|
local dy is 0.
|
|
|
|
local dz is 0.
|
|
|
|
set dx to VecDraw(V(0,0,0), dir:RIGHTVECTOR * 100, RED, prefix + "x", 1.0, true).
|
|
|
|
draws:add(dx).
|
|
|
|
set dy to VecDraw(V(0,0,0), dir:TOPVECTOR * 100, GREEN, prefix + "y", 1.0, true).
|
|
|
|
draws:add(dy).
|
|
|
|
set dz to VecDraw(V(0,0,0), dir:FOREVECTOR * 100, BLUE, prefix + "z", 1.0, true).
|
|
|
|
draws:add(dz).
|
|
|
|
}
|
|
|
|
|
|
|
|
if vec <> V(0,0,0) {
|
|
|
|
// RenderVectorShipRelative(vec).
|
|
|
|
RenderDirAxes(vec).
|
2021-07-23 21:40:46 +00:00
|
|
|
}
|
2021-07-23 21:59:51 +00:00
|
|
|
|
2021-07-25 21:24:34 +00:00
|
|
|
function ClearRenders {
|
|
|
|
set draws to list().
|
|
|
|
ClearVecDraws().
|
2021-07-23 21:59:51 +00:00
|
|
|
}
|