| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  | shader_type canvas_item; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" | 
					
						
							|  |  |  | #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform float wipeState:hint_range(0,1) = 0; | 
					
						
							|  |  |  | uniform vec2 outputViewSize = vec2(1920,1080); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform sampler2D wipeTexture : source_color, filter_linear_mipmap, repeat_enable; | 
					
						
							|  |  |  | uniform vec2 wipeTextureSize = vec2( 1,1 ); | 
					
						
							|  |  |  | uniform vec4 wipeTextureTint : source_color = vec4(0,0,0,1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform float uvRotation = 0; | 
					
						
							|  |  |  | uniform vec2 uvRotationCenter = vec2(0 ,0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform float uvScale = 1; | 
					
						
							|  |  |  | uniform vec2 uvScaleCenter = vec2(0 ,0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uniform vec2 uvTranslation = vec2(0,0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | varying vec2 textureUV; | 
					
						
							|  |  |  | varying vec4 animatedTint; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void vertex() | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   mat3 matrix = identity_m3(); | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   float textureAspect = wipeTextureSize.x / wipeTextureSize.y; | 
					
						
							|  |  |  |   float viewAspect = outputViewSize.x / outputViewSize.y; | 
					
						
							|  |  |  |   float viewRatio = viewAspect / textureAspect; | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   matrix *= rotatePivotAspect_m3( uvRotation * DegreesToRadians , uvRotationCenter, textureAspect * viewRatio ); | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   vec2 rotatedScaleCenter = applyMatrix_m3v2( rotatePivot_m3( uvRotation, vec2( 0.5,0.5)), uvScaleCenter ); | 
					
						
							|  |  |  |   matrix *= scalePivot_m3( uvScale * vec2( viewRatio,1), rotatedScaleCenter ); | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   matrix *= translate_m3( applyMatrixBase_m3v2( matrix, -uvTranslation ) ); | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   vec2 uv = applyMatrix_m3v2( matrix, UV ); | 
					
						
							|  |  |  |   textureUV = uv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   animatedTint = wipeTextureTint; | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   animatedTint.a *= wipeState; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void fragment() | 
					
						
							| 
									
										
										
										
											2025-02-12 16:48:15 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   COLOR = texture( wipeTexture, textureUV ) * animatedTint; | 
					
						
							|  |  |  | } |