File tree 4 files changed +22
-7
lines changed
bevy_render/src/mesh/mesh
4 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ pub(crate) fn convert_attribute(
263
263
gltf:: Semantic :: Tangents => Some ( ( Mesh :: ATTRIBUTE_TANGENT , ConversionMode :: Any ) ) ,
264
264
gltf:: Semantic :: Colors ( 0 ) => Some ( ( Mesh :: ATTRIBUTE_COLOR , ConversionMode :: Rgba ) ) ,
265
265
gltf:: Semantic :: TexCoords ( 0 ) => Some ( ( Mesh :: ATTRIBUTE_UV_0 , ConversionMode :: TexCoord ) ) ,
266
+ gltf:: Semantic :: TexCoords ( 1 ) => Some ( ( Mesh :: ATTRIBUTE_UV_1 , ConversionMode :: TexCoord ) ) ,
266
267
gltf:: Semantic :: Joints ( 0 ) => {
267
268
Some ( ( Mesh :: ATTRIBUTE_JOINT_INDEX , ConversionMode :: JointIndex ) )
268
269
}
Original file line number Diff line number Diff line change @@ -779,14 +779,19 @@ impl SpecializedMeshPipeline for MeshPipeline {
779
779
vertex_attributes. push ( Mesh :: ATTRIBUTE_UV_0 . at_shader_location ( 2 ) ) ;
780
780
}
781
781
782
+ if layout. contains ( Mesh :: ATTRIBUTE_UV_1 ) {
783
+ shader_defs. push ( "VERTEX_UVS_1" . into ( ) ) ;
784
+ vertex_attributes. push ( Mesh :: ATTRIBUTE_UV_1 . at_shader_location ( 3 ) ) ;
785
+ }
786
+
782
787
if layout. contains ( Mesh :: ATTRIBUTE_TANGENT ) {
783
788
shader_defs. push ( "VERTEX_TANGENTS" . into ( ) ) ;
784
- vertex_attributes. push ( Mesh :: ATTRIBUTE_TANGENT . at_shader_location ( 3 ) ) ;
789
+ vertex_attributes. push ( Mesh :: ATTRIBUTE_TANGENT . at_shader_location ( 4 ) ) ;
785
790
}
786
791
787
792
if layout. contains ( Mesh :: ATTRIBUTE_COLOR ) {
788
793
shader_defs. push ( "VERTEX_COLORS" . into ( ) ) ;
789
- vertex_attributes. push ( Mesh :: ATTRIBUTE_COLOR . at_shader_location ( 4 ) ) ;
794
+ vertex_attributes. push ( Mesh :: ATTRIBUTE_COLOR . at_shader_location ( 5 ) ) ;
790
795
}
791
796
792
797
let mut bind_group_layout = match key. msaa_samples ( ) {
@@ -800,7 +805,7 @@ impl SpecializedMeshPipeline for MeshPipeline {
800
805
bind_group_layout. push ( setup_morph_and_skinning_defs (
801
806
& self . mesh_layouts ,
802
807
layout,
803
- 5 ,
808
+ 6 ,
804
809
& key,
805
810
& mut shader_defs,
806
811
& mut vertex_attributes,
Original file line number Diff line number Diff line change @@ -16,15 +16,16 @@ struct Vertex {
16
16
#ifdef VERTEX_UVS
17
17
@location (2 ) uv : vec2 <f32 >,
18
18
#endif
19
+ // (Alternate UVs are at location 3, but they're currently unused here.)
19
20
#ifdef VERTEX_TANGENTS
20
- @location (3 ) tangent : vec4 <f32 >,
21
+ @location (4 ) tangent : vec4 <f32 >,
21
22
#endif
22
23
#ifdef VERTEX_COLORS
23
- @location (4 ) color : vec4 <f32 >,
24
+ @location (5 ) color : vec4 <f32 >,
24
25
#endif
25
26
#ifdef SKINNED
26
- @location (5 ) joint_indices : vec4 <u32 >,
27
- @location (6 ) joint_weights : vec4 <f32 >,
27
+ @location (6 ) joint_indices : vec4 <u32 >,
28
+ @location (7 ) joint_weights : vec4 <f32 >,
28
29
#endif
29
30
#ifdef MORPH_TARGETS
30
31
@builtin (vertex_index ) index : u32 ,
Original file line number Diff line number Diff line change @@ -146,6 +146,14 @@ impl Mesh {
146
146
pub const ATTRIBUTE_UV_0 : MeshVertexAttribute =
147
147
MeshVertexAttribute :: new ( "Vertex_Uv" , 2 , VertexFormat :: Float32x2 ) ;
148
148
149
+ /// Alternate texture coordinates for the vertex. Use in conjuction with
150
+ /// [`Mesh::insert_attribute`].
151
+ ///
152
+ /// Typically, these are used for lightmaps, textures that provide
153
+ /// precomputed illumination.
154
+ pub const ATTRIBUTE_UV_1 : MeshVertexAttribute =
155
+ MeshVertexAttribute :: new ( "Vertex_Uv_1" , 2 , VertexFormat :: Float32x2 ) ;
156
+
149
157
/// The direction of the vertex tangent. Used for normal mapping.
150
158
/// Usually generated with [`generate_tangents`](Mesh::generate_tangents).
151
159
pub const ATTRIBUTE_TANGENT : MeshVertexAttribute =
You can’t perform that action at this time.
0 commit comments