|
AnoPlib - Animlets are not Particles library
|
Some helper methods and data. More...
#include <AnoPhelpers.h>
Static Public Member Functions | |
| static void | close () |
| static void | drawOutlineCircle (double width, double iwidth, int steps, double beg, double end) throw () |
| static void | drawOutlineCircle2 (double width, double iwidth, int steps, double beg, double end, float *rgba1, float *rgba2) throw () |
| static void | init () |
Static Public Attributes | |
| static double * | costab |
| static double * | sintab |
Some helper methods and data.
Definition at line 49 of file AnoPhelpers.h.
| void AnoPhelpers::close | ( | ) | [static] |
| void AnoPhelpers::drawOutlineCircle | ( | double | width, |
| double | iwidth, | ||
| int | steps, | ||
| double | beg, | ||
| double | end | ||
| ) | throw () [static] |
Definition at line 73 of file AnoPhelpers.cpp.
Referenced by AnoPwavepropagation1::render().
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
double p1x = beg==0 ? sintab[0] : sintab[((int) beg)%360];
double p1y = beg==0 ? costab[0] : costab[((int) beg)%360];
for (int i=(int)(beg); i<steps&&(360.0/(double) steps *(double) i)<end; i++) {
double p2x = sintab[(size_t)(360.0/(double) steps * (double) i)%360];
double p2y = costab[(size_t)(360.0/(double) steps * (double) i)%360];
glBegin(GL_TRIANGLES);
glVertex2d(p1x * width, p1y * width);
glVertex2d(p2x * width, p2y * width);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p1x * iwidth, p1y * iwidth);
glVertex2d(p1x * width, p1y * width);
glEnd();
p1x = p2x;
p1y = p2y;
}
double p2x = end==360 ? sintab[0] : sintab[((int) end)%360];
double p2y = end==360 ? costab[0] : costab[((int) end)%360];
glBegin(GL_TRIANGLES);
glVertex2d(p1x * width, p1y * width);
glVertex2d(p2x * width, p2y * width);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p1x * iwidth, p1y * iwidth);
glVertex2d(p1x * width, p1y * width);
glEnd();
}
| void AnoPhelpers::drawOutlineCircle2 | ( | double | width, |
| double | iwidth, | ||
| int | steps, | ||
| double | beg, | ||
| double | end, | ||
| float * | rgba1, | ||
| float * | rgba2 | ||
| ) | throw () [static] |
Definition at line 107 of file AnoPhelpers.cpp.
References s.
Referenced by AnoPemergency1::render(), and AnoPflashlight1::render().
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
double p1x = beg==0 ? sintab[0] : sintab[((int) beg)%360];
double p1y = beg==0 ? costab[0] : costab[((int) beg)%360];
double s = end - beg;
if(s<0) {
s = 360. + s;
}
for (int i=0; i<steps; ++i) {
double p2x = sintab[(size_t)(s/(double) steps * (double) i + beg)%360];
double p2y = costab[(size_t)(s/(double) steps * (double) i + beg)%360];
glBegin(GL_TRIANGLES);
glColor4fv(rgba2);
glVertex2d(p1x * width, p1y * width);
glVertex2d(p2x * width, p2y * width);
glColor4fv(rgba1);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p1x * iwidth, p1y * iwidth);
glColor4fv(rgba2);
glVertex2d(p1x * width, p1y * width);
glEnd();
p1x = p2x;
p1y = p2y;
}
double p2x = end==360 ? sintab[0] : sintab[((int) end)%360];
double p2y = end==360 ? costab[0] : costab[((int) end)%360];
glBegin(GL_TRIANGLES);
glColor4fv(rgba2);
glVertex2d(p1x * width, p1y * width);
glVertex2d(p2x * width, p2y * width);
glColor4fv(rgba1);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p2x * iwidth, p2y * iwidth);
glVertex2d(p1x * iwidth, p1y * iwidth);
glColor4fv(rgba2);
glVertex2d(p1x * width, p1y * width);
glEnd();
}
| void AnoPhelpers::init | ( | ) | [static] |
double * AnoPhelpers::costab [static] |
Definition at line 53 of file AnoPhelpers.h.
Referenced by close(), init(), and AnoPwavelogo1::render().
double * AnoPhelpers::sintab [static] |
Definition at line 52 of file AnoPhelpers.h.
Referenced by close(), init(), AnoPtentacle1::render(), AnoPwavelogo1::render(), and AnoPflashlight1::render().