shadows working, although a bit jumpy
This commit is contained in:
parent
deb8208c84
commit
5d36d1c73b
File diff suppressed because it is too large
Load Diff
@ -177,7 +177,11 @@
|
||||
},{
|
||||
"trileName": "test",
|
||||
"positions": [
|
||||
0,0,-1,1,0,0,2,1,-3,0,2,1,-3,0,-1,1,-3,1,2,1,0,1,2,1,-3,1,-1,1
|
||||
-3,1,-1,1,0,0,2,1,-3,0,2,1,-3,0,-1,1,-3,1,2,1,0,1,2,1,0,0,-1,1
|
||||
]
|
||||
},{
|
||||
"trileName": "plat",
|
||||
"positions": [
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@ -7,17 +7,13 @@ theme_ptr : GR.Overall_Theme;
|
||||
|
||||
current_pipeline : s32 = 0;
|
||||
current_slot : s32 = 0;
|
||||
pipeline_names : []string = .["arbtri", "trixel", "sky", "trile", "plane"];
|
||||
slot_names : []string = .["Slot 1","Slot 2","Slot 3","Slot 4","Slot 5","Slot 6","Slot 7","Slot 8"];
|
||||
pipeline_names : []string = .["shadowmap", "reflection", "main"];
|
||||
|
||||
draw_subwindow_texture_debug :: (state: *GR.Subwindow_State, r: GR.Rect, data: *void) {
|
||||
r2 := r;
|
||||
r2.h = ui_h(5,0);
|
||||
r2.w = r.w * 0.75;
|
||||
r2.w = r.w;
|
||||
GR.dropdown(r2, pipeline_names, *current_pipeline, *theme_ptr.dropdown_theme);
|
||||
r2.x += r2.w;
|
||||
r2.w = r.w * 0.25;
|
||||
GR.dropdown(r2, slot_names, *current_slot, *theme_ptr.dropdown_theme);
|
||||
|
||||
r2.y = r.y + r2.h;
|
||||
r2.h = r.h - r2.h;
|
||||
@ -26,16 +22,14 @@ draw_subwindow_texture_debug :: (state: *GR.Subwindow_State, r: GR.Rect, data: *
|
||||
|
||||
uiTex := New(Ui_Texture ,,temp);
|
||||
|
||||
bind : sg_bindings;
|
||||
image : sg_image;
|
||||
if current_pipeline == {
|
||||
case 0; bind = gPipelines.arbtri.bind;
|
||||
case 1; bind = gPipelines.trixel.bind;
|
||||
case 2; bind = gPipelines.sky.bind;
|
||||
case 3; bind = gPipelines.trile.bind;
|
||||
case 4; bind = gPipelines.plane.bind;
|
||||
case 0; image = g_shadowmap_img;
|
||||
case 1; image = gPipelines.plane.bind.images[0];
|
||||
case 2; image = g_rendertex;
|
||||
}
|
||||
|
||||
uiTex.tex = bind.images[current_slot];
|
||||
uiTex.tex = image;
|
||||
|
||||
if uiTex.tex.id != INVALID_ID {
|
||||
set_shader_for_images(uiTex);
|
||||
|
||||
@ -7,6 +7,7 @@ current_trile_offset_index : s32 = 0;
|
||||
|
||||
current_world_config : *World_Config = null;
|
||||
in_shadowmap_pass : bool = false;
|
||||
shadow_mvp : Matrix4;
|
||||
|
||||
backend_handle_command :: (cmd: *Render_Command) {
|
||||
if cmd.type == {
|
||||
@ -101,6 +102,7 @@ backend_draw_trile_positions :: (trile : string, amount : s32, worldConf: *World
|
||||
mvp = create_viewproj(*camera);
|
||||
} else {
|
||||
mvp = create_shadow_viewproj(*camera, worldConf);
|
||||
shadow_mvp = mvp;
|
||||
}
|
||||
vs_params : Trile_Vs_Params;
|
||||
vs_params.mvp = mvp.floats;
|
||||
@ -147,8 +149,6 @@ backend_draw_sky :: (wc: *World_Config) {
|
||||
|
||||
backend_draw_ground :: (wc: *World_Config) {
|
||||
mvp := create_viewproj(*camera);
|
||||
mvp_shadow : Matrix4;
|
||||
if current_world_config != null then mvp_shadow = create_shadow_viewproj(*camera, current_world_config);
|
||||
vs_params : Plane_Vs_Params;
|
||||
world_conf : Plane_World_Config;
|
||||
plane_data : Plane_Data;
|
||||
@ -158,7 +158,7 @@ backend_draw_ground :: (wc: *World_Config) {
|
||||
|
||||
world_config_to_shader_type(wc, *world_conf);
|
||||
|
||||
vs_params.mvp_shadow = mvp_shadow.floats;
|
||||
vs_params.mvp_shadow = shadow_mvp.floats;
|
||||
vs_params.mvp = mvp.floats;
|
||||
sg_apply_pipeline(gPipelines.plane.pipeline);
|
||||
gPipelines.plane.bind.samplers[2] = g_shadowmap_sampler;
|
||||
|
||||
@ -461,8 +461,8 @@ create_plane_pipeline :: () {
|
||||
g_shadowmap_sampler = sg_make_sampler(*(sg_sampler_desc.{
|
||||
wrap_u = .CLAMP_TO_EDGE,
|
||||
wrap_v = .CLAMP_TO_EDGE,
|
||||
min_filter = .LINEAR,
|
||||
mag_filter = .LINEAR,
|
||||
min_filter = .NEAREST,
|
||||
mag_filter = .NEAREST,
|
||||
compare = .LESS,
|
||||
}));
|
||||
|
||||
|
||||
@ -16,6 +16,22 @@ draw_sky :: (cam: *Camera, worldConfig: *World_Config = null) {
|
||||
sg_draw(0, 36, 1);
|
||||
}
|
||||
|
||||
get_frustum_corners :: (cam: *Camera) -> [8]Vector3 {
|
||||
mat_view := create_lookat(cam);
|
||||
mat_proj := create_perspective(cam);
|
||||
|
||||
corners : [8]Vector3;
|
||||
corners[0] = unproject(Vector3.{-1, -1, -1}, mat_proj, mat_view);
|
||||
corners[1] = unproject(Vector3.{1, -1, -1}, mat_proj, mat_view);
|
||||
corners[2] = unproject(Vector3.{1, 1, -1}, mat_proj, mat_view);
|
||||
corners[3] = unproject(Vector3.{-1, 1, -1}, mat_proj, mat_view);
|
||||
corners[4] = unproject(Vector3.{-1, -1, 1}, mat_proj, mat_view);
|
||||
corners[5] = unproject(Vector3.{1, -1, 1}, mat_proj, mat_view);
|
||||
corners[6] = unproject(Vector3.{1, 1, 1}, mat_proj, mat_view);
|
||||
corners[7] = unproject(Vector3.{-1, 1, 1}, mat_proj, mat_view);
|
||||
return corners;
|
||||
}
|
||||
|
||||
create_shadow_viewproj :: (cam: *Camera, conf: *World_Config) -> Matrix4 {
|
||||
up: Vector3 = .{0, 1, 0};
|
||||
targetToPos := conf.sunPosition;
|
||||
@ -23,7 +39,18 @@ create_shadow_viewproj :: (cam: *Camera, conf: *World_Config) -> Matrix4 {
|
||||
B := normalize(cross(up, A));
|
||||
C := cross(A, B);
|
||||
|
||||
sunCameraPosition := cam.target + 20*A;
|
||||
camcpy := cam.*;
|
||||
camcpy.far = 50;
|
||||
camcpy.near = 0.5;
|
||||
|
||||
frustum_corners := get_frustum_corners(*camcpy);
|
||||
|
||||
avg : Vector3;
|
||||
for frustum_corners {
|
||||
avg += it;
|
||||
}
|
||||
avg /= 8.0;
|
||||
sunCameraPosition := avg + 30*A;
|
||||
|
||||
view := Matrix4.{
|
||||
B.x, C.x, A.x, 0,
|
||||
@ -32,7 +59,37 @@ create_shadow_viewproj :: (cam: *Camera, conf: *World_Config) -> Matrix4 {
|
||||
-dot(B, sunCameraPosition), -dot(C, sunCameraPosition), -dot(A, sunCameraPosition), 1
|
||||
};
|
||||
|
||||
top := 10.0; right := 10.0;
|
||||
proj := orthographic_projection_matrix(-right, right, -top, top, 5, 100, true);
|
||||
return view * proj;
|
||||
min_v := Vector3.{ 9999, 9999, 9999};
|
||||
max_v := Vector3.{-9999, -9999, -9999};
|
||||
|
||||
for corner: frustum_corners {
|
||||
transformed_corner := (view * Vector4.{corner.x, corner.y, corner.z, 1.0}).xyz;
|
||||
min_v.x = min(min_v.x, transformed_corner.x);
|
||||
min_v.y = min(min_v.y, transformed_corner.y);
|
||||
min_v.z = min(min_v.z, transformed_corner.z);
|
||||
max_v.x = max(max_v.x, transformed_corner.x);
|
||||
max_v.y = max(max_v.y, transformed_corner.y);
|
||||
max_v.z = max(max_v.z, transformed_corner.z);
|
||||
}
|
||||
|
||||
max_v *= 2;
|
||||
min_v *= 2;
|
||||
|
||||
proj := matrix_ortho(min_v.x, max_v.x, min_v.y, max_v.y, -max_v.z-100, -min_v.z);
|
||||
return view*proj;
|
||||
}
|
||||
|
||||
// taken from raymath.h
|
||||
matrix_ortho :: (left: float, right: float, bottom: float, top: float, near: float, far: float) -> Matrix4 {
|
||||
rl := right - left;
|
||||
tb := top - bottom;
|
||||
fn := far - near;
|
||||
|
||||
return Matrix4.{
|
||||
2.0/rl,0,0,0,
|
||||
0,2.0/tb,0,0,
|
||||
0,0,-2/fn,0,
|
||||
-(left + right)/rl, -(top+bottom)/tb, (far+near)/fn, 1
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -104,9 +104,10 @@ Plane_World_Config :: struct {
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 _37 = vec4(position.xyz * 1000.0, 1.0);
|
||||
vec3 _16 = position.xyz * 1000.0;
|
||||
vec4 _37 = vec4(_16, 1.0);
|
||||
gl_Position = mat4(plane_vs_params[0], plane_vs_params[1], plane_vs_params[2], plane_vs_params[3]) * _37;
|
||||
light_proj_pos = mat4(plane_vs_params[4], plane_vs_params[5], plane_vs_params[6], plane_vs_params[7]) * _37;
|
||||
light_proj_pos = mat4(plane_vs_params[4], plane_vs_params[5], plane_vs_params[6], plane_vs_params[7]) * vec4(round(_16 * 16.0) * vec3(0.0625), 1.0);
|
||||
pos = _37;
|
||||
idx = gl_InstanceID;
|
||||
}
|
||||
@ -127,26 +128,30 @@ vs_plane_source_glsl430 := u8.[
|
||||
0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x66,0x6c,0x61,0x74,
|
||||
0x20,0x6f,0x75,0x74,0x20,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76,
|
||||
0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x37,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,
|
||||
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,
|
||||
0x31,0x30,0x30,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x70,0x6c,0x61,
|
||||
0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,
|
||||
0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x36,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x31,0x30,0x30,0x30,0x2e,
|
||||
0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x37,0x20,
|
||||
0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x36,0x2c,0x20,0x31,0x2e,0x30,0x29,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x70,0x6c,0x61,
|
||||
0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
|
||||
0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,0x20,0x3d,
|
||||
0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x70,0x6c,
|
||||
0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,
|
||||
0x5b,0x32,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,
|
||||
0x6f,0x73,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x70,0x6c,
|
||||
0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,
|
||||
0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x69,0x64,0x78,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
||||
0x65,0x49,0x44,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x73,0x5b,0x36,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,
|
||||
0x28,0x72,0x6f,0x75,0x6e,0x64,0x28,0x5f,0x31,0x36,0x20,0x2a,0x20,0x31,0x36,0x2e,
|
||||
0x30,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x36,0x32,0x35,
|
||||
0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,
|
||||
0x20,0x3d,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,
|
||||
0x3d,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x3b,
|
||||
0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 430
|
||||
@ -499,9 +504,10 @@ fs_plane_source_glsl430 := u8.[
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 _37 = vec4(position.xyz * 1000.0, 1.0);
|
||||
vec3 _16 = position.xyz * 1000.0;
|
||||
vec4 _37 = vec4(_16, 1.0);
|
||||
gl_Position = mat4(plane_vs_params[0], plane_vs_params[1], plane_vs_params[2], plane_vs_params[3]) * _37;
|
||||
light_proj_pos = mat4(plane_vs_params[4], plane_vs_params[5], plane_vs_params[6], plane_vs_params[7]) * _37;
|
||||
light_proj_pos = mat4(plane_vs_params[4], plane_vs_params[5], plane_vs_params[6], plane_vs_params[7]) * vec4(round(_16 * 16.0) * vec3(0.0625), 1.0);
|
||||
pos = _37;
|
||||
idx = gl_InstanceID;
|
||||
}
|
||||
@ -518,26 +524,30 @@ vs_plane_source_glsl300es := u8.[
|
||||
0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x3b,0x0a,
|
||||
0x66,0x6c,0x61,0x74,0x20,0x6f,0x75,0x74,0x20,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,
|
||||
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x33,0x37,0x20,0x3d,0x20,
|
||||
0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,
|
||||
0x7a,0x20,0x2a,0x20,0x31,0x30,0x30,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x70,0x6c,0x61,
|
||||
0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x36,0x20,0x3d,0x20,
|
||||
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x31,
|
||||
0x30,0x30,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,
|
||||
0x5f,0x33,0x37,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x36,0x2c,0x20,
|
||||
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,
|
||||
0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,
|
||||
0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,
|
||||
0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x5b,0x32,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,
|
||||
0x6f,0x73,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,0x61,0x6e,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x70,0x6c,
|
||||
0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,
|
||||
0x5b,0x31,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,
|
||||
0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,
|
||||
0x6f,0x6a,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x70,0x6c,
|
||||
0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
|
||||
0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x73,0x5b,0x36,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x37,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,
|
||||
0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x73,0x5b,0x35,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2c,0x20,0x70,0x6c,0x61,0x6e,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,
|
||||
0x76,0x65,0x63,0x34,0x28,0x72,0x6f,0x75,0x6e,0x64,0x28,0x5f,0x31,0x36,0x20,0x2a,
|
||||
0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,
|
||||
0x30,0x36,0x32,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x69,0x64,0x78,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
||||
0x65,0x49,0x44,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 300 es
|
||||
@ -924,9 +934,10 @@ fs_plane_source_glsl300es := u8.[
|
||||
vertex main0_out main0(main0_in in [[stage_in]], constant plane_vs_params& _28 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]])
|
||||
{
|
||||
main0_out out = {};
|
||||
float4 _37 = float4(in.position.xyz * 1000.0, 1.0);
|
||||
float3 _16 = in.position.xyz * 1000.0;
|
||||
float4 _37 = float4(_16, 1.0);
|
||||
out.gl_Position = _28.mvp * _37;
|
||||
out.light_proj_pos = _28.mvp_shadow * _37;
|
||||
out.light_proj_pos = _28.mvp_shadow * float4(round(_16 * 16.0) * float3(0.0625), 1.0);
|
||||
out.pos = _37;
|
||||
out.idx = int(gl_InstanceIndex);
|
||||
return out;
|
||||
@ -967,20 +978,24 @@ vs_plane_source_metal_macos := u8.[
|
||||
0x64,0x65,0x78,0x20,0x5b,0x5b,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x69,
|
||||
0x64,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,
|
||||
0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x33,0x37,0x20,0x3d,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,
|
||||
0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x31,0x30,0x30,0x30,0x2e,0x30,0x2c,
|
||||
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,
|
||||
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x32,0x38,
|
||||
0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x6f,0x75,0x74,0x2e,0x6c,0x69,0x67,0x68,0x74,0x5f,0x70,0x72,0x6f,0x6a,0x5f,0x70,
|
||||
0x6f,0x73,0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x6d,0x76,0x70,0x5f,0x73,0x68,0x61,
|
||||
0x64,0x6f,0x77,0x20,0x2a,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,
|
||||
0x75,0x74,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x6f,0x75,0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,
|
||||
0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,
|
||||
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,
|
||||
0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x36,0x20,0x3d,0x20,
|
||||
0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,
|
||||
0x2a,0x20,0x31,0x30,0x30,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x20,0x5f,0x33,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x34,0x28,0x5f,0x31,0x36,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x5f,0x33,0x37,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x6c,0x69,0x67,0x68,0x74,0x5f,
|
||||
0x70,0x72,0x6f,0x6a,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x6d,
|
||||
0x76,0x70,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x34,0x28,0x72,0x6f,0x75,0x6e,0x64,0x28,0x5f,0x31,0x36,0x20,0x2a,0x20,0x31,
|
||||
0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,
|
||||
0x30,0x36,0x32,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x6f,0x75,0x74,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x33,0x37,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x69,0x6e,
|
||||
0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,
|
||||
0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
|
||||
0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
@ -15,7 +15,8 @@ out vec4 light_proj_pos;
|
||||
void main() {
|
||||
vec3 multisize = vec3(position.xyz * 1000.0);
|
||||
gl_Position = mvp * vec4(multisize, 1.0);
|
||||
light_proj_pos = mvp_shadow * vec4(multisize, 1.0);
|
||||
vec3 texelMultisize = round(multisize* 16.0) / 16.0;
|
||||
light_proj_pos = mvp_shadow * vec4(texelMultisize, 1.0);
|
||||
// #if !SOKOL_GLSL
|
||||
// light_proj_pos.y = -light_proj_pos.y;
|
||||
// #endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user