source: trunk/packages/vizservers/nanovis/nanovis.h @ 3464

Last change on this file since 3464 was 3463, checked in by ldelgass, 12 years ago

Begin process of renaming R2 library

  • Property svn:eol-style set to native
File size: 5.6 KB
RevLine 
[2798]1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
[226]2/*
3 * ----------------------------------------------------------------------
4 *  nanovis.h: package header
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
[3177]10 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
[226]11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
[2831]16#ifndef NANOVIS_H
17#define NANOVIS_H
[259]18
[850]19#include <tcl.h>
[3377]20#include <md5.h>
[226]21#include <GL/glew.h>
[2831]22
[226]23#include <math.h>
[2831]24#include <stddef.h> // For size_t
[226]25#include <stdio.h>
26
[2831]27#include <vector>
28#include <iostream>
29
[2818]30#include <rappture.h>
31
[251]32#include "config.h"
[226]33
[3362]34#define NANOVIS_VERSION         "1.1"
[251]35
[226]36//defines for the image based flow visualization
37#define NMESH 256       //resolution of flow mesh
38#define NPIX  512       //display size
39
[3463]40namespace nv {
[2831]41namespace graphics {
42    class RenderContext;
43}
[3463]44namespace util {
45    class Fonts;
46}
47}
[2831]48
49class VolumeRenderer;
50class PointSetRenderer;
51class NvParticleRenderer;
52class NvFlowVisRenderer;
53class PlaneRenderer;
54class VelocityArrowsSlice;
55class NvLIC;
56class PointSet;
57class Texture2D;
58class NvColorTableRenderer;
59class HeightMap;
[1370]60class NvVectorField;
[2831]61class Grid;
62class NvCamera;
63class TransferFunction;
64class Volume;
65class FlowCmd;
66class FlowIterator;
[1370]67
[2822]68class NanoVis
69{
[2831]70public:
71    enum NanoVisFlags {
72        REDRAW_PENDING = (1 << 0),
73        MAP_FLOWS = (1 << 1),
74        MAP_VOLUMES = (1 << 2),
75        MAP_HEIGHTMAPS = (1 << 3),
76    };
[2822]77
[3452]78    static void processCommands();
[2831]79    static void init(const char *path);
80    static void initGL();
[2877]81    static void initOffscreenBuffer();
82    static void resizeOffscreenBuffer(int w, int h);
[2847]83    static void display();
[2951]84    static void draw3dAxis();
[2847]85    static void idle();
86    static void update();
[2951]87    static void removeAllData();
[2930]88
[3362]89    static const NvCamera *getCamera()
90    {
91        return cam;
92    }
[2847]93    static void pan(float dx, float dy);
94    static void zoom(float z);
[1299]95
[2877]96    static void eventuallyRedraw(unsigned int flag = 0);
[2847]97
[2877]98    static void setVolumeRanges();
99    static void setHeightmapRanges();
[3362]100
101#ifdef KEEPSTATS
[3377]102    static int getStatsFile(Tcl_Obj *objPtr);
103    static int writeToStatsFile(int f, const char *s, size_t length);
[2951]104#endif
[2877]105    static void ppmWrite(const char *prefix);
[1295]106    static void sendDataToClient(const char *command, const char *data,
[2831]107                                 size_t dlen);
[2877]108    static void bmpWrite(const char *prefix);
109    static void bmpWriteToFile(int frame_number, const char* directory_name);
[2847]110 
[2877]111    static TransferFunction *getTransfunc(const char *name);
112    static TransferFunction *defineTransferFunction(const char *name,
[2847]113                                                    size_t n, float *data);
114
[2877]115    static int renderLegend(TransferFunction *tf, double min, double max,
116                            int width, int height, const char *volArg);
[2847]117
[2877]118    static Volume *loadVolume(const char *tag, int width, int height, int depth,
119                              int n, float* data, double vmin, double vmax,
120                              double nonZeroMin);
[1156]121
[2877]122    static void removeVolume(Volume *volPtr);
123
124    static void readScreen()
[2822]125    {
[2877]126        glReadPixels(0, 0, winWidth, winHeight, GL_RGB, GL_UNSIGNED_BYTE,
127                     screenBuffer);
[1028]128    }
[2930]129    static void bindOffscreenBuffer()
[2822]130    {
[2877]131        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _finalFbo);
[1028]132    }
[1431]133
134    static FlowCmd *FirstFlow(FlowIterator *iterPtr);
135    static FlowCmd *NextFlow(FlowIterator *iterPtr);
[2831]136    static void InitFlows();
137    static int GetFlow(Tcl_Interp *interp, Tcl_Obj *objPtr,
138                       FlowCmd **flowPtrPtr);
[1431]139    static int CreateFlow(Tcl_Interp *interp, Tcl_Obj *objPtr);
140    static void DeleteFlows(Tcl_Interp *interp);
[2831]141    static bool MapFlows();
142    static void RenderFlows();
143    static void ResetFlows();
144    static bool UpdateFlows();
145    static void AdvectFlows();
146
[2846]147    static FILE *stdin, *logfile, *recfile;
[3376]148    static int statsFile;
[2846]149    static unsigned int flags;
[2877]150    static bool debugFlag;
151    static bool axisOn;
152    static int winWidth;        //size of the render window
153    static int winHeight;       //size of the render window
154    static int renderWindow;
155    static unsigned char *screenBuffer;
[2951]156    static Texture2D *legendTexture;
[2846]157    static Grid *grid;
[3463]158    static nv::util::Fonts *fonts;
[2846]159    static int updir;
160    static NvCamera *cam;
[3463]161    static nv::graphics::RenderContext *renderContext;
[2846]162
[2951]163    static Tcl_HashTable tfTable;
[2846]164    static Tcl_HashTable volumeTable;
[2951]165    static Tcl_HashTable flowTable;
166    static Tcl_HashTable heightmapTable;
[2846]167
168    static double magMin, magMax;
169    static float xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax;
170
[2951]171    static NvColorTableRenderer *colorTableRenderer;
[2877]172    static VolumeRenderer *volRenderer;
[2951]173#ifdef notdef
[2846]174    static NvFlowVisRenderer *flowVisRenderer;
[2951]175#endif
[2846]176    static VelocityArrowsSlice *velocityArrowsSlice;
177    static NvLIC *licRenderer;
[2877]178    static PlaneRenderer *planeRenderer;
[2846]179#if PLANE_CMD
[2930]180    static int numPlanes;
[3362]181    static Texture2D *plane[]; ///< Pointers to 2D planes
[2846]182#endif
183#ifdef USE_POINTSET_RENDERER
[2877]184    static PointSetRenderer *pointSetRenderer;
[2846]185    static std::vector<PointSet *> pointSet;
186#endif
187
188    static Tcl_Interp *interp;
[3330]189    static struct timeval startTime;           /* Start of elapsed time. */
[2831]190private:
[3362]191    static float _licSlice;  ///< Slice position [0,1]
192    static int _licAxis;     ///< Slice axis: 0:x, 1:y, 2:z
[2877]193
[2831]194    //frame buffer for final rendering
[2877]195    static GLuint _finalFbo, _finalColorTex, _finalDepthRb;
[835]196};
[851]197
[2831]198#endif
Note: See TracBrowser for help on using the repository browser.