1 | /****************************************************************************** |
---|
2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
3 | * |
---|
4 | * Module: sageDraw.h |
---|
5 | * Author : Byungil Jeong |
---|
6 | * |
---|
7 | * Description: This is the header file for the simple drawing class of SAGE. |
---|
8 | * |
---|
9 | * Copyright (C) 2007 Electronic Visualization Laboratory, |
---|
10 | * University of Illinois at Chicago |
---|
11 | * |
---|
12 | * All rights reserved. |
---|
13 | * |
---|
14 | * Redistribution and use in source and binary forms, with or without |
---|
15 | * modification, are permitted provided that the following conditions are met: |
---|
16 | * |
---|
17 | * * Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * * Redistributions in binary form must reproduce the above |
---|
20 | * copyright notice, this list of conditions and the following disclaimer |
---|
21 | * in the documentation and/or other materials provided with the distribution. |
---|
22 | * * Neither the name of the University of Illinois at Chicago nor |
---|
23 | * the names of its contributors may be used to endorse or promote |
---|
24 | * products derived from this software without specific prior written permission. |
---|
25 | * |
---|
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
34 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
37 | * |
---|
38 | * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or |
---|
39 | * http://www.evl.uic.edu/cavern/forum/ |
---|
40 | * |
---|
41 | *********************************************************************************/ |
---|
42 | |
---|
43 | #ifndef SAGE_DRAW_H |
---|
44 | #define SAGE_DRAW_H |
---|
45 | |
---|
46 | #if defined(__APPLE__) |
---|
47 | #include <ApplicationServices/ApplicationServices.h> |
---|
48 | #include <AGL/agl.h> |
---|
49 | #include <OpenGL/OpenGL.h> |
---|
50 | |
---|
51 | #else |
---|
52 | |
---|
53 | #ifdef sun |
---|
54 | #include <SDL.h> |
---|
55 | #else |
---|
56 | #include <SDL/SDL.h> |
---|
57 | #endif |
---|
58 | |
---|
59 | #endif |
---|
60 | |
---|
61 | #include <map> |
---|
62 | #include "sage.h" |
---|
63 | #include "sageDrawObject.h" |
---|
64 | |
---|
65 | |
---|
66 | #if defined(__APPLE__) |
---|
67 | #include <OpenGL/gl.h> // Header File For The OpenGL Library |
---|
68 | #include <OpenGL/glu.h> // Header File For The GLu Library |
---|
69 | #else |
---|
70 | #include <GL/gl.h> // Header File For The OpenGL Library |
---|
71 | #include <GL/glu.h> // Header File For The GLu Library |
---|
72 | #endif |
---|
73 | |
---|
74 | #define SAGE_POST_DRAW 0 |
---|
75 | #define SAGE_INTER_DRAW 1 |
---|
76 | #define SAGE_PRE_DRAW 2 |
---|
77 | |
---|
78 | class sageDraw { |
---|
79 | private: |
---|
80 | // hashes of drawObjects keyed by their ID for easy access |
---|
81 | std::map<int, sageDrawObject *> preDrawList; |
---|
82 | std::map<int, sageDrawObject *> interDrawList; |
---|
83 | std::map<int, sageDrawObject *> postDrawList; |
---|
84 | bool &dirtyBit; |
---|
85 | int displayID; |
---|
86 | |
---|
87 | public: |
---|
88 | sageDraw(bool &dirty, int dispID); |
---|
89 | sageDrawObject * createDrawObject(char *name); |
---|
90 | int preDraw(sageRect rect); // draw objects to background |
---|
91 | int interDraw(sageRect rect); |
---|
92 | int postDraw(sageRect rect); // draw objects to overlay |
---|
93 | int addObjectInstance(char *data); |
---|
94 | int updateObjectPosition(char *data); |
---|
95 | int removeObject(int id); |
---|
96 | int showObject(char *data); |
---|
97 | int forwardObjectMessage(char *data); |
---|
98 | ~sageDraw(); |
---|
99 | }; |
---|
100 | |
---|
101 | #endif |
---|