-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathopenpbr_bsdf_lobe_type.h
More file actions
46 lines (41 loc) · 2.27 KB
/
openpbr_bsdf_lobe_type.h
File metadata and controls
46 lines (41 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/***************************************************************************
* Copyright 2026 Adobe
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
#ifndef OPENPBR_BSDF_LOBE_TYPE_H
#define OPENPBR_BSDF_LOBE_TYPE_H
#ifndef OPENPBR_UINT32
#error "OPENPBR_UINT32 must be defined by the interop layer before including openpbr_bsdf_lobe_type.h."
#endif
#define OpenPBR_BsdfLobeType OPENPBR_UINT32
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeNone = 0;
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeReflection = OpenPBR_BsdfLobeType(1) << 0;
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeTransmission = OpenPBR_BsdfLobeType(1) << 1;
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeDiffuse = OpenPBR_BsdfLobeType(1) << 2;
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeGlossy = OpenPBR_BsdfLobeType(1) << 3;
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeSpecular = OpenPBR_BsdfLobeType(1) << 4;
OPENPBR_CONSTEXPR_GLOBAL OpenPBR_BsdfLobeType OpenPBR_BsdfLobeTypeVolume = OpenPBR_BsdfLobeType(1) << 5;
// Swap reflection and transmission in the OpenPBR_BsdfLobeType bitmask.
OPENPBR_INLINE_FUNCTION OpenPBR_BsdfLobeType openpbr_swap_reflect_trans_flags(OpenPBR_BsdfLobeType bsdf_lobe_type)
{
const bool has_r = bool(bsdf_lobe_type & OpenPBR_BsdfLobeTypeReflection);
const bool has_t = bool(bsdf_lobe_type & OpenPBR_BsdfLobeTypeTransmission);
bsdf_lobe_type &= ~(OpenPBR_BsdfLobeTypeReflection | OpenPBR_BsdfLobeTypeTransmission);
if (has_r)
bsdf_lobe_type |= OpenPBR_BsdfLobeTypeTransmission;
if (has_t)
bsdf_lobe_type |= OpenPBR_BsdfLobeTypeReflection;
return bsdf_lobe_type;
}
#endif