|
@@ -151,6 +151,34 @@
|
|
|
|
|
|
return torusKnot;
|
|
|
}
|
|
|
+
|
|
|
+ public static CreateLineSystem(name: string, options: {lines: Vector3[][], updatable: boolean, instance?: LinesMesh}, scene: Scene): LinesMesh {
|
|
|
+ var instance = options.instance;
|
|
|
+ var lines = options.lines;
|
|
|
+
|
|
|
+ if (instance) { // lines update
|
|
|
+ var positionFunction = positions => {
|
|
|
+ var i = 0;
|
|
|
+ for (var l = 0; l < lines.length; l++) {
|
|
|
+ var points = lines[l];
|
|
|
+ for (var p = 0; p < points.length; p++) {
|
|
|
+ positions[i] = points[p].x;
|
|
|
+ positions[i + 1] = points[p].y;
|
|
|
+ positions[i + 2] = points[p].z;
|
|
|
+ i += 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ instance.updateMeshPositions(positionFunction, false);
|
|
|
+ return instance;
|
|
|
+ }
|
|
|
+
|
|
|
+ // line system creation
|
|
|
+ var lineSystem = new LinesMesh(name, scene);
|
|
|
+ var vertexData = VertexData.CreateLineSystem(options);
|
|
|
+ vertexData.applyToMesh(lineSystem, options.updatable);
|
|
|
+ return lineSystem;
|
|
|
+ }
|
|
|
|
|
|
public static CreateLines(name: string, options: { points: Vector3[], updatable?: boolean, instance?: LinesMesh }, scene: Scene): LinesMesh {
|
|
|
var instance = options.instance;
|