All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
texture.h
1 //
2 // Copyright 2016 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 #ifndef HD_TEXTURE_H
25 #define HD_TEXTURE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/imaging/hd/bprim.h"
31 #include "pxr/imaging/hd/textureResource.h"
32 #include "pxr/imaging/hd/types.h"
33 #include "pxr/imaging/hd/enums.h"
34 
35 #include "pxr/usd/sdf/path.h"
36 
37 #include "pxr/base/vt/value.h"
38 #include "pxr/base/tf/token.h"
39 
40 #include <boost/shared_ptr.hpp>
41 
42 PXR_NAMESPACE_OPEN_SCOPE
43 
44 
45 class HdRenderIndex;
46 class HdSceneDelegate;
47 
48 typedef boost::shared_ptr<class HdTextureResource> HdTextureResourceSharedPtr;
49 
58 class HdTexture : public HdBprim {
59 public:
60  // change tracking for HdTexture
61  enum DirtyBits : HdDirtyBits {
62  Clean = 0,
63  DirtyParams = 1 << 0,
64  DirtyTexture = 1 << 1,
65  AllDirty = (DirtyParams
66  |DirtyTexture)
67  };
68 
69  HD_API
70  HdTexture(SdfPath const & id);
71  HD_API
72  virtual ~HdTexture();
73 
76  HD_API
77  virtual void Sync(HdSceneDelegate *sceneDelegate,
78  HdRenderParam *renderParam,
79  HdDirtyBits *dirtyBits) override;
80 
84  HD_API
85  virtual HdDirtyBits GetInitialDirtyBitsMask() const override;
86 
87  // ---------------------------------------------------------------------- //
89  // ---------------------------------------------------------------------- //
90 
92  HD_API
93  virtual HdTextureType GetTextureType() const;
94 
96  HD_API
97  bool ShouldGenerateMipMaps() const;
98 
99 protected:
100  HD_API
101  virtual HdTextureResourceSharedPtr _GetTextureResource(
102  HdSceneDelegate *sceneDelegate,
103  const SdfPath &sceneId,
104  HdTextureResource::ID texID) const;
105 
106  HD_API
107  virtual void _RegisterTextureResource(
108  HdRenderIndex *renderIndex,
109  const SdfPath &textureHandleId,
110  const HdTextureResourceSharedPtr &textureResource);
111 
112 private:
113  // Make sure we have a reference to the texture resource, so its
114  // life time exists at least as long as this object.
115  HdTextureResourceSharedPtr _textureResource;
116 };
117 
118 
119 PXR_NAMESPACE_CLOSE_SCOPE
120 
121 #endif //HD_TEXTURE_H
122 
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
virtual HD_API HdTextureType GetTextureType() const
Returns the type of the texture.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Represents a Texture Buffer Prim.
Definition: texture.h:58
Adapter class providing data exchange with the client scene graph.
virtual HD_API HdDirtyBits GetInitialDirtyBitsMask() const override
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
HD_API bool ShouldGenerateMipMaps() const
Returns true if mipmaps should be generated when loading.
Bprim (buffer prim) is a base class of managing a blob of data that is used to communicate between th...
Definition: bprim.h:56
virtual HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to Hydra, for example, allocating parameters into GPU memory...