CGO.h (pymol-v1.8.6.0.tar.bz2) | : | CGO.h (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
/* | /* | |||
A* ------------------------------------------------------------------- | A* ------------------------------------------------------------------- | |||
B* This file contains source code for the PyMOL computer program | B* This file contains source code for the PyMOL computer program | |||
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. | C* copyright by Schrodinger, LLC | |||
D* ------------------------------------------------------------------- | D* ------------------------------------------------------------------- | |||
E* It is unlawful to modify or remove this copyright notice. | E* It is unlawful to modify or remove this copyright notice. | |||
F* ------------------------------------------------------------------- | F* ------------------------------------------------------------------- | |||
G* Please see the accompanying LICENSE file for further information. | G* Please see the accompanying LICENSE file for further information. | |||
H* ------------------------------------------------------------------- | H* ------------------------------------------------------------------- | |||
I* Additional authors of this source file include: | I* Additional authors of this source file include: | |||
-* | -* | |||
-* | -* | |||
-* | -* | |||
Z* ------------------------------------------------------------------- | Z* ------------------------------------------------------------------- | |||
skipping to change at line 36 | skipping to change at line 36 | |||
/* Compiled Graphics Library for simple graphics objects | /* Compiled Graphics Library for simple graphics objects | |||
in floating point three-space, with the goal of achieving | in floating point three-space, with the goal of achieving | |||
quick and easy rendering in multiple environments without the | quick and easy rendering in multiple environments without the | |||
headaches of OpenGL arrays. | headaches of OpenGL arrays. | |||
*/ | */ | |||
#define CGO_read_int(p) (*((int*)((p)++))) | #define CGO_read_int(p) (*((int*)((p)++))) | |||
#define CGO_get_int(p) (*((int*)(p))) | #define CGO_get_int(p) (*((int*)(p))) | |||
#define CGO_get_uint(p) (uint)(*((int*)(p))) | #define CGO_get_uint(p) (uint)(*((uint*)(p))) | |||
#define CGO_write_int(p,i) ((*((int*)(p++)))=(i)) | #define CGO_write_int(p,i) ((*((int*)(p++)))=(i)) | |||
#define CGO_put_int(p,i) ((*((int*)(p)))=(i)) | #define CGO_put_int(p,i) ((*((int*)(p)))=(i)) | |||
/* Supported functions: | /* Supported functions: | |||
* stop | * stop | |||
* null | * null | |||
* begin | * begin | |||
GL_POINTS, | GL_POINTS, | |||
GL_LINES, GL_LINE_LOOP, GL_LINE_STRIP, | GL_LINES, GL_LINE_LOOP, GL_LINE_STRIP, | |||
GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN | GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN | |||
skipping to change at line 58 | skipping to change at line 58 | |||
* vertex | * vertex | |||
* normal | * normal | |||
* color | * color | |||
* sphere * currently for ray-tracing only | * sphere * currently for ray-tracing only | |||
* triangle * currently for ray-tracing only | * triangle * currently for ray-tracing only | |||
* cylinder * currently for ray-tracing only | * cylinder * currently for ray-tracing only | |||
* linewidth | * linewidth | |||
* primwidth * ray-tracing | * primwidth * ray-tracing | |||
*/ | */ | |||
#include "CGOStruct.h" | ||||
/* instructions and data segment sizes */ | /* instructions and data segment sizes */ | |||
#define CGO_STOP 0x00 | #define CGO_STOP 0x00 | |||
#define CGO_STOP_SZ 0 | #define CGO_STOP_SZ 0 | |||
#define CGO_NULL 0x01 | #define CGO_NULL 0x01 | |||
#define CGO_NULL_SZ 0 | #define CGO_NULL_SZ 0 | |||
#define CGO_BEGIN 0x02 | #define CGO_BEGIN 0x02 | |||
#define CGO_BEGIN_SZ 1 | #define CGO_BEGIN_SZ 1 | |||
#define CGO_END 0x03 | #define CGO_END 0x03 | |||
#define CGO_END_SZ 0 | #define CGO_END_SZ 0 | |||
skipping to change at line 86 | skipping to change at line 84 | |||
#define CGO_SPHERE 0x07 | #define CGO_SPHERE 0x07 | |||
#define CGO_SPHERE_SZ 4 | #define CGO_SPHERE_SZ 4 | |||
#define CGO_TRIANGLE 0x08 | #define CGO_TRIANGLE 0x08 | |||
#define CGO_TRIANGLE_SZ 27 | #define CGO_TRIANGLE_SZ 27 | |||
#define CGO_CYLINDER 0x09 | #define CGO_CYLINDER 0x09 | |||
#define CGO_CYLINDER_SZ 13 | #define CGO_CYLINDER_SZ 13 | |||
#define CGO_LINEWIDTH 0x0A | #define CGO_LINEWIDTH 0x0A | |||
#define CGO_LINEWIDTH_SZ 1 | #define CGO_LINEWIDTH_SZ 1 | |||
#define CGO_WIDTHSCALE 0x0B | #define CGO_WIDTHSCALE 0x0B | |||
#define CGO_WIDTHSCALE_SZ 1 | #define CGO_WIDTHSCALE_SZ 1 | |||
#define CGO_ENABLE 0x0C | #define CGO_ENABLE 0x0C | |||
#define CGO_ENABLE_SZ 1 | #define CGO_ENABLE_SZ 1 | |||
#define CGO_DISABLE 0x0D | #define CGO_DISABLE 0x0D | |||
#define CGO_DISABLE_SZ 1 | #define CGO_DISABLE_SZ 1 | |||
#define CGO_SAUSAGE 0x0E | #define CGO_SAUSAGE 0x0E | |||
#define CGO_SAUSAGE_SZ 13 | #define CGO_SAUSAGE_SZ 13 | |||
#define CGO_CUSTOM_CYLINDER 0x0F | #define CGO_CUSTOM_CYLINDER 0x0F | |||
#define CGO_CUSTOM_CYLINDER_SZ 15 | #define CGO_CUSTOM_CYLINDER_SZ 15 | |||
#define CGO_DOTWIDTH 0x10 | #define CGO_DOTWIDTH 0x10 | |||
#define CGO_DOTWIDTH_SZ 1 | #define CGO_DOTWIDTH_SZ 1 | |||
#define CGO_ALPHA_TRIANGLE 0x11 | #define CGO_ALPHA_TRIANGLE 0x11 | |||
#define CGO_ALPHA_TRIANGLE_SZ 35 | #define CGO_ALPHA_TRIANGLE_SZ 35 | |||
#define CGO_ELLIPSOID 0x12 | #define CGO_ELLIPSOID 0x12 | |||
#define CGO_ELLIPSOID_SZ 13 | #define CGO_ELLIPSOID_SZ 13 | |||
#define CGO_FONT 0x13 | #define CGO_FONT 0x13 | |||
#define CGO_FONT_SZ 3 /* size, face, style */ | #define CGO_FONT_SZ 3 /* size, face, style */ | |||
#define CGO_FONT_SCALE 0x14 | #define CGO_FONT_SCALE 0x14 | |||
#define CGO_FONT_SCALE_SZ 2 | #define CGO_FONT_SCALE_SZ 2 | |||
#define CGO_FONT_VERTEX 0x15 | #define CGO_FONT_VERTEX 0x15 | |||
#define CGO_FONT_VERTEX_SZ 3 /* principle axes (zeros -> use camera x y z */ | #define CGO_FONT_VERTEX_SZ 3 /* principle axes (zeros -> use camera x y z */ | |||
#define CGO_FONT_AXES 0x16 | #define CGO_FONT_AXES 0x16 | |||
#define CGO_FONT_AXES_SZ 9 /* principle axes (zeros -> use camera x y z */ | #define CGO_FONT_AXES_SZ 9 /* principle axes (zeros -> use camera x y z */ | |||
#define CGO_CHAR 0x17 | #define CGO_CHAR 0x17 | |||
#define CGO_CHAR_SZ 1 | #define CGO_CHAR_SZ 1 | |||
#define CGO_INDENT 0x18 | #define CGO_INDENT 0x18 | |||
#define CGO_INDENT_SZ 2 | #define CGO_INDENT_SZ 2 | |||
#define CGO_ALPHA 0x19 | #define CGO_ALPHA 0x19 | |||
#define CGO_ALPHA_SZ 1 | #define CGO_ALPHA_SZ 1 | |||
#define CGO_QUADRIC 0x1A | #define CGO_QUADRIC 0x1A | |||
#define CGO_QUADRIC_SZ 14 | #define CGO_QUADRIC_SZ 14 | |||
#define CGO_CONE 0x1B | #define CGO_CONE 0x1B | |||
#define CGO_CONE_SZ 16 | #define CGO_CONE_SZ 16 | |||
#define CGO_RESET_NORMAL 0x1E | #define CGO_RESET_NORMAL 0x1E | |||
#define CGO_RESET_NORMAL_SZ 1 | #define CGO_RESET_NORMAL_SZ 1 | |||
#define CGO_PICK_COLOR 0x1F | #define CGO_PICK_COLOR 0x1F | |||
#define CGO_PICK_COLOR_SZ 2 | #define CGO_PICK_COLOR_SZ 2 | |||
/* CGO_DRAW_ARRAYS : operation that calls glDrawArrays with all arrays in memory | /* CGO_DRAW_ARRAYS : operation that calls glDrawArrays with all arrays in memory | |||
(i.e., stored in the CGO array). There can be up to 4 arrays (vertex, normal, color, | (i.e., stored in the CGO array). There can be up to 4 arrays (vertex, normal, color, | |||
and pick color array, where each are stored using GL_FLOAT array (except for the pick | and pick color array, where each are stored using GL_FLOAT array (except for the pick | |||
color array, which is GL_UNSIGNED_BYTE, because the 2nd 2/3rds of the array i s used to | color array, which is GL_UNSIGNED_BYTE, because the 2nd 2/3rds of the array i s used to | |||
store atom/bond picking information. Also, the color array is stored using 4 floats, | store atom/bond picking information. Also, the color array is stored using 4 floats, | |||
since glColorPointer() requires having 4 as an argument for OpenGLES. | since glColorPointer() requires having 4 as an argument for OpenGLES. | |||
- mode : GL Mode that is used | - mode : GL Mode that is used | |||
- arrays : which arrays that are used (bitmask on CGO_<type>_ARRAY, where <ty pe> | - arrays : which arrays that are used (bitmask on CGO_<type>_ARRAY, where <ty pe> | |||
can be VERTEX, NORMAL, COLOR, or PICK_COLOR) | can be VERTEX, NORMAL, COLOR, or PICK_COLOR) | |||
- narrays : number of arrays specified in arrays | - narrays : number of arrays specified in arrays | |||
skipping to change at line 230 | skipping to change at line 233 | |||
#define CGO_LIGHTING 0x0B50 | #define CGO_LIGHTING 0x0B50 | |||
#define CGO_VERTEX_ARRAY 0x01 | #define CGO_VERTEX_ARRAY 0x01 | |||
#define CGO_NORMAL_ARRAY 0x02 | #define CGO_NORMAL_ARRAY 0x02 | |||
#define CGO_COLOR_ARRAY 0x04 | #define CGO_COLOR_ARRAY 0x04 | |||
#define CGO_PICK_COLOR_ARRAY 0x08 | #define CGO_PICK_COLOR_ARRAY 0x08 | |||
#define CGO_ACCESSIBILITY_ARRAY 0x10 | #define CGO_ACCESSIBILITY_ARRAY 0x10 | |||
#define CGO_TEX_COORD_ARRAY 0x20 | #define CGO_TEX_COORD_ARRAY 0x20 | |||
extern int CGO_sz[]; | ||||
class CGO { | ||||
public: | ||||
PyMOLGlobals *G; | ||||
float *op; | ||||
int c; | ||||
int z_flag; | ||||
float z_min, z_max; | ||||
float z_vector[3]; | ||||
float alpha; | ||||
int *i_start, i_size; | ||||
short has_begin_end; | ||||
int current_pick_color_index, current_pick_color_bond; | ||||
float current_accessibility; | ||||
short has_draw_buffers, has_draw_cylinder_buffers, has_draw_sphere_buffers; | ||||
float normal[3], color[3], texture[2]; | ||||
uchar pickColor[4]; | ||||
short use_shader, cgo_shader_ub_color, cgo_shader_ub_normal; | ||||
short debug; | ||||
short enable_shaders; | ||||
short no_pick; | ||||
/*********************************************************************** | ||||
* CGO iterator | ||||
* | ||||
* for (auto it = cgo->begin(); !it.is_stop(); ++it) { | ||||
* auto pc = it.data(); | ||||
* int op = it.op_code(); | ||||
* ... | ||||
* } | ||||
***********************************************************************/ | ||||
class const_iterator { | ||||
protected: | ||||
const float * m_pc; | ||||
const float * m_stop; | ||||
public: | ||||
int op_code() const { | ||||
return CGO_MASK & *reinterpret_cast<const int*>(m_pc); | ||||
} | ||||
operator int() const { return op_code(); } | ||||
const float * data() const { return m_pc + 1; } | ||||
template <typename T> | ||||
const T * cast() const { return reinterpret_cast<const T *>(m_pc + 1); } | ||||
const_iterator(const CGO * cgo) { | ||||
m_pc = cgo->op; | ||||
m_stop = cgo->op + cgo->c; | ||||
} | ||||
const_iterator& operator++() { | ||||
m_pc += CGO_sz[op_code()] + 1; | ||||
return *this; | ||||
} | ||||
bool is_stop() const { | ||||
return m_pc == m_stop || op_code() == CGO_STOP; | ||||
} | ||||
}; | ||||
class iterator : public const_iterator { | ||||
public: | ||||
iterator(CGO * cgo) : const_iterator(cgo) {} | ||||
float * data() { return const_cast<float*>(m_pc + 1); } | ||||
}; | ||||
const_iterator begin() const { return this; } | ||||
iterator begin() { return this; } | ||||
}; | ||||
int CGORendererInit(PyMOLGlobals * G); | int CGORendererInit(PyMOLGlobals * G); | |||
void CGORendererFree(PyMOLGlobals * G); | void CGORendererFree(PyMOLGlobals * G); | |||
CGO *CGONew(PyMOLGlobals * G); | CGO *CGONew(PyMOLGlobals * G); | |||
CGO *CGONewSized(PyMOLGlobals * G, int size); | CGO *CGONewSized(PyMOLGlobals * G, int size); | |||
int CGOGetExtent(CGO * I, float *mn, float *mx); | int CGOGetExtent(CGO * I, float *mn, float *mx); | |||
int CGOHasNormals(CGO * I); | int CGOHasNormals(CGO * I); | |||
void CGOFreeWithoutVBOs(CGO * I); | void CGOFreeWithoutVBOs(CGO * I); | |||
void CGOFree(CGO * &I); | void CGOFree(CGO * &I); | |||
void CGOFreeImpl(CGO * I, short withVBOs); | void CGOFreeImpl(CGO * I, short withVBOs); | |||
skipping to change at line 319 | skipping to change at line 395 | |||
int CGODrawTexture(CGO *I, int texture_id, float *worldPos, float *screenMin, fl oat *screenMax, float *textExtent); | int CGODrawTexture(CGO *I, int texture_id, float *worldPos, float *screenMin, fl oat *screenMax, float *textExtent); | |||
int CGODrawLabel(CGO *I, int texture_id, float *worldPos, float *screenWorldOffs et, float *screenMin, float *screenMax, float *textExtent); | int CGODrawLabel(CGO *I, int texture_id, float *worldPos, float *screenWorldOffs et, float *screenMin, float *screenMax, float *textExtent); | |||
CGO *CGOOptimizeLabels(CGO * I, int est); | CGO *CGOOptimizeLabels(CGO * I, int est); | |||
CGO *CGOOptimizeTextures(CGO * I, int est); | CGO *CGOOptimizeTextures(CGO * I, int est); | |||
CGO *CGOExpandDrawTextures(CGO * I, int est); | CGO *CGOExpandDrawTextures(CGO * I, int est); | |||
/*void CGOFontScale(CGO *I,float v); | /*void CGOFontScale(CGO *I,float v); | |||
void CGOFont(CGO *I,float size,int face,int style);*/ | void CGOFont(CGO *I,float size,int face,int style);*/ | |||
void CGORoundNub(CGO * I, | ||||
const float *v1, // cap center | ||||
const float *p0, // normal along axis | ||||
const float *p1, // x coord in cap space | ||||
const float *p2, // y coord in cap space | ||||
int direction, // 1 or -1 | ||||
int nEdge, // "quality" | ||||
float size); | ||||
int CGOEnable(CGO * I, int mode); | int CGOEnable(CGO * I, int mode); | |||
int CGODisable(CGO * I, int mode); | int CGODisable(CGO * I, int mode); | |||
int CGOStop(CGO * I); | int CGOStop(CGO * I); | |||
int CGOCylinderv(CGO * I, const float *p1, const float *p2, float r, const float *c1, const float *c2); | int CGOCylinderv(CGO * I, const float *p1, const float *p2, float r, const float *c1, const float *c2); | |||
int CGOCustomCylinderv(CGO * I, const float *p1, const float *p2, float r, const float *c1, const float *c2, | int CGOCustomCylinderv(CGO * I, const float *p1, const float *p2, float r, const float *c1, const float *c2, | |||
float cap1, float cap2); | float cap1, float cap2); | |||
int CGOConev(CGO * I, const float *p1, const float *p2, float r1, float r2, cons t float *c1, const float *c2, | int CGOConev(CGO * I, const float *p1, const float *p2, float r1, float r2, cons t float *c1, const float *c2, | |||
float cap1, float cap2); | float cap1, float cap2); | |||
End of changes. 10 change blocks. | ||||
4 lines changed or deleted | 89 lines changed or added |