Loading...
Searching...
No Matches
udimTextureObject.h
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_ST_UDIM_TEXTURE_OBJECT_H
8#define PXR_IMAGING_HD_ST_UDIM_TEXTURE_OBJECT_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12
13#include "pxr/imaging/hdSt/textureObject.h"
14
15#include "pxr/imaging/hgi/handle.h"
16
17#include "pxr/base/gf/vec3i.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21enum HgiFormat : int;
23
31HDST_API bool HdStIsSupportedUdimTexture(std::string const& imageFilePath);
32
38{
39public:
40 HDST_API
42 const HdStTextureIdentifier &textureId,
43 HdSt_TextureObjectRegistry *textureObjectRegistry);
44
45 HDST_API
46 ~HdStUdimTextureObject() override;
47
52 HgiTextureHandle const& GetTexelTexture() const { return _texelTexture; }
53
58 HgiTextureHandle const& GetLayoutTexture() const { return _layoutTexture; }
59
60 HDST_API
61 bool IsValid() const override;
62
63 HDST_API
64 HdStTextureType GetTextureType() const override;
65
66 HDST_API
67 size_t GetCommittedSize() const override;
68
69protected:
70 HDST_API
71 void _Load() override;
72
73 HDST_API
74 void _Commit() override;
75
76private:
77 std::vector<uint8_t> _textureData;
78 std::vector<float> _layoutData;
79 size_t _textureDataSize;
80 size_t _layoutDataSize;
81
82 GfVec3i _dimensions;
83 size_t _tileCount;
84 size_t _mipCount;
85 HgiFormat _hgiFormat;
86
87 HgiTextureHandle _texelTexture;
88 HgiTextureHandle _layoutTexture;
89
90 void _DestroyTextures();
91};
92
93template<>
94struct HdSt_TypedTextureObjectHelper<HdStTextureType::Udim> {
95 using type = HdStUdimTextureObject;
96};
97
98PXR_NAMESPACE_CLOSE_SCOPE
99
100#endif
Basic type for a vector of 3 int components.
Definition: vec3i.h:44
Class to identify a texture file or a texture within the texture file (e.g., a frame in a movie).
Base class for a texture object.
Definition: textureObject.h:43
HDST_API void _Load() override
Load texture to CPU (thread-safe)
HDST_API bool IsValid() const override
Is texture valid? Only correct after commit phase.
HDST_API void _Commit() override
Commit texture to GPU (not thread-safe)
HDST_API size_t GetCommittedSize() const override
Returns the actual amount of memory committed to the GPU.
HDST_API HdStTextureType GetTextureType() const override
Get texture type.
HgiTextureHandle const & GetTexelTexture() const
Get the gpu texture name for the texels.
HgiTextureHandle const & GetLayoutTexture() const
Get the gpu texture name for the layout.