ObjectVolume.cpp (pymol-open-source-2.2.0) | : | ObjectVolume.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
#include"Executive.h" | #include"Executive.h" | |||
#include"PConv.h" | #include"PConv.h" | |||
#include"P.h" | #include"P.h" | |||
#include"Matrix.h" | #include"Matrix.h" | |||
#include"ObjectGadgetRamp.h" | #include"ObjectGadgetRamp.h" | |||
#include"ShaderMgr.h" | #include"ShaderMgr.h" | |||
#include"Field.h" | #include"Field.h" | |||
#define clamp(x,l,h) ((x) < (l) ? (l) : (x) > (h) ? (h) : (x)) | #define clamp(x,l,h) ((x) < (l) ? (l) : (x) > (h) ? (h) : (x)) | |||
ObjectVolume *ObjectVolumeNew(PyMOLGlobals * G); | static ObjectVolume *ObjectVolumeNew(PyMOLGlobals * G); | |||
static void ObjectVolumeFree(ObjectVolume * I); | static void ObjectVolumeFree(ObjectVolume * I); | |||
static void ObjectVolumeInvalidate(ObjectVolume * I, int rep, int level, int sta te); | static void ObjectVolumeInvalidate(ObjectVolume * I, int rep, int level, int sta te); | |||
void ObjectVolumeStateInit(PyMOLGlobals * G, ObjectVolumeState * vs); | static void ObjectVolumeStateInit(PyMOLGlobals * G, ObjectVolumeState * vs); | |||
void ObjectVolumeRecomputeExtent(ObjectVolume * I); | static void ObjectVolumeRecomputeExtent(ObjectVolume * I); | |||
static ObjectVolumeState * ObjectVolumeGetActiveState(ObjectVolume * I) { | static ObjectVolumeState * ObjectVolumeGetActiveState(ObjectVolume * I) { | |||
int a; | int a; | |||
ok_assert(1, I); | ok_assert(1, I); | |||
for(a = 0; a < I->NState; a++) | for(a = 0; a < I->NState; a++) | |||
if(I->State[a].Active) | if(I->State[a].Active) | |||
return I->State + a; | return I->State + a; | |||
ok_except1: | ok_except1: | |||
return NULL; | return NULL; | |||
} | } | |||
skipping to change at line 261 | skipping to change at line 260 | |||
if(!ok) | if(!ok) | |||
break; | break; | |||
} | } | |||
} | } | |||
return (ok); | return (ok); | |||
} | } | |||
int ObjectVolumeNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectVolume ** result) | int ObjectVolumeNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectVolume ** result) | |||
{ | { | |||
int ok = true; | int ok = true; | |||
int ll; | ||||
ObjectVolume *I = NULL; | ObjectVolume *I = NULL; | |||
(*result) = NULL; | (*result) = NULL; | |||
if(ok) | if(ok) | |||
ok = (list != NULL); | ok = (list != NULL); | |||
if(ok) | if(ok) | |||
ok = PyList_Check(list); | ok = PyList_Check(list); | |||
if(ok) | ||||
ll = PyList_Size(list); | ||||
/* TO SUPPORT BACKWARDS COMPATIBILITY... | /* TO SUPPORT BACKWARDS COMPATIBILITY... | |||
Always check ll when adding new PyList_GetItem's */ | Always check ll when adding new PyList_GetItem's */ | |||
I = ObjectVolumeNew(G); | I = ObjectVolumeNew(G); | |||
if(ok) | if(ok) | |||
ok = (I != NULL); | ok = (I != NULL); | |||
if(ok) | if(ok) | |||
ok = ObjectFromPyList(G, PyList_GetItem(list, 0), &I->Obj); | ok = ObjectFromPyList(G, PyList_GetItem(list, 0), &I->Obj); | |||
if(ok) | if(ok) | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 1), &I->NState); | ok = PConvPyIntToInt(PyList_GetItem(list, 1), &I->NState); | |||
if(ok) | if(ok) | |||
skipping to change at line 586 | skipping to change at line 582 | |||
vs->isUpdated = true; | vs->isUpdated = true; | |||
SceneInvalidate(I->Obj.G); | SceneInvalidate(I->Obj.G); | |||
} | } | |||
if(!I->Obj.ExtentFlag) { | if(!I->Obj.ExtentFlag) { | |||
ObjectVolumeRecomputeExtent(I); | ObjectVolumeRecomputeExtent(I); | |||
if(I->Obj.ExtentFlag) | if(I->Obj.ExtentFlag) | |||
SceneInvalidate(I->Obj.G); | SceneInvalidate(I->Obj.G); | |||
} | } | |||
} | } | |||
static | ||||
int ObjectVolumeAddSlicePoint(float *p0, float *p1, float *zaxis, float d, float *slice, float *t0, float *t1, float *tex_coords, float *origin); | int ObjectVolumeAddSlicePoint(float *p0, float *p1, float *zaxis, float d, float *slice, float *t0, float *t1, float *tex_coords, float *origin); | |||
static | ||||
void ObjectVolumeDrawSlice(float *points, float *tex_coords, int n_points, float *zaxis); | void ObjectVolumeDrawSlice(float *points, float *tex_coords, int n_points, float *zaxis); | |||
/* | /* | |||
* Converting Ramp to `count * 4` sized interpolated RGBA color | * Converting Ramp to `count * 4` sized interpolated RGBA color | |||
* array. Returns allocated memory. | * array. Returns allocated memory. | |||
* Assigns data minimum and range covered by ramp to `ramp_min` and `ramp_range` . | * Assigns data minimum and range covered by ramp to `ramp_min` and `ramp_range` . | |||
*/ | */ | |||
static float * ObjectVolumeStateGetColors(PyMOLGlobals * G, ObjectVolumeState * ovs, | static float * ObjectVolumeStateGetColors(PyMOLGlobals * G, ObjectVolumeState * ovs, | |||
int count, float *ramp_min, float *ramp_range) { | int count, float *ramp_min, float *ramp_range) { | |||
int i, j, k; | int i, j, k; | |||
int lowerId, upperId; | int lowerId, upperId = 0; | |||
float mixc, mixcincr, r_min, range; | float mixc, mixcincr, r_min, range; | |||
float stdev = ovs->min_max_mean_stdev[3]; | float stdev = ovs->min_max_mean_stdev[3]; | |||
float * colors; | float * colors; | |||
ok_assert(1, ovs->Ramp && ovs->RampSize > 1); | ok_assert(1, ovs->Ramp && ovs->RampSize > 1); | |||
r_min = ovs->Ramp[0]; | r_min = ovs->Ramp[0]; | |||
range = ovs->Ramp[5 * (ovs->RampSize - 1)] - r_min; | range = ovs->Ramp[5 * (ovs->RampSize - 1)] - r_min; | |||
ok_assert(1, range > R_SMALL4); | ok_assert(1, range > R_SMALL4); | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 6 lines changed or added |