From 7b454895d60ce647cfc20dd62d62450804f6463f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 27 Sep 2024 16:54:23 +0200 Subject: add printed shader --- client/map/tiles/portal.gdshader | 2 +- client/menu/communicate/item/item_message.gd | 4 ++-- client/menu/printed.gdshader | 22 ++++++++++++++++++++++ client/menu/printed_material.tres | 6 ++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 client/menu/printed.gdshader create mode 100644 client/menu/printed_material.tres (limited to 'client') diff --git a/client/map/tiles/portal.gdshader b/client/map/tiles/portal.gdshader index 1555619d..93a85be8 100644 --- a/client/map/tiles/portal.gdshader +++ b/client/map/tiles/portal.gdshader @@ -42,7 +42,7 @@ void fragment() { vec3 rv = normalize(world_position - world_camera); vec3 em = vec3(0.); bool hit = false; - + for (int i = 0; i < 100; i++) { float st = length(ray) * 0.1; ray += normalize(rv) * st; diff --git a/client/menu/communicate/item/item_message.gd b/client/menu/communicate/item/item_message.gd index bd517d1d..17d2a629 100644 --- a/client/menu/communicate/item/item_message.gd +++ b/client/menu/communicate/item/item_message.gd @@ -17,7 +17,7 @@ class_name ItemMessage extends Control -const GRAYSCALE_MAT := preload("res://menu/grayscale_material.tres") +const PRINTED_MAT := preload("res://menu/printed_material.tres") @export var enable_rotation := true @export var enable_grayscale := false @@ -35,7 +35,7 @@ func _ready() -> void: Global.configure_viewport_aa(sub_viewport, Global.get_setting("graphics.aa")) if enable_grayscale: - sub_viewport_container.material = GRAYSCALE_MAT + sub_viewport_container.material = PRINTED_MAT func set_subviewport_size(sub_viewport_size: Vector2): sub_viewport.size = sub_viewport_size diff --git a/client/menu/printed.gdshader b/client/menu/printed.gdshader new file mode 100644 index 00000000..3b35faa8 --- /dev/null +++ b/client/menu/printed.gdshader @@ -0,0 +1,22 @@ +/* + Hurry Curry! - a game about cooking + Copyright 2024 metamuffin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, version 3 of the License only. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +*/ +shader_type canvas_item; + +void fragment() { + COLOR = floor(COLOR*5.)/5.; +} diff --git a/client/menu/printed_material.tres b/client/menu/printed_material.tres new file mode 100644 index 00000000..595248fd --- /dev/null +++ b/client/menu/printed_material.tres @@ -0,0 +1,6 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://dogdyoqrmy6ft"] + +[ext_resource type="Shader" path="res://menu/printed.gdshader" id="1_v4ily"] + +[resource] +shader = ExtResource("1_v4ily") -- cgit v1.2.3-70-g09d2