shader_object.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2009 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 **    Kenneth Gangstoe
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 

Generated on Thu Dec 3 02:39:31 2009 for ClanLib by  doxygen 1.4.6