• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Amber Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SRC_SHADER_H_
16 #define SRC_SHADER_H_
17 
18 #include <string>
19 
20 #include "amber/shader_info.h"
21 
22 namespace amber {
23 
24 /// Stores information for a shader described in a script.
25 class Shader {
26  public:
27   /// Create a shader of |type|.
28   explicit Shader(ShaderType type);
29   ~Shader();
30 
GetType()31   ShaderType GetType() const { return shader_type_; }
32 
SetName(const std::string & name)33   void SetName(const std::string& name) { name_ = name; }
GetName()34   const std::string& GetName() const { return name_; }
35 
SetFormat(ShaderFormat fmt)36   void SetFormat(ShaderFormat fmt) { shader_format_ = fmt; }
GetFormat()37   ShaderFormat GetFormat() const { return shader_format_; }
38 
39   /// Sets the compiled shader to |data|.
SetData(const std::string & data)40   void SetData(const std::string& data) { data_ = data; }
41   /// Returns the compiled shader source.
GetData()42   const std::string& GetData() const { return data_; }
43 
44  private:
45   ShaderType shader_type_;
46   ShaderFormat shader_format_;
47   std::string data_;
48   std::string name_;
49 };
50 
51 }  // namespace amber
52 
53 #endif  // SRC_SHADER_H_
54