(double x, double y, double z)
| 135 | } |
| 136 | |
| 137 | private Vec3 toWorld(double x, double y, double z) { |
| 138 | if (this.projectionViewMatrix == null) { |
| 139 | return null; |
| 140 | } |
| 141 | |
| 142 | x /= mc.getWindow().getWidth(); |
| 143 | y /= mc.getWindow().getHeight(); |
| 144 | x = x * 2 - 1; |
| 145 | y = y * 2 - 1; |
| 146 | |
| 147 | Vector4f pos = new Vector4f((float) x, (float) y, (float) z, 1.0F); |
| 148 | projectionViewMatrix.transform(pos); |
| 149 | |
| 150 | if (pos.w() == 0) { |
| 151 | return null; |
| 152 | } |
| 153 | |
| 154 | pos.mul(1/pos.w()); |
| 155 | return new Vec3(pos.x(), pos.y(), pos.z()); |
| 156 | } |
| 157 | } |