source: trunk/packages/vizservers/nanovis/VolumeRenderer.h @ 2974

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

Remove unused volume axis/bbox labeling from VolumeRenderer?. This feature is
now provided by the Grid. Also remove unused volume/slice mode flags in
VolumeRenderer? since it now uses cutplane information from each Volume object
instead.

  • Property svn:eol-style set to native
File size: 3.1 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-2006  Purdue Research Foundation
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
65    friend class NanoVis;
66
67private:
68    void initShaders();
69
70    void activateVolumeShader(Volume *vol, bool slice_mode);
71
72    void deactivateVolumeShader();
73
74    void drawBoundingBox(float x0, float y0, float z0,
75                         float x1, float y1, float z1,
76                         float r, float g, float b, float line_width);
77
78    void getEyeSpaceBounds(const Mat4x4& mv,
79                           double& xMin, double& xMax,
80                           double& yMin, double& yMax,
81                           double& zNear, double& zFar);
82
83    VolumeInterpolator *_volumeInterpolator;
84
85    /**
86     * shader parameters for rendering a single cubic volume
87     */
88    NvRegularVolumeShader *_regularVolumeShader;
89
90    /**
91     * Shader parameters for rendering a single zincblende orbital.  A
92     * simulation contains S, P, D and SS, total of 4 orbitals. A full
93     * rendering requires 4 zincblende orbital volumes.  A zincblende orbital
94     * volume is decomposed into two "interlocking" cubic volumes and passed
95     * to the shader.  We render each orbital with its own independent
96     * transfer functions then blend the result.
97     *
98     * The engine is already capable of rendering multiple volumes and combine
99     * them. Thus, we just invoke this shader on S, P, D and SS orbitals with
100     * different transfor functions. The result is a multi-orbital rendering.
101     * This is equivalent to rendering 4 unrelated data sets occupying the
102     * same space.
103     */
104    NvZincBlendeVolumeShader *_zincBlendeShader;
105
106    /**
107     * standard vertex shader
108     */
109    NvStdVertexShader *_stdVertexShader;
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.