Extrude.cpp (pymol-v2.1.0.tar.bz2) | : | Extrude.cpp (pymol-open-source-2.2.0) | ||
---|---|---|---|---|
skipping to change at line 47 | skipping to change at line 47 | |||
if (ok) | if (ok) | |||
ExtrudeInit(orig->G, I); | ExtrudeInit(orig->G, I); | |||
if (ok) | if (ok) | |||
ok &= ExtrudeAllocPointsNormalsColors(I, orig->N); | ok &= ExtrudeAllocPointsNormalsColors(I, orig->N); | |||
if (ok){ | if (ok){ | |||
CopyArray(I->p, orig->p, float, 3 * I->N); | CopyArray(I->p, orig->p, float, 3 * I->N); | |||
CopyArray(I->n, orig->n, float, 9 * I->N); | CopyArray(I->n, orig->n, float, 9 * I->N); | |||
CopyArray(I->c, orig->c, float, 3 * I->N); | CopyArray(I->c, orig->c, float, 3 * I->N); | |||
CopyArray(I->i, orig->i, int, I->N); | CopyArray(I->i, orig->i, unsigned int, I->N); | |||
CopyArray(I->sf, orig->sf, float, I->N); /* PUTTY: scale factors */ | CopyArray(I->sf, orig->sf, float, I->N); /* PUTTY: scale factors */ | |||
} else { | } else { | |||
ExtrudeFree(I); | ExtrudeFree(I); | |||
I = NULL; | I = NULL; | |||
} | } | |||
return (I); | return (I); | |||
} | } | |||
void ExtrudeInit(PyMOLGlobals * G, CExtrude * I) | void ExtrudeInit(PyMOLGlobals * G, CExtrude * I) | |||
{ | { | |||
skipping to change at line 730 | skipping to change at line 730 | |||
} | } | |||
/* | /* | |||
* I: tube instance | * I: tube instance | |||
* cgo: CGO to add to | * cgo: CGO to add to | |||
* cap: 0: no caps, 1: flat caps, 2: round caps | * cap: 0: no caps, 1: flat caps, 2: round caps | |||
* color_override: RGB color or NULL to use color from `I` | * color_override: RGB color or NULL to use color from `I` | |||
* use_spheres: do round caps with spheres instead of triangles | * use_spheres: do round caps with spheres instead of triangles | |||
* dash: if > 0, skip every segment which is a multiple of `dash` | * dash: if > 0, skip every segment which is a multiple of `dash` | |||
*/ | */ | |||
int ExtrudeCGOSurfaceTube(CExtrude * I, CGO * cgo, int cap, float *color_overrid e, bool use_spheres, int dash) | int ExtrudeCGOSurfaceTube(CExtrude * I, CGO * cgo, int cap, const float *color_o verride, bool use_spheres, int dash) | |||
{ | { | |||
int a, b, *i; | int a, b; | |||
unsigned int *i; | ||||
float *v; | float *v; | |||
float *n; | float *n; | |||
float *c; | float *c; | |||
float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | |||
int start, stop; | int start, stop; | |||
int ok = true; | int ok = true; | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfaceTube-DEBUG: entered.\n" ENDFD; | " ExtrudeCGOSurfaceTube-DEBUG: entered.\n" ENDFD; | |||
if(I->N && I->Ns) { | if(I->N && I->Ns) { | |||
skipping to change at line 1046 | skipping to change at line 1047 | |||
} | } | |||
FreeP(TV); | FreeP(TV); | |||
FreeP(TN); | FreeP(TN); | |||
} | } | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfaceTube-DEBUG: exiting...\n" ENDFD; | " ExtrudeCGOSurfaceTube-DEBUG: exiting...\n" ENDFD; | |||
return ok; | return ok; | |||
} | } | |||
int ExtrudeCylindersToCGO(CExtrude * I, CGO * cgo, float tube_radius, short is_p | int ExtrudeCylindersToCGO(CExtrude * I, CGO * cgo, float tube_radius){ | |||
icking){ | float *v1, *c1, midc[3], axis[3]; | |||
float *v1, *c1, midv[3], midc[3]; | int a; | |||
int a, *i; | unsigned int *i; | |||
int ok = true; | int ok = true; | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCylindersToCGO-DEBUG: entered.\n" ENDFD; | " ExtrudeCylindersToCGO-DEBUG: entered.\n" ENDFD; | |||
v1 = I->p + 3; | v1 = I->p + 3; | |||
c1 = I->c + 3; | c1 = I->c + 3; | |||
i = I->i + 1; | i = I->i + 1; | |||
if (is_picking){ | int cap = (cCylShaderBothCapsRound | cCylShaderInterpColor); | |||
float first = 2.f; | for(a = 1; a < I->N; a++) { | |||
for(a = 1; a < I->N; a++) { | average3f(c1-3, c1, midc); | |||
average3f(v1-3, v1, midv); | ok &= CGOPickColor(cgo, *(i-1), cPickableAtom); | |||
average3f(c1-3, c1, midc); | subtract3f(v1, v1-3, axis); | |||
ok &= CGOPickColor(cgo, *(i-1), cPickableAtom); | CGOColorv(cgo, c1-3); | |||
if (ok) | Pickable pickcolor2 = { *i, cPickableAtom }; | |||
ok &= CGOCustomCylinderv(cgo, v1-3, midv, tube_radius, c1-3, midc, first, | cgo->add<cgo::draw::shadercylinder2ndcolor>(cgo, v1-3, axis, tube_radius, ca | |||
0.f); | p, c1, &pickcolor2); | |||
if (ok) | v1 += 3; | |||
ok &= CGOPickColor(cgo, *i, cPickableAtom); | c1 += 3; | |||
if (ok) | i++; | |||
ok &= CGOCustomCylinderv(cgo, midv, v1, tube_radius, midc, c1, 0.f, 2.f); | cap = cCylShaderCap2Round | cCylShaderInterpColor; | |||
v1 += 3; | ||||
c1 += 3; | ||||
i++; | ||||
first = 0.f; | ||||
} | ||||
if (ok) | ||||
ok &= CGOPickColor(cgo, -1, cPickableNoPick); | ||||
} else { | ||||
if (I->N > 1){ | ||||
// CGOSausage(cgo, v1-3, v1, tube_radius, c1-3, c1); | ||||
ok &= CGOCustomCylinderv(cgo, v1-3, v1, tube_radius, c1-3, c1, 2.f, 2.f); | ||||
v1 += 3; | ||||
c1 += 3; | ||||
} | ||||
for(a = 2; ok && a < I->N; a++) { | ||||
// CGOSausage(cgo, v1-3, v1, tube_radius, c1-3, c1); | ||||
ok &= CGOCustomCylinderv(cgo, v1-3, v1, tube_radius, c1-3, c1, 0.f, 2.f); | ||||
v1 += 3; | ||||
c1 += 3; | ||||
} | ||||
} | } | |||
if (ok) | ||||
ok &= CGOPickColor(cgo, 0, cPickableNoPick); | ||||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCylindersToCGO-DEBUG: exiting...\n" ENDFD; | " ExtrudeCylindersToCGO-DEBUG: exiting...\n" ENDFD; | |||
return ok; | return ok; | |||
} | } | |||
int ExtrudeCGOSurfaceVariableTube(CExtrude * I, CGO * cgo, int cap) | int ExtrudeCGOSurfaceVariableTube(CExtrude * I, CGO * cgo, int cap) | |||
{ | { | |||
int a, b, *i; | int a, b; | |||
unsigned int *i; | ||||
float *v; | float *v; | |||
float *n; | float *n; | |||
float *c; | float *c; | |||
float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL, *AN = NULL, *an; | float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL, *AN = NULL, *an; | |||
float v0[3]; | float v0[3]; | |||
float *sf; /* PUTTY: scale factor from ExtrudeMakeSausLUT() */ | float *sf; /* PUTTY: scale factor from ExtrudeMakeSausLUT() */ | |||
int start, stop; | ||||
int ok = true; | int ok = true; | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfaceTube-DEBUG: entered.\n" ENDFD; | " ExtrudeCGOSurfaceTube-DEBUG: entered.\n" ENDFD; | |||
if(I->N && I->Ns) { | if(I->N && I->Ns) { | |||
TV = Alloc(float, 3 * (I->Ns + 1) * I->N); | TV = Alloc(float, 3 * (I->Ns + 1) * I->N); | |||
TN = Alloc(float, 3 * (I->Ns + 1) * I->N); | TN = Alloc(float, 3 * (I->Ns + 1) * I->N); | |||
AN = Alloc(float, 3 * I->N); /* normals adjusted for changing widths */ | AN = Alloc(float, 3 * I->N); /* normals adjusted for changing widths */ | |||
skipping to change at line 1223 | skipping to change at line 1207 | |||
} | } | |||
/* fill in each strip separately */ | /* fill in each strip separately */ | |||
tv = TV; | tv = TV; | |||
tn = TN; | tn = TN; | |||
tv1 = TV + 3 * I->N; | tv1 = TV + 3 * I->N; | |||
tn1 = TN + 3 * I->N; | tn1 = TN + 3 * I->N; | |||
start = I->Ns / 4; | ||||
stop = 3 * I->Ns / 4; | ||||
for(b = 0; b < I->Ns; b++) { | for(b = 0; b < I->Ns; b++) { | |||
if(SettingGetGlobal_i(I->G, cSetting_cartoon_debug) < 1.5) | if(SettingGetGlobal_i(I->G, cSetting_cartoon_debug) < 1.5) | |||
CGOBegin(cgo, GL_TRIANGLE_STRIP); | CGOBegin(cgo, GL_TRIANGLE_STRIP); | |||
else { | else { | |||
CGOBegin(cgo, GL_LINE_STRIP); | CGOBegin(cgo, GL_LINE_STRIP); | |||
} | } | |||
c = I->c; | c = I->c; | |||
i = I->i; | i = I->i; | |||
for(a = 0; a < I->N; a++) { | for(a = 0; a < I->N; a++) { | |||
CGOColorv(cgo, c); | CGOColorv(cgo, c); | |||
skipping to change at line 1259 | skipping to change at line 1241 | |||
} | } | |||
if(ok && SettingGetGlobal_i(I->G, cSetting_cartoon_debug) > 3.5) { | if(ok && SettingGetGlobal_i(I->G, cSetting_cartoon_debug) > 3.5) { | |||
tv = TV; | tv = TV; | |||
tn = TN; | tn = TN; | |||
tv1 = TV + 3 * I->N; | tv1 = TV + 3 * I->N; | |||
tn1 = TN + 3 * I->N; | tn1 = TN + 3 * I->N; | |||
start = I->Ns / 4; | ||||
stop = 3 * I->Ns / 4; | ||||
for(b = 0; b < I->Ns; b++) { | for(b = 0; b < I->Ns; b++) { | |||
float vv[3]; | float vv[3]; | |||
CGOBegin(cgo, GL_LINES); | CGOBegin(cgo, GL_LINES); | |||
c = I->c; | c = I->c; | |||
i = I->i; | i = I->i; | |||
for(a = 0; a < I->N; a++) { | for(a = 0; a < I->N; a++) { | |||
CGOColorv(cgo, c); | CGOColorv(cgo, c); | |||
copy3f(tn, vv); | copy3f(tn, vv); | |||
scale3f(vv, 0.3F, vv); | scale3f(vv, 0.3F, vv); | |||
add3f(vv, tv, vv); | add3f(vv, tv, vv); | |||
skipping to change at line 1366 | skipping to change at line 1346 | |||
FreeP(TN); | FreeP(TN); | |||
FreeP(AN); | FreeP(AN); | |||
} | } | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfaceTube-DEBUG: exiting...\n" ENDFD; | " ExtrudeCGOSurfaceTube-DEBUG: exiting...\n" ENDFD; | |||
} | } | |||
return ok; | return ok; | |||
} | } | |||
int ExtrudeCGOSurfacePolygon(CExtrude * I, CGO * cgo, int cap, float *color_over ride) | int ExtrudeCGOSurfacePolygon(CExtrude * I, CGO * cgo, int cap, const float *colo r_override) | |||
{ | { | |||
int a, b, *i; | int a, b; | |||
unsigned int *i; | ||||
float *v; | float *v; | |||
float *n; | float *n; | |||
float *c; | float *c; | |||
float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | |||
float v0[3]; | float v0[3]; | |||
int ok = true; | int ok = true; | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfacePolygon-DEBUG: entered.\n" ENDFD; | " ExtrudeCGOSurfacePolygon-DEBUG: entered.\n" ENDFD; | |||
skipping to change at line 1549 | skipping to change at line 1530 | |||
FreeP(TV); | FreeP(TV); | |||
FreeP(TN); | FreeP(TN); | |||
} | } | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfacePolygon-DEBUG: exiting...\n" ENDFD; | " ExtrudeCGOSurfacePolygon-DEBUG: exiting...\n" ENDFD; | |||
return ok; | return ok; | |||
} | } | |||
int ExtrudeCGOSurfacePolygonTaper(CExtrude * I, CGO * cgo, int sampling, | int ExtrudeCGOSurfacePolygonTaper(CExtrude * I, CGO * cgo, int sampling, | |||
float *color_override) | const float *color_override) | |||
{ | { | |||
int a, b, *i; | int a, b; | |||
unsigned int *i; | ||||
float *v; | float *v; | |||
float *n; | float *n; | |||
float *c; | float *c; | |||
float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | |||
float s0[3]; | float s0[3]; | |||
float f; | float f; | |||
int subN; | int subN; | |||
int ok = true; | int ok = true; | |||
subN = I->N - sampling; | subN = I->N - sampling; | |||
skipping to change at line 1684 | skipping to change at line 1666 | |||
FreeP(TV); | FreeP(TV); | |||
FreeP(TN); | FreeP(TN); | |||
} | } | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfacePolygonTaper-DEBUG: exiting...\n" ENDFD; | " ExtrudeCGOSurfacePolygonTaper-DEBUG: exiting...\n" ENDFD; | |||
return ok; | return ok; | |||
} | } | |||
int ExtrudeCGOSurfaceStrand(CExtrude * I, CGO * cgo, int sampling, float *color_ override) | int ExtrudeCGOSurfaceStrand(CExtrude * I, CGO * cgo, int sampling, const float * color_override) | |||
{ | { | |||
int a, b, *i; | int a, b; | |||
unsigned int *i; | ||||
float *v; | float *v; | |||
float *n; | float *n; | |||
float *c; | float *c; | |||
float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; | |||
float v0[3], n0[3], s0[3], z[3] = { 1.0, 0.0, 1.0 }; | float v0[3], n0[3], s0[3], z[3] = { 1.0, 0.0, 1.0 }; | |||
int subN; | int subN; | |||
int ok = true; | int ok = true; | |||
subN = I->N - sampling; | subN = I->N - sampling; | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
skipping to change at line 1755 | skipping to change at line 1738 | |||
for(b = 0; ok && b < I->Ns; b += 2) { | for(b = 0; ok && b < I->Ns; b += 2) { | |||
if(SettingGetGlobal_i(I->G, cSetting_cartoon_debug) < 1.5) | if(SettingGetGlobal_i(I->G, cSetting_cartoon_debug) < 1.5) | |||
ok &= CGOBegin(cgo, GL_TRIANGLE_STRIP); | ok &= CGOBegin(cgo, GL_TRIANGLE_STRIP); | |||
else { | else { | |||
ok &= CGOBegin(cgo, GL_LINE_STRIP); | ok &= CGOBegin(cgo, GL_LINE_STRIP); | |||
} | } | |||
c = I->c; | c = I->c; | |||
i = I->i; | i = I->i; | |||
for(a = 0; ok && a < I->N; a++) { | for(a = 0; ok && a < I->N; a++) { | |||
if(a <= subN) { | if(a < subN) { | |||
if(color_override && ((b == 2) || (b == 3) || (b == 6) || (b == 7))) | if(color_override && ((b == 2) || (b == 3) || (b == 6) || (b == 7))) | |||
ok &= CGOColorv(cgo, color_override); | ok &= CGOColorv(cgo, color_override); | |||
else | else | |||
ok &= CGOColorv(cgo, c); | ok &= CGOColorv(cgo, c); | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(cgo, *i, cPickableAtom); | ok &= CGOPickColor(cgo, *i, cPickableAtom); | |||
if (ok) | if (ok) | |||
ok &= CGONormalv(cgo, tn); | ok &= CGONormalv(cgo, tn); | |||
if (ok) | if (ok) | |||
ok &= CGOVertexv(cgo, tv); | ok &= CGOVertexv(cgo, tv); | |||
} | } | |||
tn += 3; | tn += 3; | |||
tv += 3; | tv += 3; | |||
if(ok && a <= subN) { | if(ok && a < subN) { | |||
ok &= CGONormalv(cgo, tn1); | ok &= CGONormalv(cgo, tn1); | |||
if (ok) | if (ok) | |||
ok &= CGOVertexv(cgo, tv1); | ok &= CGOVertexv(cgo, tv1); | |||
} | } | |||
tn1 += 3; | tn1 += 3; | |||
tv1 += 3; | tv1 += 3; | |||
c += 3; | c += 3; | |||
i++; | i++; | |||
} | } | |||
tv += 3 * I->N; | tv += 3 * I->N; | |||
skipping to change at line 1803 | skipping to change at line 1786 | |||
sv = I->sv; | sv = I->sv; | |||
tv = I->tv; | tv = I->tv; | |||
for(b = 0; b < I->Ns; b++) { | for(b = 0; b < I->Ns; b++) { | |||
transform33Tf3f(n, sv, tv); | transform33Tf3f(n, sv, tv); | |||
add3f(v, tv, tv); | add3f(v, tv, tv); | |||
sv += 3; | sv += 3; | |||
tv += 3; | tv += 3; | |||
} | } | |||
ok &= CGOBegin(cgo, GL_TRIANGLE_FAN); | ||||
copy3f(I->n, v0); | copy3f(I->n, v0); | |||
invert3f(v0); | invert3f(v0); | |||
if (ok){ | if (ok){ | |||
if(color_override) | if(color_override) | |||
ok &= CGOColorv(cgo, color_override); | ok &= CGOColorv(cgo, color_override); | |||
else | else | |||
ok &= CGOColorv(cgo, I->c); | ok &= CGOColorv(cgo, I->c); | |||
} | } | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(cgo, I->i[0], cPickableAtom); | ok &= CGOPickColor(cgo, I->i[0], cPickableAtom); | |||
if (ok) | if (ok) | |||
ok &= CGONormalv(cgo, v0); | ok &= CGOBegin(cgo, GL_TRIANGLE_STRIP); | |||
if (ok) | ||||
ok &= CGOVertexv(cgo, v); | ||||
/* trace shape */ | ||||
if (ok) | if (ok) | |||
ok &= CGOVertexv(cgo, I->tv); | ok &= CGONormalv(cgo, v0); | |||
for(b = I->Ns - 2; ok && b >= 0; b -= 2) { | ||||
ok &= CGOVertexv(cgo, I->tv + b * 3); | ok &= CGOVertexv(cgo, I->tv + 6 * 3); | |||
} | ok &= CGOVertexv(cgo, I->tv + 4 * 3); | |||
ok &= CGOVertexv(cgo, I->tv + 0 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 2 * 3); | ||||
if (ok) | if (ok) | |||
ok &= CGOEnd(cgo); | ok &= CGOEnd(cgo); | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(cgo, -1, cPickableNoPick); | ok &= CGOPickColor(cgo, -1, cPickableNoPick); | |||
} | } | |||
/* now do the arrow part */ | /* now do the arrow part */ | |||
tn = TN; | tn = TN; | |||
tv = TV; | tv = TV; | |||
skipping to change at line 1920 | skipping to change at line 1902 | |||
tv1 += 3 * I->N; | tv1 += 3 * I->N; | |||
tn1 += 3 * I->N; | tn1 += 3 * I->N; | |||
if (ok) | if (ok) | |||
ok &= CGOEnd(cgo); | ok &= CGOEnd(cgo); | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(cgo, -1, cPickableNoPick); | ok &= CGOPickColor(cgo, -1, cPickableNoPick); | |||
} | } | |||
n = I->n + 9 * (subN - 1); | n = I->n + 9 * (subN - 1); | |||
v = I->p + 3 * (subN - 1); | v = I->p + 3 * (subN - 1); | |||
sv = I->sv; | sv = I->sv; | |||
tv = I->tv; | tv = I->tv; | |||
if (ok){ | if (ok){ | |||
for(b = 0; b < I->Ns; b++) { | for(b = 0; b < I->Ns; b++) { | |||
copy3f(sv, s0); | copy3f(sv, s0); | |||
s0[2] = s0[2] * 1.5F; | s0[2] = s0[2] * ((s0[2] < 0.f) ? -1.f : 1.5F) ; | |||
transform33Tf3f(n, s0, tv); | transform33Tf3f(n, s0, tv); | |||
add3f(v, tv, tv); | add3f(v, tv, tv); | |||
sv += 3; | sv += 3; | |||
tv += 3; | tv += 3; | |||
} | } | |||
} | } | |||
if (ok) | // Back end/flat surface of the arrow, | |||
ok &= CGOBegin(cgo, GL_TRIANGLE_FAN); | // now split into two pieces, one for each side | |||
copy3f(n, v0); | copy3f(n, v0); | |||
invert3f(v0); | invert3f(v0); | |||
if (ok){ | if (ok){ | |||
if(color_override) | if(color_override) | |||
ok &= CGOColorv(cgo, color_override); | ok &= CGOColorv(cgo, color_override); | |||
else | else | |||
ok &= CGOColorv(cgo, I->c + 3 * (subN - 1)); | ok &= CGOColorv(cgo, I->c + 3 * (subN - 1)); | |||
} | } | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(cgo, I->i[(subN - 1)], cPickableAtom); | ok &= CGOPickColor(cgo, I->i[(subN - 1)], cPickableAtom); | |||
// draw first side | ||||
tv = I->tv; | ||||
if (ok) | ||||
ok &= CGOBegin(cgo, GL_TRIANGLE_STRIP); | ||||
if (ok) | if (ok) | |||
ok &= CGONormalv(cgo, v0); | ok &= CGONormalv(cgo, v0); | |||
ok &= CGOVertexv(cgo, I->tv + 6 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 4 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 0 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 2 * 3); | ||||
if (ok) | if (ok) | |||
ok &= CGOVertexv(cgo, v); | ok &= CGOEnd(cgo); | |||
/* trace shape */ | ||||
// switch vertices to other side of flat surface of arrow | ||||
sv = I->sv; | ||||
tv = I->tv; | tv = I->tv; | |||
for(b = 0; ok && b < I->Ns; b += 2) { | if (ok){ | |||
ok &= CGOVertexv(cgo, I->tv + b * 3); | for(b = 0; b < I->Ns; b++) { | |||
copy3f(sv, s0); | ||||
s0[2] = s0[2] * ((s0[2] < 0.f) ? 1.f : -1.5F) ; | ||||
transform33Tf3f(n, s0, tv); | ||||
add3f(v, tv, tv); | ||||
sv += 3; | ||||
tv += 3; | ||||
} | ||||
} | } | |||
// draw other side | ||||
if (ok) | ||||
ok &= CGOBegin(cgo, GL_TRIANGLE_STRIP); | ||||
if (ok) | if (ok) | |||
ok &= CGOVertexv(cgo, I->tv); | ok &= CGONormalv(cgo, v0); | |||
ok &= CGOVertexv(cgo, I->tv + 0 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 2 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 6 * 3); | ||||
ok &= CGOVertexv(cgo, I->tv + 4 * 3); | ||||
if (ok) | if (ok) | |||
ok &= CGOEnd(cgo); | ok &= CGOEnd(cgo); | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(cgo, -1, cPickableNoPick); | ok &= CGOPickColor(cgo, -1, cPickableNoPick); | |||
FreeP(TV); | FreeP(TV); | |||
FreeP(TN); | FreeP(TN); | |||
} | } | |||
PRINTFD(I->G, FB_Extrude) | PRINTFD(I->G, FB_Extrude) | |||
" ExtrudeCGOSurfaceStrand-DEBUG: exiting...\n" ENDFD; | " ExtrudeCGOSurfaceStrand-DEBUG: exiting...\n" ENDFD; | |||
return ok; | return ok; | |||
} | } | |||
int ExtrudeComputePuttyScaleFactors(CExtrude * I, ObjectMolecule * obj, int tran sform, | int ExtrudeComputePuttyScaleFactors(CExtrude * I, ObjectMolecule * obj, int tran sform, | |||
float mean, float stdev, float min, float max , | float mean, float stdev, float min, float max , | |||
float power, float range, | float power, float range, | |||
float min_scale, float max_scale, int window) | float min_scale, float max_scale, int window) | |||
{ | { | |||
float *sf; | float *sf; | |||
int a; | int a; | |||
int *i; | unsigned int *i; | |||
AtomInfoType *at; | AtomInfoType *at; | |||
float scale = 1.0F; | float scale = 1.0F; | |||
float data_range = max - min; | float data_range = max - min; | |||
int ok = true; | int ok = true; | |||
if(I->N && I->Ns) { | if(I->N && I->Ns) { | |||
int invalid = false; | int invalid = false; | |||
i = I->i; | i = I->i; | |||
sf = I->sf; | sf = I->sf; | |||
skipping to change at line 2169 | skipping to change at line 2176 | |||
FreeP(I->sf); /* PUTTY */ | FreeP(I->sf); /* PUTTY */ | |||
I->p = Alloc(float, 3 * (n + 1)); | I->p = Alloc(float, 3 * (n + 1)); | |||
CHECKOK(ok, I->p); | CHECKOK(ok, I->p); | |||
if (ok) | if (ok) | |||
I->n = Alloc(float, 9 * (n + 1)); | I->n = Alloc(float, 9 * (n + 1)); | |||
CHECKOK(ok, I->n); | CHECKOK(ok, I->n); | |||
if (ok) | if (ok) | |||
I->c = Alloc(float, 3 * (n + 1)); | I->c = Alloc(float, 3 * (n + 1)); | |||
CHECKOK(ok, I->c); | CHECKOK(ok, I->c); | |||
if (ok) | if (ok) | |||
I->i = Alloc(int, 3 * (n + 1)); | I->i = Alloc(unsigned int, 3 * (n + 1)); | |||
CHECKOK(ok, I->i); | CHECKOK(ok, I->i); | |||
if (ok) | if (ok) | |||
I->sf = Alloc(float, n + 1); /* PUTTY: scale factors */ | I->sf = Alloc(float, n + 1); /* PUTTY: scale factors */ | |||
CHECKOK(ok, I->sf); | CHECKOK(ok, I->sf); | |||
if (!ok){ | if (!ok){ | |||
FreeP(I->p); | FreeP(I->p); | |||
FreeP(I->n); | FreeP(I->n); | |||
FreeP(I->c); | FreeP(I->c); | |||
FreeP(I->i); | FreeP(I->i); | |||
FreeP(I->sf); | FreeP(I->sf); | |||
End of changes. 36 change blocks. | ||||
75 lines changed or deleted | 81 lines changed or added |