Draw actual hair keys when the "Guide Hair" setting is enabled.

Without this certain debug tasks become very hard to visualize.
This commit is contained in:
Lukas Tönne 2014-11-13 15:15:02 +01:00
parent 62d9aa05ab
commit e56bda4a02
1 changed files with 28 additions and 0 deletions

View File

@ -5162,10 +5162,13 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if (part->type == PART_HAIR) {
if (part->draw & PART_DRAW_GUIDE_HAIRS) {
DerivedMesh *hair_dm = psys->hair_out_dm;
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
if (pa->totkey > 1) {
HairKey *hkey = pa->hair;
@ -5179,6 +5182,31 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDrawArrays(GL_LINE_STRIP, 0, pa->totkey);
}
}
if (hair_dm) {
MVert *mvert = hair_dm->getVertArray(hair_dm);
int i;
glColor3f(0.9f, 0.4f, 0.4f);
glBegin(GL_LINES);
for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
for (i = 1; i < pa->totkey; ++i) {
float v1[3], v2[3];
copy_v3_v3(v1, mvert[pa->hair_index + i - 1].co);
copy_v3_v3(v2, mvert[pa->hair_index + i].co);
mul_m4_v3(ob->obmat, v1);
mul_m4_v3(ob->obmat, v2);
glVertex3fv(v1);
glVertex3fv(v2);
}
}
glEnd();
}
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glEnableClientState(GL_NORMAL_ARRAY);