Fix some unnecessary includes
This commit is contained in:
parent
a98589a449
commit
eb4902a455
110 changed files with 509 additions and 639 deletions
|
@ -32,9 +32,8 @@
|
|||
#define GEOMETRY_2D_H
|
||||
|
||||
#include "core/math/delaunay_2d.h"
|
||||
#include "core/math/rect2.h"
|
||||
#include "core/math/triangulate.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/math/vector3i.h"
|
||||
#include "core/templates/vector.h"
|
||||
|
||||
class Geometry2D {
|
||||
|
|
|
@ -6160,7 +6160,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
|
|||
editor = p_node;
|
||||
editor_data = editor->get_scene_tree_dock()->get_editor_data();
|
||||
canvas_item_editor = p_canvas_item_editor;
|
||||
preview_node = memnew(Node2D);
|
||||
preview_node = memnew(Control);
|
||||
|
||||
accept = memnew(AcceptDialog);
|
||||
editor->get_gui_base()->add_child(accept);
|
||||
|
|
|
@ -649,7 +649,7 @@ class CanvasItemEditorViewport : public Control {
|
|||
EditorNode *editor;
|
||||
EditorData *editor_data;
|
||||
CanvasItemEditor *canvas_item_editor;
|
||||
Node2D *preview_node;
|
||||
Control *preview_node;
|
||||
AcceptDialog *accept;
|
||||
AcceptDialog *selector;
|
||||
Label *selector_label;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "lightmap_denoiser.h"
|
||||
#include "denoise_wrapper.h"
|
||||
|
||||
#include "core/io/image.h"
|
||||
|
||||
LightmapDenoiser *LightmapDenoiserOIDN::create_oidn_denoiser() {
|
||||
return memnew(LightmapDenoiserOIDN);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "animated_sprite_2d.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/sprite_frames.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class AnimatedSprite2D : public Node2D {
|
||||
GDCLASS(AnimatedSprite2D, Node2D);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
|
||||
void Area2D::set_space_override_mode(SpaceOverride p_mode) {
|
||||
space_override = p_mode;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "audio_stream_player_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/2d/area_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#ifndef AUDIO_STREAM_PLAYER_2D_H
|
||||
#define AUDIO_STREAM_PLAYER_2D_H
|
||||
|
||||
#include "core/templates/safe_refcount.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "servers/audio/audio_stream.h"
|
||||
#include "servers/audio_server.h"
|
||||
|
|
|
@ -30,10 +30,7 @@
|
|||
|
||||
#include "camera_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/rendering_server.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
void Camera2D::_update_scroll() {
|
||||
if (!is_inside_tree()) {
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define CAMERA_2D_H
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
class Camera2D : public Node2D {
|
||||
GDCLASS(Camera2D, Node2D);
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "collision_polygon_2d.h"
|
||||
|
||||
#include "collision_object_2d.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "scene/resources/concave_polygon_shape_2d.h"
|
||||
#include "scene/resources/convex_polygon_shape_2d.h"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define COLLISION_POLYGON_2D_H
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/shape_2d.h"
|
||||
|
||||
class CollisionObject2D;
|
||||
|
||||
|
|
|
@ -31,14 +31,8 @@
|
|||
#include "collision_shape_2d.h"
|
||||
|
||||
#include "collision_object_2d.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/resources/capsule_shape_2d.h"
|
||||
#include "scene/resources/circle_shape_2d.h"
|
||||
#include "scene/resources/concave_polygon_shape_2d.h"
|
||||
#include "scene/resources/convex_polygon_shape_2d.h"
|
||||
#include "scene/resources/line_shape_2d.h"
|
||||
#include "scene/resources/rectangle_shape_2d.h"
|
||||
#include "scene/resources/segment_shape_2d.h"
|
||||
|
||||
void CollisionShape2D::_shape_changed() {
|
||||
update();
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
#include "core/core_string_names.h"
|
||||
#include "scene/2d/gpu_particles_2d.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void CPUParticles2D::set_emitting(bool p_emitting) {
|
||||
if (emitting == p_emitting) {
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
#ifndef CPU_PARTICLES_2D_H
|
||||
#define CPU_PARTICLES_2D_H
|
||||
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class CPUParticles2D : public Node2D {
|
||||
private:
|
||||
|
|
|
@ -30,9 +30,7 @@
|
|||
|
||||
#include "gpu_particles_2d.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "core/config/engine.h"
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
#ifndef PARTICLES_2D_H
|
||||
#define PARTICLES_2D_H
|
||||
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class GPUParticles2D : public Node2D {
|
||||
private:
|
||||
|
|
|
@ -30,10 +30,8 @@
|
|||
|
||||
#include "joints_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "physics_body_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
|
||||
void Joint2D::_disconnect_signals() {
|
||||
Node *node_a = get_node_or_null(a);
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
#include "light_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void Light2D::_update_light_visibility() {
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
#ifndef LINE_BUILDER_H
|
||||
#define LINE_BUILDER_H
|
||||
|
||||
#include "core/math/color.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "line_2d.h"
|
||||
#include "scene/resources/gradient.h"
|
||||
|
||||
class LineBuilder {
|
||||
public:
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "navigation_agent_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "servers/navigation_server_2d.h"
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#ifndef NAVIGATION_AGENT_2D_H
|
||||
#define NAVIGATION_AGENT_2D_H
|
||||
|
||||
#include "core/templates/vector.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
class Node2D;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "navigation_obstacle_2d.h"
|
||||
|
||||
#include "scene/2d/collision_shape_2d.h"
|
||||
#include "scene/2d/physics_body_2d.h"
|
||||
#include "servers/navigation_server_2d.h"
|
||||
|
||||
void NavigationObstacle2D::_bind_methods() {
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "navigation_region_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "core/os/mutex.h"
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
|
||||
#include "node_2d.h"
|
||||
|
||||
#include "core/object/message_queue.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Dictionary Node2D::_edit_get_state() const {
|
||||
Dictionary state;
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#ifndef PARALLAX_BACKGROUND_H
|
||||
#define PARALLAX_BACKGROUND_H
|
||||
|
||||
#include "scene/2d/camera_2d.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/main/canvas_layer.h"
|
||||
|
||||
class ParallaxBackground : public CanvasLayer {
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "parallax_layer.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "parallax_background.h"
|
||||
|
||||
void ParallaxLayer::set_motion_scale(const Size2 &p_scale) {
|
||||
|
|
|
@ -30,9 +30,7 @@
|
|||
|
||||
#include "path_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_scale.h"
|
||||
|
|
|
@ -30,12 +30,7 @@
|
|||
|
||||
#include "physics_body_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void PhysicsBody2D::_bind_methods() {
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
#include "position_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
const real_t DEFAULT_GIZMO_EXTENTS = 10.0;
|
||||
|
||||
void Position2D::_draw_cross() {
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
#include "ray_cast_2d.h"
|
||||
|
||||
#include "collision_object_2d.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "physics_body_2d.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
|
||||
void RayCast2D::set_target_position(const Vector2 &p_point) {
|
||||
target_position = p_point;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "remote_transform_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void RemoteTransform2D::_update_cache() {
|
||||
cache = ObjectID();
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "skeleton_2d.h"
|
||||
|
||||
#include "scene/resources/skeleton_modification_2d.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "sprite_2d.h"
|
||||
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/os/os.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include "tile_map.h"
|
||||
|
||||
#include "core/io/marshalls.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include "servers/navigation_server_2d.h"
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#ifndef TILE_MAP_H
|
||||
#define TILE_MAP_H
|
||||
|
||||
#include "core/templates/self_list.h"
|
||||
#include "core/templates/vset.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/resources/tile_set.h"
|
||||
|
|
|
@ -30,11 +30,8 @@
|
|||
|
||||
#include "touch_screen_button.h"
|
||||
|
||||
#include "core/input/input.h"
|
||||
#include "core/input/input_map.h"
|
||||
#include "core/os/os.h"
|
||||
#include "scene/main/window.h"
|
||||
#
|
||||
|
||||
void TouchScreenButton::set_texture(const Ref<Texture2D> &p_texture) {
|
||||
texture = p_texture;
|
||||
update();
|
||||
|
|
|
@ -30,12 +30,6 @@
|
|||
|
||||
#include "visible_on_screen_notifier_2d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "gpu_particles_2d.h"
|
||||
#include "scene/2d/animated_sprite_2d.h"
|
||||
#include "scene/2d/physics_body_2d.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
void Area3D::set_space_override_mode(SpaceOverride p_mode) {
|
||||
space_override = p_mode;
|
||||
|
|
|
@ -30,11 +30,10 @@
|
|||
|
||||
#include "audio_stream_player_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/3d/area_3d.h"
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/3d/listener_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
// Based on "A Novel Multichannel Panning Method for Standard and Arbitrary Loudspeaker Configurations" by Ramy Sadek and Chris Kyriakakis (2004)
|
||||
// Speaker-Placement Correction Amplitude Panning (SPCAP)
|
||||
|
|
|
@ -31,12 +31,10 @@
|
|||
#ifndef AUDIO_STREAM_PLAYER_3D_H
|
||||
#define AUDIO_STREAM_PLAYER_3D_H
|
||||
|
||||
#include "core/templates/safe_refcount.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/3d/velocity_tracker_3d.h"
|
||||
#include "servers/audio/audio_filter_sw.h"
|
||||
#include "servers/audio/audio_stream.h"
|
||||
#include "servers/audio_server.h"
|
||||
|
||||
class Camera3D;
|
||||
class AudioStreamPlayer3D : public Node3D {
|
||||
|
|
|
@ -31,10 +31,8 @@
|
|||
#include "camera_3d.h"
|
||||
|
||||
#include "collision_object_3d.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "core/math/camera_matrix.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
void Camera3D::_update_audio_listener_state() {
|
||||
}
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/3d/velocity_tracker_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/camera_effects.h"
|
||||
#include "scene/resources/environment.h"
|
||||
|
||||
class Camera3D : public Node3D {
|
||||
GDCLASS(Camera3D, Node3D);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "collision_object_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void CollisionObject3D::_notification(int p_what) {
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#define COLLISION_OBJECT_3D_H
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/shape_3d.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
class CollisionObject3D : public Node3D {
|
||||
GDCLASS(CollisionObject3D, Node3D);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "collision_object_3d.h"
|
||||
#include "core/math/geometry_2d.h"
|
||||
#include "scene/resources/concave_polygon_shape_3d.h"
|
||||
#include "scene/resources/convex_polygon_shape_3d.h"
|
||||
|
||||
void CollisionPolygon3D::_build_polygon() {
|
||||
|
|
|
@ -30,12 +30,10 @@
|
|||
|
||||
#include "collision_shape_3d.h"
|
||||
|
||||
#include "core/math/quick_hull.h"
|
||||
#include "mesh_instance_3d.h"
|
||||
#include "physics_body_3d.h"
|
||||
#include "scene/resources/concave_polygon_shape_3d.h"
|
||||
#include "scene/resources/convex_polygon_shape_3d.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void CollisionShape3D::make_convex_from_siblings() {
|
||||
Node *p = get_parent();
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/shape_3d.h"
|
||||
|
||||
class CollisionObject3D;
|
||||
class CollisionShape3D : public Node3D {
|
||||
GDCLASS(CollisionShape3D, Node3D);
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/3d/gpu_particles_3d.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
AABB CPUParticles3D::get_aabb() const {
|
||||
return AABB();
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#ifndef CPU_PARTICLES_H
|
||||
#define CPU_PARTICLES_H
|
||||
|
||||
#include "core/templates/rid.h"
|
||||
#include "core/templates/safe_refcount.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
|
||||
class CPUParticles3D : public GeometryInstance3D {
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#define DECAL_H
|
||||
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class Decal : public VisualInstance3D {
|
||||
GDCLASS(Decal, VisualInstance3D);
|
||||
|
|
|
@ -30,11 +30,8 @@
|
|||
|
||||
#include "gpu_particles_3d.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
AABB GPUParticles3D::get_aabb() const {
|
||||
return AABB();
|
||||
}
|
||||
|
@ -487,6 +484,7 @@ void GPUParticles3D::set_skin(const Ref<Skin> &p_skin) {
|
|||
skin = p_skin;
|
||||
_skinning_changed();
|
||||
}
|
||||
|
||||
Ref<Skin> GPUParticles3D::get_skin() const {
|
||||
return skin;
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
#ifndef PARTICLES_H
|
||||
#define PARTICLES_H
|
||||
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/skin.h"
|
||||
|
||||
class GPUParticles3D : public GeometryInstance3D {
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "gpu_particles_collision_3d.h"
|
||||
|
||||
#include "core/templates/thread_work_pool.h"
|
||||
#include "mesh_instance_3d.h"
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
#define GPU_PARTICLES_COLLISION_3D_H
|
||||
|
||||
#include "core/templates/local_vector.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
class GPUParticlesCollision3D : public VisualInstance3D {
|
||||
GDCLASS(GPUParticlesCollision3D, VisualInstance3D);
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include "light_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
|
||||
bool Light3D::_can_gizmo_scale() const {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#define LIGHT_3D_H
|
||||
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class Light3D : public VisualInstance3D {
|
||||
GDCLASS(Light3D, VisualInstance3D);
|
||||
|
|
|
@ -31,14 +31,9 @@
|
|||
#include "lightmap_gi.h"
|
||||
|
||||
#include "core/io/config_file.h"
|
||||
#include "core/io/dir_access.h"
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/math/camera_matrix.h"
|
||||
#include "core/math/delaunay_3d.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/templates/sort_array.h"
|
||||
#include "lightmap_probe.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
|
||||
void LightmapGIData::add_user(const NodePath &p_path, const Rect2 &p_uv_scale, int p_slice_index, int32_t p_sub_instance) {
|
||||
User user;
|
||||
|
|
|
@ -34,10 +34,7 @@
|
|||
#include "core/templates/local_vector.h"
|
||||
#include "scene/3d/light_3d.h"
|
||||
#include "scene/3d/lightmapper.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/multimesh_instance_3d.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/sky.h"
|
||||
|
||||
class LightmapGIData : public Resource {
|
||||
GDCLASS(LightmapGIData, Resource);
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
#ifndef LIGHTMAPPER_H
|
||||
#define LIGHTMAPPER_H
|
||||
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "servers/rendering/rendering_device.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
|
||||
class Image;
|
||||
|
||||
#if !defined(__aligned)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "listener_3d.h"
|
||||
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
void Listener3D::_update_audio_listener_state() {
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define LISTENER_3D_H
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
class Listener3D : public Node3D {
|
||||
GDCLASS(Listener3D, Node3D);
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include "collision_shape_3d.h"
|
||||
#include "core/core_string_names.h"
|
||||
#include "physics_body_3d.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "skeleton_3d.h"
|
||||
|
||||
bool MeshInstance3D::_set(const StringName &p_name, const Variant &p_value) {
|
||||
//this is not _too_ bad performance wise, really. it only arrives here if the property was not set anywhere else.
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
#ifndef MESH_INSTANCE_H
|
||||
#define MESH_INSTANCE_H
|
||||
|
||||
#include "scene/3d/skeleton_3d.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/skin.h"
|
||||
|
||||
class Skin;
|
||||
class SkinReference;
|
||||
|
||||
class MeshInstance3D : public GeometryInstance3D {
|
||||
GDCLASS(MeshInstance3D, GeometryInstance3D);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "navigation_agent_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
|
||||
void NavigationAgent3D::_bind_methods() {
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#ifndef NAVIGATION_AGENT_H
|
||||
#define NAVIGATION_AGENT_H
|
||||
|
||||
#include "core/templates/vector.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
class Node3D;
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define NAVIGATION_OBSTACLE_H
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
class NavigationObstacle3D : public Node {
|
||||
GDCLASS(NavigationObstacle3D, Node);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "navigation_region_3d.h"
|
||||
|
||||
#include "core/os/thread.h"
|
||||
#include "mesh_instance_3d.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define NAVIGATION_REGION_H
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/navigation_mesh.h"
|
||||
|
||||
class NavigationRegion3D : public Node3D {
|
||||
|
|
|
@ -30,11 +30,9 @@
|
|||
|
||||
#include "node_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/object/message_queue.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define NODE_3D_H
|
||||
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
|
||||
class Node3DGizmo : public RefCounted {
|
||||
GDCLASS(Node3DGizmo, RefCounted);
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
#include "path_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void Path3D::_notification(int p_what) {
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,8 @@
|
|||
|
||||
#include "physics_body_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/3d/collision_shape_3d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "position_3d.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
Position3D::Position3D() {
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
#include "ray_cast_3d.h"
|
||||
|
||||
#include "collision_object_3d.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "mesh_instance_3d.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
void RayCast3D::set_target_position(const Vector3 &p_point) {
|
||||
target_position = p_point;
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#define REFLECTIONPROBE_H
|
||||
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/sky.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class ReflectionProbe : public VisualInstance3D {
|
||||
GDCLASS(ReflectionProbe, VisualInstance3D);
|
||||
|
|
|
@ -30,12 +30,8 @@
|
|||
|
||||
#include "skeleton_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/message_queue.h"
|
||||
#include "core/variant/type_info.h"
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void SkinReference::_skin_changed() {
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#ifndef SKELETON_3D_H
|
||||
#define SKELETON_3D_H
|
||||
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/skin.h"
|
||||
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
/**
|
||||
* @author AndreaCatania
|
||||
*/
|
||||
|
||||
#include "core/math/transform_3d.h"
|
||||
#include "scene/3d/skeleton_3d.h"
|
||||
|
||||
class FabrikInverseKinematic {
|
||||
|
|
|
@ -30,13 +30,7 @@
|
|||
|
||||
#include "soft_body_3d.h"
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/3d/collision_object_3d.h"
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
#include "scene/3d/skeleton_3d.h"
|
||||
|
||||
SoftBodyRenderingServerHandler::SoftBodyRenderingServerHandler() {}
|
||||
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
|
||||
#include "spring_arm_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/3d/collision_object_3d.h"
|
||||
#include "scene/resources/sphere_shape_3d.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
void SpringArm3D::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#ifndef SPRITE_3D_H
|
||||
#define SPRITE_3D_H
|
||||
|
||||
#include "scene/2d/animated_sprite_2d.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
#include "scene/resources/sprite_frames.h"
|
||||
|
||||
class SpriteBase3D : public GeometryInstance3D {
|
||||
GDCLASS(SpriteBase3D, GeometryInstance3D);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "velocity_tracker_3d.h"
|
||||
#include "core/config/engine.h"
|
||||
|
||||
void VelocityTracker3D::set_track_physics_step(bool p_track_physics_step) {
|
||||
physics_step = p_track_physics_step;
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
|
||||
#include "visible_on_screen_notifier_3d.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void VisibleOnScreenNotifier3D::_visibility_enter() {
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include "visual_instance_3d.h"
|
||||
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/rendering_server.h"
|
||||
#include "skeleton_3d.h"
|
||||
|
||||
AABB VisualInstance3D::get_transformed_aabb() const {
|
||||
return get_global_transform().xform(get_aabb());
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
#ifndef VISUAL_INSTANCE_H
|
||||
#define VISUAL_INSTANCE_H
|
||||
|
||||
#include "core/math/face3.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
class VisualInstance3D : public Node3D {
|
||||
GDCLASS(VisualInstance3D, Node3D);
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
|
||||
#include "voxel_gi.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
|
||||
#include "mesh_instance_3d.h"
|
||||
#include "multimesh_instance_3d.h"
|
||||
#include "voxelizer.h"
|
||||
|
||||
void VoxelGIData::_set_data(const Dictionary &p_data) {
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#ifndef VOXEL_GI_H
|
||||
#define VOXEL_GI_H
|
||||
|
||||
#include "multimesh_instance_3d.h"
|
||||
#include "scene/3d/visual_instance_3d.h"
|
||||
|
||||
class VoxelGIData : public Resource {
|
||||
|
|
|
@ -29,11 +29,6 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "voxelizer.h"
|
||||
#include "core/math/geometry_3d.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/os/threaded_array_processor.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static _FORCE_INLINE_ void get_uv_and_normal(const Vector3 &p_pos, const Vector3 *p_vtx, const Vector2 *p_uv, const Vector3 *p_normal, Vector2 &r_uv, Vector3 &r_normal) {
|
||||
if (p_pos.is_equal_approx(p_vtx[0])) {
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#ifndef VOXEL_LIGHT_BAKER_H
|
||||
#define VOXEL_LIGHT_BAKER_H
|
||||
|
||||
#include "core/math/vector3i.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/resources/multimesh.h"
|
||||
|
||||
class Voxelizer {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "world_environment.h"
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
void WorldEnvironment::_notification(int p_what) {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef SCENARIO_FX_H
|
||||
#define SCENARIO_FX_H
|
||||
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/resources/camera_effects.h"
|
||||
#include "scene/resources/environment.h"
|
||||
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
|
||||
#include "xr_nodes.h"
|
||||
|
||||
#include "core/input/input.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "servers/xr/xr_interface.h"
|
||||
#include "servers/xr_server.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#define XR_NODES_H
|
||||
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "servers/xr/xr_positional_tracker.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#include "core/templates/local_vector.h"
|
||||
|
||||
class Panel;
|
||||
|
||||
class Popup : public Window {
|
||||
GDCLASS(Popup, Window);
|
||||
|
||||
|
|
|
@ -30,289 +30,17 @@
|
|||
|
||||
#include "canvas_item.h"
|
||||
|
||||
#include "core/input/input.h"
|
||||
#include "core/object/message_queue.h"
|
||||
#include "scene/2d/canvas_group.h"
|
||||
#include "scene/main/canvas_layer.h"
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/canvas_item_material.h"
|
||||
#include "scene/resources/font.h"
|
||||
#include "scene/resources/multimesh.h"
|
||||
#include "scene/resources/style_box.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
Mutex CanvasItemMaterial::material_mutex;
|
||||
SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = nullptr;
|
||||
Map<CanvasItemMaterial::MaterialKey, CanvasItemMaterial::ShaderData> CanvasItemMaterial::shader_map;
|
||||
CanvasItemMaterial::ShaderNames *CanvasItemMaterial::shader_names = nullptr;
|
||||
|
||||
void CanvasItemMaterial::init_shaders() {
|
||||
dirty_materials = memnew(SelfList<CanvasItemMaterial>::List);
|
||||
|
||||
shader_names = memnew(ShaderNames);
|
||||
|
||||
shader_names->particles_anim_h_frames = "particles_anim_h_frames";
|
||||
shader_names->particles_anim_v_frames = "particles_anim_v_frames";
|
||||
shader_names->particles_anim_loop = "particles_anim_loop";
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::finish_shaders() {
|
||||
memdelete(dirty_materials);
|
||||
memdelete(shader_names);
|
||||
dirty_materials = nullptr;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::_update_shader() {
|
||||
dirty_materials->remove(&element);
|
||||
|
||||
MaterialKey mk = _compute_key();
|
||||
if (mk.key == current_key.key) {
|
||||
return; //no update required in the end
|
||||
}
|
||||
|
||||
if (shader_map.has(current_key)) {
|
||||
shader_map[current_key].users--;
|
||||
if (shader_map[current_key].users == 0) {
|
||||
//deallocate shader, as it's no longer in use
|
||||
RS::get_singleton()->free(shader_map[current_key].shader);
|
||||
shader_map.erase(current_key);
|
||||
}
|
||||
}
|
||||
|
||||
current_key = mk;
|
||||
|
||||
if (shader_map.has(mk)) {
|
||||
RS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader);
|
||||
shader_map[mk].users++;
|
||||
return;
|
||||
}
|
||||
|
||||
//must create a shader!
|
||||
|
||||
String code = "shader_type canvas_item;\nrender_mode ";
|
||||
switch (blend_mode) {
|
||||
case BLEND_MODE_MIX:
|
||||
code += "blend_mix";
|
||||
break;
|
||||
case BLEND_MODE_ADD:
|
||||
code += "blend_add";
|
||||
break;
|
||||
case BLEND_MODE_SUB:
|
||||
code += "blend_sub";
|
||||
break;
|
||||
case BLEND_MODE_MUL:
|
||||
code += "blend_mul";
|
||||
break;
|
||||
case BLEND_MODE_PREMULT_ALPHA:
|
||||
code += "blend_premul_alpha";
|
||||
break;
|
||||
case BLEND_MODE_DISABLED:
|
||||
code += "blend_disabled";
|
||||
break;
|
||||
}
|
||||
|
||||
switch (light_mode) {
|
||||
case LIGHT_MODE_NORMAL:
|
||||
break;
|
||||
case LIGHT_MODE_UNSHADED:
|
||||
code += ",unshaded";
|
||||
break;
|
||||
case LIGHT_MODE_LIGHT_ONLY:
|
||||
code += ",light_only";
|
||||
break;
|
||||
}
|
||||
|
||||
code += ";\n";
|
||||
|
||||
if (particles_animation) {
|
||||
code += "uniform int particles_anim_h_frames;\n";
|
||||
code += "uniform int particles_anim_v_frames;\n";
|
||||
code += "uniform bool particles_anim_loop;\n\n";
|
||||
|
||||
code += "void vertex() {\n";
|
||||
code += " float h_frames = float(particles_anim_h_frames);\n";
|
||||
code += " float v_frames = float(particles_anim_v_frames);\n";
|
||||
code += " VERTEX.xy /= vec2(h_frames, v_frames);\n";
|
||||
code += " float particle_total_frames = float(particles_anim_h_frames * particles_anim_v_frames);\n";
|
||||
code += " float particle_frame = floor(INSTANCE_CUSTOM.z * float(particle_total_frames));\n";
|
||||
code += " if (!particles_anim_loop) {\n";
|
||||
code += " particle_frame = clamp(particle_frame, 0.0, particle_total_frames - 1.0);\n";
|
||||
code += " } else {\n";
|
||||
code += " particle_frame = mod(particle_frame, particle_total_frames);\n";
|
||||
code += " }";
|
||||
code += " UV /= vec2(h_frames, v_frames);\n";
|
||||
code += " UV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);\n";
|
||||
code += "}\n";
|
||||
}
|
||||
|
||||
ShaderData shader_data;
|
||||
shader_data.shader = RS::get_singleton()->shader_create();
|
||||
shader_data.users = 1;
|
||||
|
||||
RS::get_singleton()->shader_set_code(shader_data.shader, code);
|
||||
|
||||
shader_map[mk] = shader_data;
|
||||
|
||||
RS::get_singleton()->material_set_shader(_get_material(), shader_data.shader);
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::flush_changes() {
|
||||
MutexLock lock(material_mutex);
|
||||
|
||||
while (dirty_materials->first()) {
|
||||
dirty_materials->first()->self()->_update_shader();
|
||||
}
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::_queue_shader_change() {
|
||||
MutexLock lock(material_mutex);
|
||||
|
||||
if (!element.in_list()) {
|
||||
dirty_materials->add(&element);
|
||||
}
|
||||
}
|
||||
|
||||
bool CanvasItemMaterial::_is_shader_dirty() const {
|
||||
MutexLock lock(material_mutex);
|
||||
|
||||
return element.in_list();
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::set_blend_mode(BlendMode p_blend_mode) {
|
||||
blend_mode = p_blend_mode;
|
||||
_queue_shader_change();
|
||||
}
|
||||
|
||||
CanvasItemMaterial::BlendMode CanvasItemMaterial::get_blend_mode() const {
|
||||
return blend_mode;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::set_light_mode(LightMode p_light_mode) {
|
||||
light_mode = p_light_mode;
|
||||
_queue_shader_change();
|
||||
}
|
||||
|
||||
CanvasItemMaterial::LightMode CanvasItemMaterial::get_light_mode() const {
|
||||
return light_mode;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::set_particles_animation(bool p_particles_anim) {
|
||||
particles_animation = p_particles_anim;
|
||||
_queue_shader_change();
|
||||
notify_property_list_changed();
|
||||
}
|
||||
|
||||
bool CanvasItemMaterial::get_particles_animation() const {
|
||||
return particles_animation;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::set_particles_anim_h_frames(int p_frames) {
|
||||
particles_anim_h_frames = p_frames;
|
||||
RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_h_frames, p_frames);
|
||||
}
|
||||
|
||||
int CanvasItemMaterial::get_particles_anim_h_frames() const {
|
||||
return particles_anim_h_frames;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::set_particles_anim_v_frames(int p_frames) {
|
||||
particles_anim_v_frames = p_frames;
|
||||
RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_v_frames, p_frames);
|
||||
}
|
||||
|
||||
int CanvasItemMaterial::get_particles_anim_v_frames() const {
|
||||
return particles_anim_v_frames;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::set_particles_anim_loop(bool p_loop) {
|
||||
particles_anim_loop = p_loop;
|
||||
RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_loop, particles_anim_loop);
|
||||
}
|
||||
|
||||
bool CanvasItemMaterial::get_particles_anim_loop() const {
|
||||
return particles_anim_loop;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name.begins_with("particles_anim_") && !particles_animation) {
|
||||
property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
RID CanvasItemMaterial::get_shader_rid() const {
|
||||
ERR_FAIL_COND_V(!shader_map.has(current_key), RID());
|
||||
return shader_map[current_key].shader;
|
||||
}
|
||||
|
||||
Shader::Mode CanvasItemMaterial::get_shader_mode() const {
|
||||
return Shader::MODE_CANVAS_ITEM;
|
||||
}
|
||||
|
||||
void CanvasItemMaterial::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_blend_mode", "blend_mode"), &CanvasItemMaterial::set_blend_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_blend_mode"), &CanvasItemMaterial::get_blend_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_light_mode", "light_mode"), &CanvasItemMaterial::set_light_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_light_mode"), &CanvasItemMaterial::get_light_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_particles_animation", "particles_anim"), &CanvasItemMaterial::set_particles_animation);
|
||||
ClassDB::bind_method(D_METHOD("get_particles_animation"), &CanvasItemMaterial::get_particles_animation);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_particles_anim_h_frames", "frames"), &CanvasItemMaterial::set_particles_anim_h_frames);
|
||||
ClassDB::bind_method(D_METHOD("get_particles_anim_h_frames"), &CanvasItemMaterial::get_particles_anim_h_frames);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_particles_anim_v_frames", "frames"), &CanvasItemMaterial::set_particles_anim_v_frames);
|
||||
ClassDB::bind_method(D_METHOD("get_particles_anim_v_frames"), &CanvasItemMaterial::get_particles_anim_v_frames);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_particles_anim_loop", "loop"), &CanvasItemMaterial::set_particles_anim_loop);
|
||||
ClassDB::bind_method(D_METHOD("get_particles_anim_loop"), &CanvasItemMaterial::get_particles_anim_loop);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Subtract,Multiply,Premultiplied Alpha"), "set_blend_mode", "get_blend_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mode", PROPERTY_HINT_ENUM, "Normal,Unshaded,Light Only"), "set_light_mode", "get_light_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "particles_animation"), "set_particles_animation", "get_particles_animation");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_h_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_h_frames", "get_particles_anim_h_frames");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_v_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_v_frames", "get_particles_anim_v_frames");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "particles_anim_loop"), "set_particles_anim_loop", "get_particles_anim_loop");
|
||||
|
||||
BIND_ENUM_CONSTANT(BLEND_MODE_MIX);
|
||||
BIND_ENUM_CONSTANT(BLEND_MODE_ADD);
|
||||
BIND_ENUM_CONSTANT(BLEND_MODE_SUB);
|
||||
BIND_ENUM_CONSTANT(BLEND_MODE_MUL);
|
||||
BIND_ENUM_CONSTANT(BLEND_MODE_PREMULT_ALPHA);
|
||||
|
||||
BIND_ENUM_CONSTANT(LIGHT_MODE_NORMAL);
|
||||
BIND_ENUM_CONSTANT(LIGHT_MODE_UNSHADED);
|
||||
BIND_ENUM_CONSTANT(LIGHT_MODE_LIGHT_ONLY);
|
||||
}
|
||||
|
||||
CanvasItemMaterial::CanvasItemMaterial() :
|
||||
element(this) {
|
||||
set_particles_anim_h_frames(1);
|
||||
set_particles_anim_v_frames(1);
|
||||
set_particles_anim_loop(false);
|
||||
|
||||
current_key.invalid_key = 1;
|
||||
_queue_shader_change();
|
||||
}
|
||||
|
||||
CanvasItemMaterial::~CanvasItemMaterial() {
|
||||
MutexLock lock(material_mutex);
|
||||
|
||||
if (shader_map.has(current_key)) {
|
||||
shader_map[current_key].users--;
|
||||
if (shader_map[current_key].users == 0) {
|
||||
//deallocate shader, as it's no longer in use
|
||||
RS::get_singleton()->free(shader_map[current_key].shader);
|
||||
shader_map.erase(current_key);
|
||||
}
|
||||
|
||||
RS::get_singleton()->material_set_shader(_get_material(), RID());
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
#ifdef TOOLS_ENABLED
|
||||
bool CanvasItem::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
|
||||
if (_edit_use_rect()) {
|
||||
|
|
|
@ -33,132 +33,15 @@
|
|||
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/multimesh.h"
|
||||
#include "scene/resources/shader.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "scene/resources/canvas_item_material.h"
|
||||
#include "servers/text_server.h"
|
||||
|
||||
class CanvasLayer;
|
||||
class Viewport;
|
||||
class Font;
|
||||
|
||||
class MultiMesh;
|
||||
class StyleBox;
|
||||
|
||||
class CanvasItemMaterial : public Material {
|
||||
GDCLASS(CanvasItemMaterial, Material);
|
||||
|
||||
public:
|
||||
enum BlendMode {
|
||||
BLEND_MODE_MIX,
|
||||
BLEND_MODE_ADD,
|
||||
BLEND_MODE_SUB,
|
||||
BLEND_MODE_MUL,
|
||||
BLEND_MODE_PREMULT_ALPHA,
|
||||
BLEND_MODE_DISABLED
|
||||
};
|
||||
|
||||
enum LightMode {
|
||||
LIGHT_MODE_NORMAL,
|
||||
LIGHT_MODE_UNSHADED,
|
||||
LIGHT_MODE_LIGHT_ONLY
|
||||
};
|
||||
|
||||
private:
|
||||
union MaterialKey {
|
||||
struct {
|
||||
uint32_t blend_mode : 4;
|
||||
uint32_t light_mode : 4;
|
||||
uint32_t particles_animation : 1;
|
||||
uint32_t invalid_key : 1;
|
||||
};
|
||||
|
||||
uint32_t key = 0;
|
||||
|
||||
bool operator<(const MaterialKey &p_key) const {
|
||||
return key < p_key.key;
|
||||
}
|
||||
};
|
||||
|
||||
struct ShaderNames {
|
||||
StringName particles_anim_h_frames;
|
||||
StringName particles_anim_v_frames;
|
||||
StringName particles_anim_loop;
|
||||
};
|
||||
|
||||
static ShaderNames *shader_names;
|
||||
|
||||
struct ShaderData {
|
||||
RID shader;
|
||||
int users = 0;
|
||||
};
|
||||
|
||||
static Map<MaterialKey, ShaderData> shader_map;
|
||||
|
||||
MaterialKey current_key;
|
||||
|
||||
_FORCE_INLINE_ MaterialKey _compute_key() const {
|
||||
MaterialKey mk;
|
||||
mk.key = 0;
|
||||
mk.blend_mode = blend_mode;
|
||||
mk.light_mode = light_mode;
|
||||
mk.particles_animation = particles_animation;
|
||||
return mk;
|
||||
}
|
||||
|
||||
static Mutex material_mutex;
|
||||
static SelfList<CanvasItemMaterial>::List *dirty_materials;
|
||||
SelfList<CanvasItemMaterial> element;
|
||||
|
||||
void _update_shader();
|
||||
_FORCE_INLINE_ void _queue_shader_change();
|
||||
_FORCE_INLINE_ bool _is_shader_dirty() const;
|
||||
|
||||
BlendMode blend_mode = BLEND_MODE_MIX;
|
||||
LightMode light_mode = LIGHT_MODE_NORMAL;
|
||||
bool particles_animation = false;
|
||||
|
||||
// Initialized in the constructor.
|
||||
int particles_anim_h_frames;
|
||||
int particles_anim_v_frames;
|
||||
bool particles_anim_loop;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
|
||||
public:
|
||||
void set_blend_mode(BlendMode p_blend_mode);
|
||||
BlendMode get_blend_mode() const;
|
||||
|
||||
void set_light_mode(LightMode p_light_mode);
|
||||
LightMode get_light_mode() const;
|
||||
|
||||
void set_particles_animation(bool p_particles_anim);
|
||||
bool get_particles_animation() const;
|
||||
|
||||
void set_particles_anim_h_frames(int p_frames);
|
||||
int get_particles_anim_h_frames() const;
|
||||
void set_particles_anim_v_frames(int p_frames);
|
||||
int get_particles_anim_v_frames() const;
|
||||
|
||||
void set_particles_anim_loop(bool p_loop);
|
||||
bool get_particles_anim_loop() const;
|
||||
|
||||
static void init_shaders();
|
||||
static void finish_shaders();
|
||||
static void flush_changes();
|
||||
|
||||
virtual RID get_shader_rid() const override;
|
||||
|
||||
virtual Shader::Mode get_shader_mode() const override;
|
||||
|
||||
CanvasItemMaterial();
|
||||
virtual ~CanvasItemMaterial();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(CanvasItemMaterial::BlendMode)
|
||||
VARIANT_ENUM_CAST(CanvasItemMaterial::LightMode)
|
||||
class Window;
|
||||
class World2D;
|
||||
|
||||
class CanvasItem : public Node {
|
||||
GDCLASS(CanvasItem, Node);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define CANVAS_LAYER_H
|
||||
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
|
||||
class Viewport;
|
||||
class CanvasLayer : public Node {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "http_request.h"
|
||||
#include "core/io/compression.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "scene/main/timer.h"
|
||||
|
||||
void HTTPRequest::_redirect_request(const String &p_new_url) {
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue