source: trunk/gui/vizservers/nanovis/Sphere.cpp @ 406

Last change on this file since 406 was 406, checked in by qiaow, 19 years ago

Added ScreenSnapper? class and VolumeRenderer? class.
VolumeRenderer? class can handle motiple volumes. Volume rendering code is seperated
from nanovis.cpp file.

File size: 1.3 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * Sphere.cpp : Sphere class
4 *
5 * ======================================================================
6 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
7 *           Purdue Rendering and Perceptualization Lab (PURPL)
8 *
9 *  Copyright (c) 2004-2006  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15
16#include "Sphere.h"
17#include <stdio.h>
18
19Sphere::Sphere(float x, float y, float z,
20                float r, float g, float b,
21                float _radius,
22                int _stack,
23                int _slice):
24        Renderable(Vector3(x, y, z)),
25        radius(_radius),
26        stack(_stack),
27        slice(_slice),
28        color(Color(r,g,b))
29{
30  boundary = BoundBox(x-r, y-r, z-r, x+r, y+r, z+r);
31}
32
33Sphere::~Sphere(){}
34
35void Sphere::render(){}
36
37void Sphere::draw(GLUquadric* quad){
38  glColor3f(color.R, color.G, color.B);
39
40  glMatrixMode(GL_MODELVIEW);
41  glPushMatrix();
42  glTranslatef(location.x, location.y, location.z);
43
44  //draw it
45  gluSphere(quad, radius, stack, slice);
46
47  glPopMatrix();
48}
49
50void Sphere::set_horizontal_res(int _slice) {slice=_slice;}
51void Sphere::set_vertical_res(int _stack) {stack=_stack;}
52
Note: See TracBrowser for help on using the repository browser.