source: trunk/src/testing/app/volvis/vPrimitive.h @ 4

Revision 4, 3.6 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#ifndef __VPRIMITIVE_H
36#define __VPRIMITIVE_H
37#include "global.h"
38#include "Trackball.h"
39//The mother of all the graphics objects
40//in the main just create a list of vPrimitives
41//and then call init/draw
42class vPrimitive {
43public:
44        vPrimitive();
45        virtual ~vPrimitive() { };
46
47        virtual  void          init() { };
48        virtual  void          draw() { };
49
50        virtual void            next() { };
51        virtual void            prev() { };
52
53        inline void setName(const char *n) {
54                strcpy(name,n);
55        }
56
57        inline void disable() {
58                enabled = false;
59        }
60
61        inline void enable() {
62                enabled = true;
63        }
64
65        inline void setTranslation(float x, float y, float z) {
66                xform.trans[0] = x;
67                xform.trans[1] = y;
68                xform.trans[2] = z;
69        }
70
71        inline void setScale(float s) {
72                xform.scale = s;
73        }
74
75        inline void setColor(float col[]) {
76                color[0] = col[0];
77                color[1] = col[1];
78                color[2] = col[2];
79                color[3] = col[3];
80        }
81
82        inline void setSelected(bool s) {
83                selected = s;
84        }
85
86        inline bool isSelected() {
87                return selected;
88        }
89
90        inline bool isAnimating() {
91                return animate;
92        }
93
94        inline void toggleAnimate() {
95                animate = !animate;
96        }
97
98        //return 1 if the key press was for you
99        //virtual  int           key(unsigned char k, int x, int y);
100        //virtual  int           special(int k, int x, int y);
101        //virtual  int           mouse(int button, int state, int x, int y);
102        //virtual  int           move(int x, int y);
103        //virtual  int           release();   //tells widget it is done
104        vTransform xform;
105        bool rot;
106        float rotAngle;
107        float color[4];
108        Trackball       track;  //global trackball
109protected:
110        //the above wil be used for the picking
111        char name[256];
112        bool enabled;
113        bool selected;
114        bool animate;
115};
116
117#endif
Note: See TracBrowser for help on using the repository browser.