1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * texture3d.h: 3d texture class |
---|
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 | #ifndef TEXTURE3D_H |
---|
17 | #define TEXTURE3D_H |
---|
18 | |
---|
19 | #include <GL/glew.h> |
---|
20 | |
---|
21 | class Texture3D |
---|
22 | { |
---|
23 | public: |
---|
24 | Texture3D(); |
---|
25 | |
---|
26 | Texture3D(int width, int height, int depth, |
---|
27 | GLuint type = GL_FLOAT, |
---|
28 | GLuint interp = GL_LINEAR, |
---|
29 | int numComponents = 4, |
---|
30 | void *data = NULL); |
---|
31 | |
---|
32 | ~Texture3D(); |
---|
33 | |
---|
34 | GLuint initialize(void *data); |
---|
35 | |
---|
36 | void update(void *data); |
---|
37 | |
---|
38 | void activate(); |
---|
39 | |
---|
40 | void deactivate(); |
---|
41 | |
---|
42 | int width() const |
---|
43 | { |
---|
44 | return _width; |
---|
45 | } |
---|
46 | |
---|
47 | int height() const |
---|
48 | { |
---|
49 | return _width; |
---|
50 | } |
---|
51 | |
---|
52 | int depth() const |
---|
53 | { |
---|
54 | return _width; |
---|
55 | } |
---|
56 | |
---|
57 | double aspectRatioWidth() const |
---|
58 | { |
---|
59 | return _aspectRatioWidth; |
---|
60 | } |
---|
61 | |
---|
62 | double aspectRatioHeight() const |
---|
63 | { |
---|
64 | return _aspectRatioHeight; |
---|
65 | } |
---|
66 | |
---|
67 | double aspectRatioDepth() const |
---|
68 | { |
---|
69 | return _aspectRatioDepth; |
---|
70 | } |
---|
71 | |
---|
72 | GLuint id() const |
---|
73 | { |
---|
74 | return _id; |
---|
75 | } |
---|
76 | |
---|
77 | void setWrapS(GLuint wrapMode); |
---|
78 | |
---|
79 | void setWrapT(GLuint wrapMode); |
---|
80 | |
---|
81 | void setWrapR(GLuint wrapMode); |
---|
82 | |
---|
83 | static void check_max_size(); |
---|
84 | |
---|
85 | static void check_max_unit(); |
---|
86 | |
---|
87 | private: |
---|
88 | int _width; |
---|
89 | int _height; |
---|
90 | int _depth; |
---|
91 | |
---|
92 | double _aspectRatioWidth; |
---|
93 | double _aspectRatioHeight; |
---|
94 | double _aspectRatioDepth; |
---|
95 | |
---|
96 | int _numComponents; |
---|
97 | |
---|
98 | bool _glResourceAllocated; |
---|
99 | GLuint _id; |
---|
100 | GLuint _type; |
---|
101 | GLuint _interpType; |
---|
102 | GLuint _wrapS; |
---|
103 | GLuint _wrapT; |
---|
104 | GLuint _wrapR; |
---|
105 | }; |
---|
106 | |
---|
107 | #endif |
---|