source: nanovis/branches/1.1/VolumeRenderer.h @ 4923

Last change on this file since 4923 was 4889, checked in by ldelgass, 9 years ago

Merge r3611:3618 from trunk

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (c) 2004-2013  HUBzero Foundation, LLC
4 *
5 * Authors:
6 *   Wei Qiao <qiaow@purdue.edu>
7 */
8#ifndef NV_VOLUME_RENDERER_H
9#define NV_VOLUME_RENDERER_H
10
11#include <vrmath/Matrix4x4d.h>
12
13#include "Volume.h"
14#include "VolumeInterpolator.h"
15#include "RegularVolumeShader.h"
16#include "ZincBlendeVolumeShader.h"
17#include "StdVertexShader.h"
18
19namespace nv {
20
21class VolumeRenderer
22{
23public:
24    VolumeRenderer();
25
26    ~VolumeRenderer();
27
28    /// render all enabled volumes
29    void renderAll();
30
31    void specular(float val);
32
33    void diffuse(float val);
34
35    void clearAnimatedVolumeInfo()
36    {
37        _volumeInterpolator->clearAll();
38    }
39
40    void addAnimatedVolume(Volume* volume)
41    {
42        _volumeInterpolator->addVolume(volume);
43    }
44
45    void startVolumeAnimation()
46    {
47        _volumeInterpolator->start();
48    }
49
50    void stopVolumeAnimation()
51    {
52        _volumeInterpolator->stop();
53    }
54
55    VolumeInterpolator* getVolumeInterpolator()
56    {
57        return _volumeInterpolator;
58    }
59
60private:
61    void initShaders();
62
63    void activateVolumeShader(Volume *vol, bool sliceMode, float sampleRatio);
64
65    void deactivateVolumeShader();
66
67    void drawBoundingBox(float x0, float y0, float z0,
68                         float x1, float y1, float z1,
69                         float r, float g, float b, float line_width);
70
71    void getEyeSpaceBounds(const vrmath::Matrix4x4d& mv,
72                           double& xMin, double& xMax,
73                           double& yMin, double& yMax,
74                           double& zNear, double& zFar);
75
76    VolumeInterpolator *_volumeInterpolator;
77
78    /**
79     * Shader for single slice cutplane render
80     */
81    Shader *_cutplaneShader;
82
83    /**
84     * Shader for rendering a single cubic volume
85     */
86    RegularVolumeShader *_regularVolumeShader;
87
88    /**
89     * Shader 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    ZincBlendeVolumeShader *_zincBlendeShader;
103
104    /**
105     * standard vertex shader
106     */
107    StdVertexShader *_stdVertexShader;
108};
109
110}
111
112#endif
Note: See TracBrowser for help on using the repository browser.