Debian Codegraph @

servers/rendering/storage/material_storage.h

raw symbols SCIP
1 /**************************************************************************/
2 /* material_storage.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 #pragma once
32
33 #include "servers/rendering/rendering_server.h"
34 #include "utilities.h"
35
36 class RendererMaterialStorage {
37 public:
38 virtual ~RendererMaterialStorage() {}
39
40 /* GLOBAL SHADER UNIFORM API */
41 virtual void global_shader_parameter_add(const StringName &p_name, RS::GlobalShaderParameterType p_type, const Variant &p_value) = 0;
42 virtual void global_shader_parameter_remove(const StringName &p_name) = 0;
43 virtual Vector<StringName> global_shader_parameter_get_list() const = 0;
44
45 virtual void global_shader_parameter_set(const StringName &p_name, const Variant &p_value) = 0;
46 virtual void global_shader_parameter_set_override(const StringName &p_name, const Variant &p_value) = 0;
47 virtual Variant global_shader_parameter_get(const StringName &p_name) const = 0;
48 virtual RS::GlobalShaderParameterType global_shader_parameter_get_type(const StringName &p_name) const = 0;
49
50 virtual void global_shader_parameters_load_settings(bool p_load_textures = true) = 0;
51 virtual void global_shader_parameters_clear() = 0;
52
53 virtual int32_t global_shader_parameters_instance_allocate(RID p_instance) = 0;
54 virtual void global_shader_parameters_instance_free(RID p_instance) = 0;
55 virtual void global_shader_parameters_instance_update(RID p_instance, int p_index, const Variant &p_value, int p_flags_count = 0) = 0;
56
57 /* SHADER API */
58 virtual RID shader_allocate() = 0;
59 virtual void shader_initialize(RID p_rid, bool p_embedded = true) = 0;
60 virtual void shader_free(RID p_rid) = 0;
61
62 virtual void shader_set_code(RID p_shader, const String &p_code) = 0;
63 virtual void shader_set_path_hint(RID p_shader, const String &p_path) = 0;
64 virtual String shader_get_code(RID p_shader) const = 0;
65 virtual void get_shader_parameter_list(RID p_shader, List<PropertyInfo> *p_param_list) const = 0;
66
67 virtual void shader_set_default_texture_parameter(RID p_shader, const StringName &p_name, RID p_texture, int p_index) = 0;
68 virtual RID shader_get_default_texture_parameter(RID p_shader, const StringName &p_name, int p_index) const = 0;
69 virtual Variant shader_get_parameter_default(RID p_material, const StringName &p_param) const = 0;
70
71 virtual RS::ShaderNativeSourceCode shader_get_native_source_code(RID p_shader) const = 0;
72 virtual void shader_embedded_set_lock() = 0;
73 virtual const HashSet<RID> &shader_embedded_set_get() const = 0;
74 virtual void shader_embedded_set_unlock() = 0;
75
76 /* MATERIAL API */
77
78 virtual RID material_allocate() = 0;
79 virtual void material_initialize(RID p_rid) = 0;
80 virtual void material_free(RID p_rid) = 0;
81
82 virtual void material_set_render_priority(RID p_material, int priority) = 0;
83 virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0;
84
85 virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
86 virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
87
88 virtual void material_set_next_pass(RID p_material, RID p_next_material) = 0;
89
90 virtual bool material_is_animated(RID p_material) = 0;
91 virtual bool material_casts_shadows(RID p_material) = 0;
92 virtual RS::CullMode material_get_cull_mode(RID p_material) const = 0;
93
94 struct InstanceShaderParam {
95 PropertyInfo info;
96 int index;
97 Variant default_value;
98 };
99
100 virtual void material_get_instance_shader_parameters(RID p_material, List<InstanceShaderParam> *r_parameters) = 0;
101
102 virtual void material_update_dependency(RID p_material, DependencyTracker *p_instance) = 0;
103 };