@@ -210,6 +210,10 @@ pub enum VisualOp {
210210 direction : Option < ( WgslValue , WgslValue , WgslValue ) > ,
211211 scale_mul : Option < WgslValue > ,
212212 scale_add : Option < WgslValue > ,
213+ /// Per-axis scale multipliers (Smx/Smy/Smz). Multiply on top of uniform scale.
214+ scale_x_mul : Option < WgslValue > ,
215+ scale_y_mul : Option < WgslValue > ,
216+ scale_z_mul : Option < WgslValue > ,
213217 velocity_mul : Option < WgslValue > ,
214218 velocity_add : Option < WgslValue > ,
215219 /// Bend: (bend_vector_x, bend_vector_y, bend_vector_z, strength)
@@ -253,6 +257,9 @@ impl Default for VisualOp {
253257 direction : None ,
254258 scale_mul : None ,
255259 scale_add : None ,
260+ scale_x_mul : None ,
261+ scale_y_mul : None ,
262+ scale_z_mul : None ,
256263 velocity_mul : None ,
257264 velocity_add : None ,
258265 bend : None ,
@@ -297,6 +304,10 @@ pub struct VisualPointOp {
297304 // Scalar modifiers
298305 pub scale_mul : Rational64 ,
299306 pub scale_add : Rational64 ,
307+ // Per-axis scale multipliers (multiply on top of uniform scale_mul)
308+ pub scale_x_mul : Rational64 ,
309+ pub scale_y_mul : Rational64 ,
310+ pub scale_z_mul : Rational64 ,
300311 pub velocity_mul : Rational64 ,
301312 pub velocity_add : Rational64 ,
302313 pub alpha_mul : Rational64 ,
@@ -321,6 +332,9 @@ impl Default for VisualPointOp {
321332 direction : None ,
322333 scale_mul : Rational64 :: new ( 1 , 1 ) ,
323334 scale_add : Rational64 :: new ( 0 , 1 ) ,
335+ scale_x_mul : Rational64 :: new ( 1 , 1 ) ,
336+ scale_y_mul : Rational64 :: new ( 1 , 1 ) ,
337+ scale_z_mul : Rational64 :: new ( 1 , 1 ) ,
324338 velocity_mul : Rational64 :: new ( 1 , 1 ) ,
325339 velocity_add : Rational64 :: new ( 0 , 1 ) ,
326340 alpha_mul : Rational64 :: new ( 1 , 1 ) ,
@@ -346,6 +360,9 @@ impl Mul for VisualPointOp {
346360 y_mul : self . y_mul * other. y_mul ,
347361 z_mul : self . z_mul * other. z_mul ,
348362 scale_mul : self . scale_mul * other. scale_mul ,
363+ scale_x_mul : self . scale_x_mul * other. scale_x_mul ,
364+ scale_y_mul : self . scale_y_mul * other. scale_y_mul ,
365+ scale_z_mul : self . scale_z_mul * other. scale_z_mul ,
349366 velocity_mul : self . velocity_mul * other. velocity_mul ,
350367 alpha_mul : self . alpha_mul * other. alpha_mul ,
351368
@@ -550,6 +567,15 @@ impl VisualPointOp {
550567 if self . scale_add != Rational64 :: new ( 0 , 1 ) {
551568 lines. push ( format ! ( " scale = scale + {:.6};" , rational_to_f32( self . scale_add) ) ) ;
552569 }
570+ if self . scale_x_mul != Rational64 :: new ( 1 , 1 ) {
571+ lines. push ( format ! ( " scale_vec.x = scale_vec.x * {:.6};" , rational_to_f32( self . scale_x_mul) ) ) ;
572+ }
573+ if self . scale_y_mul != Rational64 :: new ( 1 , 1 ) {
574+ lines. push ( format ! ( " scale_vec.y = scale_vec.y * {:.6};" , rational_to_f32( self . scale_y_mul) ) ) ;
575+ }
576+ if self . scale_z_mul != Rational64 :: new ( 1 , 1 ) {
577+ lines. push ( format ! ( " scale_vec.z = scale_vec.z * {:.6};" , rational_to_f32( self . scale_z_mul) ) ) ;
578+ }
553579 if self . velocity_mul != Rational64 :: new ( 1 , 1 ) {
554580 lines. push ( format ! ( " velocity = velocity * {:.6};" , rational_to_f32( self . velocity_mul) ) ) ;
555581 }
@@ -628,6 +654,9 @@ impl VisualOp {
628654 direction,
629655 scale_mul,
630656 scale_add,
657+ scale_x_mul,
658+ scale_y_mul,
659+ scale_z_mul,
631660 velocity_mul,
632661 velocity_add,
633662 bend,
@@ -677,6 +706,9 @@ impl VisualOp {
677706 direction : dir,
678707 scale_mul : get_rational ( scale_mul, one) ,
679708 scale_add : get_rational ( scale_add, zero) ,
709+ scale_x_mul : get_rational ( scale_x_mul, one) ,
710+ scale_y_mul : get_rational ( scale_y_mul, one) ,
711+ scale_z_mul : get_rational ( scale_z_mul, one) ,
680712 velocity_mul : get_rational ( velocity_mul, one) ,
681713 velocity_add : get_rational ( velocity_add, zero) ,
682714 alpha_mul : get_rational ( alpha_mul, one) ,
@@ -752,6 +784,9 @@ impl VisualOp {
752784 direction,
753785 scale_mul,
754786 scale_add,
787+ scale_x_mul,
788+ scale_y_mul,
789+ scale_z_mul,
755790 velocity_mul,
756791 velocity_add,
757792 bend,
@@ -768,6 +803,9 @@ impl VisualOp {
768803 direction,
769804 scale_mul,
770805 scale_add,
806+ scale_x_mul,
807+ scale_y_mul,
808+ scale_z_mul,
771809 velocity_mul,
772810 velocity_add,
773811 bend,
@@ -831,6 +869,9 @@ impl VisualOp {
831869 direction : dir1,
832870 scale_mul : scale_mul1,
833871 scale_add : scale_add1,
872+ scale_x_mul : scale_x_mul1,
873+ scale_y_mul : scale_y_mul1,
874+ scale_z_mul : scale_z_mul1,
834875 velocity_mul : vel_mul1,
835876 velocity_add : vel_add1,
836877 bend : bend1,
@@ -851,6 +892,9 @@ impl VisualOp {
851892 direction : dir2,
852893 scale_mul : scale_mul2,
853894 scale_add : scale_add2,
895+ scale_x_mul : scale_x_mul2,
896+ scale_y_mul : scale_y_mul2,
897+ scale_z_mul : scale_z_mul2,
854898 velocity_mul : vel_mul2,
855899 velocity_add : vel_add2,
856900 bend : bend2,
@@ -872,6 +916,9 @@ impl VisualOp {
872916 direction : dir2. or ( dir1) , // Later wins
873917 scale_mul : compose_mul ( scale_mul1, scale_mul2) ,
874918 scale_add : compose_add ( scale_add1, scale_add2) ,
919+ scale_x_mul : compose_mul ( scale_x_mul1, scale_x_mul2) ,
920+ scale_y_mul : compose_mul ( scale_y_mul1, scale_y_mul2) ,
921+ scale_z_mul : compose_mul ( scale_z_mul1, scale_z_mul2) ,
875922 velocity_mul : compose_mul ( vel_mul1, vel_mul2) ,
876923 velocity_add : compose_add ( vel_add1, vel_add2) ,
877924 bend : bend2. or ( bend1) , // Later wins
@@ -962,6 +1009,9 @@ impl VisualOp {
9621009 z_add,
9631010 scale_mul,
9641011 scale_add,
1012+ scale_x_mul,
1013+ scale_y_mul,
1014+ scale_z_mul,
9651015 velocity_mul,
9661016 velocity_add,
9671017 bend,
@@ -984,6 +1034,9 @@ impl VisualOp {
9841034 && z_add. is_none ( )
9851035 && scale_mul. is_none ( )
9861036 && scale_add. is_none ( )
1037+ && scale_x_mul. is_none ( )
1038+ && scale_y_mul. is_none ( )
1039+ && scale_z_mul. is_none ( )
9871040 && velocity_mul. is_none ( )
9881041 && velocity_add. is_none ( )
9891042 && bend. is_none ( )
@@ -1111,6 +1164,15 @@ z += pos.z;"#,
11111164 if let Some ( v) = scale_add {
11121165 lines. push ( format ! ( "scale = scale + {};" , v. to_wgsl( ) ) ) ;
11131166 }
1167+ if let Some ( v) = scale_x_mul {
1168+ lines. push ( format ! ( "scale_vec.x = scale_vec.x * {};" , v. to_wgsl( ) ) ) ;
1169+ }
1170+ if let Some ( v) = scale_y_mul {
1171+ lines. push ( format ! ( "scale_vec.y = scale_vec.y * {};" , v. to_wgsl( ) ) ) ;
1172+ }
1173+ if let Some ( v) = scale_z_mul {
1174+ lines. push ( format ! ( "scale_vec.z = scale_vec.z * {};" , v. to_wgsl( ) ) ) ;
1175+ }
11141176 if let Some ( v) = velocity_mul {
11151177 lines. push ( format ! ( "velocity = velocity * {};" , v. to_wgsl( ) ) ) ;
11161178 }
@@ -1261,6 +1323,9 @@ z += pos.z;"#,
12611323 direction : None ,
12621324 scale_mul : None ,
12631325 scale_add : None ,
1326+ scale_x_mul : None ,
1327+ scale_y_mul : None ,
1328+ scale_z_mul : None ,
12641329 velocity_mul : None ,
12651330 velocity_add : None ,
12661331 bend : None ,
@@ -1345,6 +1410,30 @@ z += pos.z;"#,
13451410 op
13461411 }
13471412
1413+ pub fn smx ( v : impl Into < WgslValue > ) -> Self {
1414+ let mut op = Self :: simple_default ( ) ;
1415+ if let VisualOp :: Simple { scale_x_mul : ref mut f, .. } = op {
1416+ * f = Some ( v. into ( ) ) ;
1417+ }
1418+ op
1419+ }
1420+
1421+ pub fn smy ( v : impl Into < WgslValue > ) -> Self {
1422+ let mut op = Self :: simple_default ( ) ;
1423+ if let VisualOp :: Simple { scale_y_mul : ref mut f, .. } = op {
1424+ * f = Some ( v. into ( ) ) ;
1425+ }
1426+ op
1427+ }
1428+
1429+ pub fn smz ( v : impl Into < WgslValue > ) -> Self {
1430+ let mut op = Self :: simple_default ( ) ;
1431+ if let VisualOp :: Simple { scale_z_mul : ref mut f, .. } = op {
1432+ * f = Some ( v. into ( ) ) ;
1433+ }
1434+ op
1435+ }
1436+
13481437 pub fn vm ( v : impl Into < WgslValue > ) -> Self {
13491438 let mut op = Self :: simple_default ( ) ;
13501439 if let VisualOp :: Simple { velocity_mul : ref mut f, .. } = op {
@@ -1440,6 +1529,9 @@ z += pos.z;"#,
14401529 z_add,
14411530 scale_mul,
14421531 scale_add,
1532+ scale_x_mul,
1533+ scale_y_mul,
1534+ scale_z_mul,
14431535 velocity_mul,
14441536 velocity_add,
14451537 bend,
@@ -1540,6 +1632,15 @@ z += pos.z;"#,
15401632 if let Some ( v) = scale_mul {
15411633 segment_ops. push ( format ! ( " scale = scale * {};" , v. to_wgsl( ) ) ) ;
15421634 }
1635+ if let Some ( v) = scale_x_mul {
1636+ segment_ops. push ( format ! ( " scale_vec.x = scale_vec.x * {};" , v. to_wgsl( ) ) ) ;
1637+ }
1638+ if let Some ( v) = scale_y_mul {
1639+ segment_ops. push ( format ! ( " scale_vec.y = scale_vec.y * {};" , v. to_wgsl( ) ) ) ;
1640+ }
1641+ if let Some ( v) = scale_z_mul {
1642+ segment_ops. push ( format ! ( " scale_vec.z = scale_vec.z * {};" , v. to_wgsl( ) ) ) ;
1643+ }
15431644 if let Some ( v) = velocity_mul {
15441645 segment_ops. push ( format ! ( " velocity = velocity * {};" , v. to_wgsl( ) ) ) ;
15451646 }
@@ -1640,6 +1741,9 @@ z += pos.z;"#,
16401741 z_add,
16411742 scale_mul,
16421743 scale_add,
1744+ scale_x_mul,
1745+ scale_y_mul,
1746+ scale_z_mul,
16431747 velocity_mul,
16441748 velocity_add,
16451749 bend,
@@ -1785,6 +1889,15 @@ z += pos.z;"#,
17851889 if let Some ( v) = scale_mul {
17861890 segment_ops. push ( format ! ( " scale = scale * {};" , v. to_wgsl( ) ) ) ;
17871891 }
1892+ if let Some ( v) = scale_x_mul {
1893+ segment_ops. push ( format ! ( " scale_vec.x = scale_vec.x * {};" , v. to_wgsl( ) ) ) ;
1894+ }
1895+ if let Some ( v) = scale_y_mul {
1896+ segment_ops. push ( format ! ( " scale_vec.y = scale_vec.y * {};" , v. to_wgsl( ) ) ) ;
1897+ }
1898+ if let Some ( v) = scale_z_mul {
1899+ segment_ops. push ( format ! ( " scale_vec.z = scale_vec.z * {};" , v. to_wgsl( ) ) ) ;
1900+ }
17881901 if let Some ( v) = velocity_mul {
17891902 segment_ops. push ( format ! ( " velocity = velocity * {};" , v. to_wgsl( ) ) ) ;
17901903 }
@@ -2024,6 +2137,7 @@ fn dummy_function() {
20242137 var r: f32 = 0.01;
20252138 var life: f32 = 1.0;
20262139 var scale: f32 = 1.0;
2140+ var scale_vec: vec3<f32> = vec3<f32>(1.0, 1.0, 1.0); // Per-axis scale (Smx/Smy/Smz)
20272141 var time: f32 = 0.0;
20282142 var velocity: f32 = 1.0;
20292143 var seg_length: f32 = 1.0; // Duration multiplier for Seq segments
0 commit comments