diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 3ecf9f853..75fd62537 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -1193,9 +1193,10 @@ function Panel_Preview() : PanelContent() constructor { shader_set_f("camRotation", [ d3_view_camera.focus_angle_y, -d3_view_camera.focus_angle_x, 0 ]); shader_set_f("camScale", zm); shader_set_f("camRatio", w / h); + shader_set_i("shapeAmount", 0); _env.apply(); - _obj.apply(); + if(_obj) _obj.apply(); shader_set_i("drawBg", 0); shader_set_f("depthInt", 0); diff --git a/shaders/sh_rm_primitive/sh_rm_primitive.fsh b/shaders/sh_rm_primitive/sh_rm_primitive.fsh index 76bdcfad4..85ec2d62a 100644 --- a/shaders/sh_rm_primitive/sh_rm_primitive.fsh +++ b/shaders/sh_rm_primitive/sh_rm_primitive.fsh @@ -717,6 +717,7 @@ vec3 normal(vec3 p) { } float march(vec3 camera, vec3 direction, out vec3 blendIndx) { + if(shapeAmount == 0) return viewRange.y; float depth = viewRange.x; for (int i = 0; i < MAX_MARCHING_STEPS; i++) { @@ -806,13 +807,13 @@ vec4 scene() { vec3 norm = normal(coll); vec4 grid = vec4(0.); - if(drawGrid == 1 && sign(eye.y) != sign(coll.y)) { + if(drawGrid == 1 && (shapeAmount == 0 || sign(eye.y) != sign(coll.y))) { vec3 gp = eye + dir * depth * (abs(eye.y) / (abs(coll.y) + abs(eye.y))); grid = viewGrid( gp.xz, gridStep ); grid.a *= clamp(1. - length(gp.xz) * gridScale, 0., 1.) * 0.75; } - if(depth > viewRange.y - EPSILON) // Not hitting anything. + if(shapeAmount == 0 || depth > viewRange.y - EPSILON) // Not hitting anything. return drawGrid == 1? grid : vec4(0.); /////////////////////////////////////////////////////////// @@ -885,7 +886,7 @@ void main() { } vec4 result = drawBg == 1? bg : vec4(0.); - result = blend(result, scene()); + result = blend(result, scene()); //////////////////////////////////////////////////