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

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
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-2012  HUBzero Foundation, LLC
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
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    _color(Color(r, g, b)),
27    _stack(stack),
28    _slice(slice)
29{
30}
31
32Sphere::~Sphere()
33{
34}
35
36void
37Sphere::draw(GLUquadric *quad)
38{
39    glColor3f(_color.r(), _color.g(), _color.b());
40
41    glMatrixMode(GL_MODELVIEW);
42    glPushMatrix();
43    glTranslatef(_location.x, _location.y, _location.z);
44
45    //draw it
46    gluSphere(quad, _radius, _stack, _slice);
47
48    glPopMatrix();
49}
50
51void
52Sphere::setHorizontalRes(int slice)
53{
54    _slice = slice;
55}
56
57void
58Sphere::setVerticalRes(int stack)
59{
60    _stack = stack;
61}
Note: See TracBrowser for help on using the repository browser.