Scene.cpp (pymol-v1.8.6.0.tar.bz2) | : | Scene.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 1044 | skipping to change at line 1044 | |||
if (stereo_via_adjacent_array(I->StereoMode)) | if (stereo_via_adjacent_array(I->StereoMode)) | |||
*width /= 2.f; | *width /= 2.f; | |||
} | } | |||
void SceneSetCardInfo(PyMOLGlobals * G, | void SceneSetCardInfo(PyMOLGlobals * G, | |||
const char *vendor, | const char *vendor, | |||
const char *renderer, | const char *renderer, | |||
const char *version) | const char *version) | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
if (!vendor) vendor = "(null)"; | ||||
if (!renderer) renderer = "(null)"; | ||||
if (!version) version = "(null)"; | ||||
UtilNCopy(I->vendor, vendor, sizeof(OrthoLineType) - 1); | UtilNCopy(I->vendor, vendor, sizeof(OrthoLineType) - 1); | |||
UtilNCopy(I->renderer, renderer, sizeof(OrthoLineType) - 1); | UtilNCopy(I->renderer, renderer, sizeof(OrthoLineType) - 1); | |||
UtilNCopy(I->version, version, sizeof(OrthoLineType) - 1); | UtilNCopy(I->version, version, sizeof(OrthoLineType) - 1); | |||
} | } | |||
int SceneGetStereo(PyMOLGlobals * G) | int SceneGetStereo(PyMOLGlobals * G) | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
return (I->StereoMode); | return (I->StereoMode); | |||
} | } | |||
skipping to change at line 1236 | skipping to change at line 1239 | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
int cur_stereo = I->StereoMode; | int cur_stereo = I->StereoMode; | |||
if(flag) { | if(flag) { | |||
I->StereoMode = SettingGetGlobal_i(G, cSetting_stereo_mode); | I->StereoMode = SettingGetGlobal_i(G, cSetting_stereo_mode); | |||
} else { | } else { | |||
I->StereoMode = 0; | I->StereoMode = 0; | |||
} | } | |||
if((cur_stereo != I->StereoMode) && ((cur_stereo == 4) || (I->StereoMode == 4) )) { | if((cur_stereo != I->StereoMode) && (cur_stereo == cStereo_geowall || I->Stere oMode == cStereo_geowall)) { | |||
OrthoReshape(G, G->Option->winX, G->Option->winY, true); | OrthoReshape(G, G->Option->winX, G->Option->winY, true); | |||
#ifndef _PYMOL_NOPY | #ifndef _PYMOL_NOPY | |||
if((cur_stereo == 4) && I->StereoMode) { | if(cur_stereo == cStereo_geowall) { | |||
PParse(G, "viewport"); | PParse(G, "viewport"); | |||
} | } | |||
#endif | #endif | |||
} | } | |||
SettingSetGlobal_b(G, cSetting_stereo, flag); | SettingSetGlobal_b(G, cSetting_stereo, flag); | |||
SceneInvalidateStencil(G); | SceneInvalidateStencil(G); | |||
SceneInvalidate(G); | SceneInvalidate(G); | |||
CShaderMgr_Set_Reload_Bits(G, RELOAD_ALL_SHADERS); | CShaderMgr_Set_Reload_Bits(G, RELOAD_ALL_SHADERS); | |||
} | } | |||
skipping to change at line 2355 | skipping to change at line 2358 | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
Block *SceneGetBlock(PyMOLGlobals * G) | Block *SceneGetBlock(PyMOLGlobals * G) | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
return (I->Block); | return (I->Block); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
int SceneValidateImageMode(PyMOLGlobals * G, int mode, bool defaultdraw) { | ||||
switch (mode) { | ||||
case cSceneImage_Normal: | ||||
case cSceneImage_Draw: | ||||
case cSceneImage_Ray: | ||||
return mode; | ||||
} | ||||
if (mode != cSceneImage_Default) { | ||||
PRINTFB(G, FB_Scene, FB_Warnings) | ||||
" %s-Warning: invalid mode %d\n", __FUNCTION__, mode ENDFB(G); | ||||
} | ||||
if(!G->HaveGUI || SettingGetGlobal_b(G, cSetting_ray_trace_frames)) { | ||||
return cSceneImage_Ray; | ||||
} | ||||
if(defaultdraw || SettingGetGlobal_b(G, cSetting_draw_frames)) { | ||||
return cSceneImage_Draw; | ||||
} | ||||
return cSceneImage_Normal; | ||||
} | ||||
/*========================================================================*/ | ||||
int SceneMakeMovieImage(PyMOLGlobals * G, | int SceneMakeMovieImage(PyMOLGlobals * G, | |||
int show_timing, | int show_timing, | |||
int validate, | int validate, | |||
int mode, | int mode, | |||
int width, | int width, | |||
int height) | int height) | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
// float *v; | // float *v; | |||
int valid = true; | int valid = true; | |||
PRINTFB(G, FB_Scene, FB_Blather) | PRINTFB(G, FB_Scene, FB_Blather) | |||
" Scene: Making movie image.\n" ENDFB(G); | " Scene: Making movie image.\n" ENDFB(G); | |||
switch (mode) { | mode = SceneValidateImageMode(G, mode, width || height); | |||
case cSceneImage_Normal: | ||||
case cSceneImage_Draw: | ||||
case cSceneImage_Ray: | ||||
break; | ||||
default: | ||||
if(!G->HaveGUI || | ||||
SettingGetGlobal_b(G, cSetting_ray_trace_frames)) { | ||||
mode = cSceneImage_Ray; | ||||
} else if(SettingGetGlobal_b(G, cSetting_draw_frames) || width || height) { | ||||
mode = cSceneImage_Draw; | ||||
} else { | ||||
mode = cSceneImage_Normal; | ||||
} | ||||
break; | ||||
} | ||||
I->DirtyFlag = false; | I->DirtyFlag = false; | |||
switch (mode) { | switch (mode) { | |||
case cSceneImage_Ray: | case cSceneImage_Ray: | |||
SceneRay(G, width, height, SettingGetGlobal_i(G, cSetting_ray_default_render er), | SceneRay(G, width, height, SettingGetGlobal_i(G, cSetting_ray_default_render er), | |||
NULL, NULL, 0.0F, 0.0F, false, NULL, show_timing, -1); | NULL, NULL, 0.0F, 0.0F, false, NULL, show_timing, -1); | |||
break; | break; | |||
case cSceneImage_Draw: | case cSceneImage_Draw: | |||
SceneMakeSizedImage(G, width, height, SettingGetGlobal_i(G, cSetting_antiali as)); | SceneMakeSizedImage(G, width, height, SettingGetGlobal_i(G, cSetting_antiali as)); | |||
break; | break; | |||
skipping to change at line 2442 | skipping to change at line 2455 | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
float ang_cur, disp, diff; | float ang_cur, disp, diff; | |||
float sweep_angle = SettingGetGlobal_f(G, cSetting_sweep_angle); | float sweep_angle = SettingGetGlobal_f(G, cSetting_sweep_angle); | |||
float sweep_speed = SettingGetGlobal_f(G, cSetting_sweep_speed); | float sweep_speed = SettingGetGlobal_f(G, cSetting_sweep_speed); | |||
float sweep_phase = SettingGetGlobal_f(G, cSetting_sweep_phase); | float sweep_phase = SettingGetGlobal_f(G, cSetting_sweep_phase); | |||
int sweep_mode = SettingGetGlobal_i(G, cSetting_sweep_mode); | int sweep_mode = SettingGetGlobal_i(G, cSetting_sweep_mode); | |||
float shift = (float) (PI / 2.0F); | float shift = (float) (PI / 2.0F); | |||
I->SweepTime += I->RenderTime; | ||||
I->LastSweepTime = UtilGetSeconds(G); | ||||
switch (sweep_mode) { | switch (sweep_mode) { | |||
case 0: | case 0: | |||
case 1: | case 1: | |||
case 2: | case 2: | |||
if(sweep_angle <= 0.0F) { | if(sweep_angle <= 0.0F) { | |||
diff = (float) ((PI / 180.0F) * I->RenderTime * 10); | diff = (float) ((PI / 180.0F) * I->RenderTime * 10 * sweep_speed / 0.75F); | |||
} else { | } else { | |||
ang_cur = (float) (I->SweepTime * sweep_speed) + sweep_phase; | ang_cur = (float) (I->SweepTime * sweep_speed) + sweep_phase; | |||
disp = (float) (sweep_angle * (PI / 180.0F) * sin(ang_cur) / 2); | disp = (float) (sweep_angle * (PI / 180.0F) * sin(ang_cur) / 2); | |||
diff = (float) (disp - I->LastSweep); | diff = (float) (disp - I->LastSweep); | |||
I->LastSweep = disp; | I->LastSweep = disp; | |||
} | } | |||
switch (sweep_mode) { | switch (sweep_mode) { | |||
case 0: | case 0: | |||
SceneRotateWithDirty(G, (float) (180 * diff / PI), 0.0F, 1.0F, 0.0F, dirty ); | SceneRotateWithDirty(G, (float) (180 * diff / PI), 0.0F, 1.0F, 0.0F, dirty ); | |||
break; | break; | |||
skipping to change at line 2537 | skipping to change at line 2553 | |||
} else { | } else { | |||
I->LastFrameAdjust = 0.0F; | I->LastFrameAdjust = 0.0F; | |||
} | } | |||
frameFlag = true; | frameFlag = true; | |||
} | } | |||
} | } | |||
} else if(ControlRocking(G)) { | } else if(ControlRocking(G)) { | |||
renderTime = -I->LastSweepTime + UtilGetSeconds(G); | renderTime = -I->LastSweepTime + UtilGetSeconds(G); | |||
minTime = SettingGetGlobal_f(G, cSetting_rock_delay) / 1000.0; | minTime = SettingGetGlobal_f(G, cSetting_rock_delay) / 1000.0; | |||
if(renderTime >= minTime) { | if(renderTime >= minTime) { | |||
I->LastSweepTime = UtilGetSeconds(G); | I->RenderTime = renderTime; | |||
I->SweepTime += I->RenderTime; | ||||
SceneUpdateCameraRock(G, true); | SceneUpdateCameraRock(G, true); | |||
} | } | |||
} | } | |||
if(MoviePlaying(G) && frameFlag) { | if(MoviePlaying(G) && frameFlag) { | |||
I->LastFrameTime = UtilGetSeconds(G); | I->LastFrameTime = UtilGetSeconds(G); | |||
if((SettingGetGlobal_i(G, cSetting_frame) - 1) == (I->NFrame - 1)) { | if((SettingGetGlobal_i(G, cSetting_frame) - 1) == (I->NFrame - 1)) { | |||
if(SettingGetGlobal_b(G, cSetting_movie_loop)) { | if(SettingGetGlobal_b(G, cSetting_movie_loop)) { | |||
SceneSetFrame(G, 7, 0); | SceneSetFrame(G, 7, 0); | |||
} else | } else | |||
skipping to change at line 2791 | skipping to change at line 2806 | |||
} | } | |||
return (ok); | return (ok); | |||
} | } | |||
/*static unsigned int byte_max(unsigned int value) | /*static unsigned int byte_max(unsigned int value) | |||
{ | { | |||
return (value>0xFF) ? 0xFF : value; | return (value>0xFF) ? 0xFF : value; | |||
} | } | |||
*/ | */ | |||
#define SceneClickMargin 2 | #define SceneClickMargin DIP2PIXEL(2) | |||
#define SceneTopMargin 0 | #define SceneTopMargin 0 | |||
#define SceneToggleMargin 2 | #define SceneToggleMargin DIP2PIXEL(2) | |||
#define SceneRightMargin 0 | #define SceneRightMargin 0 | |||
#define SceneToggleWidth 17 | #define SceneToggleWidth DIP2PIXEL(17) | |||
#define SceneToggleSize 16 | #define SceneToggleSize DIP2PIXEL(16) | |||
#define SceneToggleTextShift 4 | #define SceneToggleTextShift DIP2PIXEL(4) | |||
#define SceneTextLeftMargin 1 | #define SceneTextLeftMargin DIP2PIXEL(1) | |||
#define SceneScrollBarMargin 1 | #define SceneScrollBarMargin DIP2PIXEL(1) | |||
#define SceneScrollBarWidth 13 | #define SceneScrollBarWidth DIP2PIXEL(13) | |||
#ifndef _PYMOL_NOPY | #ifndef _PYMOL_NOPY | |||
static void draw_button(int x2, int y2, int z, int w, int h, float *light, float *dark, | static void draw_button(int x2, int y2, int z, int w, int h, float *light, float *dark, | |||
float *inside ORTHOCGOARG) | float *inside ORTHOCGOARG) | |||
{ | { | |||
if (orthoCGO){ | if (orthoCGO){ | |||
CGOColorv(orthoCGO, light); | CGOColorv(orthoCGO, light); | |||
CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | CGOBegin(orthoCGO, GL_TRIANGLE_STRIP); | |||
CGOVertex(orthoCGO, x2, y2, z); | CGOVertex(orthoCGO, x2, y2, z); | |||
CGOVertex(orthoCGO, x2, y2 + h, z); | CGOVertex(orthoCGO, x2, y2 + h, z); | |||
CGOVertex(orthoCGO, x2 + w, y2, z); | CGOVertex(orthoCGO, x2 + w, y2, z); | |||
skipping to change at line 2919 | skipping to change at line 2934 | |||
#ifndef _PYMOL_NOPY | #ifndef _PYMOL_NOPY | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = block->G; | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
int x, y, xx, x2; | int x, y, xx, x2; | |||
const char *c = NULL; | const char *c = NULL; | |||
float enabledColor[3] = { 0.5F, 0.5F, 0.5F }; | float enabledColor[3] = { 0.5F, 0.5F, 0.5F }; | |||
float pressedColor[3] = { 0.7F, 0.7F, 0.7F }; | float pressedColor[3] = { 0.7F, 0.7F, 0.7F }; | |||
float disabledColor[3] = { 0.25F, 0.25F, 0.25F }; | float disabledColor[3] = { 0.25F, 0.25F, 0.25F }; | |||
float lightEdge[3] = { 0.6F, 0.6F, 0.6F }; | float lightEdge[3] = { 0.6F, 0.6F, 0.6F }; | |||
float darkEdge[3] = { 0.35F, 0.35F, 0.35F }; | float darkEdge[3] = { 0.35F, 0.35F, 0.35F }; | |||
int charWidth = 8; | int charWidth = DIP2PIXEL(8); | |||
int n_ent; | int n_ent; | |||
int n_disp; | int n_disp; | |||
int skip = 0; | int skip = 0; | |||
int row = -1; | int row = -1; | |||
int lineHeight = SettingGetGlobal_i(G, cSetting_internal_gui_control_size); | int lineHeight = DIP2PIXEL(SettingGetGlobal_i(G, cSetting_internal_gui_control | |||
int text_lift = (lineHeight / 2) - 5; | _size)); | |||
int text_lift = (lineHeight / 2) - DIP2PIXEL(5); | ||||
int op_cnt = 1; | int op_cnt = 1; | |||
if(((G->HaveGUI && G->ValidContext) || (!draw_for_real)) && | if(((G->HaveGUI && G->ValidContext) || (!draw_for_real)) && | |||
((block->rect.right - block->rect.left) > 6) && (I->NScene)) { | ((block->rect.right - block->rect.left) > 6) && (I->NScene)) { | |||
int max_char; | int max_char; | |||
int nChar; | int nChar; | |||
I->ButtonsShown = true; | I->ButtonsShown = true; | |||
/* do we have enough structures to warrant a scroll bar? */ | /* do we have enough structures to warrant a scroll bar? */ | |||
n_ent = I->NScene; | n_ent = I->NScene; | |||
skipping to change at line 3028 | skipping to change at line 3043 | |||
if((x - SceneToggleMargin) - (xx - SceneToggleMargin) > -10) { | if((x - SceneToggleMargin) - (xx - SceneToggleMargin) > -10) { | |||
x2 = x + 10; | x2 = x + 10; | |||
} | } | |||
{ | { | |||
float toggleColor[3] = { 0.5F, 0.5F, 1.0F }; | float toggleColor[3] = { 0.5F, 0.5F, 1.0F }; | |||
if(draw_for_real) { | if(draw_for_real) { | |||
glColor3fv(toggleColor); | glColor3fv(toggleColor); | |||
TextSetColor(G, I->Block->TextColor); | TextSetColor(G, I->Block->TextColor); | |||
TextSetPos2i(G, x + 2, y + text_lift); | TextSetPos2i(G, x + DIP2PIXEL(2), y + text_lift); | |||
} | } | |||
{ | { | |||
int len; | int len; | |||
const char *cur_name = SettingGetGlobal_s(G, cSetting_scene_curren t_name); | const char *cur_name = SettingGetGlobal_s(G, cSetting_scene_curren t_name); | |||
SceneElem *elem = I->SceneVLA + i; | SceneElem *elem = I->SceneVLA + i; | |||
int item = I->NSkip + row; | int item = I->NSkip + row; | |||
c = elem->name; | c = elem->name; | |||
len = elem->len; | len = elem->len; | |||
x2 = xx; | x2 = xx; | |||
if(len > max_char) | if(len > max_char) | |||
len = max_char; | len = max_char; | |||
x2 = x + len * charWidth + 6; | x2 = x + len * charWidth + DIP2PIXEL(6); | |||
/* store rectangles for finding clicks */ | /* store rectangles for finding clicks */ | |||
elem->drawn = true; | elem->drawn = true; | |||
elem->x1 = x; | elem->x1 = x; | |||
elem->y1 = y; | elem->y1 = y; | |||
elem->x2 = x2; | elem->x2 = x2; | |||
elem->y2 = y + lineHeight; | elem->y2 = y + lineHeight; | |||
skipping to change at line 3261 | skipping to change at line 3276 | |||
x_pos + I->Block->rect.left, y_pos + I->Block->rect.botto m ORTHOCGOARGVAR); | x_pos + I->Block->rect.left, y_pos + I->Block->rect.botto m ORTHOCGOARGVAR); | |||
} | } | |||
} | } | |||
} else if(((width < I->Width) || (height < I->Height)) && ((I->Width - width ) > 2) && ((I->Height - height) > 2)) { | } else if(((width < I->Width) || (height < I->Height)) && ((I->Width - width ) > 2) && ((I->Height - height) > 2)) { | |||
/* but a border around image */ | /* but a border around image */ | |||
unsigned int color_word; | unsigned int color_word; | |||
float rgba[4] = { 0.0F, 0.0F, 0.0F, 1.0F }; | float rgba[4] = { 0.0F, 0.0F, 0.0F, 1.0F }; | |||
unsigned int tmp_height = height + 2; | unsigned int tmp_height = height + 2; | |||
unsigned int tmp_width = width + 2; | unsigned int tmp_width = width + 2; | |||
unsigned int border = 1; | ||||
unsigned int upscale = 1; | ||||
// Upscale for Retina/4K | ||||
if (DIP2PIXEL(height) == I->Height && DIP2PIXEL(width) == I->Width) { | ||||
upscale = DIP2PIXEL(1); | ||||
tmp_height = DIP2PIXEL(height); | ||||
tmp_width = DIP2PIXEL(width); | ||||
border = 0; | ||||
} | ||||
unsigned int n_word = tmp_height * tmp_width; | unsigned int n_word = tmp_height * tmp_width; | |||
unsigned int *tmp_buffer = Alloc(unsigned int, n_word); | unsigned int *tmp_buffer = Alloc(unsigned int, n_word); | |||
ColorGetBkrdContColor(G, rgba, false); | ColorGetBkrdContColor(G, rgba, false); | |||
color_word = ColorGet32BitWord(G, rgba); | color_word = ColorGet32BitWord(G, rgba); | |||
if(tmp_buffer) { | if(tmp_buffer) { | |||
unsigned int a, b; | unsigned int a, b; | |||
unsigned int *p = (unsigned int *) data; | unsigned int *p = (unsigned int *) data; | |||
unsigned int *q = tmp_buffer; | unsigned int *q = tmp_buffer; | |||
for(b = 0; b < tmp_width; b++) | ||||
*(q++) = color_word; | // top border | |||
for(a = 1; a < tmp_height-1; a++) { | for(a = 0; a < border; ++a) { | |||
*(q++) = color_word; | for(b = 0; b < tmp_width; b++) | |||
for(b = 1; b < tmp_width-1; b++) { | *(q++) = color_word; | |||
} | ||||
for(a = border; a < tmp_height - border; a++) { | ||||
// left border | ||||
for(b = 0; b < border; ++b) { | ||||
*(q++) = color_word; | ||||
} | ||||
for(b = border; b < tmp_width - border; b++) { | ||||
unsigned char *qq = (unsigned char *) q; | unsigned char *qq = (unsigned char *) q; | |||
unsigned char *pp = (unsigned char *) p; | unsigned char *pp = (unsigned char *) p; | |||
unsigned char bg; | unsigned char bg; | |||
if(show_alpha && (((a >> 4) + (b >> 4)) & 0x1)) { /* introduce ch eckerboard */ | if(show_alpha && (((a >> 4) + (b >> 4)) & 0x1)) { /* introduce ch eckerboard */ | |||
bg_rr = ((bg_r & 0x80) ? bg_r - TRN_BKG : bg_r + TRN_BKG); | bg_rr = ((bg_r & 0x80) ? bg_r - TRN_BKG : bg_r + TRN_BKG); | |||
bg_gg = ((bg_g & 0x80) ? bg_g - TRN_BKG : bg_g + TRN_BKG); | bg_gg = ((bg_g & 0x80) ? bg_g - TRN_BKG : bg_g + TRN_BKG); | |||
bg_bb = ((bg_b & 0x80) ? bg_b - TRN_BKG : bg_b + TRN_BKG); | bg_bb = ((bg_b & 0x80) ? bg_b - TRN_BKG : bg_b + TRN_BKG); | |||
} else { | } else { | |||
bg_rr = bg_r; | bg_rr = bg_r; | |||
bg_gg = bg_g; | bg_gg = bg_g; | |||
skipping to change at line 3300 | skipping to change at line 3335 | |||
*(qq++) = (pp[1] * pp[3] + bg_gg * bg) / 0xFF; | *(qq++) = (pp[1] * pp[3] + bg_gg * bg) / 0xFF; | |||
*(qq++) = (pp[2] * pp[3] + bg_bb * bg) / 0xFF; | *(qq++) = (pp[2] * pp[3] + bg_bb * bg) / 0xFF; | |||
*(qq++) = 0xFF; | *(qq++) = 0xFF; | |||
} else { | } else { | |||
*(qq++) = bg_rr; | *(qq++) = bg_rr; | |||
*(qq++) = bg_gg; | *(qq++) = bg_gg; | |||
*(qq++) = bg_bb; | *(qq++) = bg_bb; | |||
*(qq++) = 0xFF; | *(qq++) = 0xFF; | |||
} | } | |||
q++; | q++; | |||
p++; | ||||
if ((b + 1 - border) % upscale == 0) { | ||||
p++; | ||||
} | ||||
} | ||||
if ((a + 1 - border) % upscale != 0) { | ||||
// read row again | ||||
p -= width; | ||||
} | ||||
// right border | ||||
for(b = 0; b < border; ++b) { | ||||
*(q++) = color_word; | ||||
} | } | |||
*(q++) = color_word; | ||||
} | } | |||
for(b = 0; b < tmp_width; b++) | ||||
*(q++) = color_word; | // bottom border | |||
for(a = 0; a < border; ++a) { | ||||
for(b = 0; b < tmp_width; b++) | ||||
*(q++) = color_word; | ||||
} | ||||
glRasterPos3i((int) ((I->Width - tmp_width) / 2 + I->Block->rect.left), | glRasterPos3i((int) ((I->Width - tmp_width) / 2 + I->Block->rect.left), | |||
(int) ((I->Height - tmp_height) / 2 + I->Block->rect.bottom ), | (int) ((I->Height - tmp_height) / 2 + I->Block->rect.bottom ), | |||
-10); | -10); | |||
PyMOLDrawPixels(tmp_width, tmp_height, GL_RGBA, GL_UNSIGNED_BYTE, tmp_buf fer); | PyMOLDrawPixels(tmp_width, tmp_height, GL_RGBA, GL_UNSIGNED_BYTE, tmp_buf fer); | |||
drawn = true; | drawn = true; | |||
} | } | |||
FreeP(tmp_buffer); | FreeP(tmp_buffer); | |||
} else if(I->CopyForced) { /* near-exact fit */ | } else if(I->CopyForced) { /* near-exact fit */ | |||
unsigned int color_word; | unsigned int color_word; | |||
skipping to change at line 3369 | skipping to change at line 3420 | |||
PyMOLDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, tmp_buffer); | PyMOLDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, tmp_buffer); | |||
drawn = true; | drawn = true; | |||
FreeP(tmp_buffer); | FreeP(tmp_buffer); | |||
} else { /* not a forced copy, so don't show/blend alpha */ | } else { /* not a forced copy, so don't show/blend alpha */ | |||
glRasterPos3i((int) ((I->Width - width) / 2 + I->Block->rect.left), | glRasterPos3i((int) ((I->Width - width) / 2 + I->Block->rect.left), | |||
(int) ((I->Height - height) / 2 + I->Block->rect.bottom), -10 ); | (int) ((I->Height - height) / 2 + I->Block->rect.bottom), -10 ); | |||
PyMOLDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); | PyMOLDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); | |||
drawn = true; | drawn = true; | |||
} | } | |||
I->RenderTime = -I->LastRender; | ||||
I->LastRender = UtilGetSeconds(G); | I->LastRender = UtilGetSeconds(G); | |||
I->RenderTime += I->LastRender; | ||||
} | } | |||
return drawn; | return drawn; | |||
} | } | |||
void SceneDraw(Block * block ORTHOCGOARG) /* returns true if scene was drawn (us ing a cached image) */ | void SceneDraw(Block * block ORTHOCGOARG) /* returns true if scene was drawn (us ing a cached image) */ | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = block->G; | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
int drawn = false; | int drawn = false; | |||
skipping to change at line 3427 | skipping to change at line 3476 | |||
int *int_ptr; | int *int_ptr; | |||
*/ | */ | |||
pix *buffer = NULL; | pix *buffer = NULL; | |||
pix *extra_safe_buffer = NULL; | pix *extra_safe_buffer = NULL; | |||
/*int after_check[100]; */ | /*int after_check[100]; */ | |||
/* pix_array *array_ptr; | /* pix_array *array_ptr; | |||
char *safe_place; | char *safe_place; | |||
*/ | */ | |||
int a, b, d, flag; | int a, b, d, flag; | |||
int cRangeVal = cRange; | float contentScaleFactor = DIP2PIXEL(1); | |||
int cRangeVal = contentScaleFactor < 1.5 ? 7 : 21; | ||||
int h = (cRangeVal * 2 + 1), w = (cRangeVal * 2 + 1); | int h = (cRangeVal * 2 + 1), w = (cRangeVal * 2 + 1); | |||
int debug = false; | int debug = false; | |||
unsigned char *c; | unsigned char *c; | |||
int strict = false, bits15 = false; | int strict = false, bits15 = false; | |||
GLint rb, gb, bb, ab; | GLint rb, gb, bb, ab; | |||
int bkrd_alpha = 0xFF; | int bkrd_alpha = 0xFF; | |||
int check_alpha = false; | int check_alpha = false; | |||
if(G->HaveGUI && G->ValidContext) { /*just in case */ | if(G->HaveGUI && G->ValidContext) { /*just in case */ | |||
skipping to change at line 6325 | skipping to change at line 6376 | |||
return 1; | return 1; | |||
} else | } else | |||
return 0; | return 0; | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void SceneReshape(Block * block, int width, int height) | void SceneReshape(Block * block, int width, int height) | |||
{ | { | |||
PyMOLGlobals *G = block->G; | PyMOLGlobals *G = block->G; | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
int y = height; | ||||
if(I->Block->margin.right) { | if(I->Block->margin.right) { | |||
width -= I->Block->margin.right; | width -= I->Block->margin.right; | |||
if(width < 1) | if(width < 1) | |||
width = 1; | width = 1; | |||
} | } | |||
if(I->Block->margin.top) { | if(I->Block->margin.top) { | |||
height -= I->Block->margin.top; | height -= I->Block->margin.top; | |||
y = height; | ||||
} | } | |||
/* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ | ||||
#ifdef _PYMOL_OSX | ||||
#ifndef _MACPYMOL_XCODE | ||||
/* workaround for broken pixel handling under OSX | ||||
(Who's fault: Me? Apple? NVidia?) */ | ||||
width = 8 * (width / 8); | ||||
/* it's 2007, four years later, do we still need this? */ | ||||
#endif | ||||
#endif | ||||
/* END PROPRIETARY CODE SEGMENT */ | ||||
I->Width = width; | I->Width = width; | |||
I->Height = height; | I->Height = height; | |||
I->Block->rect.top = I->Height; | I->Block->rect.top = I->Height; | |||
I->Block->rect.left = 0; | I->Block->rect.left = 0; | |||
I->Block->rect.bottom = 0; | I->Block->rect.bottom = 0; | |||
I->Block->rect.right = I->Width; | I->Block->rect.right = I->Width; | |||
if(I->Block->margin.bottom) { | if(I->Block->margin.bottom) { | |||
skipping to change at line 6585 | skipping to change at line 6622 | |||
int rockFlag = false; | int rockFlag = false; | |||
int dirty = false; | int dirty = false; | |||
int movie_rock = SettingGetGlobal_i(G, cSetting_movie_rock); | int movie_rock = SettingGetGlobal_i(G, cSetting_movie_rock); | |||
if(movie_rock < 0) | if(movie_rock < 0) | |||
movie_rock = ControlRocking(G); | movie_rock = ControlRocking(G); | |||
if(MoviePlaying(G) && movie_rock) { | if(MoviePlaying(G) && movie_rock) { | |||
if(MovieGetRealtime(G) && !SettingGetGlobal_b(G, cSetting_movie_animate_by_f rame)) { | if(MovieGetRealtime(G) && !SettingGetGlobal_b(G, cSetting_movie_animate_by_f rame)) { | |||
I->SweepTime += I->RenderTime; | I->RenderTime = UtilGetSeconds(G) - I->LastSweepTime; | |||
rockFlag = true; | rockFlag = true; | |||
dirty = true; /* force a subsequent update */ | dirty = true; /* force a subsequent update */ | |||
} else { | } else { | |||
float fps = SceneGetFPS(G); /* guaranteed to be >= 0.0F */ | float fps = SceneGetFPS(G); /* guaranteed to be >= 0.0F */ | |||
if(fps > 0.0F) { | if(fps > 0.0F) { | |||
int rock_frame = SceneGetFrame(G); | int rock_frame = SceneGetFrame(G); | |||
if(rock_frame != I->RockFrame) { | if(rock_frame != I->RockFrame) { | |||
I->RockFrame = rock_frame; | I->RockFrame = rock_frame; | |||
rockFlag = true; | rockFlag = true; | |||
I->SweepTime += 1.0 / fps; | I->RenderTime = 1.0 / fps; | |||
} | } | |||
} else { | } else { | |||
I->SweepTime += I->RenderTime; | I->RenderTime = UtilGetSeconds(G) - I->LastSweepTime; | |||
rockFlag = true; | rockFlag = true; | |||
} | } | |||
} | } | |||
} else | } else | |||
dirty = true; | dirty = true; | |||
if(I->cur_ani_elem < I->n_ani_elem) { /* play motion animation */ | if(I->cur_ani_elem < I->n_ani_elem) { /* play motion animation */ | |||
double now; | double now; | |||
int cur = I->cur_ani_elem; | int cur = I->cur_ani_elem; | |||
skipping to change at line 6647 | skipping to change at line 6684 | |||
cur++; | cur++; | |||
if(cur >= I->n_ani_elem) { | if(cur >= I->n_ani_elem) { | |||
cur = I->n_ani_elem; | cur = I->n_ani_elem; | |||
break; | break; | |||
} | } | |||
} | } | |||
I->cur_ani_elem = cur; | I->cur_ani_elem = cur; | |||
SceneFromViewElem(G, I->ani_elem + cur, dirty); | SceneFromViewElem(G, I->ani_elem + cur, dirty); | |||
OrthoDirty(G); | OrthoDirty(G); | |||
} | } | |||
if(rockFlag && (I->SweepTime != 0.0)) { | if(rockFlag && (I->RenderTime != 0.0)) { | |||
SceneUpdateCameraRock(G, dirty); | SceneUpdateCameraRock(G, dirty); | |||
} | } | |||
} | } | |||
static int SceneGetDrawFlag(GridInfo * grid, int *slot_vla, int slot) | static int SceneGetDrawFlag(GridInfo * grid, int *slot_vla, int slot) | |||
{ | { | |||
int draw_flag = false; | int draw_flag = false; | |||
if(grid && grid->active) { | if(grid && grid->active) { | |||
switch (grid->mode) { | switch (grid->mode) { | |||
case 1: /* assigned grid slots (usually by group) */ | case 1: /* assigned grid slots (usually by group) */ | |||
skipping to change at line 9088 | skipping to change at line 9125 | |||
/* do standard 3D objects */ | /* do standard 3D objects */ | |||
/* Set up the clipping planes */ | /* Set up the clipping planes */ | |||
glMatrixMode(GL_PROJECTION); | glMatrixMode(GL_PROJECTION); | |||
glLoadIdentity(); | glLoadIdentity(); | |||
if(SettingGetGlobal_b(G, cSetting_all_states)) { | if(SettingGetGlobal_b(G, cSetting_all_states)) { | |||
curState = -1; | curState = -1; | |||
} else { | } else { | |||
curState = SettingGetGlobal_i(G, cSetting_state) - 1; | curState = SettingGetGlobal_i(G, cSetting_state) - 1; | |||
} | } | |||
if(!SettingGetGlobal_b(G, cSetting_ortho)) { | if(!SettingGetGlobal_b(G, cSetting_ortho)) { | |||
float fov = SettingGetGlobal_f(G, cSetting_field_of_view); | height = I->FrontSafe * GetFovWidth(G) / 2.f; | |||
gluPerspective(fov, aspRat, I->FrontSafe, I->BackSafe); | width = height * aspRat; | |||
glFrustum(-width, width, -height, height, I->FrontSafe, I->BackSafe); | ||||
} else { | } else { | |||
height = std::max(R_SMALL4, -I->Pos[2]) * GetFovWidth(G) / 2.f; | height = std::max(R_SMALL4, -I->Pos[2]) * GetFovWidth(G) / 2.f; | |||
width = height * aspRat; | width = height * aspRat; | |||
GLORTHO(-width, width, -height, height, I->FrontSafe, I->BackSafe); | GLORTHO(-width, width, -height, height, I->FrontSafe, I->BackSafe); | |||
} | } | |||
glMatrixMode(GL_MODELVIEW); | glMatrixMode(GL_MODELVIEW); | |||
ScenePrepareMatrix(G, 0); | ScenePrepareMatrix(G, 0); | |||
/* Save these for editing operations */ | /* Save these for editing operations */ | |||
skipping to change at line 9564 | skipping to change at line 9602 | |||
if(Feedback(G, FB_OpenGL, FB_Debugging)) | if(Feedback(G, FB_OpenGL, FB_Debugging)) | |||
PyMOLCheckOpenGLErr("SceneRender final checkpoint"); | PyMOLCheckOpenGLErr("SceneRender final checkpoint"); | |||
} | } | |||
PRINTFD(G, FB_Scene) | PRINTFD(G, FB_Scene) | |||
" SceneRender: rendering complete.\n" ENDFD; | " SceneRender: rendering complete.\n" ENDFD; | |||
if(!(pick || smp)) { /* update frames per second field */ | if(!(pick || smp)) { /* update frames per second field */ | |||
I->RenderTime = -I->LastRender; | ||||
I->LastRender = UtilGetSeconds(G); | I->LastRender = UtilGetSeconds(G); | |||
I->RenderTime += I->LastRender; | ||||
I->ApproxRenderTime = I->LastRender - start_time; | I->ApproxRenderTime = I->LastRender - start_time; | |||
if(I->CopyNextFlag) { | if(I->CopyNextFlag) { | |||
start_time = I->LastRender - start_time; | start_time = I->LastRender - start_time; | |||
if((start_time > 0.10) || (MainSavingUnderWhileIdle())) | if((start_time > 0.10) || (MainSavingUnderWhileIdle())) | |||
if(!(ControlIdling(G))) | if(!(ControlIdling(G))) | |||
if(SettingGetGlobal_b(G, cSetting_cache_display)) { | if(SettingGetGlobal_b(G, cSetting_cache_display)) { | |||
if(!I->CopyType) { | if(!I->CopyType) { | |||
SceneCopy(G, render_buffer, false, false); | SceneCopy(G, render_buffer, false, false); | |||
} | } | |||
skipping to change at line 9612 | skipping to change at line 9648 | |||
I->RenderTime = 0.0; | I->RenderTime = 0.0; | |||
} | } | |||
void SceneRestartSweepTimer(PyMOLGlobals * G) | void SceneRestartSweepTimer(PyMOLGlobals * G) | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
I->LastSweep = 0.0F; /* continue to defer rocking until this is done */ | I->LastSweep = 0.0F; /* continue to defer rocking until this is done */ | |||
I->LastSweepX = 0.0F; | I->LastSweepX = 0.0F; | |||
I->LastSweepY = 0.0F; | I->LastSweepY = 0.0F; | |||
I->SweepTime = 0.0; | I->SweepTime = 0.0; | |||
I->LastSweepTime = UtilGetSeconds(G); | ||||
SceneRestartPerfTimer(G); | SceneRestartPerfTimer(G); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void ScenePrepareMatrix(PyMOLGlobals * G, int mode) | void ScenePrepareMatrix(PyMOLGlobals * G, int mode) | |||
{ | { | |||
CScene *I = G->Scene; | CScene *I = G->Scene; | |||
float stAng, stShift; | float stAng, stShift; | |||
End of changes. 34 change blocks. | ||||
68 lines changed or deleted | 106 lines changed or added |