| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- include = ["core/shaders/common.shader"]
- render_states = {
- debug_line = {
- rgb_write_enable = true
- alpha_write_enable = true
- depth_write_enable = true
- depth_test_enable = true
- blend_enable = false
- depth_function = "lequal"
- cull_mode = "cw"
- primitive_type = "pt_lines"
- }
- debug_line_noz = {
- rgb_write_enable = true
- alpha_write_enable = true
- depth_write_enable = true
- depth_test_enable = false
- blend_enable = false
- depth_function = "lequal"
- cull_mode = "cw"
- primitive_type = "pt_lines"
- }
- gui = {
- rgb_write_enable = true
- alpha_write_enable = true
- depth_write_enable = true
- depth_test_enable = true
- depth_function = "lequal"
- blend_enable = true
- blend_src = "src_alpha"
- blend_dst = "inv_src_alpha"
- cull_mode = "cw"
- }
- sprite = {
- rgb_write_enable = true
- alpha_write_enable = true
- depth_write_enable = true
- depth_test_enable = true
- depth_function = "lequal"
- blend_enable = true
- blend_src = "src_alpha"
- blend_dst = "inv_src_alpha"
- cull_mode = "cw"
- }
- mesh = {
- rgb_write_enable = true
- alpha_write_enable = true
- blend_enable = false
- depth_write_enable = true
- depth_test_enable = true
- depth_function = "lequal"
- cull_mode = "ccw"
- }
- }
- bgfx_shaders = {
- debug_line = {
- includes = "common"
- varying = "
- vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
- vec3 a_position : POSITION;
- vec4 a_color0 : COLOR0;
- "
- vs_input_output = "
- $input a_position, a_color0
- $output v_color0
- "
- vs_code = "
- void main()
- {
- gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));
- v_color0 = a_color0;
- }
- "
- fs_input_output = "
- $input v_color0
- "
- fs_code = "
- void main()
- {
- gl_FragColor = v_color0;
- }
- "
- }
- gui = {
- includes = "common"
- varying = "
- vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
- vec2 a_position : POSITION;
- vec2 a_texcoord0 : TEXCOORD0;
- "
- vs_input_output = "
- $input = a_position, a_texcoord0
- $output v_texcoord0
- "
- vs_code = "
- void main()
- {
- gl_Position = mul(u_modelViewProj, vec4(a_position, 0.0, 1.0));
- #ifdef DIFFUSE_MAP
- v_texcoord0 = a_texcoord0;
- #endif // DIFFUSE_MAP
- }
- "
- fs_input_output = "
- $input v_texcoord0
- "
- fs_code = "
- #ifdef DIFFUSE_MAP
- SAMPLER2D(u_albedo, 0);
- #endif // DIFFUSE_MAP
- uniform vec3 u_color = vec3(1, 1, 1);
- void main()
- {
- #ifdef DIFFUSE_MAP
- gl_FragColor = texture2D(u_albedo, v_texcoord0) * vec4(u_color, 1.0);
- #else
- gl_FragColor = vec4(u_color, 1.0);
- #endif // DIFFUSE_MAP
- }
- "
- }
- sprite = {
- includes = "common"
- varying = "
- vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
- vec2 a_position : POSITION;
- vec2 a_texcoord0 : TEXCOORD0;
- "
- vs_input_output = "
- $input = a_position, a_texcoord0
- $output v_texcoord0
- "
- vs_code = "
- void main()
- {
- gl_Position = mul(u_modelViewProj, vec4(a_position, 0.0, 1.0));
- v_texcoord0 = a_texcoord0;
- }
- "
- fs_input_output = "
- $input v_texcoord0
- "
- fs_code = "
- SAMPLER2D(u_albedo, 0);
- uniform vec3 u_color = vec3(1, 1, 1);
- void main()
- {
- gl_FragColor = texture2D(u_albedo, v_texcoord0) * vec4(u_color, 1.0);
- }
- "
- }
- mesh = {
- includes = "common"
- varying =
- "
- vec3 v_normal : NORMAL = vec3(0.0, 0.0, 0.0);
- vec4 v_view : TEXCOORD0 = vec4(0.0, 0.0, 0.0, 0.0);
- vec2 v_uv0 : TEXCOORD1 = vec2(0.0, 0.0);
- vec3 a_position : POSITION;
- vec3 a_normal : NORMAL;
- vec2 a_texcoord0 : TEXCOORD0;
- "
- vs_input_output =
- "
- $input a_position, a_normal, a_texcoord0
- $output v_normal, v_view, v_uv0
- "
- vs_code =
- "
- void main()
- {
- gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));
- v_view = mul(u_modelView, vec4(a_position, 1.0));
- v_normal = normalize(mul(u_modelView, vec4(a_normal, 0.0)).xyz);
- v_uv0 = a_texcoord0;
- }
- "
- fs_input_output =
- "
- $input v_normal, v_view, v_uv0
- "
- fs_code =
- "
- SAMPLER2D(u_albedo, 0);
- uniform vec4 u_light_pos; // In world-space
- uniform vec4 u_light_dir; // In view-space
- uniform vec4 u_light_col;
- uniform vec4 u_ambient = vec4(0.5f, 0.5f, 0.5f, 0.0f);
- uniform vec4 u_diffuse = vec4(1.0f, 1.0f, 1.0f, 0.0f);
- uniform vec4 u_specular = vec4(0.0f, 0.0f, 0.0f, 0.0f);
- void main()
- {
- // normalize both input vectors
- vec3 n = normalize(v_normal);
- vec3 e = normalize(v_view.xyz);
- float intensity = max(0.0f, dot(n, u_light_dir.xyz));
- vec4 colorOut = max(intensity * (u_diffuse * u_light_col), u_ambient);
- gl_FragColor = colorOut * texture2D(u_albedo, v_uv0);
- }
- "
- }
- mesh_unlit = {
- includes = "common"
- varying =
- "
- vec3 v_normal : NORMAL = vec3(0.0, 0.0, 0.0);
- vec4 v_view : TEXCOORD0 = vec4(0.0, 0.0, 0.0, 0.0);
- vec2 v_uv0 : TEXCOORD1 = vec2(0.0, 0.0);
- vec3 a_position : POSITION;
- vec3 a_normal : NORMAL;
- vec2 a_texcoord0 : TEXCOORD0;
- "
- vs_input_output =
- "
- $input a_position, a_normal, a_texcoord0
- $output v_normal, v_view, v_uv0
- "
- vs_code =
- "
- void main()
- {
- gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));
- v_view = mul(u_modelView, vec4(a_position, 1.0));
- v_normal = normalize(mul(u_modelView, vec4(a_normal, 0.0)).xyz);
- v_uv0 = a_texcoord0;
- }
- "
- fs_input_output =
- "
- $input v_normal, v_view, v_uv0
- "
- fs_code =
- "
- SAMPLER2D(u_albedo, 0);
- uniform vec4 u_light_pos; // In world-space
- uniform vec4 u_light_dir; // In view-space
- uniform vec4 u_light_col;
- uniform vec4 u_ambient = vec4(0.5f, 0.5f, 0.5f, 0.0f);
- uniform vec4 u_diffuse = vec4(1.0f, 1.0f, 1.0f, 0.0f);
- uniform vec4 u_specular = vec4(0.0f, 0.0f, 0.0f, 0.0f);
- void main()
- {
- // normalize both input vectors
- vec3 n = normalize(v_normal);
- vec3 e = normalize(v_view.xyz);
- float intensity = max(0.0f, dot(n, u_light_dir.xyz));
- vec4 colorOut = max(intensity * (u_diffuse * u_light_col), u_ambient);
- gl_FragColor = texture2D(u_albedo, v_uv0);
- }
- "
- }
- }
- shaders = {
- debug_line = {
- bgfx_shader = "debug_line"
- render_state = "debug_line"
- }
- debug_line_noz = {
- bgfx_shader = "debug_line"
- render_state = "debug_line_noz"
- }
- gui = {
- bgfx_shader = "gui"
- render_state = "gui"
- }
- sprite = {
- bgfx_shader = "sprite"
- render_state = "sprite"
- }
- mesh = {
- bgfx_shader = "mesh"
- render_state = "mesh"
- }
- mesh_notexture = {
- bgfx_shader = "mesh"
- render_state = "mesh"
- }
- mesh_unlit = {
- bgfx_shader = "mesh_unlit"
- render_state = "mesh"
- }
- }
|