(Supplier<FLine> wrap, Camera camera, Vec2 scale, Vec2 center)
| 153 | |
| 154 | |
| 155 | static public Supplier<FLine> camera(Supplier<FLine> wrap, Camera camera, Vec2 scale, Vec2 center) { |
| 156 | Mat4 p = camera.projectionMatrix(0); |
| 157 | Mat4 v = camera.view(); |
| 158 | |
| 159 | return new Cached<Camera, Object, FLine>((c, was) -> { |
| 160 | Mat4 o = Mat4.mul(p, v, new Mat4()); |
| 161 | o.transpose(); |
| 162 | return wrap.get() |
| 163 | .byTransforming(x -> { |
| 164 | Vec3 q = Mat4.transform(o, x, new Vec3()); |
| 165 | q.x *= scale.x; |
| 166 | q.y *= scale.y; |
| 167 | q.x += center.x; |
| 168 | q.y += center.y; |
| 169 | q.z = 0; |
| 170 | return q; |
| 171 | }); |
| 172 | }, (c) -> new Pair<>(camera, camera.getState())).toSupplier(() -> camera); |
| 173 | } |
| 174 | |
| 175 | static public Function<Box, FLine> expires(Function<Box, FLine> wrap, int updates) { |
| 176 | int[] counter = {updates}; |
nothing calls this directly
no test coverage detected