CTexture3d.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Francois Conti
40  \version 3.2.0 $Rev: 1869 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CTexture3dH
46 #define CTexture3dH
47 //------------------------------------------------------------------------------
48 #include "graphics/CMultiImage.h"
49 #include "materials/CTexture2d.h"
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 namespace chai3d {
54 //------------------------------------------------------------------------------
55 
56 //==============================================================================
63 //==============================================================================
64 
65 //------------------------------------------------------------------------------
66 class cTexture3d;
67 typedef std::shared_ptr<cTexture3d> cTexture3dPtr;
68 //------------------------------------------------------------------------------
69 
70 //==============================================================================
81 //==============================================================================
82 class cTexture3d : public cTexture2d
83 {
84  //--------------------------------------------------------------------------
85  // CONSTRUCTOR & DESTRUCTOR:
86  //--------------------------------------------------------------------------
87 
88 public:
89 
91  cTexture3d();
92 
94  virtual ~cTexture3d();
95 
97  static cTexture3dPtr create() { return (std::make_shared<cTexture3d>()); }
98 
99 
100  //--------------------------------------------------------------------------
101  // PUBLIC METHODS:
102  //--------------------------------------------------------------------------
103 
104 public:
105 
107  cTexture3dPtr copy();
108 
110  virtual void renderInitialize(cRenderOptions& a_options);
111 
113  virtual void renderFinalize(cRenderOptions& a_options);
114 
116  virtual void setWrapModeR(const GLint& a_wrapModeR);
117 
119  GLint getWrapModeR() const { return (m_wrapModeR); }
120 
122  void markForPartialUpdate(const cVector3d a_voxelUpdateMin, const cVector3d a_voxelUpdateMax);
123 
124 
125  //--------------------------------------------------------------------------
126  // PROTECTED METHODS:
127  //--------------------------------------------------------------------------
128 
129 protected:
130 
132  virtual void reset();
133 
135  virtual void update(cRenderOptions& a_options);
136 
137 
138  //--------------------------------------------------------------------------
139  // PROTECTED MEMBERS:
140  //--------------------------------------------------------------------------
141 
142 protected:
143 
146 
149 
152 
154  GLint m_wrapModeR;
155 };
156 
157 //------------------------------------------------------------------------------
158 } // namespace chai3d
159 //------------------------------------------------------------------------------
160 
161 //------------------------------------------------------------------------------
162 #endif
163 //------------------------------------------------------------------------------
This class implements a 3D vector.
Definition: CVector3d.h:88
void markForPartialUpdate(const cVector3d a_voxelUpdateMin, const cVector3d a_voxelUpdateMax)
This method marks this texture for partial GPU update from RAM.
Definition: CTexture3d.cpp:320
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
bool m_markPartialUpdate
If true the partial update is performed.
Definition: CTexture3d.h:145
cVector3d m_voxelUpdateMin
Minimum voxel coordinate to be updated.
Definition: CTexture3d.h:148
GLint m_wrapModeR
Texture wrap parameter along r (GL_REPEAT or GL_CLAMP).
Definition: CTexture3d.h:154
GLint getWrapModeR() const
This method returns the texture wrap mode of r.
Definition: CTexture3d.h:119
virtual void setWrapModeR(const GLint &a_wrapModeR)
This method set the texture wrap mode of r.
Definition: CTexture3d.cpp:132
This class implements a 3D texture map.
Definition: CTexture3d.h:82
static cTexture3dPtr create()
Shared cTexture3d allocator.
Definition: CTexture3d.h:97
cTexture3dPtr copy()
This method creates a copy of itself.
Definition: CTexture3d.cpp:92
virtual void renderInitialize(cRenderOptions &a_options)
This method enables texturing and sets this texture as the current texture.
Definition: CTexture3d.cpp:192
virtual void update(cRenderOptions &a_options)
This method updates this texture to GPU.
Definition: CTexture3d.cpp:345
virtual void renderFinalize(cRenderOptions &a_options)
This method disables texture once triangles have been rendered.
Definition: CTexture3d.cpp:298
virtual void reset()
This method resets internal variables. This function should be called only by constructors.
Definition: CTexture3d.cpp:144
virtual ~cTexture3d()
Destructor of cTexture3d.
Definition: CTexture3d.cpp:79
Definition: CAudioBuffer.cpp:56
cVector3d m_voxelUpdateMax
Maximum voxel coordinate to be updated.
Definition: CTexture3d.h:151
Implements 2D textures.
This class implements a 2D texture map.
Definition: CTexture2d.h:84
Implements an array of 2D image structures.
cTexture3d()
Constructor of cTexture3d.
Definition: CTexture3d.cpp:59
std::shared_ptr< cTexture3d > cTexture3dPtr
Definition: CTexture3d.h:66