[2798] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
[1478] | 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 | * |
---|
[3502] | 11 | * Copyright (c) 2004-2013 HUBzero Foundation, LLC |
---|
[1478] | 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> |
---|
[2844] | 18 | |
---|
[3492] | 19 | #include <vrmath/Vector3f.h> |
---|
| 20 | |
---|
[1478] | 21 | #include "ZincBlendeVolume.h" |
---|
| 22 | |
---|
[3492] | 23 | using namespace vrmath; |
---|
| 24 | |
---|
[1478] | 25 | ZincBlendeVolume::ZincBlendeVolume(float x, float y, float z, |
---|
[3362] | 26 | int w, int h, int d, int n, |
---|
[2844] | 27 | float *dataVolumeA, float *dataVolumeB, |
---|
[2827] | 28 | double v0, double v1, double non_zeromin, |
---|
[3492] | 29 | const Vector3f& cellSz) : |
---|
[3362] | 30 | Volume(x, y, z, w, h, d, n, dataVolumeA, v0, v1, non_zeromin), |
---|
[2877] | 31 | cellSize(cellSz) |
---|
[1478] | 32 | { |
---|
| 33 | //label it as zincblende |
---|
[2877] | 34 | _volumeType = ZINCBLENDE; |
---|
[1478] | 35 | |
---|
| 36 | //store member tex initialize in Volume() as zincblende_tex[0] |
---|
| 37 | assert(_tex); |
---|
[2877] | 38 | zincblendeTex[0] = _tex; |
---|
[1478] | 39 | |
---|
| 40 | //now add another tex as zincblende_tex[1] |
---|
[2844] | 41 | Texture3D *secondTex = new Texture3D(w, h, d, GL_FLOAT, GL_LINEAR, n); |
---|
[1478] | 42 | assert(secondTex); |
---|
| 43 | secondTex->initialize(dataVolumeB); |
---|
[2827] | 44 | |
---|
[2877] | 45 | zincblendeTex[1] = secondTex; |
---|
[1478] | 46 | } |
---|
| 47 | |
---|
| 48 | ZincBlendeVolume::~ZincBlendeVolume() |
---|
| 49 | { |
---|
| 50 | // This data will be deleted in a destrutor of Volume class |
---|
[2844] | 51 | //if (zincblende_tex[0]) |
---|
[1478] | 52 | // delete zincblende_tex[0]; |
---|
[2877] | 53 | if (zincblendeTex[1]) |
---|
| 54 | delete zincblendeTex[1]; |
---|
[1478] | 55 | } |
---|