Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesdna/DNA_hair_types.h')
-rw-r--r--source/blender/makesdna/DNA_hair_types.h85
1 files changed, 54 insertions, 31 deletions
diff --git a/source/blender/makesdna/DNA_hair_types.h b/source/blender/makesdna/DNA_hair_types.h
index 2e819b32033..5d54a4bb8cc 100644
--- a/source/blender/makesdna/DNA_hair_types.h
+++ b/source/blender/makesdna/DNA_hair_types.h
@@ -27,48 +27,71 @@
extern "C" {
#endif
-typedef struct HairCurve {
- /* Index of first point of hair curve. */
- int firstpoint;
- /* Number of points in hair curve, must be 2 or higher. */
- int numpoints;
-} HairCurve;
-
-/* Hair attachment to a mesh.
- * TODO: attach to tessellated triangles or polygons?
- * TODO: what type of interpolation to use for uv? */
-typedef struct HairMapping {
- float uv[2];
- int poly;
-} HairMapping;
+/**
+ * A reusable data structure for geometry consisting of many curves. All control point data is
+ * stored contiguously for better efficiency. Data for each curve is stored as a slice of the
+ * main #point_data array.
+ *
+ * The data structure is meant to be embedded in other data-blocks to allow reusing
+ * curve-processing algorithms for multiple Blender data-block types.
+ */
+typedef struct CurvesGeometry {
+ /**
+ * A runtime pointer to the "position" attribute data.
+ * \note This data is owned by #point_data.
+ */
+ float (*position)[3];
+ /**
+ * A runtime pointer to the "radius" attribute data.
+ * \note This data is owned by #point_data.
+ */
+ float *radius;
+
+ /**
+ * The start index of each curve in the point data. The size of each curve can be calculated by
+ * subtracting the offset from the next offset. That is valid even for the last curve because
+ * this array is allocated with a length one larger than the number of splines.
+ *
+ * \note This is *not* stored in #CustomData because its size is one larger than #curve_data.
+ */
+ int *offsets;
+
+ /**
+ * All attributes stored on control points (#ATTR_DOMAIN_POINT).
+ */
+ CustomData point_data;
+
+ /**
+ * All attributes stored on curves (#ATTR_DOMAIN_CURVE).
+ */
+ CustomData curve_data;
+
+ /**
+ * The total number of control points in all curves.
+ */
+ int point_size;
+ /**
+ * The number of curves in the data-block.
+ */
+ int curve_size;
+} CurvesGeometry;
typedef struct Hair {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id) */
+ /* Animation data (must be immediately after id). */
+ struct AnimData *adt;
- int flag;
- int _pad1[1];
+ CurvesGeometry geometry;
- /* Geometry */
- float (*co)[3];
- float *radius;
- struct HairCurve *curves;
- struct HairMaping *mapping;
- int totpoint;
- int totcurve;
-
- /* Custom Data */
- struct CustomData pdata;
- struct CustomData cdata;
+ int flag;
int attributes_active_index;
- int _pad3;
- /* Material */
+ /* Materials. */
struct Material **mat;
short totcol;
short _pad2[3];
- /* Draw Cache */
+ /* Draw Cache. */
void *batch_cache;
} Hair;