"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer1/SceneRender.cpp" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.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.

SceneRender.cpp  (pymol-open-source-2.2.0):SceneRender.cpp  (pymol-open-source-2.3.0)
skipping to change at line 26 skipping to change at line 26
#include"Control.h" #include"Control.h"
#include"Editor.h" #include"Editor.h"
#include"Executive.h" #include"Executive.h"
#include"P.h" #include"P.h"
#include"Err.h" #include"Err.h"
/* EXPERIMENTAL VOLUME RAYTRACING DATA */ /* EXPERIMENTAL VOLUME RAYTRACING DATA */
extern float *rayDepthPixels; extern float *rayDepthPixels;
extern int rayVolume, rayWidth, rayHeight; extern int rayVolume, rayWidth, rayHeight;
static
void SetDrawBufferForStereo(PyMOLGlobals * G, CScene *I, int stereo_mode, int ti mes, int fog_active, int offscreen); void SetDrawBufferForStereo(PyMOLGlobals * G, CScene *I, int stereo_mode, int ti mes, int fog_active, int offscreen);
static
void SceneDrawStencilInBuffer(PyMOLGlobals * G, CScene *I, int stereo_mode); void SceneDrawStencilInBuffer(PyMOLGlobals * G, CScene *I, int stereo_mode);
static
void SceneRenderStereoLoop(PyMOLGlobals * G, int timesArg, int must_render_stere o, int stereo_mode, void SceneRenderStereoLoop(PyMOLGlobals * G, int timesArg, int must_render_stere o, int stereo_mode,
short render_to_texture, int x, int y, int oversize_w idth, int oversize_height, short render_to_texture, int x, int y, int oversize_w idth, int oversize_height,
int stereo_double_pump_mono, int curState, float *nor mal, int stereo_double_pump_mono, int curState, float *nor mal,
SceneUnitContext *context, float width_scale, int fog _active, SceneUnitContext *context, float width_scale, int fog _active,
int onlySelections, int noAA); int onlySelections, int noAA);
static
void SceneRenderAA(PyMOLGlobals * G); void SceneRenderAA(PyMOLGlobals * G);
static
void PrepareViewPortForStereoImpl(PyMOLGlobals * G, CScene *I, int stereo_mode, short offscreen, int times, void PrepareViewPortForStereoImpl(PyMOLGlobals * G, CScene *I, int stereo_mode, short offscreen, int times,
int x, int y, int oversize_width, int oversize _height, GLenum draw_mode, int x, int y, int oversize_width, int oversize _height, GLenum draw_mode,
int position /* left=0, right=1 */); int position /* left=0, right=1 */);
static
void PrepareViewPortForMonoInitializeViewPort(PyMOLGlobals * G, CScene *I, int s tereo_mode, short offscreen, void PrepareViewPortForMonoInitializeViewPort(PyMOLGlobals * G, CScene *I, int s tereo_mode, short offscreen,
int times, int x, int y, int overs ize_width, int oversize_height); int times, int x, int y, int overs ize_width, int oversize_height);
static
void PrepareViewPortForStereo(PyMOLGlobals * G, CScene *I, int stereo_mode, shor t offscreen, int times, void PrepareViewPortForStereo(PyMOLGlobals * G, CScene *I, int stereo_mode, shor t offscreen, int times,
int x, int y, int oversize_width, int oversize_hei ght); int x, int y, int oversize_width, int oversize_hei ght);
static
void PrepareViewPortForStereo2nd(PyMOLGlobals * G, CScene *I, int stereo_mode, s hort offscreen, void PrepareViewPortForStereo2nd(PyMOLGlobals * G, CScene *I, int stereo_mode, s hort offscreen,
int times, int x, int y, int oversize_width, in t oversize_height); int times, int x, int y, int oversize_width, in t oversize_height);
static
void InitializeViewPortToScreenBlock(PyMOLGlobals * G, CScene *I, int x, int y, int oversize_width, int oversize_height, void InitializeViewPortToScreenBlock(PyMOLGlobals * G, CScene *I, int x, int y, int oversize_width, int oversize_height,
int *stereo_mode, float *width_scale); int *stereo_mode, float *width_scale);
static
void SceneSetPrepareViewPortForStereo(PyMOLGlobals *G, void (*prepareViewPortFor Stereo)(PyMOLGlobals *, CScene *, int, short, int, int, int, int, int), void SceneSetPrepareViewPortForStereo(PyMOLGlobals *G, void (*prepareViewPortFor Stereo)(PyMOLGlobals *, CScene *, int, short, int, int, int, int, int),
int times, int x, int y, int oversize_widt h, int oversize_height, int stereo_mode, float width_scale); int times, int x, int y, int oversize_widt h, int oversize_height, int stereo_mode, float width_scale);
static
CGO *GenerateUnitScreenCGO(PyMOLGlobals * G); CGO *GenerateUnitScreenCGO(PyMOLGlobals * G);
static int stereo_via_stencil(int stereo_mode) static int stereo_via_stencil(int stereo_mode)
{ {
switch (stereo_mode) { switch (stereo_mode) {
case cStereo_stencil_by_row: case cStereo_stencil_by_row:
case cStereo_stencil_by_column: case cStereo_stencil_by_column:
case cStereo_stencil_checkerboard: case cStereo_stencil_checkerboard:
case cStereo_stencil_custom: case cStereo_stencil_custom:
return true; return true;
skipping to change at line 530 skipping to change at line 541
if(force_copy && !(I->CopyType)) { if(force_copy && !(I->CopyType)) {
SceneCopy(G, render_buffer, true, false); SceneCopy(G, render_buffer, true, false);
I->CopyType = 2; /* do not display force copies */ I->CopyType = 2; /* do not display force copies */
} }
} }
PRINTFD(G, FB_Scene) PRINTFD(G, FB_Scene)
" SceneRender: leaving...\n" ENDFD; " SceneRender: leaving...\n" ENDFD;
} }
static
void AppendCopyWithChangedShader(PyMOLGlobals * G, CGO *destCGO, CGO *srcCGO, in t frommode, int tomode){ void AppendCopyWithChangedShader(PyMOLGlobals * G, CGO *destCGO, CGO *srcCGO, in t frommode, int tomode){
CGO *cgo = CGONew(G); CGO *cgo = CGONew(G);
CGOAppendNoStop(cgo, srcCGO); CGOAppendNoStop(cgo, srcCGO);
CGOChangeShadersTo(cgo, frommode, tomode); CGOChangeShadersTo(cgo, frommode, tomode);
CGOAppendNoStop(destCGO, cgo); CGOAppendNoStop(destCGO, cgo);
CGOFreeWithoutVBOs(cgo); CGOFreeWithoutVBOs(cgo);
} }
/* SceneRenderAA: renders Anti-aliasing from the I->offscreen_texture texture, /* SceneRenderAA: renders Anti-aliasing from the I->offscreen_texture texture,
depending on the antialias_shader setting, FXAA (1 stage) depending on the antialias_shader setting, FXAA (1 stage)
skipping to change at line 720 skipping to change at line 732
* fat: wide lines (i.e., for picking) * fat: wide lines (i.e., for picking)
* width_scale: specifies width_scale and sampling * width_scale: specifies width_scale and sampling
* grid: grid information * grid: grid information
* dynamic_pass: for specific stereo modes dynamic and clone_dynamic * dynamic_pass: for specific stereo modes dynamic and clone_dynamic
* which: 0 - all objects * which: 0 - all objects
* 1 - only gadgets * 1 - only gadgets
* 2 - only non-gadgets * 2 - only non-gadgets
* 3 - gadgets last * 3 - gadgets last
*/ */
void SceneRenderAll(PyMOLGlobals * G, SceneUnitContext * context, void SceneRenderAll(PyMOLGlobals * G, SceneUnitContext * context,
float *normal, Picking ** pickVLA, float *normal, std::vector<Picking>* pickVLA,
int pass, int fat, float width_scale, int pass, int fat, float width_scale,
GridInfo * grid, int dynamic_pass, short which_objects, bool picking32bit) GridInfo * grid, int dynamic_pass, short which_objects, bool picking32bit)
{ {
CScene *I = G->Scene; CScene *I = G->Scene;
int state = SceneGetState(G); int state = SceneGetState(G);
RenderInfo info; RenderInfo info;
#if defined(_WEBGL) && defined(PYMOL_EVAL) #if defined(_WEBGL) && defined(PYMOL_EVAL)
if (!OrthoEvalCheck(G)) if (!OrthoEvalCheck(G))
return; return;
#endif #endif
skipping to change at line 863 skipping to change at line 875
rendering pass (opaque, then antialiased, then transparent) for each grid slo t rendering pass (opaque, then antialiased, then transparent) for each grid slo t
(only one grid slot if full screen). It also implements transparency_mode 3, (only one grid slot if full screen). It also implements transparency_mode 3,
(weighted, blended order-independent transparency) which renders the opaque/a ntialiased (weighted, blended order-independent transparency) which renders the opaque/a ntialiased
passes to the offscreen texture with a depth texture, renders the transparent passes to the offscreen texture with a depth texture, renders the transparent
pass to the OIT offscreen texture, calls OIT_copy to copy the opaque to the pass to the OIT offscreen texture, calls OIT_copy to copy the opaque to the
screen (if necessary, i.e., not already rendering to AA texture), and then screen (if necessary, i.e., not already rendering to AA texture), and then
calls the OIT rendering pass that computes the resulting image. calls the OIT rendering pass that computes the resulting image.
This function also renders only the selections (onlySelections) for all grids or This function also renders only the selections (onlySelections) for all grids or
the full screen. the full screen.
*/ */
static
void DoRendering(PyMOLGlobals * G, CScene *I, short offscreen, GridInfo *grid, i nt times, void DoRendering(PyMOLGlobals * G, CScene *I, short offscreen, GridInfo *grid, i nt times,
int curState, float *normal, SceneUnitContext *context, int curState, float *normal, SceneUnitContext *context,
float width_scale, short onlySelections, short excludeSelection s){ float width_scale, short onlySelections, short excludeSelection s){
int pass; int pass;
bool use_shaders = (bool)SettingGetGlobal_b(G, cSetting_use_shaders); bool use_shaders = (bool)SettingGetGlobal_b(G, cSetting_use_shaders);
bool t_mode_3_os = use_shaders && SettingGetGlobal_i(G, cSetting_transparency_ mode) == 3; bool t_mode_3_os = use_shaders && SettingGetGlobal_i(G, cSetting_transparency_ mode) == 3;
bool t_mode_3 = !onlySelections && t_mode_3_os; bool t_mode_3 = !onlySelections && t_mode_3_os;
GLint currentFrameBuffer; GLint currentFrameBuffer;
#if !defined(PURE_OPENGL_ES_2) || defined(_WEBGL) #if !defined(PURE_OPENGL_ES_2) || defined(_WEBGL)
skipping to change at line 1194 skipping to change at line 1207
void PrepareViewPortForStereo2nd(PyMOLGlobals * G, CScene *I, int stereo_mode, s hort offscreen, int times, int x, int y, int oversize_width, int oversize_height ){ void PrepareViewPortForStereo2nd(PyMOLGlobals * G, CScene *I, int stereo_mode, s hort offscreen, int times, int x, int y, int oversize_width, int oversize_height ){
PrepareViewPortForStereoImpl(G, I, stereo_mode, offscreen, times, x, y, oversi ze_width, oversize_height, GL_BACK_RIGHT, 1); PrepareViewPortForStereoImpl(G, I, stereo_mode, offscreen, times, x, y, oversi ze_width, oversize_height, GL_BACK_RIGHT, 1);
} }
void InitializeViewPortToScreenBlock(PyMOLGlobals * G, CScene *I, int x, int y, int oversize_width, int oversize_height, void InitializeViewPortToScreenBlock(PyMOLGlobals * G, CScene *I, int x, int y, int oversize_width, int oversize_height,
int *stereo_mode, float *width_scale){ int *stereo_mode, float *width_scale){
if(oversize_width && oversize_height) { if(oversize_width && oversize_height) {
int want_view[4]; int want_view[4];
int got_view[4]; int got_view[4];
want_view[0] = I->Block->rect.left + x; want_view[0] = I->rect.left + x;
want_view[1] = I->Block->rect.bottom + y; want_view[1] = I->rect.bottom + y;
want_view[2] = oversize_width; want_view[2] = oversize_width;
want_view[3] = oversize_height; want_view[3] = oversize_height;
glViewport(want_view[0], want_view[1], want_view[2], want_view[3]); glViewport(want_view[0], want_view[1], want_view[2], want_view[3]);
#ifdef _PYMOL_IOS #ifdef _PYMOL_IOS
{ {
int width, height; int width, height;
SceneGetWidthHeight(G, &width, &height); SceneGetWidthHeight(G, &width, &height);
got_view[0] = got_view[1] = 0; got_view[0] = got_view[1] = 0;
got_view[2] = width; got_view[2] = width;
got_view[3] = height; got_view[3] = height;
skipping to change at line 1225 skipping to change at line 1238
"Scene-Warning: glViewport failure.\n" ENDFB(G); "Scene-Warning: glViewport failure.\n" ENDFB(G);
} }
#endif #endif
switch (*stereo_mode) { switch (*stereo_mode) {
case cStereo_geowall: case cStereo_geowall:
*stereo_mode = 0; *stereo_mode = 0;
break; break;
} }
*width_scale = ((float) (oversize_width)) / I->Width; *width_scale = ((float) (oversize_width)) / I->Width;
} else { } else {
glViewport(I->Block->rect.left, I->Block->rect.bottom, I->Width, I->Height); glViewport(I->rect.left, I->rect.bottom, I->Width, I->Height);
} }
} }
void SceneSetPrepareViewPortForStereo(PyMOLGlobals *G, void (*prepareViewPortFor Stereo)(PyMOLGlobals *, CScene *, int, short, int, int, int, int, int), void SceneSetPrepareViewPortForStereo(PyMOLGlobals *G, void (*prepareViewPortFor Stereo)(PyMOLGlobals *, CScene *, int, short, int, int, int, int, int),
int times, int x, int y, int oversize_widt h, int oversize_height, int stereo_mode, float width_scale){ int times, int x, int y, int oversize_widt h, int oversize_height, int stereo_mode, float width_scale){
CScene *I = G->Scene; CScene *I = G->Scene;
I->vp_prepareViewPortForStereo = prepareViewPortForStereo; I->vp_prepareViewPortForStereo = prepareViewPortForStereo;
I->vp_times = times; I->vp_times = times;
I->vp_x = x; I->vp_y = y; I->vp_owidth = oversize_width; I->vp_oheight = overs ize_height; I->vp_x = x; I->vp_y = y; I->vp_owidth = oversize_width; I->vp_oheight = overs ize_height;
I->vp_stereo_mode = stereo_mode; I->vp_width_scale = width_scale; I->vp_stereo_mode = stereo_mode; I->vp_width_scale = width_scale;
skipping to change at line 1247 skipping to change at line 1260
/* PrepareViewPortForStereoImpl : sets up viewport and GL state for stereo_modes /* PrepareViewPortForStereoImpl : sets up viewport and GL state for stereo_modes
*/ */
void PrepareViewPortForStereoImpl(PyMOLGlobals * G, CScene *I, int stereo_mode, short offscreen, int times, void PrepareViewPortForStereoImpl(PyMOLGlobals * G, CScene *I, int stereo_mode, short offscreen, int times,
int x, int y, int oversize_width, int oversize _height, GLenum draw_mode, int x, int y, int oversize_width, int oversize _height, GLenum draw_mode,
int position /* left=0, right=1 */){ int position /* left=0, right=1 */){
int position_inv = 1 - position; int position_inv = 1 - position;
switch (stereo_mode) { switch (stereo_mode) {
case cStereo_quadbuffer: /* hardware */ case cStereo_quadbuffer: /* hardware */
OrthoDrawBuffer(G, draw_mode); OrthoDrawBuffer(G, draw_mode);
glViewport(I->Block->rect.left, I->Block->rect.bottom, I->Width, I->Height); glViewport(I->rect.left, I->rect.bottom, I->Width, I->Height);
break; break;
case cStereo_crosseye: /* side by side, crosseye */ case cStereo_crosseye: /* side by side, crosseye */
if (offscreen){ if (offscreen){
glViewport(position_inv * I->Width / 2, 0, I->Width / 2, glViewport(position_inv * I->Width / 2, 0, I->Width / 2,
I->Height); I->Height);
} else if(oversize_width && oversize_height) { } else if(oversize_width && oversize_height) {
glViewport(I->Block->rect.left + (position_inv * oversize_width / 2) + x, glViewport(I->rect.left + (position_inv * oversize_width / 2) + x,
I->Block->rect.bottom + y, I->rect.bottom + y,
oversize_width / 2, oversize_height); oversize_width / 2, oversize_height);
} else { } else {
glViewport(I->Block->rect.left + (position_inv * I->Width / 2), I->Block-> rect.bottom, glViewport(I->rect.left + (position_inv * I->Width / 2), I->rect.bottom,
I->Width / 2, I->Height); I->Width / 2, I->Height);
} }
break; break;
case cStereo_walleye: case cStereo_walleye:
case cStereo_sidebyside: case cStereo_sidebyside:
if (offscreen){ if (offscreen){
glViewport(position * I->Width / 2, 0, I->Width / 2, glViewport(position * I->Width / 2, 0, I->Width / 2,
I->Height); I->Height);
} else if(oversize_width && oversize_height) { } else if(oversize_width && oversize_height) {
glViewport(I->Block->rect.left + (position * oversize_width / 2) + x, glViewport(I->rect.left + (position * oversize_width / 2) + x,
I->Block->rect.bottom + y, I->rect.bottom + y,
oversize_width / 2, oversize_height); oversize_width / 2, oversize_height);
} else { } else {
glViewport(I->Block->rect.left + (position * I->Width / 2), I->Block->rect .bottom, I->Width / 2, glViewport(I->rect.left + (position * I->Width / 2), I->rect.bottom, I->Wi dth / 2,
I->Height); I->Height);
} }
break; break;
case cStereo_geowall: case cStereo_geowall:
if (offscreen){ if (offscreen){
glViewport(position * I->Width / 2, 0, I->Width / 2, glViewport(position * I->Width / 2, 0, I->Width / 2,
I->Height); I->Height);
} else { } else {
glViewport(I->Block->rect.left + (position * G->Option->winX / 2), I->Bloc k->rect.bottom, glViewport(I->rect.left + (position * G->Option->winX / 2), I->rect.bottom ,
I->Width, I->Height); I->Width, I->Height);
} }
break; break;
case cStereo_stencil_by_row: case cStereo_stencil_by_row:
case cStereo_stencil_by_column: case cStereo_stencil_by_column:
case cStereo_stencil_checkerboard: case cStereo_stencil_checkerboard:
if(I->StencilValid) { if(I->StencilValid) {
glStencilFunc(GL_EQUAL, position_inv, 1); glStencilFunc(GL_EQUAL, position_inv, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glEnable(GL_STENCIL_TEST); glEnable(GL_STENCIL_TEST);
skipping to change at line 1372 skipping to change at line 1385
float dynamic_strength = float dynamic_strength =
SettingGetGlobal_f(G, cSetting_stereo_dynamic_strength); SettingGetGlobal_f(G, cSetting_stereo_dynamic_strength);
float vv[4] = { 0.75F, 0.75F, 0.75F, 1.0F }; float vv[4] = { 0.75F, 0.75F, 0.75F, 1.0F };
vv[0] = dynamic_strength; vv[0] = dynamic_strength;
vv[1] = dynamic_strength; vv[1] = dynamic_strength;
vv[2] = dynamic_strength; vv[2] = dynamic_strength;
glClearAccum(0.5, 0.5, 0.5, 0.5); glClearAccum(0.5, 0.5, 0.5, 0.5);
glClear(GL_ACCUM_BUFFER_BIT); glClear(GL_ACCUM_BUFFER_BIT);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, vv); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, vv);
glDisable(GL_FOG); glDisable(GL_FOG);
glViewport(I->Block->rect.left + G->Option->winX / 2, glViewport(I->rect.left + G->Option->winX / 2,
I->Block->rect.bottom, I->Width, I->Height); I->rect.bottom, I->Width, I->Height);
} else { } else {
glClearAccum(0.0, 0.0, 0.0, 0.0); glClearAccum(0.0, 0.0, 0.0, 0.0);
glClear(GL_ACCUM_BUFFER_BIT); glClear(GL_ACCUM_BUFFER_BIT);
glViewport(I->Block->rect.left, glViewport(I->rect.left,
I->Block->rect.bottom, I->Width, I->Height); I->rect.bottom, I->Width, I->Height);
} }
} else { } else {
GLenum err; GLenum err;
if(times) { if(times) {
glAccum(GL_ACCUM, -0.5); glAccum(GL_ACCUM, -0.5);
} else { } else {
glAccum(GL_ACCUM, 0.5); glAccum(GL_ACCUM, 0.5);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
} }
if((err = glGetError())) { if((err = glGetError())) {
skipping to change at line 1474 skipping to change at line 1487
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, vv); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, vv);
if(fog_active) if(fog_active)
glEnable(GL_FOG); glEnable(GL_FOG);
#endif #endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
} }
#ifndef PURE_OPENGL_ES_2 #ifndef PURE_OPENGL_ES_2
glAccum(GL_RETURN, 1.0); glAccum(GL_RETURN, 1.0);
#endif #endif
if(times) { if(times) {
glViewport(I->Block->rect.left, glViewport(I->rect.left,
I->Block->rect.bottom, I->Width + 2, I->Height + 2); I->rect.bottom, I->Width + 2, I->Height + 2);
glScissor(I->Block->rect.left - 1, glScissor(I->rect.left - 1,
I->Block->rect.bottom - 1, I->Width + 2, I->Height + 2); I->rect.bottom - 1, I->Width + 2, I->Height + 2);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} else { } else {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} }
break; break;
} }
} }
 End of changes. 25 change blocks. 
20 lines changed or deleted 33 lines changed or added

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