source: trunk/packages/vizservers/nanovis/Sphere.cpp @ 2096

Last change on this file since 2096 was 2096, checked in by ldelgass, 13 years ago

Normalize line endings, set eol-style to native on *.cpp, *.h files

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