@@ -2,7 +2,6 @@ use std::mem;
2
2
3
3
use bevy_app:: { CoreSet , IntoSystemAppConfig , Plugin } ;
4
4
use bevy_asset:: { load_internal_asset, Assets , Handle , HandleUntyped } ;
5
- use bevy_core_pipeline:: { core_2d, core_3d} ;
6
5
use bevy_ecs:: {
7
6
prelude:: { Component , DetectChanges } ,
8
7
schedule:: IntoSystemConfig ,
@@ -13,8 +12,7 @@ use bevy_math::Mat4;
13
12
use bevy_reflect:: TypeUuid ;
14
13
use bevy_render:: {
15
14
mesh:: Mesh ,
16
- render_graph:: RenderGraph ,
17
- render_phase:: { sort_phase_system, AddRenderCommand , DrawFunctions } ,
15
+ render_phase:: AddRenderCommand ,
18
16
render_resource:: { PrimitiveTopology , Shader , SpecializedMeshPipelines } ,
19
17
Extract , ExtractSchedule , RenderApp , RenderSet ,
20
18
} ;
@@ -26,15 +24,12 @@ use bevy_sprite::{Mesh2dHandle, Mesh2dUniform};
26
24
27
25
pub mod gizmos;
28
26
29
- mod node_2d;
30
- mod node_3d;
31
-
32
27
#[ cfg( feature = "bevy_sprite" ) ]
33
28
mod pipeline_2d;
34
29
#[ cfg( feature = "bevy_pbr" ) ]
35
30
mod pipeline_3d;
36
31
37
- use crate :: { gizmos:: GizmoStorage , node_2d :: GizmoNode2d , node_3d :: GizmoNode3d } ;
32
+ use crate :: gizmos:: GizmoStorage ;
38
33
39
34
/// The `bevy_gizmos` prelude.
40
35
pub mod prelude {
@@ -62,64 +57,26 @@ impl Plugin for GizmoPlugin {
62
57
63
58
#[ cfg( feature = "bevy_sprite" ) ]
64
59
{
60
+ use bevy_core_pipeline:: core_2d:: Transparent2d ;
65
61
use pipeline_2d:: * ;
66
62
67
63
render_app
68
- . init_resource :: < GizmoPipeline2d > ( )
69
- . init_resource :: < SpecializedMeshPipelines < GizmoPipeline2d > > ( )
70
- . init_resource :: < DrawFunctions < GizmoLine2d > > ( )
71
- . add_render_command :: < GizmoLine2d , DrawGizmoLines > ( )
72
- . add_system ( sort_phase_system :: < GizmoLine2d > )
73
- . add_system_to_schedule ( ExtractSchedule , extract_gizmo_line_2d_camera_phase)
64
+ . add_render_command :: < Transparent2d , DrawGizmoLines > ( )
65
+ . init_resource :: < GizmoLinePipeline > ( )
66
+ . init_resource :: < SpecializedMeshPipelines < GizmoLinePipeline > > ( )
74
67
. add_system ( queue_gizmos_2d. in_set ( RenderSet :: Queue ) ) ;
75
-
76
- let gizmo_node = GizmoNode2d :: new ( & mut render_app. world ) ;
77
- let mut binding = render_app. world . resource_mut :: < RenderGraph > ( ) ;
78
- let graph = binding. get_sub_graph_mut ( core_2d:: graph:: NAME ) . unwrap ( ) ;
79
-
80
- graph. add_node ( GizmoNode2d :: NAME , gizmo_node) ;
81
- graph. add_slot_edge (
82
- graph. input_node ( ) . id ,
83
- core_2d:: graph:: input:: VIEW_ENTITY ,
84
- GizmoNode2d :: NAME ,
85
- GizmoNode2d :: IN_VIEW ,
86
- ) ;
87
- graph. add_node_edge (
88
- core_2d:: graph:: node:: END_MAIN_PASS_POST_PROCESSING ,
89
- GizmoNode2d :: NAME ,
90
- ) ;
91
- graph. add_node_edge ( GizmoNode2d :: NAME , core_2d:: graph:: node:: UPSCALING ) ;
92
68
}
93
69
94
70
#[ cfg( feature = "bevy_pbr" ) ]
95
71
{
72
+ use bevy_core_pipeline:: core_3d:: Opaque3d ;
96
73
use pipeline_3d:: * ;
97
74
98
75
render_app
99
- . init_resource :: < GizmoPipeline3d > ( )
100
- . init_resource :: < SpecializedMeshPipelines < GizmoPipeline3d > > ( )
101
- . init_resource :: < DrawFunctions < GizmoLine3d > > ( )
102
- . add_render_command :: < GizmoLine3d , DrawGizmoLines > ( )
103
- . add_system ( sort_phase_system :: < GizmoLine3d > )
104
- . add_system_to_schedule ( ExtractSchedule , extract_gizmo_line_3d_camera_phase)
76
+ . add_render_command :: < Opaque3d , DrawGizmoLines > ( )
77
+ . init_resource :: < GizmoPipeline > ( )
78
+ . init_resource :: < SpecializedMeshPipelines < GizmoPipeline > > ( )
105
79
. add_system ( queue_gizmos_3d. in_set ( RenderSet :: Queue ) ) ;
106
-
107
- let gizmo_node = GizmoNode3d :: new ( & mut render_app. world ) ;
108
- let mut binding = render_app. world . resource_mut :: < RenderGraph > ( ) ;
109
- let graph = binding. get_sub_graph_mut ( core_3d:: graph:: NAME ) . unwrap ( ) ;
110
-
111
- graph. add_node ( GizmoNode3d :: NAME , gizmo_node) ;
112
- graph. add_slot_edge (
113
- graph. input_node ( ) . id ,
114
- core_3d:: graph:: input:: VIEW_ENTITY ,
115
- GizmoNode3d :: NAME ,
116
- GizmoNode3d :: IN_VIEW ,
117
- ) ;
118
- graph. add_node_edge (
119
- core_3d:: graph:: node:: END_MAIN_PASS_POST_PROCESSING ,
120
- GizmoNode3d :: NAME ,
121
- ) ;
122
- graph. add_node_edge ( GizmoNode3d :: NAME , core_3d:: graph:: node:: UPSCALING ) ;
123
80
}
124
81
}
125
82
}
0 commit comments