RepDistLabel.cpp (pymol-v1.8.6.0.tar.bz2) | : | RepDistLabel.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 78 | skipping to change at line 78 | |||
static void RepDistLabelRender(RepDistLabel * I, RenderInfo * info) | static void RepDistLabelRender(RepDistLabel * I, RenderInfo * info) | |||
{ | { | |||
CRay *ray = info->ray; | CRay *ray = info->ray; | |||
Picking **pick = info->pick; | Picking **pick = info->pick; | |||
PyMOLGlobals *G = I->R.G; | PyMOLGlobals *G = I->R.G; | |||
float *v = I->V; | float *v = I->V; | |||
int c = I->N; | int c = I->N; | |||
DistLabel *l = I->L; | DistLabel *l = I->L; | |||
int n = 0; | int n = 0; | |||
int color; | int color; | |||
int font_id = SettingGet_i(G, I->ds->Setting, I->Obj->Setting, cSetting_label_ | int font_id = SettingGet_i(G, NULL, I->Obj->Setting, cSetting_label_font_id); | |||
font_id); | float font_size = SettingGet_f(G, NULL, I->Obj->Setting, cSetting_label_size); | |||
float font_size = SettingGet_f(G, I->ds->Setting, I->Obj->Setting, cSetting_la | ||||
bel_size); | ||||
int ok = true; | int ok = true; | |||
if(ray) { | if(ray) { | |||
TextSetOutlineColor(G, I->OutlineColor); | TextSetOutlineColor(G, I->OutlineColor); | |||
color = SettingGet_color(G, I->ds->Setting, I->Obj->Setting, cSetting_label_ color); | color = SettingGet_color(G, NULL, I->Obj->Setting, cSetting_label_color); | |||
if((color >= 0) || (color == cColorFront) || (color == cColorBack)) | if((color >= 0) || (color == cColorFront) || (color == cColorBack)) | |||
TextSetColor(G, ColorGet(G, color)); | TextSetColor(G, ColorGet(G, color)); | |||
else | else | |||
TextSetColor(G, ColorGet(G, I->Obj->Color)); | TextSetColor(G, ColorGet(G, I->Obj->Color)); | |||
while(c--) { | while(c--) { | |||
TextSetPos(G, v); | TextSetPos(G, v); | |||
TextRenderRay(G, ray, font_id, l[n], font_size, v + 3); | TextRenderRay(G, ray, font_id, l[n], font_size, v + 3); | |||
v += 6; | v += 6; | |||
n++; | n++; | |||
} | } | |||
} else if(G->HaveGUI && G->ValidContext) { | } else if(G->HaveGUI && G->ValidContext) { | |||
if(pick) { | if(pick) { | |||
if (I->shaderCGO){ | if (I->shaderCGO){ | |||
CGORenderGLPicking(I->shaderCGO, pick, &I->R.context, NULL, NULL); | CGORenderGLPicking(I->shaderCGO, pick, &I->R.context, NULL, NULL); | |||
return; | return; | |||
} | } | |||
} else { | } else { | |||
Pickable *p = I->R.P; | Pickable *p = I->R.P; | |||
int float_text = SettingGet_i(G, I->ds->Setting, | int float_text = SettingGet_i(G, NULL, | |||
I->Obj->Setting, | I->Obj->Setting, | |||
cSetting_float_labels); | cSetting_float_labels); | |||
if(float_text) | if(float_text) | |||
glDisable(GL_DEPTH_TEST); | glDisable(GL_DEPTH_TEST); | |||
if (!I->shaderCGO){ | if (!I->shaderCGO){ | |||
I->shaderCGO = CGONew(G); | I->shaderCGO = CGONew(G); | |||
CHECKOK(ok, I->shaderCGO); | CHECKOK(ok, I->shaderCGO); | |||
if (ok){ | if (ok){ | |||
I->shaderCGO->use_shader = true; | I->shaderCGO->use_shader = true; | |||
I->shaderCGO->enable_shaders = true; | I->shaderCGO->enable_shaders = true; | |||
} | } | |||
} else { | } else { | |||
CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); | CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); | |||
return; | return; | |||
} | } | |||
TextSetOutlineColor(G, I->OutlineColor); | TextSetOutlineColor(G, I->OutlineColor); | |||
color = SettingGet_color(G, I->ds->Setting, I->Obj->Setting, cSetting_labe l_color); | color = SettingGet_color(G, NULL, I->Obj->Setting, cSetting_label_color); | |||
if((color >= 0) || (color == cColorFront) || (color == cColorBack)) | if((color >= 0) || (color == cColorFront) || (color == cColorBack)) | |||
TextSetColor(G, ColorGet(G, color)); | TextSetColor(G, ColorGet(G, color)); | |||
else | else | |||
TextSetColor(G, ColorGet(G, I->Obj->Color)); | TextSetColor(G, ColorGet(G, I->Obj->Color)); | |||
while(c--) { | while(c--) { | |||
p++; | p++; | |||
if (ok) | if (ok) | |||
ok &= CGOPickColor(I->shaderCGO, p->index, p->bond); | ok &= CGOPickColor(I->shaderCGO, p->index, p->bond); | |||
TextSetPos(G, v); | TextSetPos(G, v); | |||
skipping to change at line 176 | skipping to change at line 176 | |||
Rep *RepDistLabelNew(DistSet * ds, int state) | Rep *RepDistLabelNew(DistSet * ds, int state) | |||
{ | { | |||
PyMOLGlobals *G = ds->State.G; | PyMOLGlobals *G = ds->State.G; | |||
int a; | int a; | |||
int n = 0; | int n = 0; | |||
float *v, *v1, *v2, *v3, d[3], di; | float *v, *v1, *v2, *v3, d[3], di; | |||
char buffer[255]; | char buffer[255]; | |||
const float *lab_pos = | const float *lab_pos = | |||
SettingGet_3fv(G, NULL, ds->Obj->Obj.Setting, cSetting_label_position); | SettingGet_3fv(G, NULL, ds->Obj->Obj.Setting, cSetting_label_position); | |||
int default_digits = | int default_digits = | |||
SettingGet_i(G, ds->Setting, ds->Obj->Obj.Setting, cSetting_label_digits); | SettingGet_i(G, NULL, ds->Obj->Obj.Setting, cSetting_label_digits); | |||
Pickable *rp = NULL; | Pickable *rp = NULL; | |||
int ok = true; | int ok = true; | |||
OOAlloc(G, RepDistLabel); | OOAlloc(G, RepDistLabel); | |||
CHECKOK(ok, I); | CHECKOK(ok, I); | |||
if(!ok || !(ds->NIndex || ds->NAngleIndex || ds->NDihedralIndex)) { | if(!ok || !(ds->NIndex || ds->NAngleIndex || ds->NDihedralIndex)) { | |||
ds->NLabel = 0; | ds->NLabel = 0; | |||
VLAFreeP(ds->LabCoord); | VLAFreeP(ds->LabCoord); | |||
VLAFreeP(ds->LabPos); | VLAFreeP(ds->LabPos); | |||
skipping to change at line 213 | skipping to change at line 213 | |||
I->V = NULL; | I->V = NULL; | |||
I->R.P = NULL; | I->R.P = NULL; | |||
I->Obj = (CObject *) ds->Obj; | I->Obj = (CObject *) ds->Obj; | |||
I->ds = ds; | I->ds = ds; | |||
I->R.context.object = (void *) ds->Obj; | I->R.context.object = (void *) ds->Obj; | |||
I->R.context.state = state; | I->R.context.state = state; | |||
I->shaderCGO = NULL; | I->shaderCGO = NULL; | |||
I->OutlineColor = | I->OutlineColor = | |||
SettingGet_i(G, ds->Setting, I->Obj->Setting, cSetting_label_outline_color); | SettingGet_i(G, NULL, I->Obj->Setting, cSetting_label_outline_color); | |||
if(ds->NIndex || ds->NAngleIndex || ds->NDihedralIndex) { | if(ds->NIndex || ds->NAngleIndex || ds->NDihedralIndex) { | |||
float *lc; | float *lc; | |||
ds->NLabel = (ds->NIndex / 2 + ds->NAngleIndex / 5 + ds->NDihedralIndex / 6) ; | ds->NLabel = (ds->NIndex / 2 + ds->NAngleIndex / 5 + ds->NDihedralIndex / 6) ; | |||
if(!ds->LabCoord) { /* store label coordinates */ | if(!ds->LabCoord) { /* store label coordinates */ | |||
ds->LabCoord = VLAlloc(float, 3 * ds->NLabel); | ds->LabCoord = VLAlloc(float, 3 * ds->NLabel); | |||
} else { | } else { | |||
VLACheck(ds->LabCoord, float, 3 * ds->NLabel); | VLACheck(ds->LabCoord, float, 3 * ds->NLabel); | |||
} | } | |||
skipping to change at line 249 | skipping to change at line 249 | |||
I->V = VLAlloc(float, 3 * (ds->NIndex / 2 + ds->NAngleIndex / 5) + 1); | I->V = VLAlloc(float, 3 * (ds->NIndex / 2 + ds->NAngleIndex / 5) + 1); | |||
CHECKOK(ok, I->V); | CHECKOK(ok, I->V); | |||
if (ok) | if (ok) | |||
I->L = VLAlloc(DistLabel, (ds->NIndex / 2 + ds->NAngleIndex / 5) + 1); | I->L = VLAlloc(DistLabel, (ds->NIndex / 2 + ds->NAngleIndex / 5) + 1); | |||
CHECKOK(ok, I->L); | CHECKOK(ok, I->L); | |||
n = 0; | n = 0; | |||
lc = ds->LabCoord; | lc = ds->LabCoord; | |||
if(ds->NIndex) { | if(ds->NIndex) { | |||
int digits = SettingGet_i(G, ds->Setting, ds->Obj->Obj.Setting, | int digits = SettingGet_i(G, NULL, ds->Obj->Obj.Setting, | |||
cSetting_label_distance_digits); | cSetting_label_distance_digits); | |||
WordType format; | WordType format; | |||
if(digits < 0) | if(digits < 0) | |||
digits = default_digits; | digits = default_digits; | |||
if(digits > 10) | if(digits > 10) | |||
digits = 10; | digits = 10; | |||
sprintf(format, "%c0.%df", '%', digits); | sprintf(format, "%c0.%df", '%', digits); | |||
for(a = 0; ok && a < ds->NIndex; a = a + 2) { | for(a = 0; ok && a < ds->NIndex; a = a + 2) { | |||
v1 = ds->Coord + 3 * a; | v1 = ds->Coord + 3 * a; | |||
v2 = ds->Coord + 3 * (a + 1); | v2 = ds->Coord + 3 * (a + 1); | |||
skipping to change at line 310 | skipping to change at line 310 | |||
} | } | |||
} | } | |||
if(ok && ds->NAngleIndex) { | if(ok && ds->NAngleIndex) { | |||
float d1[3], d2[3], n1[3], n2[3]; | float d1[3], d2[3], n1[3], n2[3]; | |||
float avg[3]; | float avg[3]; | |||
float l1, l2; | float l1, l2; | |||
float radius; | float radius; | |||
int digits = SettingGet_i(G, ds->Setting, ds->Obj->Obj.Setting, | int digits = SettingGet_i(G, NULL, ds->Obj->Obj.Setting, | |||
cSetting_label_angle_digits); | cSetting_label_angle_digits); | |||
WordType format; | WordType format; | |||
if(digits < 0) | if(digits < 0) | |||
digits = default_digits; | digits = default_digits; | |||
if(digits > 10) | if(digits > 10) | |||
digits = 10; | digits = 10; | |||
sprintf(format, "%c0.%df", '%', digits); | sprintf(format, "%c0.%df", '%', digits); | |||
for(a = 0; ok && a < ds->NAngleIndex; a = a + 5) { | for(a = 0; ok && a < ds->NAngleIndex; a = a + 5) { | |||
v1 = ds->AngleCoord + 3 * a; | v1 = ds->AngleCoord + 3 * a; | |||
skipping to change at line 339 | skipping to change at line 339 | |||
average3f(n1, n2, avg); | average3f(n1, n2, avg); | |||
l1 = (float) length3f(d1); | l1 = (float) length3f(d1); | |||
l2 = (float) length3f(d2); | l2 = (float) length3f(d2); | |||
if(l1 > l2) | if(l1 > l2) | |||
radius = l2; | radius = l2; | |||
else | else | |||
radius = l1; | radius = l1; | |||
radius *= | radius *= | |||
SettingGet_f(G, ds->Setting, ds->Obj->Obj.Setting, | SettingGet_f(G, NULL, ds->Obj->Obj.Setting, | |||
cSetting_angle_size) * SettingGet_f(G, ds->Setting, | cSetting_angle_size) * SettingGet_f(G, NULL, | |||
ds->Obj->Obj.Setting, | ds->Obj->Obj.Setting, | |||
cSetting_angle_label_ position); | cSetting_angle_label_ position); | |||
normalize3f(avg); | normalize3f(avg); | |||
if((avg[0] == 0.0F) && (avg[1] == 0.0F) && (avg[2] == 0.0F)) | if((avg[0] == 0.0F) && (avg[1] == 0.0F) && (avg[2] == 0.0F)) | |||
avg[0] = 1.0F; | avg[0] = 1.0F; | |||
scale3f(avg, radius, avg); | scale3f(avg, radius, avg); | |||
add3f(v2, avg, avg); | add3f(v2, avg, avg); | |||
skipping to change at line 399 | skipping to change at line 399 | |||
if(ok && ds->NDihedralIndex) { | if(ok && ds->NDihedralIndex) { | |||
float d12[3], d32[3], d43[3], n32[3]; | float d12[3], d32[3], d43[3], n32[3]; | |||
float p12[3], p43[3], np12[3], np43[3]; | float p12[3], p43[3], np12[3], np43[3]; | |||
float a32[3]; | float a32[3]; | |||
float l1, l2; | float l1, l2; | |||
float radius; | float radius; | |||
float dihedral_size = | float dihedral_size = | |||
SettingGet_f(G, ds->Setting, ds->Obj->Obj.Setting, cSetting_dihedral_siz | SettingGet_f(G, NULL, ds->Obj->Obj.Setting, cSetting_dihedral_size); | |||
e); | float dihedral_label_position = SettingGet_f(G, NULL, ds->Obj->Obj.Setting | |||
float dihedral_label_position = SettingGet_f(G, ds->Setting, ds->Obj->Obj. | , | |||
Setting, | ||||
cSetting_dihedral_label_posit ion); | cSetting_dihedral_label_posit ion); | |||
float *v4, *v5, *v6; | float *v4; | |||
float avg[3]; | float avg[3]; | |||
int digits = SettingGet_i(G, ds->Setting, ds->Obj->Obj.Setting, | int digits = SettingGet_i(G, NULL, ds->Obj->Obj.Setting, | |||
cSetting_label_dihedral_digits); | cSetting_label_dihedral_digits); | |||
WordType format; | WordType format; | |||
if(digits < 0) | if(digits < 0) | |||
digits = default_digits; | digits = default_digits; | |||
if(digits > 10) | if(digits > 10) | |||
digits = 10; | digits = 10; | |||
sprintf(format, "%c0.%df", '%', digits); | sprintf(format, "%c0.%df", '%', digits); | |||
for(a = 0; ok && a < ds->NDihedralIndex; a = a + 6) { | for(a = 0; ok && a < ds->NDihedralIndex; a = a + 6) { | |||
v1 = ds->DihedralCoord + 3 * a; | v1 = ds->DihedralCoord + 3 * a; | |||
v2 = v1 + 3; | v2 = v1 + 3; | |||
v3 = v1 + 6; | v3 = v1 + 6; | |||
v4 = v1 + 9; | v4 = v1 + 9; | |||
v5 = v1 + 12; | ||||
v6 = v1 + 15; | ||||
subtract3f(v1, v2, d12); | subtract3f(v1, v2, d12); | |||
subtract3f(v3, v2, d32); | subtract3f(v3, v2, d32); | |||
subtract3f(v4, v3, d43); | subtract3f(v4, v3, d43); | |||
normalize23f(d32, n32); | normalize23f(d32, n32); | |||
remove_component3f(d12, n32, p12); | remove_component3f(d12, n32, p12); | |||
remove_component3f(d43, n32, p43); | remove_component3f(d43, n32, p43); | |||
End of changes. 13 change blocks. | ||||
21 lines changed or deleted | 16 lines changed or added |