Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00033
00034 #pragma once
00035
00036 #include "../../Core/System/sharedptr.h"
00037 #include "../../Core/IOData/virtual_directory.h"
00038 #include "graphic_context.h"
00039 #include "../api_display.h"
00040 #include <vector>
00041
00042 class CL_GraphicContextProvider;
00043 class CL_ResourceManager;
00044 class CL_ShaderObject_Impl;
00045 class CL_ShaderObjectProvider;
00046
00050 enum CL_ShaderType
00051 {
00052 cl_shadertype_vertex,
00053 cl_shadertype_geometry,
00054 cl_shadertype_fragment
00055 };
00056
00065 class CL_API_DISPLAY CL_ShaderObject
00066 {
00069
00070 public:
00072 CL_ShaderObject();
00073
00079 CL_ShaderObject(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &source);
00080
00086 CL_ShaderObject(CL_GraphicContext &gc, CL_ShaderType type, const std::vector<CL_StringRef> &sources);
00087
00093 CL_ShaderObject(CL_GraphicContextProvider *gc_provider, CL_ShaderType type, const CL_StringRef &source);
00094
00100 CL_ShaderObject(CL_GraphicContextProvider *gc_provider, CL_ShaderType type, const std::vector<CL_StringRef> &sources);
00101
00109 static CL_ShaderObject load(CL_GraphicContext &gc, const CL_StringRef &resource_id, CL_ResourceManager *resources);
00110
00119 static CL_ShaderObject load(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename, const CL_VirtualDirectory &directory);
00120
00128 static CL_ShaderObject load(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &fullname);
00129
00137 static CL_ShaderObject load(CL_GraphicContext &gc, CL_ShaderType type, CL_IODevice &file);
00138
00147 static CL_ShaderObject load_and_compile(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename, const CL_VirtualDirectory &directory);
00148
00156 static CL_ShaderObject load_and_compile(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename);
00157
00165 static CL_ShaderObject load_and_compile(CL_GraphicContext &gc, CL_ShaderType type, CL_IODevice &file);
00166
00167 virtual ~CL_ShaderObject();
00168
00172
00173 public:
00175 unsigned int get_handle() const;
00176
00178 CL_ShaderType get_shader_type() const;
00179
00181 CL_String get_info_log() const;
00182
00184 CL_String get_shader_source() const;
00185
00187 bool is_null() const { return !impl; }
00188
00190 void throw_if_null() const;
00191
00195 CL_ShaderObjectProvider *get_provider() const;
00196
00200
00201 public:
00203 bool operator==(const CL_ShaderObject &other) const;
00204
00206
00207 bool compile();
00208
00212
00213 private:
00214 CL_SharedPtr<CL_ShaderObject_Impl> impl;
00216 };
00217