My Project
Loading...
Searching...
No Matches
CTexture3d.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, 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.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CTexture3dH
46#define CTexture3dH
47//------------------------------------------------------------------------------
50//------------------------------------------------------------------------------
51
52//------------------------------------------------------------------------------
53namespace chai3d {
54//------------------------------------------------------------------------------
55
56//==============================================================================
63//==============================================================================
64
65//------------------------------------------------------------------------------
66class cTexture3d;
67typedef std::shared_ptr<cTexture3d> cTexture3dPtr;
68//------------------------------------------------------------------------------
69
70//==============================================================================
81//==============================================================================
82class cTexture3d : public cTexture2d
83{
84 //--------------------------------------------------------------------------
85 // CONSTRUCTOR & DESTRUCTOR:
86 //--------------------------------------------------------------------------
87
88public:
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
104public:
105
107 virtual std::string getClassName() { return ("Texture3d"); }
108
111
113 virtual void renderInitialize(cRenderOptions& a_options);
114
116 virtual void renderFinalize(cRenderOptions& a_options);
117
119 virtual void setWrapModeR(const GLint& a_wrapModeR);
120
122 GLint getWrapModeR() const { return (m_wrapModeR); }
123
125 void markForPartialUpdate(const cVector3d a_voxelUpdateMin, const cVector3d a_voxelUpdateMax);
126
127
128 //--------------------------------------------------------------------------
129 // PROTECTED METHODS:
130 //--------------------------------------------------------------------------
131
132protected:
133
135 virtual void reset();
136
138 virtual void update(cRenderOptions& a_options);
139
140
141 //--------------------------------------------------------------------------
142 // PROTECTED MEMBERS:
143 //--------------------------------------------------------------------------
144
145protected:
146
149
152
155
158};
159
160//------------------------------------------------------------------------------
161} // namespace chai3d
162//------------------------------------------------------------------------------
163
164//------------------------------------------------------------------------------
165#endif
166//------------------------------------------------------------------------------
Implements an array of 2D image structures.
Implements 2D textures.
This class implements a 2D texture map.
Definition CTexture2d.h:85
This class implements a 3D texture map.
Definition CTexture3d.h:83
GLint getWrapModeR() const
This method returns the texture wrap mode of r.
Definition CTexture3d.h:122
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
virtual void setWrapModeR(const GLint &a_wrapModeR)
This method set the texture wrap mode of r.
Definition CTexture3d.cpp:132
cTexture3d()
Constructor of cTexture3d.
Definition CTexture3d.cpp:59
virtual ~cTexture3d()
Destructor of cTexture3d.
Definition CTexture3d.cpp:79
virtual void renderInitialize(cRenderOptions &a_options)
This method enables texturing and sets this texture as the current texture.
Definition CTexture3d.cpp:192
cVector3d m_voxelUpdateMax
Maximum voxel coordinate to be updated.
Definition CTexture3d.h:154
virtual std::string getClassName()
This method returns the name of the object class.
Definition CTexture3d.h:107
virtual void reset()
This method resets internal variables. This function should be called only by constructors.
Definition CTexture3d.cpp:144
cVector3d m_voxelUpdateMin
Minimum voxel coordinate to be updated.
Definition CTexture3d.h:151
bool m_markPartialUpdate
If true the partial update is performed.
Definition CTexture3d.h:148
cTexture3dPtr copy()
This method creates a copy of itself.
Definition CTexture3d.cpp:92
static cTexture3dPtr create()
Shared cTexture3d allocator.
Definition CTexture3d.h:97
GLint m_wrapModeR
Texture wrap parameter along r (GL_REPEAT or GL_CLAMP).
Definition CTexture3d.h:157
virtual void renderFinalize(cRenderOptions &a_options)
This method disables texture once triangles have been rendered.
Definition CTexture3d.cpp:298
virtual void update(cRenderOptions &a_options)
This method updates this texture to GPU.
Definition CTexture3d.cpp:345
Definition CAudioBuffer.cpp:57
std::shared_ptr< cTexture3d > cTexture3dPtr
Definition CTexture3d.h:67
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83
This class implements a 3D vector.
Definition CVector3d.h:89