src/Accum.cpp File Reference

Antialiasing utility functions. More...

#include "Accum.h"
#include <cmath>
#include "Constants.h"

Include dependency graph for Accum.cpp:

Go to the source code of this file.

Functions

void accFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far, GLdouble pixdx, GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus)
 Multiply the current matrix by a perspective matrix, adding jittering effect.
void accPerspective (GLdouble fovy, GLdouble aspect, GLdouble near, GLdouble far, GLdouble pixdx, GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus)
 Set up a perspective projection matrix, adding jittering effect.


Detailed Description

Antialiasing utility functions.

Author:
Émilien Girault, Léo Terziman
Date:
: feb 02 2008

Definition in file Accum.cpp.


Function Documentation

void accFrustum ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far,
GLdouble  pixdx,
GLdouble  pixdy,
GLdouble  eyedx,
GLdouble  eyedy,
GLdouble  focus 
)

Multiply the current matrix by a perspective matrix, adding jittering effect.

Parameters:
left the coordinates for the left vertical clipping plane
right the coordinates for the right vertical clipping plane
bottom the coordinates for the bottom horizontal clipping plane
top the coordinates for the top horizontal clipping plane
near the distance to the near depth clipping plane. Must be positive
far the distance to the far depth clipping plane. Must be positive
pixdx anti-alias x jitter in pixels
pixdy anti-alias y jitter in pixels
eyedx depth-of field x jitter in pixels
eyedy depth-of field y jitter in pixels
focus distance from eye to plane in focus

Definition at line 68 of file Accum.cpp.

Referenced by accPerspective().

00071 {
00072   // make a frustum for use with the accumulation buffer
00073   GLdouble xwsize, ywsize;
00074   GLdouble dx, dy;
00075   GLint viewport[4];
00076 
00077   glGetIntegerv(GL_VIEWPORT, viewport);
00078   xwsize = right - left;
00079   ywsize = top - bottom;
00080   dx = -(pixdx * xwsize / (GLdouble)viewport[2] + eyedx * near / focus);
00081   dy = -(pixdx * ywsize / (GLdouble)viewport[3] + eyedy * near / focus);
00082 
00083   glMatrixMode(GL_PROJECTION);
00084   glLoadIdentity();
00085 
00086   glFrustum(left + dx, right + dx, bottom + dy, top + dy, near, far);
00087   glMatrixMode(GL_MODELVIEW);
00088   glLoadIdentity();
00089   glTranslatef(-eyedx, -eyedy, 0.0);
00090 }

Here is the caller graph for this function:

void accPerspective ( GLdouble  fovy,
GLdouble  aspect,
GLdouble  near,
GLdouble  far,
GLdouble  pixdx,
GLdouble  pixdy,
GLdouble  eyedx,
GLdouble  eyedy,
GLdouble  focus 
)

Set up a perspective projection matrix, adding jittering effect.

Parameters:
fovy Specifies the field of view angle, in degrees, in the y direction
aspect Specifies the aspect ratio that determines the field of view in the x direction
near Specifies the distance from the viewer to the near clipping plane (always positive)
far Specifies the distance from the viewer to the far clipping plane (always positive)
pixdx anti-alias x jitter in pixels
pixdy anti-alias y jitter in pixels
eyedx depth-of field x jitter in pixels
eyedy depth-of field y jitter in pixels
focus distance from eye to plane in focus

Definition at line 92 of file Accum.cpp.

References accFrustum(), and PI.

Referenced by Display::draw().

00095 {
00096   GLdouble fov2, left, right, bottom, top;
00097   fov2 = ((fovy * PI) / 180.0) / 2.0;
00098 
00099   top = near / (cos(fov2) / sin(fov2));
00100   bottom = -top;
00101   right = top * aspect;
00102   left = -right;
00103 
00104   accFrustum(left, right, bottom, top, near, far,
00105              pixdx, pixdy, eyedx, eyedy, focus);
00106 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sat Feb 2 22:22:54 2008 for Teapot Colony Wars by  doxygen 1.5.4