summaryrefslogtreecommitdiff
path: root/src/shaders/common
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-07-28 00:30:33 +0800
committerchai <chaifix@163.com>2020-07-28 00:30:33 +0800
commit5dfdb6b58b2dc7bbd3348004c1fcd17e23fea48b (patch)
treea03f1a01382595ed50cc4780a728b22013f6d5a0 /src/shaders/common
parent690f20cdbe8dad3fce7a547934a5a8322303342d (diff)
*embed resource in exeHEADmaster
Diffstat (limited to 'src/shaders/common')
-rw-r--r--src/shaders/common/core.c10
-rw-r--r--src/shaders/common/core.h18
2 files changed, 14 insertions, 14 deletions
diff --git a/src/shaders/common/core.c b/src/shaders/common/core.c
index ffaa649..91bb6c0 100644
--- a/src/shaders/common/core.c
+++ b/src/shaders/common/core.c
@@ -4,7 +4,7 @@ Vec4 _proj_params;
Vec2 _time;
Vec4 _screen_params;
-Vec3 unpacknormal(Color32 c32) {
+Vec3 decode_normal(Color32 c32) {
Vec3 normal = {
c32.r * 2 - 1,
c32.g * 2 - 1,
@@ -15,16 +15,16 @@ Vec3 unpacknormal(Color32 c32) {
Mat4 mat4(Vec4* c1, Vec4* c2, Vec4* c3, Vec4* c4);
-Vec2 texsize(Texture* texture) {
+Vec2 texture_size(Texture* texture) {
Vec2 size = {texture->width, texture->height};
return size;
}
-float linear01Depth(float depth) {
+float linear_01_depth(float depth) {
float n = _proj_params.x, f = _proj_params.y;
return n / ((n-f)*depth + f);
}
-float linearEyeDepth(float depth) {
- return _proj_params.y * linear01Depth(depth);
+float linear_eye_depth(float depth) {
+ return _proj_params.y * linear_01_depth(depth);
} \ No newline at end of file
diff --git a/src/shaders/common/core.h b/src/shaders/common/core.h
index ef58897..216af15 100644
--- a/src/shaders/common/core.h
+++ b/src/shaders/common/core.h
@@ -34,24 +34,24 @@ Vec4 _screen_params;
/************************************************************************/
/*shader built in functions*/
-Vec3 unpacknormal(Color32 c32);
+Vec3 decode_normal(Color32 c32);
Mat4 mat4(Vec4* c1, Vec4* c2, Vec4* c3, Vec4* c4);
Mat3 mat3(Vec3* c1, Vec3* c2, Vec3* c3);
-Vec2 texsize(Texture* texture);
+Vec2 texture_size(Texture* texture);
#define discardif(cond) \
-do{ \
-if(cond) return 0; \
+do{ \
+if(cond) return 0; \
}while(0)
#define discard() return 0
-#define keep() return 1
+#define put() return 1
#define MVP_PROCESS \
do{ \
-static Vec4 p; p.xyz = in->position; p.w = 1; \
-internal_mat4_mulvec4(g_uniforms->mvp, &p, clipcoord); \
+static Vec4 p; p.xyz = in->position; p.w = 1; \
+internal_mat4_mulvec4(g_uniforms->mvp, &p, clipcoord); \
}while(0)
#define object2clip(pos, out) internal_mat4_mulvec4(_mvp_matrix, pos, out);
@@ -66,7 +66,7 @@ out_v3->x = color.x * 2 - 1; \
out_v3->y = color.y * 2 - 1; \
out_v3->z = color.z * 2 - 1;
-float linear01Depth(float depth);
-float linearEyeDepth(float depth);
+float linear_01_depth(float depth);
+float linear_eye_depth(float depth);
#endif \ No newline at end of file