aggiunta delle sphere
This commit is contained in:
parent
d033c7df1a
commit
2f8bd5c457
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.28 2005/02/08 12:43:03 ponchio
|
||||
Added copyright
|
||||
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -110,8 +113,10 @@ void NexusMt::Render(DrawContest contest) {
|
|||
Render(extraction, contest);
|
||||
}
|
||||
|
||||
|
||||
void NexusMt::Render(Extraction &extraction, DrawContest &contest,
|
||||
Stats *stats) {
|
||||
static ::GLUquadricObj * spr = gluNewQuadric();
|
||||
if(stats) stats->Init();
|
||||
|
||||
for(unsigned int i = 0; i < heap.size(); i++) {
|
||||
|
@ -140,6 +145,16 @@ void NexusMt::Render(Extraction &extraction, DrawContest &contest,
|
|||
if(extraction.frustum.IsOutside(sphere.Center(), sphere.Radius()))
|
||||
continue;
|
||||
|
||||
if(contest.attrs & DrawContest::SPHERES){
|
||||
glPushAttrib(GL_POLYGON_BIT);
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
|
||||
glPushMatrix();
|
||||
glTranslatef(sphere.Center().X(),sphere.Center().Y(),sphere.Center().Z());
|
||||
gluSphere(spr,sphere.Radius(),15,15);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
if(stats) stats->ktri += entry.nface;
|
||||
|
||||
if(!entry.patch) {
|
||||
|
@ -206,7 +221,7 @@ void NexusMt::Draw(unsigned int cell, DrawContest &contest) {
|
|||
case DrawContest::POINTS:
|
||||
glDrawArrays(GL_POINTS, 0, patch.nv); break;
|
||||
case DrawContest::PATCHES:
|
||||
glColor3ub((cell * 27)%255, (cell * 37)%255, (cell * 87)%255);
|
||||
glColor3ub((cell * 27)%225 + 30, (cell * 37)%225 + 30, (cell * 87)%225 + 30);
|
||||
case DrawContest::SMOOTH:
|
||||
if(signature & NXS_FACES)
|
||||
glDrawElements(GL_TRIANGLES, patch.nf * 3,
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.22 2005/02/10 09:18:20 ponchio
|
||||
Statistics.
|
||||
|
||||
Revision 1.21 2005/02/08 12:43:03 ponchio
|
||||
Added copyright
|
||||
|
||||
|
@ -49,7 +52,7 @@ namespace nxs {
|
|||
struct DrawContest {
|
||||
|
||||
enum Mode { POINTS, SMOOTH, XRAY, HIDDEN_LINE, FLAT_WIRE, FLAT, PATCHES };
|
||||
enum Attr { COLOR = 0x1, NORMAL = 0x2, TEXTURE = 0x4, DATA = 0x8 };
|
||||
enum Attr { COLOR = 0x1, NORMAL = 0x2, TEXTURE = 0x4, DATA = 0x8, SPHERES = 0x10 };
|
||||
|
||||
Mode mode;
|
||||
unsigned int attrs;
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.35 2005/02/14 14:49:09 ponchio
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.34 2005/02/14 14:21:24 ponchio
|
||||
Preload disabled at startap (-p)
|
||||
|
||||
|
@ -292,6 +295,7 @@ int main(int argc, char *argv[]) {
|
|||
" f: flat shading mode\n"
|
||||
" m: smooth mode\n"
|
||||
" p: draw points\n"
|
||||
" h: draw bounding spheres\n"
|
||||
|
||||
" c: show colors\n"
|
||||
" n: show normals\n"
|
||||
|
@ -359,6 +363,11 @@ int main(int argc, char *argv[]) {
|
|||
case SDLK_d: contest.mode = DrawContest::PATCHES; break;
|
||||
case SDLK_f: contest.mode = DrawContest::FLAT; break;
|
||||
case SDLK_m: contest.mode = DrawContest::SMOOTH; break;
|
||||
case SDLK_h: if(contest.attrs&DrawContest::SPHERES)
|
||||
contest.attrs &=~DrawContest::SPHERES;
|
||||
else
|
||||
contest.attrs |=DrawContest::SPHERES;
|
||||
break;
|
||||
|
||||
case SDLK_o: realtime = !realtime; break;
|
||||
case SDLK_s: preload = !preload; nexus.SetPreload(preload); break;
|
||||
|
|
Loading…
Reference in New Issue