xyz Yeah it's a fixed array size. The number of points will always be fixed as I do not need that many vertices/points) for the arc. This is what the code is doing for the compute shader (in the main function) and how the array gets assigned.
void main() {
int index = int(gl_GlobalInvocationID.x);
if (index >= params.numRoutes) return;
float radius = params.sphereRadius;
float time = times.data[index];
float bearing = bearings.data[index];
float harversine_distance = distances.data[index];
vec2 coordinate = coordinates.data[index];
vec3 points[MAX_POINTS];
for (int i = 0; i < int(MAX_POINTS); i++) {
float fraction = i / float(MAX_POINTS);
float angle = fraction * time * harversine_distance;
float interpolated_lat_a = sin(coordinate.x) * cos(angle);
float interpolated_lat_b = cos(coordinate.x) * sin(angle) * cos(bearing);
float interpolated_lat = asin(interpolated_lat_a + interpolated_lat_b);
float interpolated_lon_a = sin(bearing) * sin(angle) * cos(coordinate.x);
float interpolated_lon_b = cos(angle) - sin(coordinate.x) * sin(interpolated_lat);
float interpolated_lon = coordinate.y + atan(interpolated_lon_b, interpolated_lon_a);
float interpolated_x = radius * cos(interpolated_lat) * sin(interpolated_lon);
float interpolated_y = radius * sin(interpolated_lat);
float interpolated_z = radius * cos(interpolated_lat) * cos(interpolated_lon);
points[i] = vec3(interpolated_x, interpolated_y, interpolated_z);
}
arcs.data[index].points = points;
}
The problem is, I am really confused on how to decode the data from the buffer:
# Retrieve data from the buffer
var output_bytes := rd.buffer_get_data(buffer) # The arcs buffer
for i in range(output_bytes.size()):
push_warning(output_bytes[i])