ClanLib
2.3.7
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
Sources
API
Display
Render
shader_object.h
Go to the documentation of this file.
1
/*
2
** ClanLib SDK
3
** Copyright (c) 1997-2011 The ClanLib Team
4
**
5
** This software is provided 'as-is', without any express or implied
6
** warranty. In no event will the authors be held liable for any damages
7
** arising from the use of this software.
8
**
9
** Permission is granted to anyone to use this software for any purpose,
10
** including commercial applications, and to alter it and redistribute it
11
** freely, subject to the following restrictions:
12
**
13
** 1. The origin of this software must not be misrepresented; you must not
14
** claim that you wrote the original software. If you use this software
15
** in a product, an acknowledgment in the product documentation would be
16
** appreciated but is not required.
17
** 2. Altered source versions must be plainly marked as such, and must not be
18
** misrepresented as being the original software.
19
** 3. This notice may not be removed or altered from any source distribution.
20
**
21
** Note: Some of the libraries ClanLib may link to may have additional
22
** requirements or restrictions.
23
**
24
** File Author(s):
25
**
26
** Magnus Norddahl
27
** Harry Storbacka
28
** Kenneth Gangstoe
29
*/
30
33
34
#pragma once
35
36
#include "../../Core/System/sharedptr.h"
37
#include "../../Core/IOData/virtual_directory.h"
38
#include "
graphic_context.h
"
39
#include "../api_display.h"
40
#include <vector>
41
42
class
CL_GraphicContextProvider
;
43
class
CL_ResourceManager
;
44
class
CL_ShaderObject_Impl;
45
class
CL_ShaderObjectProvider
;
46
50
enum
CL_ShaderType
51
{
52
cl_shadertype_vertex
,
53
cl_shadertype_geometry
,
54
cl_shadertype_fragment
55
};
56
65
class
CL_API_DISPLAY
CL_ShaderObject
66
{
69
70
public
:
72
CL_ShaderObject
();
73
79
CL_ShaderObject
(
CL_GraphicContext
&gc,
CL_ShaderType
type,
const
CL_StringRef
&source);
80
86
CL_ShaderObject
(
CL_GraphicContext
&gc,
CL_ShaderType
type,
const
std::vector<CL_StringRef> &sources);
87
93
CL_ShaderObject
(
CL_GraphicContextProvider
*gc_provider,
CL_ShaderType
type,
const
CL_StringRef
&source);
94
100
CL_ShaderObject
(
CL_GraphicContextProvider
*gc_provider,
CL_ShaderType
type,
const
std::vector<CL_StringRef> &sources);
101
109
static
CL_ShaderObject
load(
CL_GraphicContext
&gc,
const
CL_StringRef
&resource_id,
CL_ResourceManager
*resources);
110
119
static
CL_ShaderObject
load(
CL_GraphicContext
&gc,
CL_ShaderType
type,
const
CL_StringRef
&filename,
const
CL_VirtualDirectory
&directory);
120
128
static
CL_ShaderObject
load(
CL_GraphicContext
&gc,
CL_ShaderType
type,
const
CL_StringRef
&fullname);
129
137
static
CL_ShaderObject
load(
CL_GraphicContext
&gc,
CL_ShaderType
type,
CL_IODevice
&file);
138
147
static
CL_ShaderObject
load_and_compile(
CL_GraphicContext
&gc,
CL_ShaderType
type,
const
CL_StringRef
&filename,
const
CL_VirtualDirectory
&directory);
148
156
static
CL_ShaderObject
load_and_compile(
CL_GraphicContext
&gc,
CL_ShaderType
type,
const
CL_StringRef
&filename);
157
165
static
CL_ShaderObject
load_and_compile(
CL_GraphicContext
&gc,
CL_ShaderType
type,
CL_IODevice
&file);
166
167
virtual
~
CL_ShaderObject
();
168
172
173
public
:
175
unsigned
int
get_handle()
const
;
176
178
CL_ShaderType
get_shader_type()
const
;
179
181
CL_String
get_info_log()
const
;
182
184
CL_String
get_shader_source()
const
;
185
187
bool
is_null
()
const
{
return
!impl; }
188
190
void
throw_if_null()
const
;
191
195
CL_ShaderObjectProvider
*get_provider()
const
;
196
200
201
public
:
203
bool
operator==
(
const
CL_ShaderObject
&other)
const
;
204
206
207
bool
compile();
208
212
213
private
:
214
CL_SharedPtr<CL_ShaderObject_Impl> impl;
216
};
217
Generated on Fri Jun 14 2013 13:05:46 for ClanLib by
1.8.4