source: trunk/packages/vizservers/nanovis/NvZincBlendeVolumeShader.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.4 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 "NvZincBlendeVolumeShader.h"
7
8NvZincBlendeVolumeShader::NvZincBlendeVolumeShader()
9{
10    init();
11}
12
13NvZincBlendeVolumeShader::~NvZincBlendeVolumeShader()
14{
15}
16
17void NvZincBlendeVolumeShader::init()
18{
19    loadFragmentProgram("zincblende_volume.cg", "main");
20}
21
22void NvZincBlendeVolumeShader::bind(unsigned int tfID, Volume *volume,
23                                    int sliceMode, float sampleRatio)
24{
25    ZincBlendeVolume *vol = (ZincBlendeVolume *)volume;
26    setGLStateMatrixFPParameter("modelViewInv", MODELVIEW_MATRIX,
27                                MATRIX_INVERSE);
28
29    setFPTextureParameter("tf", tfID);
30    setFPTextureParameter("volumeA", vol->zincblendeTex[0]->id());
31    setFPTextureParameter("volumeB", vol->zincblendeTex[1]->id());
32
33    setFPParameter4f("cellSize",
34                     vol->cellSize.x,
35                     vol->cellSize.y,
36                     vol->cellSize.z, 0.);
37
38    setFPParameter4f("renderParams",
39                     (sliceMode ? 0.0f : sampleRatio),
40                     volume->isosurface(),
41                     volume->opacityScale(),
42                     0.0f);
43
44    NvShader::bind();
45}
46
47void NvZincBlendeVolumeShader::unbind() 
48{
49    disableFPTextureParameter("tf");
50    disableFPTextureParameter("volumeA");
51    disableFPTextureParameter("volumeB");
52
53    NvShader::unbind();
54}
Note: See TracBrowser for help on using the repository browser.