[Bf-blender-cvs] [7cd45e17138] tmp_hair_curves: Rename "guide" curves to "fiber" curves.

Lukas Tönne noreply at git.blender.org
Fri Jun 29 17:45:19 CEST 2018


Commit: 7cd45e17138ef10eaf1d5e038b3c7ff42ae9f9c3
Author: Lukas Tönne
Date:   Fri Jun 29 15:11:27 2018 +0100
Branches: tmp_hair_curves
https://developer.blender.org/rB7cd45e17138ef10eaf1d5e038b3c7ff42ae9f9c3

Rename "guide" curves to "fiber" curves.

Guide curves should be a higher-level concept. All fibers should have their
own curve control points, with subdivision on the GPU.

===================================================================

M	source/blender/blenkernel/BKE_hair.h
M	source/blender/blenkernel/intern/hair.c
M	source/blender/blenkernel/intern/hair_draw.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/engines/workbench/workbench_deferred.c
M	source/blender/draw/engines/workbench/workbench_forward.c
M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache.h
M	source/blender/draw/intern/draw_cache_impl.h
M	source/blender/draw/intern/draw_cache_impl_hair.c
M	source/blender/draw/intern/draw_common.h
M	source/blender/draw/intern/draw_hair.c
M	source/blender/draw/intern/draw_hair_fibers.c
M	source/blender/draw/modes/object_mode.c
R100	source/blender/draw/modes/shaders/common_hair_guides_lib.glsl	source/blender/draw/modes/shaders/common_hair_fibers_lib.glsl
M	source/blender/makesdna/DNA_hair_types.h
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_hair.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_hair.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_hair.h b/source/blender/blenkernel/BKE_hair.h
index 73f8e3d9c12..af4af4fb53a 100644
--- a/source/blender/blenkernel/BKE_hair.h
+++ b/source/blender/blenkernel/BKE_hair.h
@@ -40,7 +40,7 @@ struct HairFollicle;
 struct HairPattern;
 struct HairSystem;
 struct HairDrawSettings;
-struct HairGuideData;
+struct HairCurveData;
 struct Mesh;
 struct MeshSample;
 struct MLoop;
@@ -53,38 +53,38 @@ struct HairSystem* BKE_hair_copy(struct HairSystem *hsys);
 /* Delete a hair system */
 void BKE_hair_free(struct HairSystem *hsys);
 
-/* === Guide Strands === */
+/* === Fiber curves === */
 
-/* Allocate buffers for defining guide curves
- * \param totcurves Number of guide curves to allocate
+/* Allocate buffers for defining fiber curves
+ * \param totcurves Number of fiber curves to allocate
  */
-void BKE_hair_guide_curves_begin(struct HairSystem *hsys, int totcurves);
+void BKE_hair_fiber_curves_begin(struct HairSystem *hsys, int totcurves);
 
-/* Set properties of a guide curve
- * \param index Index of the guide guide curve
- * \param mesh_sample Origin of the guide curve on the scalp mesh.
- * \param numverts Number of vertices in this guide curve
+/* Set properties of a fiber curve
+ * \param index Index of the fiber curve
+ * \param mesh_sample Origin of the fiber curve on the scalp mesh.
+ * \param numverts Number of vertices in this fiber curve
  */
-void BKE_hair_set_guide_curve(struct HairSystem *hsys, int index, const struct MeshSample *mesh_sample, int numverts,
+void BKE_hair_set_fiber_curve(struct HairSystem *hsys, int index, const struct MeshSample *mesh_sample, int numverts,
                               float taper_length, float taper_thickness);
 
-/* Finalize guide curve update */
-void BKE_hair_guide_curves_end(struct HairSystem *hsys);
+/* Finalize fiber curve update */
+void BKE_hair_fiber_curves_end(struct HairSystem *hsys);
 
-/* Set properties of a guide curve vertex
- * \param index Index of the guide curve vertex.
+/* Set properties of a fiber curve vertex
+ * \param index Index of the fiber curve vertex.
  * \param flag Flags to set on the vertex.
  * \param co Location of the vertex in object space.
  */
-void BKE_hair_set_guide_vertex(struct HairSystem *hsys, int index, int flag, const float co[3]);
+void BKE_hair_set_fiber_vertex(struct HairSystem *hsys, int index, int flag, const float co[3]);
 
-/* Set the hair guide data used by the hair system.
+/* Set the hair fiber curve data used by the hair system.
  */
-void BKE_hair_set_hair_guides(struct HairSystem *hsys, struct HairGuideData *guides);
+void BKE_hair_set_fiber_curves(struct HairSystem *hsys, struct HairCurveData *curves);
 
-/* Remove all guide curves.
+/* Remove all fiber curves.
  */
-void BKE_hair_clear_guides(struct HairSystem *hsys);
+void BKE_hair_clear_fiber_curves(struct HairSystem *hsys);
 
 /* === Follicles === */
 
@@ -131,15 +131,15 @@ void BKE_hair_draw_settings_free(struct HairDrawSettings *draw_settings);
 /* Intermediate data for export */
 typedef struct HairExportCache
 {
-	/* Per guide curve data */
-	int totguidecurves;
-	struct HairGuideCurve *guide_curves;
+	/* Per fiber curve data */
+	int totcurves;
+	struct HairFiberCurve *fiber_curves;
 	
-	/* Per guide vertex data */
-	int totguideverts;
-	struct HairGuideVertex *guide_verts;
-	float (*guide_tangents)[3];             /* Tangent vectors on guide curves */
-	float (*guide_normals)[3];              /* Normal vectors on guide curves */
+	/* Per fiber vertex data */
+	int totverts;
+	struct HairFiberVertex *fiber_verts;
+	float (*fiber_tangents)[3];             /* Tangent vectors on fiber curves */
+	float (*fiber_normals)[3];              /* Normal vectors on fiber curves */
 	
 	/* Per fiber data */
 	int totfibercurves;
@@ -159,20 +159,20 @@ typedef enum eHairExportCacheUpdateFlags
 	HAIR_EXPORT_FIBER_VERTEX_COUNTS     = (1 << 1),
 	/* Follicle parent indices and weights */
 	HAIR_EXPORT_FOLLICLE_BINDING        = (1 << 2),
-	/* Guide vertex positions (deform only) */
-	HAIR_EXPORT_GUIDE_VERTICES          = (1 << 3),
-	/* Guide curve number and vertex counts (topology changes) */
-	HAIR_EXPORT_GUIDE_CURVES            = (1 << 4),
+	/* Fiber vertex positions (deform only) */
+	HAIR_EXPORT_FIBER_VERTICES          = (1 << 3),
+	/* Fiber curve number and vertex counts (topology changes) */
+	HAIR_EXPORT_FIBER_CURVES            = (1 << 4),
 	
 	HAIR_EXPORT_ALL                     =
 	    HAIR_EXPORT_FIBER_ROOT_POSITIONS |
 	    HAIR_EXPORT_FIBER_VERTEX_COUNTS |
 	    HAIR_EXPORT_FOLLICLE_BINDING |
-	    HAIR_EXPORT_GUIDE_VERTICES |
-	    HAIR_EXPORT_GUIDE_CURVES,
-	HAIR_EXPORT_GUIDES                  =
-	    HAIR_EXPORT_GUIDE_VERTICES |
-	    HAIR_EXPORT_GUIDE_CURVES,
+	    HAIR_EXPORT_FIBER_VERTICES |
+	    HAIR_EXPORT_FIBER_CURVES,
+	HAIR_EXPORT_FIBERS                  =
+	    HAIR_EXPORT_FIBER_VERTICES |
+	    HAIR_EXPORT_FIBER_CURVES,
 	HAIR_EXPORT_FOLLICLES               =
 	    HAIR_EXPORT_FIBER_ROOT_POSITIONS |
 	    HAIR_EXPORT_FIBER_VERTEX_COUNTS |
diff --git a/source/blender/blenkernel/intern/hair.c b/source/blender/blenkernel/intern/hair.c
index 70ae53b58c8..2db345dc65b 100644
--- a/source/blender/blenkernel/intern/hair.c
+++ b/source/blender/blenkernel/intern/hair.c
@@ -73,13 +73,13 @@ HairSystem* BKE_hair_copy(HairSystem *hsys)
 		nhsys->pattern->follicles = MEM_dupallocN(hsys->pattern->follicles);
 	}
 	
-	if (hsys->guides.curves)
+	if (hsys->curve_data.curves)
 	{
-		nhsys->guides.curves = MEM_dupallocN(hsys->guides.curves);
+		nhsys->curve_data.curves = MEM_dupallocN(hsys->curve_data.curves);
 	}
-	if (hsys->guides.verts)
+	if (hsys->curve_data.verts)
 	{
-		nhsys->guides.verts = MEM_dupallocN(hsys->guides.verts);
+		nhsys->curve_data.verts = MEM_dupallocN(hsys->curve_data.verts);
 	}
 	
 	nhsys->draw_batch_cache = NULL;
@@ -92,13 +92,13 @@ void BKE_hair_free(HairSystem *hsys)
 {
 	BKE_hair_batch_cache_free(hsys);
 	
-	if (hsys->guides.curves)
+	if (hsys->curve_data.curves)
 	{
-		MEM_freeN(hsys->guides.curves);
+		MEM_freeN(hsys->curve_data.curves);
 	}
-	if (hsys->guides.verts)
+	if (hsys->curve_data.verts)
 	{
-		MEM_freeN(hsys->guides.verts);
+		MEM_freeN(hsys->curve_data.verts);
 	}
 	
 	if (hsys->pattern)
@@ -216,24 +216,24 @@ void BKE_hair_generate_follicles_ex(
 
 /* ================================= */
 
-void BKE_hair_guide_curves_begin(HairSystem *hsys, int totcurves)
+void BKE_hair_fiber_curves_begin(HairSystem *hsys, int totcurves)
 {
-	if (totcurves != hsys->guides.totcurves)
+	if (totcurves != hsys->curve_data.totcurves)
 	{
-		hsys->guides.curves = MEM_reallocN(hsys->guides.curves, sizeof(HairGuideCurve) * totcurves);
-		hsys->guides.totcurves = totcurves;
+		hsys->curve_data.curves = MEM_reallocN(hsys->curve_data.curves, sizeof(HairFiberCurve) * totcurves);
+		hsys->curve_data.totcurves = totcurves;
 
 		hsys->flag |= HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING;
 		BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
 	}
 }
 
-void BKE_hair_set_guide_curve(HairSystem *hsys, int index, const MeshSample *mesh_sample, int numverts,
+void BKE_hair_set_fiber_curve(HairSystem *hsys, int index, const MeshSample *mesh_sample, int numverts,
                               float taper_length, float taper_thickness)
 {
-	BLI_assert(index <= hsys->guides.totcurves);
+	BLI_assert(index <= hsys->curve_data.totcurves);
 	
-	HairGuideCurve *curve = &hsys->guides.curves[index];
+	HairFiberCurve *curve = &hsys->curve_data.curves[index];
 	memcpy(&curve->mesh_sample, mesh_sample, sizeof(MeshSample));
 	curve->numverts = numverts;
 	curve->taper_length = taper_length;
@@ -246,83 +246,83 @@ void BKE_hair_set_guide_curve(HairSystem *hsys, int index, const MeshSample *mes
 /* Calculate vertex start indices on all curves based on length.
  * Returns the total number of vertices.
  */
-static int hair_guide_calc_vertstart(HairSystem *hsys)
+static int hair_curve_calc_vertstart(HairSystem *hsys)
 {
 	/* Recalculate vertex count and start offsets in curves */
 	int vertstart = 0;
-	for (int i = 0; i < hsys->guides.totcurves; ++i)
+	for (int i = 0; i < hsys->curve_data.totcurves; ++i)
 	{
-		hsys->guides.curves[i].vertstart = vertstart;
-		vertstart += hsys->guides.curves[i].numverts;
+		hsys->curve_data.curves[i].vertstart = vertstart;
+		vertstart += hsys->curve_data.curves[i].numverts;
 	}
 	
 	return vertstart;
 }
 
-void BKE_hair_guide_curves_end(HairSystem *hsys)
+void BKE_hair_fiber_curves_end(HairSystem *hsys)
 {
-	const int totverts = hair_guide_calc_vertstart(hsys);
+	const int totverts = hair_curve_calc_vertstart(hsys);
 
-	if (totverts != hsys->guides.totverts)
+	if (totverts != hsys->curve_data.totverts)
 	{
-		hsys->guides.verts = MEM_reallocN(hsys->guides.verts, sizeof(HairGuideVertex) * totverts);
-		hsys->guides.totverts = totverts;
+		hsys->curve_data.verts = MEM_reallocN(hsys->curve_data.verts, sizeof(HairFiberVertex) * totverts);
+		hsys->curve_data.totverts = totverts;
 
 		BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
 	}
 }
 
-void BKE_hair_set_guide_vertex(HairSystem *hsys, int index, int flag, const float co[3])
+void BKE_hair_set_fiber_vertex(HairSystem *hsys, int index, int flag, const float co[3])
 {
-	BLI_assert(index <= hsys->guides.totverts);
+	BLI_assert(index <= hsys->curve_data.totverts);
 	
-	HairGuideVertex *vertex = &hsys->guides.verts[index];
+	HairFiberVertex *vertex = &hsys->curve_data.verts[index];
 	vertex->flag = flag;
 	copy_v3_v3(vertex->co, co);
 	
 	BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
 }
 
-void BKE_hair_set_hair_guides(HairSystem *hsys, HairGuideData *guides)
+void BKE_hair_set_fiber_curves(HairSystem *hsys, HairCurveData *curves)
 {
-	if (hsys->guides.curves)
+	if (hsys->curve_data.curves)
 	{
-		MEM_freeN(hsys->guides.curves);
+		MEM_freeN(hsys->curve_data.curves);
 	}
-	hsys->guides.curves = MEM_dupallocN(hsys->guides.curves);
-	hsys->guides.totcurves = guides->totcurves;
+	hsys->curve_data.curves = MEM_dupallocN(hsys->curve_data.curves);
+	hsys->curve_data.totcurves = curves->totcurves;
 
-	if (hsys->guides.verts)
+	if (hsys->curve_data.verts)
 	{
-		MEM_freeN(hsys->guides.verts);
+		MEM_freeN(hsys->curve_data.verts);
 	}
-	hsys->guides.verts = MEM_dupallocN(hsy

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list