ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Gradient.h
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 
8 #pragma once
9 
10 #include <Eigen/Core>
11 #include <map>
12 #include <vector>
13 
15 
16 namespace cloudViewer {
17 namespace visualization {
18 namespace rendering {
19 
20 class Renderer;
21 
41 class Gradient {
42 public:
43  struct Point {
44  float value;
45  Eigen::Vector4f color;
46  };
47 
48  Gradient();
49  Gradient(const std::vector<Gradient::Point>& points);
50  virtual ~Gradient();
51 
52  const std::vector<Gradient::Point>& GetPoints() const;
53  void SetPoints(const std::vector<Gradient::Point>& points);
54 
55  enum class Mode {
56  kGradient,
57  kLUT
60  };
61 
62  Mode GetMode() const;
63  void SetMode(Mode mode);
64 
66 
67 private:
68  std::vector<Gradient::Point> points_;
69  Mode mode_ = Mode::kGradient;
70  std::map<Renderer*, TextureHandle> textures_;
71 };
72 
73 } // namespace rendering
74 } // namespace visualization
75 } // namespace cloudViewer
int points
TextureHandle GetTextureHandle(Renderer &renderer)
Definition: Gradient.cpp:69
const std::vector< Gradient::Point > & GetPoints() const
Definition: Gradient.cpp:43
void SetPoints(const std::vector< Gradient::Point > &points)
Definition: Gradient.cpp:47
Generic file read and write utility for python interface.