Loading...
Searching...
No Matches
udimTextureObject.h
1//
2// Copyright 2020 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 PXR_IMAGING_HD_ST_UDIM_TEXTURE_OBJECT_H
25#define PXR_IMAGING_HD_ST_UDIM_TEXTURE_OBJECT_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdSt/api.h"
29
30#include "pxr/imaging/hdSt/textureObject.h"
31
32#include "pxr/imaging/hgi/handle.h"
33
34#include "pxr/base/gf/vec3i.h"
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38enum HgiFormat : int;
40
48HDST_API bool HdStIsSupportedUdimTexture(std::string const& imageFilePath);
49
55{
56public:
57 HDST_API
59 const HdStTextureIdentifier &textureId,
60 HdSt_TextureObjectRegistry *textureObjectRegistry);
61
62 HDST_API
63 ~HdStUdimTextureObject() override;
64
69 HgiTextureHandle const& GetTexelTexture() const { return _texelTexture; }
70
75 HgiTextureHandle const& GetLayoutTexture() const { return _layoutTexture; }
76
77 HDST_API
78 bool IsValid() const override;
79
80 HDST_API
81 HdTextureType GetTextureType() const override;
82
83protected:
84 HDST_API
85 void _Load() override;
86
87 HDST_API
88 void _Commit() override;
89
90private:
91 std::vector<uint8_t> _textureData;
92 std::vector<float> _layoutData;
93
94 GfVec3i _dimensions;
95 size_t _tileCount;
96 size_t _mipCount;
97 HgiFormat _hgiFormat;
98
99 HgiTextureHandle _texelTexture;
100 HgiTextureHandle _layoutTexture;
101
102 void _DestroyTextures();
103};
104
105template<>
106struct HdSt_TypedTextureObjectHelper<HdTextureType::Udim> {
107 using type = HdStUdimTextureObject;
108};
109
110PXR_NAMESPACE_CLOSE_SCOPE
111
112#endif
Basic type for a vector of 3 int components.
Definition: vec3i.h:61
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:60
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 HdTextureType 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.