ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
MaterialModifier.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 namespace cloudViewer {
11 namespace visualization {
12 namespace rendering {
13 
15  return TextureSamplerParameters();
16 }
17 
19  TextureSamplerParameters parameters;
20 
21  parameters.filter_min =
24  // NOTE: Default to repeat wrap mode. Assets authored assuming a repeating
25  // texture mode will always look wrong with Clamp mode. However, assets
26  // authored assuming Clamp generally look correct with Repeat mode.
30  parameters.SetAnisotropy(8);
31 
32  return parameters;
33 }
34 
36  TextureSamplerParameters parameters;
37 
43  parameters.SetAnisotropy(0);
44 
45  return parameters;
46 }
47 
49  WrapMode uvw) {
50  filter_min = MinFilter(min_mag);
51  filter_mag = min_mag;
52  wrap_u = uvw;
53  wrap_v = uvw;
54  wrap_w = uvw;
55 }
56 
58  MagFilter mag,
59  WrapMode uvw) {
60  filter_min = min;
61  filter_mag = mag;
62  wrap_u = uvw;
63  wrap_v = uvw;
64  wrap_w = uvw;
65 }
66 
69  filter_min = min;
70  filter_mag = mag;
71  wrap_u = u;
72  wrap_v = v;
73  wrap_w = w;
74 }
75 
77  // Set anisotropy to the largest power-of-two less than or eaqual to a.
78  anisotropy = a;
79  for (std::uint8_t b = 1 << 7; b > 0; b >>= 1) {
80  if (b <= a) {
81  anisotropy = b;
82  break;
83  }
84  }
85 }
86 
87 } // namespace rendering
88 } // namespace visualization
89 } // namespace cloudViewer
int min(int a, int b)
Definition: cutil_math.h:53
Generic file read and write utility for python interface.
@ Linear
Box filtering. Weighted average of 4 neighbors is used.
@ Linear
Box filtering. Weighted average of 4 neighbors is used.