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

Class FLine

src/main/java/field/graphics/FLine.java:53–2734  ·  view source on GitHub ↗

FLine is our main high level geometry container for lines, meshes and lists of points. FLines consist of a list of drawing instructions, or nodes: `line.moveTo(...).lineTo(...).cubicTo(...)` .etc This is essentially the common postscript / pdf / java2d drawing model with a few key difference

Source from the content-addressed store, hash-verified

51 * <p>
52 * The caching of the flattening of this line into MeshBuilder data (ready for OpenGL) cascades into MeshBuilder's cache structure. Thus, we have three levels of caching in total: FLine caches
53 * whether or not the geometry has
54 * changed at all, MeshBuilder caches whether or not there's any point sending anything to the OpenGL
55 * underlying Buffers or whether this piece of geometry can be skipped, and finally individual ArrayBuffers can elect to skip the upload to OpenGL. This means that static geometry is extremely cheap
56 * to draw.
57 */
58public class FLine implements Supplier<FLine>, fieldlinker.AsMap, HandlesCompletion, Serializable_safe, OverloadedMath {
59
60 static {
61 new StandardFLineDrawing(); // cause properties to be loaded
62 }
63
64 public List<Node> nodes = new ArrayList<>();
65 public Dict attributes = new Dict();
66 transient protected Set<String> knownNonProperties;
67 long mod = 0;
68 WeakHashMap<MeshBuilder, BookmarkCache> cache = new WeakHashMap<>();
69 WeakHashMap<MeshBuilder, BookmarkCache> cache_thickening = new WeakHashMap<>();
70 private Map<Integer, Function<Node, Object>> auxProperties;
71
72 public FLine() {
73 }
74
75 public FLine(Map<Object, Object> attributes) {
76 for (Map.Entry e : attributes.entrySet()) {
77 String name = (String) Conversions.convert(e.getKey(), String.class);
78 asMap_set(name, e.getValue());
79 }
80 }
81
82 @HiddenInAutocomplete
83 static public Vec2 evaluateCubicFrame(double ax, double ay, double c1x, double c1y, double c2x, double c2y, double bx, double by, double alpha, Vec2 out) {
84 if (out == null) out = new Vec2();
85
86 double oma = 1 - alpha;
87 double oma2 = oma * oma;
88 double oma3 = oma2 * oma;
89 double alpha2 = alpha * alpha;
90 double alpha3 = alpha2 * alpha;
91
92 out.x = ax * oma3 + 3 * c1x * alpha * oma2 + 3 * c2x * alpha2 * oma + bx * alpha3;
93 out.y = ay * oma3 + 3 * c1y * alpha * oma2 + 3 * c2y * alpha2 * oma + by * alpha3;
94
95 return out;
96 }
97
98 @HiddenInAutocomplete
99 static public Vec3 evaluateCubicFrame(double ax, double ay, double az, double c1x, double c1y, double c1z, double c2x, double c2y, double c2z, double bx, double by, double bz, double alpha,
100 Vec3 out) {
101 if (out == null) out = new Vec3();
102
103 double oma = 1 - alpha;
104 double oma2 = oma * oma;
105 double oma3 = oma2 * oma;
106 double alpha2 = alpha * alpha;
107 double alpha3 = alpha2 * alpha;
108
109 out.x = ax * oma3 + 3 * c1x * alpha * oma2 + 3 * c2x * alpha2 * oma + bx * alpha3;
110 out.y = ay * oma3 + 3 * c1y * alpha * oma2 + 3 * c2y * alpha2 * oma + by * alpha3;

Callers 15

visualizeOffMethod · 0.85
visualizeMethod · 0.85
UIGroupClass · 0.85
helpMethod · 0.85
drawTimesForMethod · 0.85
closeOnMethod · 0.85
initialPositionDownMethod · 0.85
loadedMethod · 0.85
errorMethod · 0.85
noErrorMethod · 0.85
toFLineMethod · 0.85
getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected