Skip to content

Commit 62c22ac

Browse files
committed
Docs
1 parent bacf0da commit 62c22ac

File tree

10 files changed

+45
-21
lines changed

10 files changed

+45
-21
lines changed

crates/bevy_core_pipeline/src/core_3d/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,12 @@ pub fn prepare_core_3d_depth_textures(
846846
}
847847
}
848848

849+
/// A material can specify [`MaterialProperties:reads_view_transmission_texture`] to read from [`ViewTransmissionTexture`].
850+
///
851+
/// This allows taking color output from the [`Opaque3d`] pass as an input, (for screen-space transmission) but requires
852+
/// rendering to take place in a separate [`Transmissive3d`] pass.
853+
///
854+
/// [MaterialProperties]: bevy_material::material::MaterialProperties
849855
#[derive(Component)]
850856
pub struct ViewTransmissionTexture {
851857
pub texture: Texture,

crates/bevy_material/src/material.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use smallvec::SmallVec;
2222

2323
pub const MATERIAL_BIND_GROUP_INDEX: usize = 3;
2424

25-
/// Render pipeline data for a given [`Material`].
25+
/// Render pipeline data for a given material.
2626
#[derive(Resource, Clone)]
2727
pub struct MaterialPipeline {
2828
pub mesh_pipeline: MeshPipeline,
@@ -114,7 +114,7 @@ impl Default for ErasedMaterialKey {
114114
}
115115
}
116116

117-
/// Common [`Material`] properties, calculated for a specific material instance.
117+
/// Common material properties, calculated for a specific material instance.
118118
#[derive(Default)]
119119
pub struct MaterialProperties {
120120
/// Is this material should be rendered by the deferred renderer when.
@@ -124,17 +124,16 @@ pub struct MaterialProperties {
124124
pub alpha_mode: AlphaMode,
125125
/// The bits in the [`MeshPipelineKey`] for this material.
126126
///
127-
/// These are precalculated so that we can just "or" them together in
128-
/// [`queue_material_meshes`].
127+
/// These are precalculated so that we can just "or" them together.
129128
pub mesh_pipeline_key_bits: MeshPipelineKey,
130129
/// Add a bias to the view depth of the mesh which can be used to force a specific render order
131130
/// for meshes with equal depth, to avoid z-fighting.
132131
/// The bias is in depth-texture units so large values may be needed to overcome small depth differences.
133132
pub depth_bias: f32,
134-
/// Whether the material would like to read from [`ViewTransmissionTexture`](bevy_core_pipeline::core_3d::ViewTransmissionTexture).
133+
/// Whether the material would like to read from a view transmission texture
135134
///
136-
/// This allows taking color output from the [`Opaque3d`] pass as an input, (for screen-space transmission) but requires
137-
/// rendering to take place in a separate [`Transmissive3d`] pass.
135+
/// This allows taking color output from the opaque 3d pass as an input, (for screen-space transmission) but requires
136+
/// rendering to take place in a separate transmissive 3d pass.
138137
pub reads_view_transmission_texture: bool,
139138
pub render_phase_type: RenderPhaseType,
140139
pub material_layout: Option<BindGroupLayoutDescriptor>,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::{fmt::Debug, hash::Hash};
22

33
// TODO: make this generic?
4-
/// An identifier for a [`Draw`] function stored in [`DrawFunctions`].
4+
/// An identifier for a draw functions stored.
55
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
66
pub struct DrawFunctionId(pub u32);

crates/bevy_pbr/src/material.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ pub use bevy_material::material::*;
7272
/// Materials must implement [`AsBindGroup`] to define how data will be transferred to the GPU and bound in shaders.
7373
/// [`AsBindGroup`] can be derived, which makes generating bindings straightforward. See the [`AsBindGroup`] docs for details.
7474
///
75+
/// Doc refs [MaterialPipline], [`MaterialProperties`]
76+
///
77+
/// [MaterialPipeline]: bevy_material::material::MaterialPipeline
78+
///
7579
/// # Example
7680
///
7781
/// Here is a simple [`Material`] implementation. The [`AsBindGroup`] derive has many features. To see what else is available,
@@ -1152,6 +1156,8 @@ pub fn specialize_material_meshes(
11521156

11531157
/// For each view, iterates over all the meshes visible from that view and adds
11541158
/// them to [`BinnedRenderPhase`]s or [`SortedRenderPhase`]s as appropriate.
1159+
///
1160+
/// Uses data from [`RenderMeshQueueData`] in order to place entities that contain meshes in the right batch.
11551161
pub fn queue_material_meshes(
11561162
render_materials: Res<ErasedRenderAssets<PreparedMaterial>>,
11571163
render_mesh_instances: Res<RenderMeshInstances>,

crates/bevy_pbr/src/pbr_material.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ pub enum UvChannel {
2727
/// <https://google.github.io/filament/notes/material_properties.html>.
2828
///
2929
/// May be created directly from a [`Color`] or an [`Image`].
30+
///
31+
/// When a [`Lightmap`] is assigned to an entity that contains a [`Mesh3d`](bevy_mesh::Mesh3d) and a
32+
/// [`MeshMaterial3d<StandardMaterial>`](crate::StandardMaterial), if the mesh
33+
/// has a second UV layer ([`ATTRIBUTE_UV_1`](bevy_mesh::Mesh::ATTRIBUTE_UV_1)),
34+
/// then the lightmap will render using those UVs.
3035
#[derive(Asset, AsBindGroup, Reflect, Debug, Clone)]
3136
#[bind_group_data(StandardMaterialKey)]
3237
#[data(0, StandardMaterialUniform, binding_array(10))]

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ impl RenderMeshInstanceGpuQueue {
617617
impl RenderMeshInstanceGpuBuilder {
618618
/// Flushes this mesh instance to the [`RenderMeshInstanceGpu`] and
619619
/// [`MeshInputUniform`] tables, replacing the existing entry if applicable.
620+
///
621+
/// Provides the mesh instance id for [`RenderMeshInstanceShared:for_gpu_building`]
620622
fn update(
621623
mut self,
622624
entity: MainEntity,

crates/bevy_render/src/lightmap/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ pub const LIGHTMAPS_PER_SLAB: usize = 4;
3535

3636
/// A component that applies baked indirect diffuse global illumination from a
3737
/// lightmap.
38-
///
39-
/// When assigned to an entity that contains a [`Mesh3d`](bevy_mesh::Mesh3d) and a
40-
/// [`MeshMaterial3d<StandardMaterial>`](crate::StandardMaterial), if the mesh
41-
/// has a second UV layer ([`ATTRIBUTE_UV_1`](bevy_mesh::Mesh::ATTRIBUTE_UV_1)),
42-
/// then the lightmap will render using those UVs.
4338
#[derive(Component, Clone, Reflect)]
4439
#[reflect(Component, Default, Clone)]
4540
pub struct Lightmap {

crates/bevy_render/src/mesh/allocator.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ pub struct MeshAllocatorPlugin;
5252
/// The [`MeshAllocatorSettings`] allows you to tune the behavior of the
5353
/// allocator for better performance with your application. Most applications
5454
/// won't need to change the settings from their default values.
55+
///
56+
/// Multiple meshes can be packed into a single vertex buffer.
57+
///
58+
/// [`MeshUniform:first_vertex_index`] stores the offset of the first vertex in
59+
/// this mesh in that buffer.
60+
///
61+
/// [`MeshInputUniform:first_vertex_index`] stores the offset of the first vertex in
62+
/// this mesh in that buffer.
63+
///
64+
/// [`MeshInputUniform:first_index_index`] stores the offset of the first index in
65+
/// this mesh in that buffer.
5566
#[derive(Resource)]
5667
pub struct MeshAllocator {
5768
/// Holds all buffers and allocators.

crates/bevy_render/src/mesh/render.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub struct MeshUniform {
5353
/// The index of this mesh's first vertex in the vertex buffer.
5454
///
5555
/// Multiple meshes can be packed into a single vertex buffer (see
56-
/// [`MeshAllocator`]). This value stores the offset of the first vertex in
56+
/// mesh allocator). This value stores the offset of the first vertex in
5757
/// this mesh in that buffer.
5858
pub first_vertex_index: u32,
5959
/// The current skin index, or `u32::MAX` if there's no skin.
@@ -100,13 +100,13 @@ pub struct MeshInputUniform {
100100
/// The index of this mesh's first vertex in the vertex buffer.
101101
///
102102
/// Multiple meshes can be packed into a single vertex buffer (see
103-
/// [`MeshAllocator`]). This value stores the offset of the first vertex in
103+
/// mesh allocator). This value stores the offset of the first vertex in
104104
/// this mesh in that buffer.
105105
pub first_vertex_index: u32,
106106
/// The index of this mesh's first index in the index buffer, if any.
107107
///
108108
/// Multiple meshes can be packed into a single index buffer (see
109-
/// [`MeshAllocator`]). This value stores the offset of the first index in
109+
/// mesh allocator). This value stores the offset of the first index in
110110
/// this mesh in that buffer.
111111
///
112112
/// If this mesh isn't indexed, this value is ignored.
@@ -306,7 +306,6 @@ pub struct RenderMeshInstanceShared {
306306

307307
impl RenderMeshInstanceShared {
308308
/// A gpu builder will provide the mesh instance id
309-
/// during [`RenderMeshInstanceGpuBuilder::update`].
310309
pub fn for_gpu_building(
311310
previous_transform: Option<&PreviousGlobalTransform>,
312311
mesh: &Mesh3d,
@@ -326,7 +325,7 @@ impl RenderMeshInstanceShared {
326325
)
327326
}
328327

329-
/// The cpu builder does not have an equivalent [`RenderMeshInstanceGpuBuilder::update`].
328+
/// The cpu builder does not have an equivalent ?
330329
pub fn for_cpu_building(
331330
previous_transform: Option<&PreviousGlobalTransform>,
332331
mesh: &Mesh3d,
@@ -488,8 +487,7 @@ impl RenderMeshInstancesGpu {
488487
}
489488
}
490489

491-
/// Data that [`crate::material::queue_material_meshes`] and similar systems
492-
/// need in order to place entities that contain meshes in the right batch.
490+
/// Data that systems need in order to place entities that contain meshes in the right batch.
493491
#[derive(Deref)]
494492
pub struct RenderMeshQueueData<'a> {
495493
/// General information about the mesh instance.

crates/bevy_render/src/render_phase/draw.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use variadics_please::all_tuples;
1616

1717
/// A draw function used to draw [`PhaseItem`]s.
1818
///
19+
/// Identified by a [`DrawFunctionId`], stored in [`DrawFunctions`]
20+
///
1921
/// The draw function can retrieve and query the required ECS data from the render world.
2022
///
2123
/// This trait can either be implemented directly or implicitly composed out of multiple modular
@@ -106,7 +108,7 @@ impl<P: PhaseItem> DrawFunctionsInternal<P> {
106108
}
107109
}
108110

109-
/// Stores all draw functions for the [`PhaseItem`] type hidden behind a reader-writer lock.
111+
/// Stores all [`Draw`] functions for the [`PhaseItem`] type hidden behind a reader-writer lock.
110112
///
111113
/// To access them the [`DrawFunctions::read`] and [`DrawFunctions::write`] methods are used.
112114
#[derive(Resource)]

0 commit comments

Comments
 (0)