"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer2/RepDistLabel.cpp" between
pymol-v2.1.0.tar.bz2 and pymol-open-source-2.2.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

RepDistLabel.cpp  (pymol-v2.1.0.tar.bz2):RepDistLabel.cpp  (pymol-open-source-2.2.0)
skipping to change at line 25 skipping to change at line 25
Z* ------------------------------------------------------------------- Z* -------------------------------------------------------------------
*/ */
#include"os_python.h" #include"os_python.h"
#include"os_predef.h" #include"os_predef.h"
#include"os_std.h" #include"os_std.h"
#include"os_gl.h" #include"os_gl.h"
#include"OOMac.h" #include"OOMac.h"
#include"RepDistLabel.h" #include"RepDistLabel.h"
#include"RepLabel.h"
#include"Color.h" #include"Color.h"
#include"Scene.h" #include"Scene.h"
#include"main.h" #include"main.h"
#include"Vector.h" #include"Vector.h"
#include"Setting.h" #include"Setting.h"
#include"PyMOLObject.h" #include"PyMOLObject.h"
#include"Text.h" #include"Text.h"
#include"Word.h" #include"Word.h"
#include"CGO.h" #include"CGO.h"
skipping to change at line 49 skipping to change at line 50
typedef struct RepDistLabel { typedef struct RepDistLabel {
Rep R; Rep R;
float *V; float *V;
int N; int N;
DistLabel *L; DistLabel *L;
CObject *Obj; CObject *Obj;
DistSet *ds; DistSet *ds;
int OutlineColor; int OutlineColor;
CGO *shaderCGO; CGO *shaderCGO;
int texture_font_size;
} RepDistLabel; } RepDistLabel;
#define SHADERCGO I->shaderCGO #define SHADERCGO I->shaderCGO
#include"ObjectDist.h" #include"ObjectDist.h"
void RepDistLabelFree(RepDistLabel * I); void RepDistLabelFree(RepDistLabel * I);
void RepDistLabelFree(RepDistLabel * I) void RepDistLabelFree(RepDistLabel * I)
{ {
skipping to change at line 80 skipping to change at line 82
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, NULL, I->Obj->Setting, cSetting_label_font_id); int font_id = SettingGet_i(G, NULL, I->Obj->Setting, cSetting_label_font_id);
float font_size = SettingGet_f(G, NULL, I->Obj->Setting, cSetting_label_size); float font_size = SettingGet_f(G, NULL, I->Obj->Setting, cSetting_label_size);
int float_text = SettingGet_i(G, NULL, I->Obj->Setting, cSetting_float_labels) ;
int ok = true; int ok = true;
short use_shader = SettingGetGlobal_b(G, cSetting_use_shaders);
if (I->R.MaxInvalid >= cRepInvRep)
return;
font_id = SettingCheckFontID(G, NULL, I->Obj->Setting, font_id);
if (I->shaderCGO && font_size < 0.f){
int size;
if (InvalidateShaderCGOIfTextureNeedsUpdate(G, font_size, I->texture_font_si
ze, &size)){
CGOFree(I->shaderCGO);
I->texture_font_size = size;
}
}
if(ray) { if(ray) {
TextSetOutlineColor(G, I->OutlineColor); TextSetOutlineColor(G, I->OutlineColor);
color = SettingGet_color(G, NULL, 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, false, 0);
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); if(float_text)
glDisable(GL_DEPTH_TEST);
CGORenderGLPicking(I->shaderCGO, info, &I->R.context, NULL, NULL);
if(float_text)
glEnable(GL_DEPTH_TEST);
return; return;
}
} else { } else {
Pickable *p = I->R.P; Pickable *p = I->R.P;
int float_text = SettingGet_i(G, NULL, unsigned int i;
I->Obj->Setting, TextSetIsPicking(G, true);
cSetting_float_labels); SceneSetupGLPicking(G);
if(c) {
if(float_text) if(float_text)
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
i = (*pick)->src.index;
while(c--) {
if(*l) {
TextSetPos(G, v);
p++;
AssignNewPickColor(NULL, i, pick, &I->R.context, TextGetColorUChar
4uv(G), p->index, p->bond);
TextSetColorFromUColor(G);
TextSetLabelBkgrdInfo(G, 1.f, 1.2f, NULL);
TextSetLabelPosIsSet(G, 0);
if (!TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, fal
se, 0, 1, 0)){
TextSetIsPicking(G, false);
return;
}
n++;
}
v += 6;
}
if(float_text)
glEnable(GL_DEPTH_TEST);
(*pick)[0].src.index = i; /* pass the count */
}
TextSetIsPicking(G, false);
}
} else {
Pickable *p = I->R.P;
if (use_shader){
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;
} }
} else { } else {
info->texture_font_size = I->texture_font_size;
CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R);
return; return;
} }
} else if (I->shaderCGO){
CGOFree(I->shaderCGO);
if(float_text)
glDisable(GL_DEPTH_TEST);
}
TextSetOutlineColor(G, I->OutlineColor); TextSetOutlineColor(G, I->OutlineColor);
color = SettingGet_color(G, NULL, 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--) {
p++; p++;
if (ok) if (ok && I->shaderCGO)
ok &= CGOPickColor(I->shaderCGO, p->index, p->bond); ok &= CGOPickColor(I->shaderCGO, p->index, p->bond);
TextSetPos(G, v); TextSetPos(G, v);
TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, SHADERCGO); TextSetLabelBkgrdInfo(G, 1.f, 1.2f, NULL);
TextSetLabelPosIsSet(G, 0);
if (!TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, false, 0,
1, SHADERCGO))
return;
v += 6; v += 6;
n++; n++;
} }
if (ok && I->shaderCGO){ if (ok && I->shaderCGO){
ok &= CGOStop(I->shaderCGO); ok &= CGOStop(I->shaderCGO);
if (ok){ if (ok){
CGO *convertcgo = CGOOptimizeLabels(I->shaderCGO, 0); CGO *tmpCGO = CGONew(G);
CGOEnable(tmpCGO, GL_LABEL_SHADER);
CGODisable(tmpCGO, GL_DEPTH_TEST_IF_FLOATING);
CGOSpecial(tmpCGO, SET_LABEL_SCALE_UNIFORMS);
CGO *convertcgo = CGOConvertToLabelShader(I->shaderCGO, tmpCGO);
if (!convertcgo) {
CGOFree(tmpCGO);
CGOFree(I->shaderCGO);
return;
}
CGOAppendNoStop(tmpCGO, convertcgo);
CGOFreeWithoutVBOs(convertcgo);
CGOEnable(tmpCGO, GL_DEPTH_TEST_IF_FLOATING);
CGODisable(tmpCGO, GL_LABEL_SHADER);
CGOStop(tmpCGO);
convertcgo = tmpCGO;
CHECKOK(ok, convertcgo); CHECKOK(ok, convertcgo);
CGOFree(I->shaderCGO); CGOFree(I->shaderCGO);
I->shaderCGO = convertcgo; I->shaderCGO = convertcgo;
convertcgo = NULL; convertcgo = NULL;
} }
if (ok && I->shaderCGO){ if (ok && I->shaderCGO){
I->shaderCGO->use_shader = true; I->shaderCGO->use_shader = true;
I->shaderCGO->enable_shaders = true; RepDistLabelRender(I, info);
CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); return;
} }
} }
if(float_text) if(float_text)
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
} }
} }
if (!ok){ if (!ok){
CGOFree(I->shaderCGO); CGOFree(I->shaderCGO);
I->ds->Rep[cRepLabel] = NULL; I->ds->Rep[cRepLabel] = NULL;
RepDistLabelFree(I); RepDistLabelFree(I);
skipping to change at line 206 skipping to change at line 274
RepInit(G, &I->R); RepInit(G, &I->R);
I->R.fRender = (void (*)(struct Rep *, RenderInfo *)) RepDistLabelRender; I->R.fRender = (void (*)(struct Rep *, RenderInfo *)) RepDistLabelRender;
I->R.fFree = (void (*)(struct Rep *)) RepDistLabelFree; I->R.fFree = (void (*)(struct Rep *)) RepDistLabelFree;
I->R.fRecolor = NULL; I->R.fRecolor = NULL;
I->N = 0; I->N = 0;
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->R.obj = I->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->texture_font_size = 0;
I->OutlineColor = I->OutlineColor =
SettingGet_i(G, NULL, 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);
 End of changes. 19 change blocks. 
13 lines changed or deleted 87 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)