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
00049 enum CL_ShaderType
00050 {
00051 cl_shadertype_vertex,
00052 cl_shadertype_fragment
00053 };
00054
00063 class CL_API_DISPLAY CL_ShaderObject
00064 {
00067
00068 public:
00077 CL_ShaderObject(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &source);
00078
00084 CL_ShaderObject(CL_GraphicContext &gc, CL_ShaderType type, const std::vector<CL_StringRef> &sources);
00085
00091 CL_ShaderObject(CL_GraphicContextProvider *gc_provider, CL_ShaderType type, const CL_StringRef &source);
00092
00098 CL_ShaderObject(CL_GraphicContextProvider *gc_provider, CL_ShaderType type, const std::vector<CL_StringRef> &sources);
00099
00107 static CL_ShaderObject load(CL_GraphicContext &gc, const CL_StringRef &resource_id, CL_ResourceManager *resources);
00108
00117 static CL_ShaderObject load(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename, const CL_VirtualDirectory &directory);
00118
00126 static CL_ShaderObject load(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &fullname);
00127
00135 static CL_ShaderObject load(CL_GraphicContext &gc, CL_ShaderType type, CL_IODevice &file);
00136
00145 static CL_ShaderObject load_and_compile(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename, const CL_VirtualDirectory &directory);
00146
00154 static CL_ShaderObject load_and_compile(CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename);
00155
00163 static CL_ShaderObject load_and_compile(CL_GraphicContext &gc, CL_ShaderType type, CL_IODevice &file);
00164
00165 virtual ~CL_ShaderObject();
00166
00170
00171 public:
00173 unsigned int get_handle() const;
00174
00176 CL_ShaderType get_shader_type() const;
00177
00179 CL_String get_info_log() const;
00180
00182 CL_String get_shader_source() const;
00183
00187
00188 public:
00190 bool operator==(const CL_ShaderObject &other) const;
00191
00193
00194 bool compile();
00195
00199
00200 private:
00201 CL_SharedPtr<CL_ShaderObject_Impl> impl;
00203 };
00204