source: trunk/packages/vizservers/nanovis/ZincBlendeVolume.cpp @ 1489

Last change on this file since 1489 was 1478, checked in by gah, 15 years ago

Fix volume management routines to handle deletion

File size: 1.6 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * ZincBlendeVolume.cpp: 3d zincblende volume class, a subclass of Volume.
4 *                      It contains two cubic volumes.
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
10 *  Copyright (c) 2004-2006  Purdue Research Foundation
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16
17#include <assert.h>
18#include "ZincBlendeVolume.h"
19
20
21ZincBlendeVolume::ZincBlendeVolume(float x, float y, float z,
22                                        int w, int h, int d, float s, int n,
23                                        float* dataVolumeA, float* dataVolumeB,
24                                        double v0, double v1, double non_zeromin, const Vector3& cellSize)
25                : Volume(x, y, z, w, h, d, s, n, dataVolumeA, v0, v1, non_zeromin), cell_size(cellSize)
26{
27    //label it as zincblende
28    _volume_type = ZINCBLENDE;
29
30    //store member tex initialize in Volume() as zincblende_tex[0]
31    assert(_tex);
32    zincblende_tex[0] = _tex;
33
34    //now add another tex as zincblende_tex[1]
35    Texture3D* secondTex = 0;
36    secondTex = new Texture3D(w, h, d, NVIS_FLOAT, NVIS_LINEAR_INTERP, n);
37    assert(secondTex);
38    secondTex->initialize(dataVolumeB);
39   
40    zincblende_tex[1] = secondTex;
41}
42
43
44ZincBlendeVolume::~ZincBlendeVolume()
45{
46    // This data will be deleted in a destrutor of Volume class
47    //if(zincblende_tex[0])
48    //  delete zincblende_tex[0];
49    if(zincblende_tex[1])
50        delete zincblende_tex[1];
51}
52
53
Note: See TracBrowser for help on using the repository browser.