Last change
on this file since 371 was
371,
checked in by qiaow, 19 years ago
|
Added Color and Sphere classes. Added start location to Volume class.
|
File size:
1.2 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 | #include <GL/glut.h>
|
---|
19 |
|
---|
20 | Sphere::Sphere(float x, float y, float z,
|
---|
21 | float r, float g, float b, float a,
|
---|
22 | float _radius,
|
---|
23 | int _stack,
|
---|
24 | int _slice):
|
---|
25 | center(Vector3(x,y,z)),
|
---|
26 | color(Color(r,g,b,a)),
|
---|
27 | radius(_radius),
|
---|
28 | stack(_stack),
|
---|
29 | slice(_slice)
|
---|
30 | { }
|
---|
31 |
|
---|
32 |
|
---|
33 | Sphere::draw(GLUquadric* quad){
|
---|
34 | glColor4f(color.r, color.g, color.b, color.a);
|
---|
35 |
|
---|
36 | glMatrixMode(GL_MODELVIEW);
|
---|
37 | glPushMatrix();
|
---|
38 | glTranslate(center.x, center.y, center.z);
|
---|
39 |
|
---|
40 | //draw it
|
---|
41 | gluSphere(quad, radius, stack, slice);
|
---|
42 | glPopMatrix();
|
---|
43 | }
|
---|
44 |
|
---|
45 | Sphere::set_horizontal_res(int _slice):slice(_slice){}
|
---|
46 | Sphere::set_vertical_res(int _stack):stack(_stack){}
|
---|
47 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.