Ignition Rendering

API Reference

5.0.0
ShaderParam.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef IGNITION_RENDERING_SHADERPARAM_HH_
19 #define IGNITION_RENDERING_SHADERPARAM_HH_
20 
21 #include <cstdint>
22 #include <cstring>
23 
24 #include <memory>
25 
27 
28 #include "ignition/rendering/config.hh"
29 #include "ignition/rendering/Export.hh"
30 
31 namespace ignition
32 {
33  namespace rendering
34  {
35  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
36  //
38  class ShaderParamPrivate;
39 
41  class IGNITION_RENDERING_VISIBLE ShaderParam
42  {
43  public: enum ParamType : uint16_t
44  {
46  PARAM_NONE = 0,
47 
49  PARAM_FLOAT = 1,
50 
52  PARAM_INT = 2,
53 
55  PARAM_FLOAT_BUFFER = 3,
56 
58  PARAM_INT_BUFFER = 4,
59  };
60 
62  public: ShaderParam();
63 
66  public: ShaderParam(const ShaderParam &_other);
67 
69  public: ~ShaderParam();
70 
73  public: ParamType Type() const;
74 
77  public: uint32_t Count() const;
78 
82  public: ShaderParam &operator=(const ShaderParam &_other);
83 
86  public: void operator=(const float _value);
87 
90  public: void operator=(const int _value);
91 
94  public: void InitializeBuffer(uint32_t _count);
95 
98  public: void UpdateBuffer(float *_floatBuffer);
99 
102  public: void UpdateBuffer(int *_intBuffer);
103 
107  public: bool Value(float *_value) const;
108 
112  public: bool Value(int *_value) const;
113 
117  public: bool Buffer(std::shared_ptr<void> &_buffer) const;
118 
121  private: std::unique_ptr<ShaderParamPrivate> dataPtr;
123  };
124  }
125  }
126 }
127 
128 #endif
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
a variant type that holds params that can be passed to a shader
Definition: ShaderParam.hh:41
ParamType
Definition: ShaderParam.hh:43
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING