source: nanovis/branches/1.1/ZincBlendeVolume.cpp @ 4906

Last change on this file since 4906 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.9 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ----------------------------------------------------------------------
4 * ZincBlendeVolume.cpp: 3d zincblende volume class, a subclass of Volume.
5 *                      It contains two cubic volumes.
6 *
7 * ======================================================================
8 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
9 *           Purdue Rendering and Perceptualization Lab (PURPL)
10 *
11 *  Copyright (c) 2004-2013  HUBzero Foundation, LLC
12 *
13 *  See the file "license.terms" for information on usage and
14 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 * ======================================================================
16 */
17#include <assert.h>
18
19#include <vrmath/Vector3f.h>
20
21#include "ZincBlendeVolume.h"
22
23using namespace nv;
24using namespace vrmath;
25
26ZincBlendeVolume::ZincBlendeVolume(float x, float y, float z,
27                                   int width, int height, int depth,
28                                   int numComponents, 
29                                   float *dataVolumeA, float *dataVolumeB,
30                                   double vmin, double vmax, double nonZeroMin,
31                                   const Vector3f& cellSz) :
32    Volume(x, y, z, width, height, depth, numComponents, dataVolumeA, vmin, vmax, nonZeroMin),
33    cellSize(cellSz)
34{
35    //label it as zincblende
36    _volumeType = ZINCBLENDE;
37
38    //store member tex initialize in Volume() as zincblendeTex[0]
39    assert(_tex);
40    zincblendeTex[0] = _tex;
41
42    //now add another tex as zincblendeTex[1]
43    Texture3D *secondTex = new Texture3D(width, height, depth, GL_FLOAT, GL_LINEAR, numComponents);
44    assert(secondTex);
45    secondTex->initialize(dataVolumeB);
46
47    zincblendeTex[1] = secondTex;
48}
49
50ZincBlendeVolume::~ZincBlendeVolume()
51{ 
52    // First texture will be deleted in ~Volume()
53    if (zincblendeTex[1])
54        delete zincblendeTex[1];
55}
Note: See TracBrowser for help on using the repository browser.