MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / camera

Method camera

src/main/java/fieldbox/boxes/FLineDrawing.java:155–173  ·  view source on GitHub ↗
(Supplier<FLine> wrap, Camera camera, Vec2 scale, Vec2 center)

Source from the content-addressed store, hash-verified

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};

Callers

nothing calls this directly

Calls 9

mulMethod · 0.95
transposeMethod · 0.95
transformMethod · 0.95
toSupplierMethod · 0.80
byTransformingMethod · 0.80
projectionMatrixMethod · 0.65
viewMethod · 0.65
getMethod · 0.65
getStateMethod · 0.45

Tested by

no test coverage detected