All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
glPtexMipmapTexture.h
Go to the documentation of this file.
1 //
2 // Copyright 2013 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
25 #ifndef OSD_GL_PTEX_MIPMAP_TEXTURE_H
26 #define OSD_GL_PTEX_MIPMAP_TEXTURE_H
27 
28 #include "../version.h"
29 
30 #include "../osd/nonCopyable.h"
31 #include "../osd/opengl.h"
32 
33 #include <stdlib.h>
34 
35 class PtexTexture;
36 
37 namespace OpenSubdiv {
38 namespace OPENSUBDIV_VERSION {
39 
40 namespace Osd {
41 
42 class GLPtexMipmapTexture : NonCopyable<GLPtexMipmapTexture> {
43 public:
44  static GLPtexMipmapTexture * Create(PtexTexture * reader,
45  int maxLevels=-1,
46  size_t targetMemory=0);
47 
50  GLuint GetLayoutTextureBuffer() const { return _layout; }
51 
53  GLuint GetTexelsTexture() const { return _texels; }
54 
56  size_t GetMemoryUsage() const { return _memoryUsage; }
57 
59 
60 private:
62 
63  GLsizei _width, // widht / height / depth of the 3D texel buffer
64  _height,
65  _depth;
66 
67  GLint _format; // texel color format
68 
69  GLuint _layout, // per-face lookup table
70  _texels; // texel data
71 
72  size_t _memoryUsage; // total amount of memory used (estimate)
73 };
74 
75 } // end namespace Osd
76 
77 } // end namespace OPENSUBDIV_VERSION
78 using namespace OPENSUBDIV_VERSION;
79 
80 } // end namespace OpenSubdiv
81 
82 #endif // OSD_GL_PTEX_MIPMAP_TEXTURE_H
83 
static GLPtexMipmapTexture * Create(PtexTexture *reader, int maxLevels=-1, size_t targetMemory=0)
GLuint GetTexelsTexture() const
Returns the texels texture array.
size_t GetMemoryUsage() const
Returns the amount of allocated memory (in byte)