summaryrefslogtreecommitdiff
path: root/src/shaders/pbr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shaders/pbr.c')
-rw-r--r--src/shaders/pbr.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/shaders/pbr.c b/src/shaders/pbr.c
index ce56419..bd78c8b 100644
--- a/src/shaders/pbr.c
+++ b/src/shaders/pbr.c
@@ -1,24 +1,24 @@
#include "common.h"
/*uniforms*/
-#define object2world UM4(0)
-#define light UV3(0)
+#define _object2world UM4(0)
+#define _light UV3(0)
-#define albedo_tex UTEX(0)
-#define noraml_tex UTEX(1)
-#define roughness_tex UTEX(2)
-#define metalness_tex UTEX(3)
+#define _albedo_tex UTEX(0)
+#define _noraml_tex UTEX(1)
+#define _roughness_tex UTEX(2)
+#define _metalness_tex UTEX(3)
/*varyings*/
-#define uv reg_v2_00
-#define vnormal reg_v3_05
-#define rough reg_num_00
-#define world_pos reg_v3_00
-#define depth_pos reg_v3_01
-#define clip_pos reg_v4_00
-#define world_normal reg_v3_02
-#define world_tangent reg_v3_03
-#define world_bitangent reg_v3_04
+#define _texcoord reg_v2_00
+#define _normal reg_v3_05
+#define _rough reg_num_00
+#define _world_pos reg_v3_00
+#define _depth_pos reg_v3_01
+#define _clip_pos reg_v4_00
+#define _world_normal reg_v3_02
+#define _world_tangent reg_v3_03
+#define _world_bitangent reg_v3_04
static void vert(UniformCollection* uniforms, VertexShaderIn* in, Vec4* clipcoord) {
static Vec4 p; p.xyz = in->vertex->position; p.w = 1;
@@ -29,11 +29,11 @@ static void vert(UniformCollection* uniforms, VertexShaderIn* in, Vec4* clipcoor
in->vertex->normal.z,
1
};
- Vec4 worldnormal; mat4_mulvec4(object2world, &normal, &worldnormal);
- vec3_normalize(light, light);
+ Vec4 worldnormal; mat4_mulvec4(_object2world, &normal, &worldnormal);
+ vec3_normalize(_light, _light);
//*rough = 1 - vec3_dot(&worldnormal, light);
//*vnormal = in->vertex->normal;
- *uv = in->vertex->texcoord;
+ *_texcoord = in->vertex->texcoord;
}
static bool frag(UniformCollection* uniforms, FragmentShaderIn* in, Color32* color) {
@@ -46,7 +46,7 @@ static bool frag(UniformCollection* uniforms, FragmentShaderIn* in, Color32* col
//(*color).a = 1;
//return 1;
//float rough = 1- vec3_dot(&in->normal, light);
- Color32 c = tex2d(albedo_tex, *uv);
+ Color32 c = tex2d(_albedo_tex, _texcoord);
//Color32 nc = tex2d(noramltex, in->texcoord);
//vec3_scale(&c, roughness, &c);
color32_saturate(&c);