diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-02 23:06:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-02 23:06:20 +0400 |
commit | 5faa29b01dd6b47219d1aabb3217459ba1e2f56d (patch) | |
tree | e952316f62db823d26803a7920b533cd49bfa4e0 /source/blender/editors/render | |
parent | 283372ab3c828d53173825f9f7e5908fc2548302 (diff) |
move window matrix translation into its own function. (no functional changes)
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 262a832cd16..825a6fc7043 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -153,45 +153,21 @@ static void screen_opengl_render_apply(OGLRender *oglrender) else { /* simple accumulation, less hassle then FSAA FBO's */ # define SAMPLES 5 /* fixed, easy to have more but for now this is ok */ - const float jit_ofs[SAMPLES][2] = {{0, 0}, {1,1}, {-1,-1}, {-1,1}, {1,-1}}; + const float jit_ofs[SAMPLES][2] = {{0, 0}, {0.5f, 0.5f}, {-0.5f,-0.5f}, {-0.5f, 0.5f}, {0.5f, -0.5f}}; float winmat_jitter[4][4]; float *accum_buffer= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1"); float *accum_tmp= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2"); int j, i; float *from, *to; - float pixelsize[2]; /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_buffer); - if(is_ortho) { - pixelsize[0]= 0.5f / sizex; - pixelsize[1]= 0.5f / sizey; - } - else { - /* copied from view3d_main_area_setup_view */ - float v1[3]= {rv3d->persmat[0][0], rv3d->persmat[1][0], rv3d->persmat[2][0]}; - float v2[3]= {rv3d->persmat[0][1], rv3d->persmat[1][1], rv3d->persmat[2][1]}; - float len1= (1.0f / len_v3(v1)) / (float)sizex; - float len2= (1.0f / len_v3(v2)) / (float)sizey; - - pixelsize[0]= 0.5 * len1 * winmat[0][0]; - pixelsize[1]= 0.5 * len2 * winmat[1][1]; - } - /* skip the first sample */ for(j=1; j < SAMPLES; j++) { copy_m4_m4(winmat_jitter, winmat); - - if(is_ortho) { - winmat_jitter[3][0] += jit_ofs[j][0] * pixelsize[0]; - winmat_jitter[3][1] += jit_ofs[j][1] * pixelsize[1]; - } - else { - winmat_jitter[2][0] += jit_ofs[j][0] * pixelsize[0]; - winmat_jitter[2][1] += jit_ofs[j][1] * pixelsize[1]; - } + window_translate_m4(winmat_jitter, rv3d->persmat, jit_ofs[j][0] / sizex, jit_ofs[j][1] / sizey); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter); glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_tmp); |