Debian Codegraph @

editor/scene/3d/gizmos/spring_bone_3d_gizmo_plugin.h

raw symbols SCIP
1 /**************************************************************************/
2 /* spring_bone_3d_gizmo_plugin.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 "editor/plugins/editor_plugin.h"
34 #include "editor/scene/3d/node_3d_editor_plugin.h"
35 #include "scene/3d/spring_bone_collision_3d.h"
36 #include "scene/3d/spring_bone_simulator_3d.h"
37 #include "scene/resources/surface_tool.h"
38
39 class SpringBoneSimulator3DGizmoPlugin : public EditorNode3DGizmoPlugin {
40 GDCLASS(SpringBoneSimulator3DGizmoPlugin, EditorNode3DGizmoPlugin);
41
42 struct SelectionMaterials {
43 Ref<StandardMaterial3D> unselected_mat;
44 Ref<ShaderMaterial> selected_mat;
45 };
46 static SelectionMaterials selection_materials;
47
48 public:
49 static Ref<ArrayMesh> get_joints_mesh(Skeleton3D *p_skeleton, SpringBoneSimulator3D *p_simulator, bool p_is_selected);
50 static void draw_sphere(Ref<SurfaceTool> &p_surface_tool, const Basis &p_basis, const Vector3 &p_center, float p_radius, const Color &p_color);
51 static void draw_line(Ref<SurfaceTool> &p_surface_tool, const Vector3 &p_begin_pos, const Vector3 &p_end_pos, const Color &p_color);
52
53 bool has_gizmo(Node3D *p_spatial) override;
54 String get_gizmo_name() const override;
55 int get_priority() const override;
56
57 void redraw(EditorNode3DGizmo *p_gizmo) override;
58
59 SpringBoneSimulator3DGizmoPlugin();
60 ~SpringBoneSimulator3DGizmoPlugin();
61 };
62
63 class SpringBoneCollision3DGizmoPlugin : public EditorNode3DGizmoPlugin {
64 GDCLASS(SpringBoneCollision3DGizmoPlugin, EditorNode3DGizmoPlugin);
65
66 struct SelectionMaterials {
67 Ref<StandardMaterial3D> unselected_mat;
68 Ref<ShaderMaterial> selected_mat;
69 };
70 static SelectionMaterials selection_materials;
71
72 public:
73 static Ref<ArrayMesh> get_collision_mesh(SpringBoneCollision3D *p_collision, bool p_is_selected);
74 static void draw_sphere(Ref<SurfaceTool> &p_surface_tool, float p_radius, const Color &p_color);
75 static void draw_capsule(Ref<SurfaceTool> &p_surface_tool, float p_radius, float p_height, const Color &p_color);
76 static void draw_plane(Ref<SurfaceTool> &p_surface_tool, const Color &p_color);
77
78 bool has_gizmo(Node3D *p_spatial) override;
79 String get_gizmo_name() const override;
80 int get_priority() const override;
81
82 void redraw(EditorNode3DGizmo *p_gizmo) override;
83
84 SpringBoneCollision3DGizmoPlugin();
85 ~SpringBoneCollision3DGizmoPlugin();
86 };