aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/renderUtils.js36
-rw-r--r--utils/utils.js14
2 files changed, 26 insertions, 24 deletions
diff --git a/utils/renderUtils.js b/utils/renderUtils.js
index a91043a..81bd2ea 100644
--- a/utils/renderUtils.js
+++ b/utils/renderUtils.js
@@ -126,7 +126,7 @@ module.exports = {
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
},
- drawBoxAtBlockNotVisThruWalls:function (x, y, z, colorR, colorG, colorB){
+ drawBoxAtBlockNotVisThruWalls:function (x, y, z, colorR, colorG, colorB, w=1, h=1){
GL11.glBlendFunc(770, 771);
GL11.glEnable(GL11.GL_BLEND);
GL11.glLineWidth(3);
@@ -136,28 +136,30 @@ module.exports = {
x -= 0.005
y -= 0.005
z -= 0.005
+ w += 0.01
+ h += 0.01
Tessellator.begin(3).colorize(colorR, colorG, colorB);
- Tessellator.pos(x+1.01,y+1.01,z+1.01);
- Tessellator.pos(x+1.01,y+1.01,z);
- Tessellator.pos(x,y+1.01,z);
- Tessellator.pos(x,y+1.01,z+1.01);
- Tessellator.pos(x+1.01,y+1.01,z+1.01);
- Tessellator.pos(x+1.01,y,z+1.01);
- Tessellator.pos(x+1.01,y,z);
+ Tessellator.pos(x+w,y+h,z+w);
+ Tessellator.pos(x+w,y+h,z);
+ Tessellator.pos(x,y+h,z);
+ Tessellator.pos(x,y+h,z+w);
+ Tessellator.pos(x+w,y+h,z+w);
+ Tessellator.pos(x+w,y,z+w);
+ Tessellator.pos(x+w,y,z);
Tessellator.pos(x,y,z);
- Tessellator.pos(x,y,z+1.01);
+ Tessellator.pos(x,y,z+w);
Tessellator.pos(x,y,z);
- Tessellator.pos(x,y+1.01,z);
+ Tessellator.pos(x,y+h,z);
Tessellator.pos(x,y,z);
- Tessellator.pos(x+1.01,y,z);
- Tessellator.pos(x+1.01,y+1.01,z);
- Tessellator.pos(x+1.01,y,z);
- Tessellator.pos(x+1.01,y,z+1.01);
- Tessellator.pos(x,y,z+1.01);
- Tessellator.pos(x,y+1.01,z+1.01);
- Tessellator.pos(x+1.01,y+1.01,z+1.01);
+ Tessellator.pos(x+w,y,z);
+ Tessellator.pos(x+w,y+h,z);
+ Tessellator.pos(x+w,y,z);
+ Tessellator.pos(x+w,y,z+w);
+ Tessellator.pos(x,y,z+w);
+ Tessellator.pos(x,y+h,z+w);
+ Tessellator.pos(x+w,y+h,z+w);
Tessellator.draw();
diff --git a/utils/utils.js b/utils/utils.js
index baae822..48bb569 100644
--- a/utils/utils.js
+++ b/utils/utils.js
@@ -76,23 +76,23 @@ let utils = {
let lastOrder = []
let lastOrderLength = Infinity
- allOrders.forEach((order)=>{
+ for(let i = 0;i<allOrders.length;i++){
+ let order = allOrders[i]
let lastPoint = startPoint
let positions = order.map((a)=>{
return points[a]
})
let len = 0
- positions.forEach((pos)=>{
- len += utils.calculateDistance(lastPoint,pos)
- lastPoint = pos
- })
+ for(let i = 0;i<positions.length;i++){
+ len += utils.calculateDistance(lastPoint,positions[i])
+ lastPoint = positions[i]
+ }
if(len < lastOrderLength){
lastOrder = order
lastOrderLength = len
}
- })
-
+ }
return lastOrder;
},