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

Last change on this file since 2843 was 2822, checked in by ldelgass, 12 years ago

Const correctness fixes, pass vector/matrix objects by reference, various
formatting and style cleanups, don't spam syslog and uncomment openlog() call.
Still needs to be compiled with -DWANT_TRACE to get tracing, but now trace
output will be output to file in /tmp.

  • Property svn:eol-style set to native
File size: 1.4 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-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
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    boundary = BoundBox(x-r, y-r, z-r, x+r, y+r, z+r);
31}
32
33Sphere::~Sphere()
34{
35}
36
37void
38Sphere::render()
39{
40}
41
42void
43Sphere::draw(GLUquadric* quad)
44{
45    glColor3f(color.R, color.G, color.B);
46   
47    glMatrixMode(GL_MODELVIEW);
48    glPushMatrix();
49    glTranslatef(location.x, location.y, location.z);
50   
51    //draw it
52    gluSphere(quad, radius, stack, slice);
53   
54    glPopMatrix();
55}
56
57void
58Sphere::set_horizontal_res(int _slice) {
59    slice=_slice;
60}
61
62void
63Sphere::set_vertical_res(int _stack) {
64    stack=_stack;
65}
66
Note: See TracBrowser for help on using the repository browser.