summaryrefslogtreecommitdiff
path: root/src/shaders/common.h
blob: 8b74beccbeff08428e5efbebe077856fc4955fa0 (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
#ifndef _SOFTSHADEROOM_COMMON_HEADER_H_
#define _SOFTSHADEROOM_COMMON_HEADER_H_

#include "../core/shader.h"

extern void ssrR_putline(int x0, int y0, int x1, int y1, Color color);

/*
** shader built in functions
*/
Vec3 normal_from_color(Color32 c32);

Mat4 mat4(Vec4* c1, Vec4* c2, Vec4* c3, Vec4* c4);
Mat3 mat3(Vec3* c1, Vec3* c2, Vec3* c3);

Vec2 texsize(Texture* texture);

#define discardif(cond) \
do{ \
if(cond) return 0; \
}while(0)

#define MVP_PROCESS \
do{																										 \
static Vec4 p; p.xyz = in->vertex->position; p.w = 1;	 \
mat4_mulvec4(uniforms->mvp, &p, clipcoord);						 \
}while(0)																							 

#endif