src/Jitter.h

Go to the documentation of this file.
00001 
00008 /*
00009 This file is part of Teapot Colony Wars.
00010 
00011 Teapot Colony Wars is free software: you can redistribute it and/or modify
00012 it under the terms of the GNU General Public License as published by
00013 the Free Software Foundation, either version 2 of the License, or
00014 (at your option) any later version.
00015 
00016 Teapot Colony Wars is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 GNU General Public License for more details.
00020 
00021 You should have received a copy of the GNU General Public License
00022 along with Teapot Colony Wars.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 /*
00026  * (c) Copyright 1993, Silicon Graphics, Inc.
00027  * ALL RIGHTS RESERVED
00028  * Permission to use, copy, modify, and distribute this software for
00029  * any purpose and without fee is hereby granted, provided that the above
00030  * copyright notice appear in all copies and that both the copyright notice
00031  * and this permission notice appear in supporting documentation, and that
00032  * the name of Silicon Graphics, Inc. not be used in advertising
00033  * or publicity pertaining to distribution of the software without specific,
00034  * written prior permission.
00035  *
00036  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
00037  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
00038  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
00039  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
00040  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
00041  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
00042  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
00043  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
00044  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
00045  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
00046  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
00047  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
00048  *
00049  * US Government Users Restricted Rights
00050  * Use, duplication, or disclosure by the Government is subject to
00051  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
00052  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
00053  * clause at DFARS 252.227-7013 and/or in similar or successor
00054  * clauses in the FAR or the DOD or NASA FAR Supplement.
00055  * Unpublished-- rights reserved under the copyright laws of the
00056  * United States.  Contractor/manufacturer is Silicon Graphics,
00057  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
00058  *
00059  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
00060  */
00061 
00062 #ifndef JITTER_H
00063 #define JITTER_H
00064 
00065 /*
00066 jitter.h
00067 
00068 This file contains jitter point arrays for 2,3,4,8,15,24 and 66 jitters.
00069 
00070 The arrays are named j2, j3, etc. Each element in the array has the form,
00071 for example, j8[0].x and j8[0].y
00072 
00073 Values are floating point in the range -.5 < x < .5, -.5 < y < .5, and
00074 have a gaussian distribution around the origin.
00075 
00076 Use these to do model jittering for scene anti-aliasing and view volume
00077 jittering for depth of field effects. Use in conjunction with the
00078 accwindow() routine.
00079 */
00080 
00081 #include <GL/glut.h>
00082 
00084 #define MAX_SAMPLES 66
00085 
00087 #define MAX_JITTERS 7
00088 
00099 typedef struct _jitter_point {
00101   GLfloat x;
00103   GLfloat y;
00104 } jitter_point;
00105 
00116 typedef struct _jitter_set {
00118   const int nb;
00120   jitter_point* jitter_points;
00121 } jitter_set;
00122 
00123 
00125 jitter_point j_1[] =
00126 {
00127   {0.0, 0.0}
00128 };
00129 
00131 jitter_point j_2[] =
00132 {
00133   { 0.246490,  0.249999},
00134   {-0.246490, -0.249999}
00135 };
00136 
00137 
00139 jitter_point j_3[] =
00140 {
00141   {-0.373411, -0.250550},
00142   { 0.256263,  0.368119},
00143   { 0.117148, -0.117570}
00144 };
00145 
00146 
00148 jitter_point j_4[] =
00149 {
00150   {-0.208147,  0.353730},
00151   { 0.203849, -0.353780},
00152   {-0.292626, -0.149945},
00153   { 0.296924,  0.149994}
00154 };
00155 
00156 
00158 jitter_point j_8[] =
00159 {
00160   {-0.334818,  0.435331},
00161   { 0.286438, -0.393495},
00162   { 0.459462,  0.141540},
00163   {-0.414498, -0.192829},
00164   {-0.183790,  0.082102},
00165   {-0.079263, -0.317383},
00166   { 0.102254,  0.299133},
00167   { 0.164216, -0.054399}
00168 };
00169 
00170 
00172 jitter_point j_15[] =
00173 {
00174   { 0.285561,  0.188437},
00175   { 0.360176, -0.065688},
00176   {-0.111751,  0.275019},
00177   {-0.055918, -0.215197},
00178   {-0.080231, -0.470965},
00179   { 0.138721,  0.409168},
00180   { 0.384120,  0.458500},
00181   {-0.454968,  0.134088},
00182   { 0.179271, -0.331196},
00183   {-0.307049, -0.364927},
00184   { 0.105354, -0.010099},
00185   {-0.154180,  0.021794},
00186   {-0.370135, -0.116425},
00187   { 0.451636, -0.300013},
00188   {-0.370610,  0.387504}
00189 };
00190 
00191 
00193 jitter_point j_24[] =
00194 {
00195   { 0.030245,  0.136384},
00196   { 0.018865, -0.348867},
00197   {-0.350114, -0.472309},
00198   { 0.222181,  0.149524},
00199   {-0.393670, -0.266873},
00200   { 0.404568,  0.230436},
00201   { 0.098381,  0.465337},
00202   { 0.462671,  0.442116},
00203   { 0.400373, -0.212720},
00204   {-0.409988,  0.263345},
00205   {-0.115878, -0.001981},
00206   { 0.348425, -0.009237},
00207   {-0.464016,  0.066467},
00208   {-0.138674, -0.468006},
00209   { 0.144932, -0.022780},
00210   {-0.250195,  0.150161},
00211   {-0.181400, -0.264219},
00212   { 0.196097, -0.234139},
00213   {-0.311082, -0.078815},
00214   { 0.268379,  0.366778},
00215   {-0.040601,  0.327109},
00216   {-0.234392,  0.354659},
00217   {-0.003102, -0.154402},
00218   { 0.297997, -0.417965}
00219 };
00220 
00221 
00223 jitter_point j_66[] =
00224 {
00225   { 0.266377, -0.218171},
00226   {-0.170919, -0.429368},
00227   { 0.047356, -0.387135},
00228   {-0.430063,  0.363413},
00229   {-0.221638, -0.313768},
00230   { 0.124758, -0.197109},
00231   {-0.400021,  0.482195},
00232   { 0.247882,  0.152010},
00233   {-0.286709, -0.470214},
00234   {-0.426790,  0.004977},
00235   {-0.361249, -0.104549},
00236   {-0.040643,  0.123453},
00237   {-0.189296,  0.438963},
00238   {-0.453521, -0.299889},
00239   { 0.408216, -0.457699},
00240   { 0.328973, -0.101914},
00241   {-0.055540, -0.477952},
00242   { 0.194421,  0.453510},
00243   { 0.404051,  0.224974},
00244   { 0.310136,  0.419700},
00245   {-0.021743,  0.403898},
00246   {-0.466210,  0.248839},
00247   { 0.341369,  0.081490},
00248   { 0.124156, -0.016859},
00249   {-0.461321, -0.176661},
00250   { 0.013210,  0.234401},
00251   { 0.174258, -0.311854},
00252   { 0.294061,  0.263364},
00253   {-0.114836,  0.328189},
00254   { 0.041206, -0.106205},
00255   { 0.079227,  0.345021},
00256   {-0.109319, -0.242380},
00257   { 0.425005, -0.332397},
00258   { 0.009146,  0.015098},
00259   {-0.339084, -0.355707},
00260   {-0.224596, -0.189548},
00261   { 0.083475,  0.117028},
00262   { 0.295962, -0.334699},
00263   { 0.452998,  0.025397},
00264   { 0.206511, -0.104668},
00265   { 0.447544, -0.096004},
00266   {-0.108006, -0.002471},
00267   {-0.380810,  0.130036},
00268   {-0.242440,  0.186934},
00269   {-0.200363,  0.070863},
00270   {-0.344844, -0.230814},
00271   { 0.408660,  0.345826},
00272   {-0.233016,  0.305203},
00273   { 0.158475, -0.430762},
00274   { 0.486972,  0.139163},
00275   {-0.301610,  0.009319},
00276   { 0.282245, -0.458671},
00277   { 0.482046,  0.443890},
00278   {-0.121527,  0.210223},
00279   {-0.477606, -0.424878},
00280   {-0.083941, -0.121440},
00281   {-0.345773,  0.253779},
00282   { 0.234646,  0.034549},
00283   { 0.394102, -0.210901},
00284   {-0.312571,  0.397656},
00285   { 0.200906,  0.333293},
00286   { 0.018703, -0.261792},
00287   {-0.209349, -0.065383},
00288   { 0.076248,  0.478538},
00289   {-0.073036, -0.355064},
00290   { 0.145087,  0.221726}
00291 };
00292 
00294 jitter_set j[] =
00295 {
00296   { 1, j_1},
00297   { 2, j_2},
00298   { 3, j_3},
00299   { 4, j_4},
00300   { 8, j_8},
00301   {15, j_15},
00302   {24, j_24},
00303   {66, j_66}
00304 };
00305 
00306 #endif // JITTER_H

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