source: nanovis/tags/1.1.1/VolumeRenderer.h @ 6307

Last change on this file since 6307 was 3502, checked in by ldelgass, 11 years ago

Add basic VTK structured points reader to nanovis, update copyright dates.

  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ----------------------------------------------------------------------
4 * VolumeRenderer.h : VolumeRenderer class for volume visualization
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
10 *  Copyright (c) 2004-2013  HUBzero Foundation, LLC
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 */
16#ifndef _VOLUME_RENDERER_H_
17#define _VOLUME_RENDERER_H_
18
19#include <vrmath/Matrix4x4d.h>
20
21#include "Volume.h"
22#include "VolumeInterpolator.h"
23#include "NvRegularVolumeShader.h"
24#include "NvZincBlendeVolumeShader.h"
25#include "NvStdVertexShader.h"
26
27class VolumeRenderer
28{
29public:
30    VolumeRenderer();
31
32    ~VolumeRenderer();
33
34    /// render all enabled volumes
35    void renderAll();
36
37    void specular(float val);
38
39    void diffuse(float val);
40
41    void clearAnimatedVolumeInfo()
42    {
43        _volumeInterpolator->clearAll();
44    }
45
46    void addAnimatedVolume(Volume* volume)
47    {
48        _volumeInterpolator->addVolume(volume);
49    }
50
51    void startVolumeAnimation()
52    {
53        _volumeInterpolator->start();
54    }
55
56    void stopVolumeAnimation()
57    {
58        _volumeInterpolator->stop();
59    }
60
61    VolumeInterpolator* getVolumeInterpolator()
62    {
63        return _volumeInterpolator;
64    }
65
66private:
67    void initShaders();
68
69    void activateVolumeShader(Volume *vol, bool sliceMode, float sampleRatio);
70
71    void deactivateVolumeShader();
72
73    void drawBoundingBox(float x0, float y0, float z0,
74                         float x1, float y1, float z1,
75                         float r, float g, float b, float line_width);
76
77    void getEyeSpaceBounds(const vrmath::Matrix4x4d& mv,
78                           double& xMin, double& xMax,
79                           double& yMin, double& yMax,
80                           double& zNear, double& zFar);
81
82    VolumeInterpolator *_volumeInterpolator;
83
84    /**
85     * Shader for single slice cutplane render
86     */
87    NvShader *_cutplaneShader;
88
89    /**
90     * Shader for rendering a single cubic volume
91     */
92    NvRegularVolumeShader *_regularVolumeShader;
93
94    /**
95     * Shader for rendering a single zincblende orbital.  A
96     * simulation contains S, P, D and SS, total of 4 orbitals. A full
97     * rendering requires 4 zincblende orbital volumes.  A zincblende orbital
98     * volume is decomposed into two "interlocking" cubic volumes and passed
99     * to the shader.  We render each orbital with its own independent
100     * transfer functions then blend the result.
101     *
102     * The engine is already capable of rendering multiple volumes and combine
103     * them. Thus, we just invoke this shader on S, P, D and SS orbitals with
104     * different transfor functions. The result is a multi-orbital rendering.
105     * This is equivalent to rendering 4 unrelated data sets occupying the
106     * same space.
107     */
108    NvZincBlendeVolumeShader *_zincBlendeShader;
109
110    /**
111     * standard vertex shader
112     */
113    NvStdVertexShader *_stdVertexShader;
114};
115
116#endif
Note: See TracBrowser for help on using the repository browser.