• 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 
SetFilePath(const std::string & path)36   void SetFilePath(const std::string& path) { file_path_ = path; }
GetFilePath()37   const std::string& GetFilePath() const { return file_path_; }
38 
SetFormat(ShaderFormat fmt)39   void SetFormat(ShaderFormat fmt) { shader_format_ = fmt; }
GetFormat()40   ShaderFormat GetFormat() const { return shader_format_; }
41 
SetTargetEnv(const std::string & env)42   void SetTargetEnv(const std::string& env) { target_env_ = env; }
GetTargetEnv()43   const std::string& GetTargetEnv() const { return target_env_; }
44 
45   /// Sets the source shader to |data|.
SetData(const std::string & data)46   void SetData(const std::string& data) { data_ = data; }
47   /// Returns the source shader source.
GetData()48   const std::string& GetData() const { return data_; }
49 
50  private:
51   ShaderType shader_type_;
52   ShaderFormat shader_format_;
53   std::string data_;
54   std::string name_;
55   std::string file_path_;
56   std::string target_env_;
57 };
58 
59 }  // namespace amber
60 
61 #endif  // SRC_SHADER_H_
62