add box features
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
//bls 4
|
||||
|
||||
// This file should not exist. Fix later...
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@ -200,6 +202,21 @@ function NDM_BoxSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
|
||||
%client.ndUpdateBottomPrint();
|
||||
}
|
||||
|
||||
function ndRound(%v, %step) {
|
||||
return mFloor(%v/%step + 0.5)*%step;
|
||||
}
|
||||
|
||||
function ndCorrectBox(%box) {
|
||||
%xl = ndRound(getWord(%box, 0), 0.5);
|
||||
%yl = ndRound(getWord(%box, 1), 0.5);
|
||||
%zl = ndRound(getWord(%box, 2), 0.2);
|
||||
%xh = ndRound(getWord(%box, 3), 0.5);
|
||||
%yh = ndRound(getWord(%box, 4), 0.5);
|
||||
%zh = ndRound(getWord(%box, 5), 0.2);
|
||||
%box2 = %xl SPC %yl SPC %zl SPC %xh SPC %yh SPC %zh;
|
||||
return %box2;
|
||||
}
|
||||
|
||||
function ndGetBoxFromRom(%b) {
|
||||
%db = %b.getDatablock();
|
||||
%box = %b.getWorldBox();
|
||||
@ -207,7 +224,7 @@ function ndGetBoxFromRom(%b) {
|
||||
%bh = getWords(%box, 3, 5);
|
||||
%bl = vectorAdd(%bl, "0 0 " SPC (%db.brickSizeZ * 0.2));
|
||||
%bh = vectorAdd(%bh, "0 0 " SPC (%db.logicRomZ * 0.2));
|
||||
return %bl SPC %bh;
|
||||
return ndCorrectBox(%bl SPC %bh);
|
||||
}
|
||||
|
||||
function ndGetBoxFromZone(%b) {
|
||||
@ -216,7 +233,7 @@ function ndGetBoxFromZone(%b) {
|
||||
%scale = %z.getScale(); %sx = getWord(%scale, 0); %sy = getWord(%scale, 1); %sz = getWord(%scale, 2);
|
||||
%bl = %pos;
|
||||
%bh = vectorAdd(%pos, %sx SPC (-%sy) SPC %sz);
|
||||
return %bl SPC %bh;
|
||||
return ndCorrectBox(%bl SPC %bh);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user