source: nanovis/branches/1.1/ZincBlendeVolumeShader.cpp @ 4923

Last change on this file since 4923 was 4904, checked in by ldelgass, 5 years ago

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

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