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

Last change on this file since 3335 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • 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-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 slice_mode);
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 parameters for rendering a single cubic volume
85     */
86    NvRegularVolumeShader *_regularVolumeShader;
87
88    /**
89     * Shader parameters for rendering a single zincblende orbital.  A
90     * simulation contains S, P, D and SS, total of 4 orbitals. A full
91     * rendering requires 4 zincblende orbital volumes.  A zincblende orbital
92     * volume is decomposed into two "interlocking" cubic volumes and passed
93     * to the shader.  We render each orbital with its own independent
94     * transfer functions then blend the result.
95     *
96     * The engine is already capable of rendering multiple volumes and combine
97     * them. Thus, we just invoke this shader on S, P, D and SS orbitals with
98     * different transfor functions. The result is a multi-orbital rendering.
99     * This is equivalent to rendering 4 unrelated data sets occupying the
100     * same space.
101     */
102    NvZincBlendeVolumeShader *_zincBlendeShader;
103
104    /**
105     * standard vertex shader
106     */
107    NvStdVertexShader *_stdVertexShader;
108};
109
110#endif
Note: See TracBrowser for help on using the repository browser.