]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/common/models/AbstractBoundingBox.java
9036fb29a68c0978b52bbb0e3fc31f91e79136da
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / common / models / AbstractBoundingBox.java
1 package com.irtimaled.bbor.common.models;
2
3 import com.irtimaled.bbor.client.ClientRenderer;
4 import com.irtimaled.bbor.client.renderers.AbstractRenderer;
5 import com.irtimaled.bbor.common.BoundingBoxType;
6
7 public abstract class AbstractBoundingBox {
8     private final BoundingBoxType type;
9
10     protected AbstractBoundingBox(BoundingBoxType type) {
11         this.type = type;
12     }
13
14     public abstract Boolean intersectsBounds(int minX, int minZ, int maxX, int maxZ);
15
16     public BoundingBoxType getType() {
17         return type;
18     }
19
20     public double getDistance(double x, double y, double z) {
21         double dX = getDistanceX(x);
22         double dY = getDistanceY(y);
23         double dZ = getDistanceZ(z);
24         return dX * dX + dY * dY + dZ * dZ;
25     }
26
27     protected abstract double getDistanceX(double x);
28
29     protected abstract double getDistanceY(double y);
30
31     protected abstract double getDistanceZ(double z);
32
33     public AbstractRenderer<?> getRenderer() {
34         return ClientRenderer.getRenderer(this.getClass());
35     }
36
37     public boolean isVisibleCulling() {
38         return true;
39     }
40 }