source: trunk/packages/vizservers/nanovis/NvRegularVolumeShader.cpp @ 3362

Last change on this file since 3362 was 3362, checked in by ldelgass, 6 years ago

Merge nanovis2 branch to trunk

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
3#include "NvRegularVolumeShader.h"
4
5NvRegularVolumeShader::NvRegularVolumeShader()
6{
7    init();
8}
9
10NvRegularVolumeShader::~NvRegularVolumeShader()
11{
12}
13
14void NvRegularVolumeShader::init()
15{
16    loadFragmentProgram("one_volume.cg", "main");
17}
18
19void NvRegularVolumeShader::bind(unsigned int tfID, Volume *volume,
20                                 int sliceMode, float sampleRatio)
21{
22    //regular cubic volume
23    setGLStateMatrixFPParameter("modelViewInv", MODELVIEW_MATRIX,
24                                MATRIX_INVERSE);
25    setGLStateMatrixFPParameter("modelView", MODELVIEW_MATRIX,
26                                MATRIX_IDENTITY);
27
28    setFPTextureParameter("volume", volume->textureID());
29    setFPTextureParameter("tf", tfID);
30
31    setFPParameter4f("material",
32                     volume->ambient(),
33                     volume->diffuse(),
34                     volume->specularLevel(),
35                     volume->specularExponent());
36
37    setFPParameter4f("renderParams",
38                     (sliceMode ? 0.0f : sampleRatio),
39                     volume->isosurface(),
40                     volume->opacityScale(),
41                     (volume->twoSidedLighting() ? 1.0f : 0.0f));
42
43    NvShader:: bind();
44}
45
46void NvRegularVolumeShader::unbind()
47{
48    disableFPTextureParameter("volume");
49    disableFPTextureParameter("tf");
50
51    NvShader::unbind();
52}
Note: See TracBrowser for help on using the repository browser.