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

Last change on this file since 3502 was 3502, checked in by ldelgass, 7 years ago

Add basic VTK structured points reader to nanovis, update copyright dates.

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