source: trunk/src/testing/app/VRA/src/VolumeRendererShell.h @ 4

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

Added modified SAGE sources

Line 
1/*--------------------------------------------------------------------------*/
2/* Volume Rendering Application                                             */
3/* Copyright (C) 2006-2007 Nicholas Schwarz                                 */
4/*                                                                          */
5/* This software is free software; you can redistribute it and/or modify it */
6/* under the terms of the GNU Lesser General Public License as published by */
7/* the Free Software Foundation; either Version 2.1 of the License, or      */
8/* (at your option) any later version.                                      */
9/*                                                                          */
10/* This software is distributed in the hope that it will be useful, but     */
11/* WITHOUT ANY WARRANTY; without even the implied warranty of               */
12/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser  */
13/* General Public License for more details.                                 */
14/*                                                                          */
15/* You should have received a copy of the GNU Lesser Public License along   */
16/* with this library; if not, write to the Free Software Foundation, Inc.,  */
17/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                    */
18/*--------------------------------------------------------------------------*/
19
20#ifndef VOLUME_RENDERER_SHELL_H
21#define VOLUME_RENDERER_SHELL_H
22
23/*--------------------------------------------------------------------------*/
24
25#ifdef SAGE
26#define GLX_GLXEXT_PROTOTYPES
27#include <GL/glx.h>
28#include <X11/Xlib.h>
29#include <sail.h>
30#include <misc.h>
31#endif
32
33#include <pthread.h>
34#include <SDL.h>
35
36#include "Octree.h"
37#include "VolumeRenderer.h"
38#include "VolumeRendererThreadInfo.h"
39
40/*--------------------------------------------------------------------------*/
41
42class VolumeRendererShell {
43
44public:
45
46  // Default constructor
47  VolumeRendererShell();
48
49  // Default destructor
50  ~VolumeRendererShell();
51
52  // Abort render
53  void AbortRender(bool flag);
54
55  // Destroy pbuffer
56  static void DestroyDisplay();
57
58#ifdef SAGE
59
60  // X error handler
61  static int HandleXError(Display* display, XErrorEvent *event);
62
63#endif
64
65  // Initialize
66  void Init(int width, int height, bool fullScreen,
67            char* hostname, int port,
68            float left, float right,
69            float bottom, float top,
70            int rank, int numberOfNodes);
71
72  // Initialize display
73  static void InitDisplay(int width, int height, bool fullScreen,
74                          float left, float right,
75                          float bottom, float top);
76
77  // Is a render in progress
78  bool InRender();
79 
80  // User must call Init before any other method
81  bool IsInitialized();
82 
83  // Render
84  void Render();
85
86  // Set axis off
87  void SetAxisOff();
88
89  // Set axis on
90  void SetAxisOn();
91
92  // Set axis position
93  void SetAxisPosition(float x, float y, float z);
94
95  // Set brick box off
96  void SetBrickBoxOff();
97
98  // Set brick box on
99  void SetBrickBoxOn();
100
101  // Set bounding box off
102  void SetBoundingBoxOff();
103
104  // Set bounding box on
105  void SetBoundingBoxOn();
106
107  // Set data
108  void SetData(Octree* data);
109
110  // Set data
111  void SetData(Octree* data, int ramSize, int vramSize);
112
113  // Set exit flag
114  void SetExitFlag();
115 
116  // Set frustum
117  void SetFrustum(float left, float right, float bottom,
118                  float top, float near, float far);
119
120  // Set color and opacity map
121  void SetMap(unsigned char* map);
122
123  // Set 8bit color and opacity map
124  void SetMap8(unsigned char* map);
125
126  // Set 16bit color and opacity map
127  void SetMap16(unsigned char* map);
128
129  // Set rotation matrix
130  void SetR(float m[16]);
131 
132  // Set scale matrix
133  void SetS(float m[16]);
134
135  // Set slice frequency
136  void SetSliceFrequency(double frequency);
137 
138  // Set translation matrix
139  void SetT(float m[16]);
140 
141  // Set viewport
142  void SetViewport(int x, int y, int w, int h);
143
144  // Thread function
145  static void *ThreadFunction(void* ptr);
146
147private:
148
149  // Condition variable
150  pthread_cond_t _conditionCond;
151 
152  // Condition variable mutex
153  pthread_mutex_t _conditionMutex;
154
155  // State for thread
156  VolumeRendererThreadInfo _info;
157
158  // User must call Init before any other method
159  bool _isInitialized;
160
161  // Rendering thread
162  pthread_t _thread;
163
164#ifdef SAGE
165
166  // Declare static variable for glXPBuffer
167  static GLXPbufferSGIX _glXPBuffer;
168 
169  // Declare static variable for X display
170  static Display* _xDisplay;
171
172  // Declare static variable for X error flag
173  static int _xErrorFlag;
174
175  // Declare static variable for X visual info
176  static XVisualInfo* _xVisualInfo;
177
178#endif
179
180};
181
182/*--------------------------------------------------------------------------*/
183
184#endif
185
186/*--------------------------------------------------------------------------*/
Note: See TracBrowser for help on using the repository browser.