@@ -97,8 +97,7 @@ impl Attribute {
9797#[ pyclass( unsendable) ]
9898pub struct Particles {
9999 pub ( crate ) entity : Entity ,
100- /// Name → (entity, format) so `emit(**kwargs)` can route kwargs to the
101- /// right attribute and pack them into bytes.
100+ // name → (entity, format), used by `emit(**kwargs)` to route kwargs and pack bytes
102101 name_to_attr : HashMap < String , ( Entity , AttributeFormat ) > ,
103102}
104103
@@ -116,8 +115,7 @@ impl Particles {
116115
117116#[ pymethods]
118117impl Particles {
119- /// Pass `capacity` for empty buffers, or `geometry` to seed positions
120- /// (and matching attributes) from a source mesh. Exactly one is required.
118+ /// Pass `capacity` for empty buffers, or `geometry` to seed from a source mesh.
121119 #[ new]
122120 #[ pyo3( signature = ( capacity=None , attributes=None , geometry=None ) ) ]
123121 pub fn new (
@@ -161,8 +159,6 @@ impl Particles {
161159 }
162160
163161 /// Backing `Buffer` for a registered attribute, or `None` if not registered.
164- /// The element type matches the attribute's format so `read()` returns
165- /// typed values.
166162 pub fn buffer ( & self , attribute : & Attribute ) -> PyResult < Option < Buffer > > {
167163 let buf = particles_buffer ( self . entity , attribute. entity )
168164 . map_err ( |e| PyRuntimeError :: new_err ( format ! ( "{e}" ) ) ) ?;
@@ -177,13 +173,8 @@ impl Particles {
177173 Ok ( buf. map ( |e| Buffer :: from_entity ( e, Some ( element_type) ) ) )
178174 }
179175
180- /// Dispatch a compute kernel against these particles' buffers. Buffers
181- /// are auto-bound by attribute name; kwargs are forwarded to
182- /// `compute.set(...)`. For example:
183- ///
184- /// ```python
185- /// p.apply(noise, scale=0.25, strength=0.02, time=t)
186- /// ```
176+ /// Dispatch a compute kernel against these particles' buffers. Buffers are
177+ /// auto-bound by attribute name; kwargs are forwarded to `compute.set(...)`.
187178 #[ pyo3( signature = ( compute, * * kwargs) ) ]
188179 pub fn apply (
189180 & self ,
@@ -198,12 +189,8 @@ impl Particles {
198189 }
199190
200191 /// Emit `n` particles into the next ring-buffer slots. Per-attribute data
201- /// is passed as kwargs keyed by attribute name; each value is a flat list
202- /// of `n * format.float_count()` floats.
203- ///
204- /// ```python
205- /// p.emit(50, position=[x0,y0,z0, x1,y1,z1, ...], color=[r0,g0,b0,a0, ...])
206- /// ```
192+ /// is a kwarg keyed by attribute name; each value is a flat list of
193+ /// `n * format.float_count()` floats.
207194 #[ pyo3( signature = ( n, * * kwargs) ) ]
208195 pub fn emit ( & self , n : u32 , kwargs : Option < & Bound < ' _ , PyDict > > ) -> PyResult < ( ) > {
209196 let Some ( kwargs) = kwargs else {
@@ -235,9 +222,8 @@ impl Particles {
235222 . map_err ( |e| PyRuntimeError :: new_err ( format ! ( "{e}" ) ) )
236223 }
237224
238- /// Emit `n` particles via a GPU kernel. Buffer bindings and a
239- /// `emit_range: vec4<f32> = (base_slot, n, capacity, 0)` uniform are
240- /// auto-bound; set any other uniforms via `compute.set(...)` first.
225+ /// Emit `n` particles via a GPU kernel. Auto-binds buffers and an
226+ /// `emit_range: vec4<f32> = (base_slot, n, capacity, 0)` uniform.
241227 pub fn emit_gpu ( & self , n : u32 , compute : & Compute ) -> PyResult < ( ) > {
242228 particles_emit_gpu ( self . entity , n, compute. entity )
243229 . map_err ( |e| PyRuntimeError :: new_err ( format ! ( "{e}" ) ) )
@@ -257,8 +243,7 @@ pub fn kernel_noise() -> PyResult<Compute> {
257243}
258244
259245/// Built-in transform kernel: scale → axis-angle rotate → translate. Uniforms:
260- /// `translate: vec3`, `rotation_axis: vec3`, `rotation_angle: f32`,
261- /// `scale: vec3`. Identity defaults are seeded so unset uniforms are no-ops.
246+ /// `translate: vec3`, `rotation_axis: vec3`, `rotation_angle: f32`, `scale: vec3`.
262247pub fn kernel_transform ( ) -> PyResult < Compute > {
263248 let entity = particles_kernel_transform ( ) . map_err ( |e| PyRuntimeError :: new_err ( format ! ( "{e}" ) ) ) ?;
264249 Ok ( Compute :: from_entity ( entity) )
0 commit comments