source: branches/nanovis2/packages/vizservers/nanovis/VolumeRenderer.h @ 3305

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

sync with trunk

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