1 | /**************************************************************************/ |
2 | /* visual_shader_sdf_nodes.h */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #ifndef VISUAL_SHADER_SDF_NODES_H |
32 | #define VISUAL_SHADER_SDF_NODES_H |
33 | |
34 | #include "scene/resources/visual_shader.h" |
35 | |
36 | class VisualShaderNodeSDFToScreenUV : public VisualShaderNode { |
37 | GDCLASS(VisualShaderNodeSDFToScreenUV, VisualShaderNode); |
38 | |
39 | public: |
40 | virtual String get_caption() const override; |
41 | |
42 | virtual int get_input_port_count() const override; |
43 | virtual PortType get_input_port_type(int p_port) const override; |
44 | virtual String get_input_port_name(int p_port) const override; |
45 | |
46 | virtual int get_output_port_count() const override; |
47 | virtual PortType get_output_port_type(int p_port) const override; |
48 | virtual String get_output_port_name(int p_port) const override; |
49 | |
50 | virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; |
51 | |
52 | VisualShaderNodeSDFToScreenUV(); |
53 | }; |
54 | |
55 | class VisualShaderNodeScreenUVToSDF : public VisualShaderNode { |
56 | GDCLASS(VisualShaderNodeScreenUVToSDF, VisualShaderNode); |
57 | |
58 | public: |
59 | virtual String get_caption() const override; |
60 | |
61 | virtual int get_input_port_count() const override; |
62 | virtual PortType get_input_port_type(int p_port) const override; |
63 | virtual String get_input_port_name(int p_port) const override; |
64 | |
65 | virtual int get_output_port_count() const override; |
66 | virtual PortType get_output_port_type(int p_port) const override; |
67 | virtual String get_output_port_name(int p_port) const override; |
68 | |
69 | virtual bool is_input_port_default(int p_port, Shader::Mode p_mode) const override; |
70 | virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; |
71 | |
72 | VisualShaderNodeScreenUVToSDF(); |
73 | }; |
74 | |
75 | class VisualShaderNodeTextureSDF : public VisualShaderNode { |
76 | GDCLASS(VisualShaderNodeTextureSDF, VisualShaderNode); |
77 | |
78 | public: |
79 | virtual String get_caption() const override; |
80 | |
81 | virtual int get_input_port_count() const override; |
82 | virtual PortType get_input_port_type(int p_port) const override; |
83 | virtual String get_input_port_name(int p_port) const override; |
84 | |
85 | virtual int get_output_port_count() const override; |
86 | virtual PortType get_output_port_type(int p_port) const override; |
87 | virtual String get_output_port_name(int p_port) const override; |
88 | |
89 | virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; |
90 | |
91 | VisualShaderNodeTextureSDF(); |
92 | }; |
93 | |
94 | class VisualShaderNodeTextureSDFNormal : public VisualShaderNode { |
95 | GDCLASS(VisualShaderNodeTextureSDFNormal, VisualShaderNode); |
96 | |
97 | public: |
98 | virtual String get_caption() const override; |
99 | |
100 | virtual int get_input_port_count() const override; |
101 | virtual PortType get_input_port_type(int p_port) const override; |
102 | virtual String get_input_port_name(int p_port) const override; |
103 | |
104 | virtual int get_output_port_count() const override; |
105 | virtual PortType get_output_port_type(int p_port) const override; |
106 | virtual String get_output_port_name(int p_port) const override; |
107 | |
108 | virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; |
109 | |
110 | VisualShaderNodeTextureSDFNormal(); |
111 | }; |
112 | |
113 | class VisualShaderNodeSDFRaymarch : public VisualShaderNode { |
114 | GDCLASS(VisualShaderNodeSDFRaymarch, VisualShaderNode); |
115 | |
116 | public: |
117 | virtual String get_caption() const override; |
118 | |
119 | virtual int get_input_port_count() const override; |
120 | virtual PortType get_input_port_type(int p_port) const override; |
121 | virtual String get_input_port_name(int p_port) const override; |
122 | |
123 | virtual int get_output_port_count() const override; |
124 | virtual PortType get_output_port_type(int p_port) const override; |
125 | virtual String get_output_port_name(int p_port) const override; |
126 | |
127 | virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; |
128 | |
129 | VisualShaderNodeSDFRaymarch(); |
130 | }; |
131 | |
132 | #endif // VISUAL_SHADER_SDF_NODES_H |
133 | |