Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | |
---|
3 | #include "NvRegularVolumeShader.h" |
---|
4 | |
---|
5 | NvRegularVolumeShader::NvRegularVolumeShader() |
---|
6 | { |
---|
7 | init(); |
---|
8 | } |
---|
9 | |
---|
10 | NvRegularVolumeShader::~NvRegularVolumeShader() |
---|
11 | { |
---|
12 | } |
---|
13 | |
---|
14 | void NvRegularVolumeShader::init() |
---|
15 | { |
---|
16 | loadFragmentProgram("one_volume.cg", "main"); |
---|
17 | } |
---|
18 | |
---|
19 | void NvRegularVolumeShader::bind(unsigned int tfID, Volume *volume, int sliceMode) |
---|
20 | { |
---|
21 | //regular cubic volume |
---|
22 | setGLStateMatrixFPParameter("modelViewInv", MODELVIEW_MATRIX, |
---|
23 | MATRIX_INVERSE); |
---|
24 | setGLStateMatrixFPParameter("modelView", MODELVIEW_MATRIX, |
---|
25 | MATRIX_IDENTITY); |
---|
26 | |
---|
27 | setFPTextureParameter("volume", volume->id); |
---|
28 | setFPTextureParameter("tf", tfID); |
---|
29 | |
---|
30 | if (!sliceMode) { |
---|
31 | setFPParameter4f("renderParameters", |
---|
32 | volume->numSlices(), |
---|
33 | volume->opacityScale(), |
---|
34 | volume->diffuse(), |
---|
35 | volume->specular()); |
---|
36 | } else { |
---|
37 | setFPParameter4f("renderParameters", |
---|
38 | 0., |
---|
39 | volume->opacityScale(), |
---|
40 | volume->diffuse(), |
---|
41 | volume->specular()); |
---|
42 | } |
---|
43 | |
---|
44 | setFPParameter4f("options", |
---|
45 | 0.0f, |
---|
46 | volume->isosurface(), |
---|
47 | 0.0f, |
---|
48 | 0.0f); |
---|
49 | |
---|
50 | NvShader:: bind(); |
---|
51 | } |
---|
52 | |
---|
53 | void NvRegularVolumeShader::unbind() |
---|
54 | { |
---|
55 | disableFPTextureParameter("volume"); |
---|
56 | disableFPTextureParameter("tf"); |
---|
57 | |
---|
58 | NvShader::unbind(); |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.