source: branches/nanovis2/packages/vizservers/nanovis/ZincBlendeVolume.cpp @ 3001

Last change on this file since 3001 was 2877, checked in by ldelgass, 13 years ago

Some minor refactoring, also add some more fine grained config.h defines
(e.g. replace NV40 define with feature defines). Add tests for some required
OpenGL extensions (should always check for extensions or base version before
calling entry points from the extension). Also, clamp diffuse and specular
values on input and warn when they are out of range.

  • Property svn:eol-style set to native
File size: 1.8 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-2006  Purdue Research Foundation
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
18#include <assert.h>
19
20#include "ZincBlendeVolume.h"
21
22ZincBlendeVolume::ZincBlendeVolume(float x, float y, float z,
23                                   int w, int h, int d, float s, int n,
24                                   float *dataVolumeA, float *dataVolumeB,
25                                   double v0, double v1, double non_zeromin,
26                                   const Vector3& cellSz) :
27    Volume(x, y, z, w, h, d, s, n, dataVolumeA, v0, v1, non_zeromin),
28    cellSize(cellSz)
29{
30    //label it as zincblende
31    _volumeType = ZINCBLENDE;
32
33    //store member tex initialize in Volume() as zincblende_tex[0]
34    assert(_tex);
35    zincblendeTex[0] = _tex;
36
37    //now add another tex as zincblende_tex[1]
38    Texture3D *secondTex = new Texture3D(w, h, d, GL_FLOAT, GL_LINEAR, n);
39    assert(secondTex);
40    secondTex->initialize(dataVolumeB);
41
42    zincblendeTex[1] = secondTex;
43}
44
45ZincBlendeVolume::~ZincBlendeVolume()
46{
47    // This data will be deleted in a destrutor of Volume class
48    //if (zincblende_tex[0])
49    //  delete zincblende_tex[0];
50    if (zincblendeTex[1])
51        delete zincblendeTex[1];
52}
Note: See TracBrowser for help on using the repository browser.