summaryrefslogtreecommitdiff
path: root/src/shader-node.h
blob: 7c93c812c500e4bb208e5dd72cc6da8ccf1f0e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 *  Copyright (C) 2018-2020 - Vito Caputo - <vcaputo@pengaru.com>
 *
 *  This program is free software: you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 3 as published
 *  by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _SHADER_NODE_H
#define _SHADER_NODE_H

typedef struct shader_t shader_t;
typedef struct stage_t stage_t;
typedef struct stage_conf_t stage_conf_t;
typedef struct m4f_t m4f_t;

typedef void (shader_node_uniforms_func_t)(void *uniforms_ctxt, void *render_ctxt, unsigned n_uniforms, const int *uniforms, const m4f_t *transform, float alpha);

typedef struct shader_conf_t {
	shader_t			*shader;
	const m4f_t			*transform;
	shader_node_uniforms_func_t	*uniforms_func;
	void				*uniforms_ctxt;
} shader_conf_t;

typedef struct shader_src_conf_t {
	const char			*vs_src, *fs_src;
	const m4f_t			*transform;
	shader_node_uniforms_func_t	*uniforms_func;
	void				*uniforms_ctxt;
	unsigned			n_uniforms;
	const char			**uniforms;
} shader_src_conf_t;

stage_t * shader_node_new_shaderv(const stage_conf_t *conf, unsigned n_shader_confs, const shader_conf_t *shader_confs, unsigned *index_ptr);
stage_t * shader_node_new_shader(const stage_conf_t *conf, const shader_conf_t *shader_conf);

stage_t * shader_node_new_srcv(const stage_conf_t *conf, unsigned n_shader_src_confs, const shader_src_conf_t *shader_src_conf, unsigned *index_ptr);
stage_t * shader_node_new_src(const stage_conf_t *conf, const shader_src_conf_t *shader_src_conf);

#endif
© All Rights Reserved