Search in sources :

Example 1 with Vector4f

use of net.minecraft.util.math.Vector4f in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method isPointVisible.

public static boolean isPointVisible(double x, double y, double z) {
    FrustramAccessor frustum = (FrustramAccessor) getFrustum();
    Vector4f[] frustumCoords = frustum.getHomogeneousCoordinates();
    Vector4f pos = new Vector4f((float) (x - frustum.getX()), (float) (y - frustum.getY()), (float) (z - frustum.getZ()), 1f);
    for (int i = 0; i < 6; ++i) {
        if (frustumCoords[i].dotProduct(pos) <= 0f) {
            return false;
        }
    }
    return true;
}
Also used : FrustramAccessor(dev.hypnotic.mixin.FrustramAccessor) Vector4f(net.minecraft.util.math.Vector4f)

Example 2 with Vector4f

use of net.minecraft.util.math.Vector4f in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method getRenderPosition.

public static Vec3d getRenderPosition(Vec3d vec3d, MatrixStack matrixStack) {
    Matrix4f matrix = matrixStack.peek().getPositionMatrix();
    double minX = vec3d.getX() - mc.getEntityRenderDispatcher().camera.getPos().x;
    double minY = vec3d.getY() - mc.getEntityRenderDispatcher().camera.getPos().y;
    double minZ = vec3d.getZ() - mc.getEntityRenderDispatcher().camera.getPos().z;
    Vector4f vector4f = new Vector4f((float) minX, (float) minY, (float) minZ, 1.f);
    vector4f.transform(matrix);
    return new Vec3d(vector4f.getX(), vector4f.getY(), vector4f.getZ());
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) IMatrix4f(dev.hypnotic.utils.mixin.IMatrix4f) Vector4f(net.minecraft.util.math.Vector4f) Vec3d(net.minecraft.util.math.Vec3d)

Example 3 with Vector4f

use of net.minecraft.util.math.Vector4f in project KiwiClient by TangyKiwi.

the class FrustumUtils method isPointVisible.

public static boolean isPointVisible(double x, double y, double z) {
    FrustrumAccessor frustum = (FrustrumAccessor) getFrustum();
    Vector4f[] frustumCoords = frustum.getHomogeneousCoordinates();
    Vector4f pos = new Vector4f((float) (x - frustum.getX()), (float) (y - frustum.getY()), (float) (z - frustum.getZ()), 1f);
    for (int i = 0; i < 6; ++i) {
        if (frustumCoords[i].dotProduct(pos) <= 0f) {
            return false;
        }
    }
    return true;
}
Also used : FrustrumAccessor(com.tangykiwi.kiwiclient.mixin.FrustrumAccessor) Vector4f(net.minecraft.util.math.Vector4f)

Example 4 with Vector4f

use of net.minecraft.util.math.Vector4f in project BleachHack by BleachDrinker420.

the class FrustumUtils method isPointVisible.

public static boolean isPointVisible(double x, double y, double z) {
    AccessorFrustum frustum = (AccessorFrustum) getFrustum();
    Vector4f[] frustumCoords = frustum.getHomogeneousCoordinates();
    Vector4f pos = new Vector4f((float) (x - frustum.getX()), (float) (y - frustum.getY()), (float) (z - frustum.getZ()), 1f);
    for (int i = 0; i < 6; ++i) {
        if (frustumCoords[i].dotProduct(pos) <= 0f) {
            return false;
        }
    }
    return true;
}
Also used : Vector4f(net.minecraft.util.math.Vector4f) AccessorFrustum(org.bleachhack.mixin.AccessorFrustum)

Example 5 with Vector4f

use of net.minecraft.util.math.Vector4f in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method getPos.

public static Vec3d getPos(Entity entity, float yOffset, float partialTicks, MatrixStack matrixStack) {
    Vec3d bound = getEntityRenderPosition(entity, partialTicks).add(0, yOffset, 0);
    Vector4f vector4f = new Vector4f((float) bound.x, (float) bound.y, (float) bound.z, 1.f);
    vector4f.transform(matrixStack.peek().getPositionMatrix());
    Vec3d twoD = to2D(vector4f.getX(), vector4f.getY(), vector4f.getZ());
    return new Vec3d(twoD.x, twoD.y, twoD.z);
}
Also used : Vector4f(net.minecraft.util.math.Vector4f) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

Vector4f (net.minecraft.util.math.Vector4f)6 Vec3d (net.minecraft.util.math.Vec3d)3 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)2 Matrix4f (net.minecraft.util.math.Matrix4f)2 FrustrumAccessor (com.tangykiwi.kiwiclient.mixin.FrustrumAccessor)1 FrustramAccessor (dev.hypnotic.mixin.FrustramAccessor)1 AccessorFrustum (org.bleachhack.mixin.AccessorFrustum)1