program_object.h Source File - ClanLib SDK
Description: program_object.h Source File

program_object.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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#pragma once
32
33#include <memory>
34#include "../../Core/IOData/file_system.h"
35#include "graphic_context.h"
36#include "uniform_vector.h"
37
38namespace clan
39{
42
43 class ShaderObject;
44 class ProgramObject_Impl;
45 class GraphicContext;
46 class GraphicContextProvider;
47 class XMLResourceDocument;
48 class ProgramObjectProvider;
49
68 class ProgramObject
69 {
70 public:
72 ProgramObject();
73
77 ProgramObject(GraphicContext &gc);
78
82 ProgramObject(GraphicContextProvider *gc_provider);
83
87 ProgramObject(std::unique_ptr<ProgramObjectProvider> provider);
88
96 static ProgramObject load(GraphicContext &gc, const std::string &resource_id, const XMLResourceDocument &resman);
97
105 static ProgramObject load(GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname);
106
115 static ProgramObject load(GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname);
116
125 static ProgramObject load(GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs);
126
136 static ProgramObject load(GraphicContext &gc, const std::string &vertex_filename, const std::string &geometry_filename, const std::string &fragment_filename, const FileSystem &fs);
137
145 static ProgramObject load(GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file);
146
155 static ProgramObject load(GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file);
156
164 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname);
165
174 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname);
175
184 static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs);
185
195 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);
196
204 static ProgramObject load_and_link(GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file);
205
214 static ProgramObject load_and_link(GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file);
215
216 virtual ~ProgramObject();
217
219 bool is_null() const { return !impl; }
220 explicit operator bool() const { return bool(impl); }
221
223 void throw_if_null() const;
224
226 ProgramObjectProvider *get_provider() const;
227
229 unsigned int get_handle() const;
230
232 std::vector<ShaderObject> get_shaders() const;
233
235 std::string get_info_log() const;
236
240 int get_attribute_location(const std::string &name) const;
241
245 int get_uniform_location(const std::string &name) const;
246
252 int get_uniform_buffer_size(const std::string &block_name) const;
253
255 int get_uniform_buffer_size(int block_index) const;
256
260 int get_uniform_buffer_index(const std::string &block_name) const;
261
265 int get_storage_buffer_index(const std::string &name) const;
266
268 bool operator==(const ProgramObject &other) const;
269
271 void attach(const ShaderObject &obj);
272
274 void detach(const ShaderObject &obj);
275
277
278 void bind_attribute_location(int index, const std::string &name);
279
281
282 void bind_frag_data_location(int color_number, const std::string &name);
283
285
286 bool link();
287
289
290 bool validate();
291
292 void set_uniform1i(int location, int value_a);
293 void set_uniform2i(int location, int value_a, int value_b);
294 void set_uniform3i(int location, int value_a, int value_b, int value_c);
295 void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d);
296 void set_uniformiv(int location, int size, int count, const int *data);
297 void set_uniform2i(int location, const Vec2i &vec) { set_uniform2i(location, vec.x, vec.y); }
298 void set_uniform3i(int location, const Vec3i &vec) { set_uniform3i(location, vec.x, vec.y, vec.z); }
299 void set_uniform4i(int location, const Vec4i &vec) { set_uniform4i(location, vec.x, vec.y, vec.z, vec.w); }
300 void set_uniform2s(int location, const Vec2s &vec) { set_uniform2i(location, vec.x, vec.y); }
301 void set_uniform3s(int location, const Vec3s &vec) { set_uniform3i(location, vec.x, vec.y, vec.z); }
302 void set_uniform4s(int location, const Vec4s &vec) { set_uniform4i(location, vec.x, vec.y, vec.z, vec.w); }
303 void set_uniform2b(int location, const Vec2b &vec) { set_uniform2i(location, vec.x, vec.y); }
304 void set_uniform3b(int location, const Vec3b &vec) { set_uniform3i(location, vec.x, vec.y, vec.z); }
305 void set_uniform4b(int location, const Vec4b &vec) { set_uniform4i(location, vec.x, vec.y, vec.z, vec.w); }
306 void set_uniformiv(int location, int count, const Vec2i *data) { set_uniformiv(location, 2, count, &data->x); }
307 void set_uniformiv(int location, int count, const Vec3i *data) { set_uniformiv(location, 3, count, &data->x); }
308 void set_uniformiv(int location, int count, const Vec4i *data) { set_uniformiv(location, 4, count, &data->x); }
309 void set_uniform1f(int location, float value_a);
310 void set_uniform2f(int location, float value_a, float value_b);
311 void set_uniform3f(int location, float value_a, float value_b, float value_c);
312 void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d);
313 void set_uniformfv(int location, int size, int count, const float *data);
314 void set_uniform2f(int location, const Vec2f &vec) { set_uniform2f(location, vec.x, vec.y); }
315 void set_uniform3f(int location, const Vec3f &vec) { set_uniform3f(location, vec.x, vec.y, vec.z); }
316 void set_uniform4f(int location, const Vec4f &vec) { set_uniform4f(location, vec.x, vec.y, vec.z, vec.w); }
317 void set_uniformfv(int location, int count, const Vec2f *data) { set_uniformfv(location, 2, count, &data->x); }
318 void set_uniformfv(int location, int count, const Vec3f *data) { set_uniformfv(location, 3, count, &data->x); }
319 void set_uniformfv(int location, int count, const Vec4f *data) { set_uniformfv(location, 4, count, &data->x); }
320 void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data);
321 void set_uniform_matrix(int location, const Mat2f &matrix) { set_uniform_matrix(location, 2, 1, false, matrix.matrix); }
322 void set_uniform_matrix(int location, const Mat3f &matrix) { set_uniform_matrix(location, 3, 1, false, matrix.matrix); }
323 void set_uniform_matrix(int location, const Mat4f &matrix) { set_uniform_matrix(location, 4, 1, false, matrix.matrix); }
324 void set_uniform_matrix(int location, int count, const Mat2f *matrix) { set_uniform_matrix(location, 2, count, false, matrix->matrix); }
325 void set_uniform_matrix(int location, int count, const Mat3f *matrix) { set_uniform_matrix(location, 3, count, false, matrix->matrix); }
326 void set_uniform_matrix(int location, int count, const Mat4f *matrix) { set_uniform_matrix(location, 4, count, false, matrix->matrix); }
327
328 void set_uniform1i(const std::string &name, int value_a) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform1i(loc, value_a); }
329 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); }
330 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); }
331 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); }
332 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); }
333 void set_uniform2i(const std::string &name, const Vec2i &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2i(loc, vec); }
334 void set_uniform3i(const std::string &name, const Vec3i &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3i(loc, vec); }
335 void set_uniform4i(const std::string &name, const Vec4i &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4i(loc, vec); }
336 void set_uniform2s(const std::string &name, const Vec2s &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2s(loc, vec); }
337 void set_uniform3s(const std::string &name, const Vec3s &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3s(loc, vec); }
338 void set_uniform4s(const std::string &name, const Vec4s &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4s(loc, vec); }
339 void set_uniform2b(const std::string &name, const Vec2b &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2b(loc, vec); }
340 void set_uniform3b(const std::string &name, const Vec3b &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3b(loc, vec); }
341 void set_uniform4b(const std::string &name, const Vec4b &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4b(loc, vec); }
342 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); }
343 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); }
344 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); }
345 void set_uniform1f(const std::string &name, float value_a) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform1f(loc, value_a); }
346 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); }
347 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); }
348 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); }
349 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); }
350 void set_uniform2f(const std::string &name, const Vec2f &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform2f(loc, vec); }
351 void set_uniform3f(const std::string &name, const Vec3f &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform3f(loc, vec); }
352 void set_uniform4f(const std::string &name, const Vec4f &vec) { int loc = get_uniform_location(name); if (loc >= 0) set_uniform4f(loc, vec); }
353 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); }
354 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); }
355 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); }
356 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); }
357 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); }
358 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); }
359 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); }
360 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); }
361 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); }
362 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); }
363
365 void set_uniform_buffer_index(const std::string &block_name, int bind_index);
366
368 void set_uniform_buffer_index(int block_index, int bind_index);
369
371 void set_storage_buffer_index(const std::string &block_name, int bind_index);
372
374 void set_storage_buffer_index(int block_index, int bind_index);
375
376 private:
377 std::shared_ptr<ProgramObject_Impl> impl;
378 };
379
381}
clan::FileSystem
Virtual File System (VFS).
Definition file_system.h:47
clan::GraphicContextProvider
Interface for implementing a GraphicContext target.
Definition graphic_context_provider.h:86
clan::GraphicContext
Interface to drawing graphics.
Definition graphic_context.h:257
clan::IODevice
I/O Device interface.
Definition iodevice.h:50
clan::Mat2::matrix
Type matrix[4]
The matrix (in column-major format).
Definition mat2.h:173
clan::Mat3::matrix
Type matrix[9]
The matrix (in column-major format).
Definition mat3.h:266
clan::Mat4::matrix
Type matrix[16]
The matrix (in column-major format).
Definition mat4.h:339
clan::ProgramObjectProvider
Program Object provider.
Definition program_object_provider.h:43
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::ProgramObject::set_uniform2i
void set_uniform2i(int location, const Vec2i &vec)
Definition program_object.h:297
clan::ProgramObject::ProgramObject
ProgramObject(std::unique_ptr< ProgramObjectProvider > provider)
Constructs a ProgramObject.
clan::ProgramObject::link
bool link()
Link program.
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int size, int count, const int *data)
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, const Mat3f &matrix)
Definition program_object.h:322
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int count, const Mat4f *matrix)
Definition program_object.h:326
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname)
Load.
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:356
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int count, const Mat3f *matrix)
Definition program_object.h:325
clan::ProgramObject::attach
void attach(const ShaderObject &obj)
Add shader to program object.
clan::ProgramObject::set_uniform2b
void set_uniform2b(int location, const Vec2b &vec)
Definition program_object.h:303
clan::ProgramObject::get_uniform_location
int get_uniform_location(const std::string &name) const
Returns the location of a named uniform variable.
clan::ProgramObject::is_null
bool is_null() const
Returns true if this object is invalid.
Definition program_object.h:219
clan::ProgramObject::ProgramObject
ProgramObject()
Construct a null instance.
clan::ProgramObject::set_uniform3b
void set_uniform3b(int location, const Vec3b &vec)
Definition program_object.h:304
clan::ProgramObject::set_uniform4f
void set_uniform4f(int location, const Vec4f &vec)
Definition program_object.h:316
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int size, int count, const int *data)
Definition program_object.h:332
clan::ProgramObject::set_uniform3i
void set_uniform3i(int location, int value_a, int value_b, int value_c)
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int count, const Vec3f *data)
Definition program_object.h:354
clan::ProgramObject::set_uniform4b
void set_uniform4b(int location, const Vec4b &vec)
Definition program_object.h:305
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int count, const Vec2i *data)
Definition program_object.h:306
clan::ProgramObject::validate
bool validate()
Validate program.
clan::ProgramObject::set_uniform2i
void set_uniform2i(const std::string &name, int value_a, int value_b)
Definition program_object.h:329
clan::ProgramObject::set_uniform2s
void set_uniform2s(int location, const Vec2s &vec)
Definition program_object.h:300
clan::ProgramObject::set_uniform1i
void set_uniform1i(const std::string &name, int value_a)
Definition program_object.h:328
clan::ProgramObject::set_uniform4i
void set_uniform4i(int location, const Vec4i &vec)
Definition program_object.h:299
clan::ProgramObject::operator==
bool operator==(const ProgramObject &other) const
Equality operator.
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, const Mat4f &matrix)
Definition program_object.h:323
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, const Mat2f &matrix)
Definition program_object.h:357
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int size, int count, const float *data)
Definition program_object.h:349
clan::ProgramObject::load_and_link
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)
Load and link.
clan::ProgramObject::set_uniform2f
void set_uniform2f(int location, const Vec2f &vec)
Definition program_object.h:314
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname)
Load.
clan::ProgramObject::set_uniform4i
void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d)
clan::ProgramObject::load_and_link
static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname)
Load and link.
clan::ProgramObject::set_uniform2i
void set_uniform2i(int location, int value_a, int value_b)
clan::ProgramObject::ProgramObject
ProgramObject(GraphicContext &gc)
Constructs a ProgramObject.
clan::ProgramObject::set_uniform2b
void set_uniform2b(const std::string &name, const Vec2b &vec)
Definition program_object.h:339
clan::ProgramObject::set_uniform3s
void set_uniform3s(int location, const Vec3s &vec)
Definition program_object.h:301
clan::ProgramObject::load_and_link
static ProgramObject load_and_link(GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file)
Load and link.
clan::ProgramObject::set_uniform4s
void set_uniform4s(const std::string &name, const Vec4s &vec)
Definition program_object.h:338
clan::ProgramObject::set_uniform_buffer_index
void set_uniform_buffer_index(const std::string &block_name, int bind_index)
Sets the UniformBuffer.
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int count, const Vec3i *data)
Definition program_object.h:307
clan::ProgramObject::set_uniform3i
void set_uniform3i(int location, const Vec3i &vec)
Definition program_object.h:298
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_uniform4i
void set_uniform4i(const std::string &name, const Vec4i &vec)
Definition program_object.h:335
clan::ProgramObject::load_and_link
static ProgramObject load_and_link(GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs)
Load and link.
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, const std::string &resource_id, const XMLResourceDocument &resman)
Load.
clan::ProgramObject::set_uniform2f
void set_uniform2f(const std::string &name, const Vec2f &vec)
Definition program_object.h:350
clan::ProgramObject::get_info_log
std::string get_info_log() const
Returns the current info log for the program object.
clan::ProgramObject::set_uniform1i
void set_uniform1i(int location, int value_a)
clan::ProgramObject::set_uniform3b
void set_uniform3b(const std::string &name, const Vec3b &vec)
Definition program_object.h:340
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int count, const Vec2i *data)
Definition program_object.h:342
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int count, const Vec2f *data)
Definition program_object.h:353
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int count, const Vec4f *data)
Definition program_object.h:319
clan::ProgramObject::set_uniform2f
void set_uniform2f(int location, float value_a, float value_b)
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int count, const Mat4f *matrix)
Definition program_object.h:362
clan::ProgramObject::throw_if_null
void throw_if_null() const
Throw an exception if this object is invalid.
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, const std::string &vertex_filename, const std::string &geometry_filename, const std::string &fragment_filename, const FileSystem &fs)
Load.
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file)
Load.
clan::ProgramObject::get_uniform_buffer_size
int get_uniform_buffer_size(int block_index) const
Get the uniform block size.
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::ProgramObject::set_uniform2f
void set_uniform2f(const std::string &name, float value_a, float value_b)
Definition program_object.h:346
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, const Mat3f &matrix)
Definition program_object.h:358
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int count, const Vec4i *data)
Definition program_object.h:344
clan::ProgramObject::set_storage_buffer_index
void set_storage_buffer_index(int block_index, int bind_index)
Sets the UniformBuffer.
clan::ProgramObject::set_uniformfv
void set_uniformfv(const std::string &name, int count, const Vec4f *data)
Definition program_object.h:355
clan::ProgramObject::set_uniform4b
void set_uniform4b(const std::string &name, const Vec4b &vec)
Definition program_object.h:341
clan::ProgramObject::get_storage_buffer_index
int get_storage_buffer_index(const std::string &name) const
Get the storage buffer index.
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int count, const Mat2f *matrix)
Definition program_object.h:360
clan::ProgramObject::set_uniform3f
void set_uniform3f(int location, float value_a, float value_b, float value_c)
clan::ProgramObject::set_uniformiv
void set_uniformiv(const std::string &name, int count, const Vec3i *data)
Definition program_object.h:343
clan::ProgramObject::set_uniform1f
void set_uniform1f(const std::string &name, float value_a)
Definition program_object.h:345
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:331
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data)
clan::ProgramObject::get_uniform_buffer_index
int get_uniform_buffer_index(const std::string &block_name) const
Get the uniform block index.
clan::ProgramObject::detach
void detach(const ShaderObject &obj)
Remove shader from program object.
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs)
Load.
clan::ProgramObject::set_uniform3i
void set_uniform3i(const std::string &name, int value_a, int value_b, int value_c)
Definition program_object.h:330
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_uniform_buffer_index
void set_uniform_buffer_index(int block_index, int bind_index)
Sets the UniformBuffer.
clan::ProgramObject::set_uniform2i
void set_uniform2i(const std::string &name, const Vec2i &vec)
Definition program_object.h:333
clan::ProgramObject::set_uniform3i
void set_uniform3i(const std::string &name, const Vec3i &vec)
Definition program_object.h:334
clan::ProgramObject::set_uniform3f
void set_uniform3f(int location, const Vec3f &vec)
Definition program_object.h:315
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, int count, const Mat3f *matrix)
Definition program_object.h:361
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(int location, const Mat2f &matrix)
Definition program_object.h:321
clan::ProgramObject::set_uniform1f
void set_uniform1f(int location, float value_a)
clan::ProgramObject::load_and_link
static ProgramObject load_and_link(GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file)
Load and link.
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int count, const Vec3f *data)
Definition program_object.h:318
clan::ProgramObject::ProgramObject
ProgramObject(GraphicContextProvider *gc_provider)
Constructs a ProgramObject.
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(int location, int count, const Mat2f *matrix)
Definition program_object.h:324
clan::ProgramObject::get_provider
ProgramObjectProvider * get_provider() const
Retrieves the provider.
clan::ProgramObject::set_uniform4f
void set_uniform4f(const std::string &name, const Vec4f &vec)
Definition program_object.h:352
clan::ProgramObject::set_uniform2s
void set_uniform2s(const std::string &name, const Vec2s &vec)
Definition program_object.h:336
clan::ProgramObject::set_uniform4s
void set_uniform4s(int location, const Vec4s &vec)
Definition program_object.h:302
clan::ProgramObject::set_uniform3s
void set_uniform3s(const std::string &name, const Vec3s &vec)
Definition program_object.h:337
clan::ProgramObject::get_handle
unsigned int get_handle() const
Returns the OpenGL program object handle.
clan::ProgramObject::load
static ProgramObject load(GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file)
Load.
clan::ProgramObject::set_uniformiv
void set_uniformiv(int location, int count, const Vec4i *data)
Definition program_object.h:308
clan::ProgramObject::set_uniform_matrix
void set_uniform_matrix(const std::string &name, const Mat4f &matrix)
Definition program_object.h:359
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_uniformfv
void set_uniformfv(int location, int size, int count, const float *data)
clan::ProgramObject::bind_attribute_location
void bind_attribute_location(int index, const std::string &name)
Bind attribute to specific location.
clan::ProgramObject::set_uniform3f
void set_uniform3f(const std::string &name, float value_a, float value_b, float value_c)
Definition program_object.h:347
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:348
clan::ProgramObject::get_shaders
std::vector< ShaderObject > get_shaders() const
Returns the shaders attached to the program object.
clan::ProgramObject::set_uniformfv
void set_uniformfv(int location, int count, const Vec2f *data)
Definition program_object.h:317
clan::ProgramObject::~ProgramObject
virtual ~ProgramObject()
clan::ProgramObject::set_uniform3f
void set_uniform3f(const std::string &name, const Vec3f &vec)
Definition program_object.h:351
clan::ShaderObject
Shader Object.
Definition shader_object.h:68
clan::Vec2::y
Type y
Definition vec2.h:81
clan::Vec2::x
Type x
Definition vec2.h:80
clan::Vec3::z
Type z
Definition vec3.h:81
clan::Vec3::y
Type y
Definition vec3.h:80
clan::Vec3::x
Type x
Definition vec3.h:79
clan::Vec4::z
Type z
Definition vec4.h:81
clan::Vec4::y
Type y
Definition vec4.h:80
clan::Vec4::x
Type x
Definition vec4.h:79
clan::Vec4::w
Type w
Definition vec4.h:82
clan::XMLResourceDocument
XML Resource Document.
Definition xml_resource_document.h:48
clan::Mat3f
Mat3< float > Mat3f
Definition mat3.h:368
clan::Vec4b
Vec4< char > Vec4b
Definition vec4.h:394
clan::Vec4f
Vec4< float > Vec4f
Definition vec4.h:399
clan::Vec2b
Vec2< char > Vec2b
Definition vec2.h:352
clan::Vec3f
Vec3< float > Vec3f
Definition vec3.h:347
clan::Vec2i
Vec2< int > Vec2i
Definition vec2.h:356
clan::Vec4s
Vec4< short > Vec4s
Definition vec4.h:396
clan::Vec4i
Vec4< int > Vec4i
Definition vec4.h:398
clan::Vec3b
Vec3< char > Vec3b
Definition vec3.h:342
clan::Mat4f
Mat4< float > Mat4f
Definition mat4.h:521
clan::Mat2f
Mat2< float > Mat2f
Definition mat2.h:230
clan::Vec2f
Vec2< float > Vec2f
Definition vec2.h:357
clan::Vec3s
Vec3< short > Vec3s
Definition vec3.h:344
clan::Vec2s
Vec2< short > Vec2s
Definition vec2.h:354
clan::Vec3i
Vec3< int > Vec3i
Definition vec3.h:346
clan
Definition clanapp.h:36