program_object.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 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
31
32 #pragma once
33
34 #include <memory>
35 #include "../../Core/IOData/file_system.h"
36 #include "graphic_context.h"
37 #include "uniform_vector.h"
38
39 namespace clan
40 {
43
44 class ShaderObject;
45 class ProgramObject_Impl;
46 class GraphicContext;
47 class GraphicContextProvider;
48 class XMLResourceDocument;
49 class ProgramObjectProvider;
50
69 class ProgramObject
70 {
73 public:
75 ProgramObject();
76
80 ProgramObject(GraphicContext &gc);
81
85 ProgramObject(GraphicContextProvider *gc_provider);
86
90 ProgramObject(ProgramObjectProvider *provider);
91
99 static ProgramObject load(GraphicContext &gc, const std::string &resource_id, const XMLResourceDocument &resman);
100
108 static ProgramObject load(GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname);
109
118 static ProgramObject load(GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname);
119
128 static ProgramObject load(GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs);
129
139 static ProgramObject load(GraphicContext &gc, const std::string &vertex_filename, const std::string &geometry_filename, const std::string &fragment_filename, const FileSystem &fs);
140
148 static ProgramObject load(GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file);
149
158 static ProgramObject load(GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file);
159
167 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname);
168
177 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname);
178
187 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs);
188
198 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_filename, const std::string &geometry_filename, const std::string &fragment_filename, const FileSystem &fs);
199
207 static ProgramObject load_and_link(GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file);
208
217 static ProgramObject load_and_link(GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file);
218
219 virtual ~ProgramObject();
221
224 public:
226 bool is_null() const { return !impl; }
227
229 void throw_if_null() const;
230
232 ProgramObjectProvider *get_provider() const;
233
235 unsigned int get_handle() const;
236
238 std::vector<ShaderObject> get_shaders() const;
239
241 std::string get_info_log() const;
242
246 int get_attribute_location(const std::string &name) const;
247
251 int get_uniform_location(const std::string &name) const;
252
258 int get_uniform_buffer_size(const std::string &block_name) const;
259
261 int get_uniform_buffer_size(int block_index) const;
262
266 int get_uniform_buffer_index(const std::string &block_name) const;
267
271 int get_storage_buffer_index(const std::string &name) const;
273
276 public:
278 bool operator==(const ProgramObject &other) const;
279
281 void attach(const ShaderObject &obj);
282
284 void detach(const ShaderObject &obj);
285
287
288 void bind_attribute_location(int index, const std::string &name);
289
291
292 void bind_frag_data_location(int color_number, const std::string &name);
293
295
296 bool link();
297
299
300 bool validate();
301
302 void set_uniform1i(int location, int value_a);
303 void set_uniform2i(int location, int value_a, int value_b);
304 void set_uniform3i(int location, int value_a, int value_b, int value_c);
305 void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d);
306 void set_uniformiv(int location, int size, int count, const int *data);
307 void set_uniform2i(int location, const Vec2i &vec) {set_uniform2i(location, vec.x, vec.y);}
308 void set_uniform3i(int location, const Vec3i &vec) {set_uniform3i(location, vec.x, vec.y, vec.z);}
309 void set_uniform4i(int location, const Vec4i &vec) {set_uniform4i(location, vec.x, vec.y, vec.z, vec.w);}
310 void set_uniform2s(int location, const Vec2s &vec) {set_uniform2i(location, vec.x, vec.y);}
311 void set_uniform3s(int location, const Vec3s &vec) {set_uniform3i(location, vec.x, vec.y, vec.z);}
312 void set_uniform4s(int location, const Vec4s &vec) {set_uniform4i(location, vec.x, vec.y, vec.z, vec.w);}
313 void set_uniform2b(int location, const Vec2b &vec) {set_uniform2i(location, vec.x, vec.y);}
314 void set_uniform3b(int location, const Vec3b &vec) {set_uniform3i(location, vec.x, vec.y, vec.z);}
315 void set_uniform4b(int location, const Vec4b &vec) {set_uniform4i(location, vec.x, vec.y, vec.z, vec.w);}
316 void set_uniformiv(int location, int count, const Vec2i *data) {set_uniformiv(location, 2, count, &data->x);}
317 void set_uniformiv(int location, int count, const Vec3i *data) {set_uniformiv(location, 3, count, &data->x);}
318 void set_uniformiv(int location, int count, const Vec4i *data) {set_uniformiv(location, 4, count, &data->x);}
319 void set_uniform1f(int location, float value_a);
320 void set_uniform2f(int location, float value_a, float value_b);
321 void set_uniform3f(int location, float value_a, float value_b, float value_c);
322 void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d);
323 void set_uniformfv(int location, int size, int count, const float *data);
324 void set_uniform2f(int location, const Vec2f &vec) {set_uniform2f(location, vec.x, vec.y);}
325 void set_uniform3f(int location, const Vec3f &vec) {set_uniform3f(location, vec.x, vec.y, vec.z);}
326 void set_uniform4f(int location, const Vec4f &vec) {set_uniform4f(location, vec.x, vec.y, vec.z, vec.w);}
327 void set_uniformfv(int location, int count, const Vec2f *data) {set_uniformfv(location, 2, count, &data->x);}
328 void set_uniformfv(int location, int count, const Vec3f *data) {set_uniformfv(location, 3, count, &data->x);}
329 void set_uniformfv(int location, int count, const Vec4f *data) {set_uniformfv(location, 4, count, &data->x);}
330 void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data);
331 void set_uniform_matrix(int location, const Mat2f &matrix) {set_uniform_matrix(location, 2, 1, false, matrix.matrix);}
332 void set_uniform_matrix(int location, const Mat3f &matrix) {set_uniform_matrix(location, 3, 1, false, matrix.matrix);}
333 void set_uniform_matrix(int location, const Mat4f &matrix) {set_uniform_matrix(location, 4, 1, false, matrix.matrix);}
334 void set_uniform_matrix(int location, int count, const Mat2f *matrix) {set_uniform_matrix(location, 2, count, false, matrix->matrix);}
335 void set_uniform_matrix(int location, int count, const Mat3f *matrix) {set_uniform_matrix(location, 3, count, false, matrix->matrix);}
336 void set_uniform_matrix(int location, int count, const Mat4f *matrix) {set_uniform_matrix(location, 4, count, false, matrix->matrix);}
337
338 void set_uniform1i(const std::string &name, int value_a) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform1i(loc, value_a); }
339 void set_uniform2i(const std::string &name, int value_a, int value_b) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2i(loc, value_a, value_b); }
340 void set_uniform3i(const std::string &name, int value_a, int value_b, int value_c) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3i(loc, value_a, value_b, value_c); }
341 void set_uniform4i(const std::string &name, int value_a, int value_b, int value_c, int value_d) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4i(loc, value_a, value_b, value_c, value_d); }
342 void set_uniformiv(const std::string &name, int size, int count, const int *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformiv(loc, size, count, data); }
343 void set_uniform2i(const std::string &name, const Vec2i &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2i(loc, vec); }
344 void set_uniform3i(const std::string &name, const Vec3i &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3i(loc, vec); }
345 void set_uniform4i(const std::string &name, const Vec4i &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4i(loc, vec); }
346 void set_uniform2s(const std::string &name, const Vec2s &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2s(loc, vec); }
347 void set_uniform3s(const std::string &name, const Vec3s &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3s(loc, vec); }
348 void set_uniform4s(const std::string &name, const Vec4s &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4s(loc, vec); }
349 void set_uniform2b(const std::string &name, const Vec2b &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2b(loc, vec); }
350 void set_uniform3b(const std::string &name, const Vec3b &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3b(loc, vec); }
351 void set_uniform4b(const std::string &name, const Vec4b &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4b(loc, vec); }
352 void set_uniformiv(const std::string &name, int count, const Vec2i *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformiv(loc, count, data); }
353 void set_uniformiv(const std::string &name, int count, const Vec3i *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformiv(loc, count, data); }
354 void set_uniformiv(const std::string &name, int count, const Vec4i *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformiv(loc, count, data); }
355 void set_uniform1f(const std::string &name, float value_a) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform1f(loc, value_a); }
356 void set_uniform2f(const std::string &name, float value_a, float value_b) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2f(loc, value_a, value_b); }
357 void set_uniform3f(const std::string &name, float value_a, float value_b, float value_c) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3f(loc, value_a, value_b, value_c); }
358 void set_uniform4f(const std::string &name, float value_a, float value_b, float value_c, float value_d) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4f(loc, value_a, value_b, value_c, value_d); }
359 void set_uniformfv(const std::string &name, int size, int count, const float *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformfv(loc, size, count, data); }
360 void set_uniform2f(const std::string &name, const Vec2f &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2f(loc, vec); }
361 void set_uniform3f(const std::string &name, const Vec3f &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3f(loc, vec); }
362 void set_uniform4f(const std::string &name, const Vec4f &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4f(loc, vec); }
363 void set_uniformfv(const std::string &name, int count, const Vec2f *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformfv(loc, count, data); }
364 void set_uniformfv(const std::string &name, int count, const Vec3f *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformfv(loc, count, data); }
365 void set_uniformfv(const std::string &name, int count, const Vec4f *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniformfv(loc, count, data); }
366 void set_uniform_matrix(const std::string &name, int size, int count, bool transpose, const float *data) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, size, count, transpose, data); }
367 void set_uniform_matrix(const std::string &name, const Mat2f &matrix) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, matrix); }
368 void set_uniform_matrix(const std::string &name, const Mat3f &matrix) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, matrix); }
369 void set_uniform_matrix(const std::string &name, const Mat4f &matrix) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, matrix); }
370 void set_uniform_matrix(const std::string &name, int count, const Mat2f *matrix) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, count, matrix); }
371 void set_uniform_matrix(const std::string &name, int count, const Mat3f *matrix) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, count, matrix); }
372 void set_uniform_matrix(const std::string &name, int count, const Mat4f *matrix) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform_matrix(loc, count, matrix); }
373
375 void set_uniform_buffer_index(const std::string &block_name, int bind_index);
376
378 void set_uniform_buffer_index(int block_index, int bind_index);
379
381 void set_storage_buffer_index(const std::string &block_name, int bind_index);
382
384 void set_storage_buffer_index(int block_index, int bind_index);
386
389 private:
390 std::shared_ptr<ProgramObject_Impl> impl;
392 };
393
394 }
395
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int size, int count, const float *data)
clan::ProgramObject::~ProgramObject
virtual ~ProgramObject()
clan::ShaderObject
Shader Object.
Definition: shader_object.h:68
clan::ProgramObject::set_uniform3f
void set_uniform3f(int location, float value_a, float value_b, float value_c)
clan
Definition: clanapp.h:35
clan::Vec3::x
Type x
Definition: vec3.h:80
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int count, const Vec4f *data)
Definition: program_object.h:329
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data)
clan::ProgramObjectProvider
Program Object provider.
Definition: program_object_provider.h:43
clan::ProgramObject::validate
bool validate()
Validate program.
clan::ProgramObject::set_uniform2i
void set_uniform2i(int location, int value_a, int value_b)
clan::ProgramObject::operator==
bool operator==(const ProgramObject &other) const
Equality operator.
clan::ProgramObject::set_uniform_buffer_index
void set_uniform_buffer_index(const std::string &block_name, int bind_index)
Sets the UniformBuffer.
clan::Vec3::y
Type y
Definition: vec3.h:81
clan::Vec4::z
Type z
Definition: vec4.h:82
clan::ProgramObject::get_uniform_buffer_index
int get_uniform_buffer_index(const std::string &block_name) const
Get the uniform block index.
clan::IODevice
I/O Device interface.
Definition: iodevice.h:50
clan::GraphicContextProvider
Interface for implementing a GraphicContext target.
Definition: graphic_context_provider.h:86
clan::ProgramObject::set_uniform4i
void set_uniform4i(int location, const Vec4i &vec)
Definition: program_object.h:309
clan::ProgramObject::set_uniform4b
void set_uniform4b(const std::string &name, const Vec4b &vec)
Definition: program_object.h:351
clan::ProgramObject::set_uniform2b
void set_uniform2b(const std::string &name, const Vec2b &vec)
Definition: program_object.h:349
clan::ProgramObject::set_uniform3s
void set_uniform3s(int location, const Vec3s &vec)
Definition: program_object.h:311
clan::ProgramObject::attach
void attach(const ShaderObject &obj)
Add shader to program object.
clan::ProgramObject::set_uniform3s
void set_uniform3s(const std::string &name, const Vec3s &vec)
Definition: program_object.h:347
clan::ProgramObject::set_uniform2b
void set_uniform2b(int location, const Vec2b &vec)
Definition: program_object.h:313
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int count, const Mat2f *matrix)
Definition: program_object.h:334
clan::ProgramObject::is_null
bool is_null() const
Returns true if this object is invalid.
Definition: program_object.h:226
clan::ProgramObject::set_uniform4i
void set_uniform4i(const std::string &name, int value_a, int value_b, int value_c, int value_d)
Definition: program_object.h:341
clan::ProgramObject::set_uniform3i
void set_uniform3i(int location, int value_a, int value_b, int value_c)
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int count, const Vec2i *data)
Definition: program_object.h:316
clan::ProgramObject::set_uniform2i
void set_uniform2i(const std::string &name, int value_a, int value_b)
Definition: program_object.h:339
clan::ProgramObject::set_uniform4b
void set_uniform4b(int location, const Vec4b &vec)
Definition: program_object.h:315
clan::ProgramObject::get_uniform_location
int get_uniform_location(const std::string &name) const
Returns the location of a named uniform variable.
clan::ProgramObject::link
bool link()
Link program.
clan::StyleTokenType::string
@ keyword
clan::ProgramObject::set_uniform2f
void set_uniform2f(int location, const Vec2f &vec)
Definition: program_object.h:324
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, const Mat4f &matrix)
Definition: program_object.h:333
clan::Vec2::x
Type x
Definition: vec2.h:80
clan::Mat2::matrix
Type matrix[4]
Definition: mat2.h:185
clan::ProgramObject::get_attribute_location
int get_attribute_location(const std::string &name) const
Returns the location of a named active attribute.
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int size, int count, const float *data)
Definition: program_object.h:359
clan::ProgramObject::set_uniform4i
void set_uniform4i(const std::string &name, const Vec4i &vec)
Definition: program_object.h:345
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int count, const Vec4i *data)
Definition: program_object.h:318
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int size, int count, bool transpose, const float *data)
Definition: program_object.h:366
clan::ProgramObject::bind_frag_data_location
void bind_frag_data_location(int color_number, const std::string &name)
Bind shader out variable a specific color buffer location.
clan::FileSystem
Virtual File System (VFS).
Definition: file_system.h:47
clan::ProgramObject::set_uniform3f
void set_uniform3f(const std::string &name, float value_a, float value_b, float value_c)
Definition: program_object.h:357
clan::ProgramObject::get_uniform_buffer_size
int get_uniform_buffer_size(const std::string &block_name) const
Get the uniform block size.
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, const Mat3f &matrix)
Definition: program_object.h:332
clan::Mat2
2D matrix
Definition: mat2.h:45
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, const Mat2f &matrix)
Definition: program_object.h:331
clan::ProgramObject::set_uniform1f
void set_uniform1f(const std::string &name, float value_a)
Definition: program_object.h:355
clan::ProgramObject::throw_if_null
void throw_if_null() const
Throw an exception if this object is invalid.
clan::ProgramObject::get_info_log
std::string get_info_log() const
Returns the current info log for the program object.
clan::Vec2< int >
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int count, const Vec4f *data)
Definition: program_object.h:365
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int size, int count, const int *data)
Definition: program_object.h:342
clan::Mat3
3D matrix
Definition: mat2.h:48
clan::ProgramObject::set_uniform3f
void set_uniform3f(int location, const Vec3f &vec)
Definition: program_object.h:325
clan::ProgramObject::ProgramObject
ProgramObject()
Construct a null instance.
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int count, const Mat3f *matrix)
Definition: program_object.h:335
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int count, const Vec3f *data)
Definition: program_object.h:328
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int count, const Vec2i *data)
Definition: program_object.h:352
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int size, int count, const int *data)
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int count, const Vec3f *data)
Definition: program_object.h:364
clan::ProgramObject::get_storage_buffer_index
int get_storage_buffer_index(const std::string &name) const
Get the storage buffer index.
clan::ProgramObject::set_uniform3b
void set_uniform3b(const std::string &name, const Vec3b &vec)
Definition: program_object.h:350
clan::Vec3
3D vector
Definition: line_ray.h:48
clan::ProgramObject::set_uniform2f
void set_uniform2f(const std::string &name, float value_a, float value_b)
Definition: program_object.h:356
clan::ProgramObject::bind_attribute_location
void bind_attribute_location(int index, const std::string &name)
Bind attribute to specific location.
clan::Vec4::y
Type y
Definition: vec4.h:81
clan::ProgramObject::set_uniform2i
void set_uniform2i(const std::string &name, const Vec2i &vec)
Definition: program_object.h:343
clan::GraphicContext
Interface to drawing graphics.
Definition: graphic_context.h:257
clan::ProgramObject::set_uniform1i
void set_uniform1i(const std::string &name, int value_a)
Definition: program_object.h:338
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int count, const Vec2f *data)
Definition: program_object.h:327
clan::ProgramObject::set_uniform3i
void set_uniform3i(const std::string &name, const Vec3i &vec)
Definition: program_object.h:344
clan::ProgramObject::set_storage_buffer_index
void set_storage_buffer_index(const std::string &block_name, int bind_index)
Sets the UniformBuffer.
clan::ProgramObject::set_uniform4f
void set_uniform4f(int location, const Vec4f &vec)
Definition: program_object.h:326
clan::ProgramObject::set_uniform3i
void set_uniform3i(const std::string &name, int value_a, int value_b, int value_c)
Definition: program_object.h:340
clan::ProgramObject::get_provider
ProgramObjectProvider * get_provider() const
Retrieves the provider.
clan::ProgramObject::set_uniform3b
void set_uniform3b(int location, const Vec3b &vec)
Definition: program_object.h:314
clan::Vec4::w
Type w
Definition: vec4.h:83
clan::ProgramObject::set_uniform1f
void set_uniform1f(int location, float value_a)
clan::ProgramObject
Program Object.
Definition: program_object.h:69
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, const Mat2f &matrix)
Definition: program_object.h:367
clan::ProgramObject::set_uniform4f
void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d)
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int count, const Mat2f *matrix)
Definition: program_object.h:370
clan::ProgramObject::detach
void detach(const ShaderObject &obj)
Remove shader from program object.
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int count, const Mat3f *matrix)
Definition: program_object.h:371
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int count, const Mat4f *matrix)
Definition: program_object.h:372
clan::ProgramObject::get_shaders
std::vector< ShaderObject > get_shaders() const
Returns the shaders attached to the program object.
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int count, const Vec3i *data)
Definition: program_object.h:317
clan::ProgramObject::load_and_link
static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname)
Load and link.
clan::XMLResourceDocument
XML Resource Document.
Definition: xml_resource_document.h:48
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int count, const Mat4f *matrix)
Definition: program_object.h:336
clan::Mat4
4D matrix
Definition: mat2.h:51
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, const Mat4f &matrix)
Definition: program_object.h:369
clan::ProgramObject::set_uniform4f
void set_uniform4f(const std::string &name, float value_a, float value_b, float value_c, float value_d)
Definition: program_object.h:358
clan::ProgramObject::set_uniform2i
void set_uniform2i(int location, const Vec2i &vec)
Definition: program_object.h:307
clan::Mat4::matrix
Type matrix[16]
The matrix (in column-major format)
Definition: mat4.h:352
clan::ProgramObject::set_uniform3i
void set_uniform3i(int location, const Vec3i &vec)
Definition: program_object.h:308
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, const std::string &resource_id, const XMLResourceDocument &resman)
Load.
clan::Vec4::x
Type x
Definition: vec4.h:80
clan::ProgramObject::get_handle
unsigned int get_handle() const
Returns the OpenGL program object handle.
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int count, const Vec4i *data)
Definition: program_object.h:354
clan::ProgramObject::set_uniform4i
void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d)
clan::Vec4
4D vector
Definition: size.h:47
clan::Mat3::matrix
Type matrix[9]
Definition: mat3.h:278
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, const Mat3f &matrix)
Definition: program_object.h:368
clan::ProgramObject::set_uniform4f
void set_uniform4f(const std::string &name, const Vec4f &vec)
Definition: program_object.h:362
clan::ProgramObject::set_uniform4s
void set_uniform4s(const std::string &name, const Vec4s &vec)
Definition: program_object.h:348
clan::ProgramObject::set_uniform2s
void set_uniform2s(const std::string &name, const Vec2s &vec)
Definition: program_object.h:346
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int count, const Vec3i *data)
Definition: program_object.h:353
clan::ProgramObject::set_uniform3f
void set_uniform3f(const std::string &name, const Vec3f &vec)
Definition: program_object.h:361
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int count, const Vec2f *data)
Definition: program_object.h:363
clan::Vec3::z
Type z
Definition: vec3.h:82
clan::ProgramObject::set_uniform2f
void set_uniform2f(const std::string &name, const Vec2f &vec)
Definition: program_object.h:360
clan::Vec2::y
Type y
Definition: vec2.h:81
clan::ProgramObject::set_uniform2f
void set_uniform2f(int location, float value_a, float value_b)
clan::ProgramObject::set_uniform2s
void set_uniform2s(int location, const Vec2s &vec)
Definition: program_object.h:310
clan::ProgramObject::set_uniform1i
void set_uniform1i(int location, int value_a)
clan::ProgramObject::set_uniform4s
void set_uniform4s(int location, const Vec4s &vec)
Definition: program_object.h:312