[Plib-cvs] plib/src/ssgAux ssgaCelestialBody.cxx,NONE,1.1 ssgaCloudLayer.cxx,NONE,1.1 ssgaSky.cxx,NO
Brought to you by:
sjbaker
Update of /cvsroot/plib/plib/src/ssgAux In directory sc8-pr-cvs1:/tmp/cvs-serv1335 Added Files: ssgaCelestialBody.cxx ssgaCloudLayer.cxx ssgaSky.cxx ssgaSky.h ssgaSkyDome.cxx ssgaSphere.cxx ssgaSphere.h ssgaStars.cxx Log Message: Added ssgaSky --- NEW FILE: ssgaCelestialBody.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...367 lines suppressed...] q = 0; for (i = 0; i < win_height; i++) { for (j = 0; j < win_width; j++) { for (k = 0; k < RGB; k++) { ibuffer[q++] = (unsigned char) *(buffer + (pixelSize*((win_height-1-i)*win_width+j)+k)); } } } // *(buffer + (pixelSize*((win_height-1-i)*win_width+j)+k)); fwrite(ibuffer, sizeof(unsigned char), RGB*win_width*win_height, fp); fclose(fp); free(ibuffer); printf("wrote file (%d x %d pixels, %d bytes)\n", win_width, win_height, RGB*win_width*win_height); } #endif --- NEW FILE: ssgaCloudLayer.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...452 lines suppressed...] // double tmp3 = sin(d)*cos_start_y); // double tmp4 = sin(dest[SG_Y])-sin(start[SG_Y])*cos(d); // double tmp5 = acos(tmp4/tmp3); // Doing this way gaurentees that the temps are // not stored into memory double tmp5 = acos( (sin(dest[SG_Y]) - sin_start_y * cos(d)) / (sin(d) * cos_start_y) ); // if ( sin( dest[SG_X] - start[SG_X] ) < 0 ) { // the sin of the negative angle is just the opposite sign // of the sin of the angle so tmp2 will have the opposite // sign of sin( dest[SG_X] - start[SG_X] ) if ( tmp2 >= 0 ) { *course = tmp5; } else { *course = 2 * SGD_PI - tmp5; } } } --- NEW FILE: ssgaSky.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...353 lines suppressed...] else { effvis = 0.0; } puff_progression += time_factor; if ( puff_progression > puff_length + ramp_up + ramp_down) { in_puff = false; } } // never let visibility drop below 25 meters if ( effvis <= 25.0 ) { effvis = 25.0; } } } // for effective_visibility = effvis; } --- NEW FILE: ssgaSky.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...349 lines suppressed...] }; inline void ssgaGammaCorrectC(float *color, float reff = 2.5, float system = system_gamma) { *color = (float)pow(*color, reff/system); }; inline void ssgaGammaRestoreRGB(float *color, float reff = 2.5, float system = system_gamma) { color[0] = (float)pow(color[0], system/reff); color[1] = (float)pow(color[1], system/reff); color[2] = (float)pow(color[2], system/reff); }; inline void ssgaGammaRestoreC(float *color, float reff = 2.5, float system = system_gamma) { *color = (float)pow(*color, system/reff); }; #endif --- NEW FILE: ssgaSkyDome.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...465 lines suppressed...] slot = middle_ring_cl->get( counter++ ); sgCopyVec4( slot, middle_color[0] ); // generate lower ring counter = 0; for ( i = 0; i < 12; i++ ) { slot = lower_ring_cl->get( counter++ ); sgCopyVec4( slot, bottom_color[i] ); slot = lower_ring_cl->get( counter++ ); sgCopyVec4( slot, lower_color[i] ); } slot = lower_ring_cl->get( counter++ ); sgCopyVec4( slot, bottom_color[0] ); slot = lower_ring_cl->get( counter++ ); sgCopyVec4( slot, lower_color[0] ); return true; } --- NEW FILE: ssgaSphere.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...85 lines suppressed...] if ( vl->getNum() != nl->getNum() ) { ulSetError(UL_FATAL, "bad sphere1\n"); exit(-1); } if ( vl->getNum() != tl->getNum() ) { ulSetError(UL_FATAL, "bad sphere2\n"); exit(-1); } slice->setState( state ); slice->setCallback( SSG_CALLBACK_PREDRAW, predraw ); slice->setCallback( SSG_CALLBACK_POSTDRAW, postdraw ); sphere->addKid( slice ); t -= dt; } return sphere; } --- NEW FILE: ssgaSphere.h --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: ssgaSphere.h,v 1.1 2003/07/26 06:16:19 nmcevoy Exp $ */ #include "ssg.h" // return a sphere object as an ssgBranch (connected to the specified ssgSimpleState) ssgBranch *ssgaMakeSphere( ssgSimpleState *state, ssgColourArray *cl, float radius, int slices, int stacks, ssgCallback predraw, ssgCallback postdraw ); --- NEW FILE: ssgaStars.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 1998,2002 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net [...203 lines suppressed...] if ( mag < cutoff ) { nmag = ( 4.5 - mag ) / 5.5; // translate to 0 ... 1.0 scale // alpha = nmag * 0.7 + 0.3; // translate to a 0.3 ... 1.0 scale alpha = nmag * 0.85 + 0.15; // translate to a 0.15 ... 1.0 scale alpha *= factor; // dim when the sun is brighter } else { alpha = 0.0; } if (alpha > 1.0) { alpha = 1.0; } if (alpha < 0.0) { alpha = 0.0; } color = cl->get( i ); sgSetVec4( color, 1.0, 1.0, 1.0, (float)alpha ); } } return true; } |