source: trunk/src/testing/app/volvis/vProbe.cpp @ 4

Revision 4, 3.3 KB checked in by ajaworski, 13 years ago (diff)

Added modified SAGE sources

Line 
1/********************************************************************************
2 * Volatile - Volume Visualization Software for SAGE
3 * Copyright (C) 2004 Electronic Visualization Laboratory,
4 * University of Illinois at Chicago
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 *  * Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *  * Redistributions in binary form must reproduce the above
14 *    copyright notice, this list of conditions and the following disclaimer
15 *    in the documentation and/or other materials provided with the distribution.
16 *  * Neither the name of the University of Illinois at Chicago nor
17 *    the names of its contributors may be used to endorse or promote
18 *    products derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * Direct questions, comments etc about Volatile to www.evl.uic.edu/cavern/forum
33 *********************************************************************************/
34
35//implements a probe or a 3d pointer
36#include "vProbe.h"
37#include "VectorMath.h"    //usefull vector/matrix operations
38enum {SPHERE = 1, CONE};
39
40vProbe::vProbe() :vPrimitive() {
41        xform.scale = 1.0f/(float)global.volume->maxDim;
42}
43
44//do opngl initialization here
45void vProbe::init() {
46}
47
48vProbe::~vProbe() {
49}
50
51//draws the cone here
52void vProbe::draw()
53{
54        color[0] = 0.0f;
55        color[1] = 1.0f;
56        color[2] = 0.0f;
57        glPushMatrix();
58        glPushAttrib(GL_ALL_ATTRIB_BITS);
59        glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
60        glTranslatef(xform.trans[0],xform.trans[1],xform.trans[2]);
61        glMultMatrixf(xform.rotn);
62        glutSolidSphere(xform.scale,20,20);
63        glPopAttrib();
64        glPopMatrix();
65        return;
66}
67
68//the pointer for the environment
69vPointer::vPointer() :vPrimitive() {
70        xform.scale = 0.02;
71}
72
73//do opngl initialization here
74void vPointer::init() {
75}
76
77vPointer::~vPointer() {
78}
79
80//draws the cone here
81void vPointer::draw()
82{
83        //update translation
84        xform.trans[0] = global.pointerPos[0];
85        xform.trans[1] = global.pointerPos[1];
86        xform.trans[2] = global.pointerPos[2];
87        color[0] = 0.25f;
88        color[1] = 0.5f;
89        color[2] = 0.5f;
90        glPushMatrix();
91        glPushAttrib(GL_ALL_ATTRIB_BITS);
92        glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
93        glTranslatef(xform.trans[0],xform.trans[1],xform.trans[2]);
94        glMultMatrixf(xform.rotn);
95        glRotatef(180.0f,0.0f,1.0f,0.0f);
96        glutSolidCone(0.02, 0.1, 8, 8);
97        glPopAttrib();
98        glPopMatrix();
99        return;
100}
101
Note: See TracBrowser for help on using the repository browser.