commit db58b509501fd8f98b0e0ba762d183509a6ea4a8
parent 25fd1eab65a4b88d38b47470a2fed98d251d401b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 24 Jun 2016 09:48:36 +0200
Use a callback to retrieve the polygon vertices
This callback replaces the explicit list of 2D vertex positions.
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/ssol.h b/src/ssol.h
@@ -121,26 +121,25 @@ struct ssol_quadric {
} data;
};
-/* Material descriptors */
-struct ssol_miror_desc {/* TODO */};
-
struct ssol_carving_circle circle {
double radius;
};
struct ssol_carving_polygon polygon {
- double* twoD_vertice;
- size_t nb_vertice;
+ void (*get) /* Retrieve the 2D coordinates of the vertex `ivert' */
+ (const size_t ivert, double position[2], void* ctx);
+ size_t nvertices; /* #vertices */
+ void* context; /* User defined data */
};
-
+
struct ssol_carving {
enum ssol_carving_type type;
union {
struct ssol_carving_circle circle;
struct ssol_carving_polygon polygon;
} data;
- double twoD_offset[2];
- char internal;
+ double offset[2];
+ char internal; /* TODO comment/rename (?) this */
};
struct ssol_punched_surface {
@@ -149,6 +148,9 @@ struct ssol_punched_surface {
size_t nb_carvings;
};
+/* Material descriptors */
+struct ssol_miror_desc {/* TODO */};
+
/*
* All the ssol structures are ref counted. Once created with the appropriated
* `ssol_<TYPE>_create' function, the caller implicitly owns the created data,