/**************************************************************************/1/* decal.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "scene/3d/visual_instance_3d.h"3334class Decal : public VisualInstance3D {35GDCLASS(Decal, VisualInstance3D);3637public:38enum DecalTexture {39TEXTURE_ALBEDO,40TEXTURE_NORMAL,41TEXTURE_ORM,42TEXTURE_EMISSION,43TEXTURE_MAX44};4546private:47RID decal;48Vector3 size = Vector3(2, 2, 2);49Ref<Texture2D> textures[TEXTURE_MAX];50real_t emission_energy = 1.0;51real_t albedo_mix = 1.0;52Color modulate = Color(1, 1, 1, 1);53uint32_t cull_mask = (1 << 20) - 1;54real_t normal_fade = 0.0;55real_t upper_fade = 0.3;56real_t lower_fade = 0.3;57bool distance_fade_enabled = false;58real_t distance_fade_begin = 40.0;59real_t distance_fade_length = 10.0;6061protected:62static void _bind_methods();63void _validate_property(PropertyInfo &p_property) const;64#ifndef DISABLE_DEPRECATED65bool _set(const StringName &p_name, const Variant &p_value);66bool _get(const StringName &p_name, Variant &r_property) const;67#endif // DISABLE_DEPRECATED6869public:70virtual PackedStringArray get_configuration_warnings() const override;7172void set_size(const Vector3 &p_size);73Vector3 get_size() const;7475void set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture);76Ref<Texture2D> get_texture(DecalTexture p_type) const;7778void set_emission_energy(real_t p_energy);79real_t get_emission_energy() const;8081void set_albedo_mix(real_t p_mix);82real_t get_albedo_mix() const;8384void set_modulate(Color p_modulate);85Color get_modulate() const;8687void set_upper_fade(real_t p_energy);88real_t get_upper_fade() const;8990void set_lower_fade(real_t p_fade);91real_t get_lower_fade() const;9293void set_normal_fade(real_t p_fade);94real_t get_normal_fade() const;9596void set_enable_distance_fade(bool p_enable);97bool is_distance_fade_enabled() const;9899void set_distance_fade_begin(real_t p_distance);100real_t get_distance_fade_begin() const;101102void set_distance_fade_length(real_t p_length);103real_t get_distance_fade_length() const;104105void set_cull_mask(uint32_t p_layers);106uint32_t get_cull_mask() const;107108virtual AABB get_aabb() const override;109110Decal();111~Decal();112};113114VARIANT_ENUM_CAST(Decal::DecalTexture);115116117