source: nanovis/trunk/RegularVolumeShader.cpp @ 4626

Last change on this file since 4626 was 3630, checked in by ldelgass, 12 years ago

Nanovis refactoring to fix problems with scaling and multiple results.
Do rendering in world space to properly place and scale multiple data sets.
Also fix flows to reduce resets of animations. More work toward removing
Cg dependency. Fix panning to convert viewport coords to world coords.

  • Property svn:eol-style set to native
File size: 1.2 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 "RegularVolumeShader.h"
7
8using namespace nv;
9
10RegularVolumeShader::RegularVolumeShader()
11{
12    init();
13}
14
15RegularVolumeShader::~RegularVolumeShader()
16{
17}
18
19void RegularVolumeShader::init()
20{
21    loadFragmentProgram("one_volume.cg");
22}
23
24void RegularVolumeShader::bind(unsigned int tfID, Volume *volume,
25                               int sliceMode, float sampleRatio)
26{
27    //regular cubic volume
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    Shader:: bind();
44}
45
46void RegularVolumeShader::unbind()
47{
48    disableFPTextureParameter("volume");
49    disableFPTextureParameter("tf");
50
51    Shader::unbind();
52}
Note: See TracBrowser for help on using the repository browser.