Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 363816d6ad | |||
| 9d7f65772b | |||
| cef6a6188a | |||
| 1515f6761b |
@@ -12,3 +12,4 @@ Examples/SimpleVideoAnimation/SimpleVIdeoAnimation.xcodeproj/project.xcworkspace
|
||||
Examples/SimpleVideoAnimation/SimpleVIdeoAnimation.xcodeproj/xcuserdata
|
||||
Examples/SimpleVideoAnimation/SimpleVideoAnimation.xcworkspace/xcuserdata
|
||||
Examples/SimpleVideoTransitionSwitch/SimpleVideoTransitionSwitch.xcodeproj/xcuserdata
|
||||
Examples/SimpleVideoEditor/SimpleVideoEditor.xcodeproj/project.xcworkspace/xcuserdata
|
||||
|
||||
@@ -16,20 +16,55 @@ class NavigateViewController: UIViewController {
|
||||
|
||||
var transitionTimeRange = CMTimeRange.init()
|
||||
|
||||
let N = 3
|
||||
let N = 19
|
||||
private func getTransition(index: Int) -> (titleName: String, transObject: MetalVideoProcessMotion) {
|
||||
switch index {
|
||||
case 0:
|
||||
return (titleName: "向上滑动", transObject: MetalVideoProcessMoveUpMotion())
|
||||
return (titleName: "渐显", transObject: MetalVideoProcessFadeInMotion())
|
||||
case 1:
|
||||
return (titleName: "放大", transObject: MetalVideoProcessMoveInMotion())
|
||||
return (titleName: "轻微放大", transObject: MetalVideoProcessSlimZoomInMotion())
|
||||
case 2:
|
||||
return (titleName: "旋转", transObject: MetalVideoProcessRotateMotion())
|
||||
return (titleName: "放大", transObject: MetalVideoProcessZoomInMotion())
|
||||
case 3:
|
||||
return (titleName: "渐显", transObject: MetalVideoProcessFadeInMotion())
|
||||
default:
|
||||
return (titleName: "放大", transObject: MetalVideoProcessMoveInMotion())
|
||||
return (titleName: "缩小", transObject: MetalVideoProcessZoomOutMotion())
|
||||
case 4:
|
||||
return (titleName: "向左滑入", transObject: MetalVideoProcessMoveLeftMotion())
|
||||
case 5:
|
||||
return (titleName: "向右滑入", transObject: MetalVideoProcessMoveRightMotion())
|
||||
case 6:
|
||||
return (titleName: "向下滑动", transObject: MetalVideoProcessMoveDownMotion())
|
||||
case 7:
|
||||
return (titleName: "向上滑动", transObject: MetalVideoProcessMoveUpMotion())
|
||||
case 8:
|
||||
return (titleName: "旋转", transObject: MetalVideoProcessRotateMotion())
|
||||
case 9:
|
||||
return (titleName: "涡旋旋转", transObject: MetalVideoProcessSwirlMotion())
|
||||
case 10:
|
||||
return (titleName: "镜像旋转", transObject: MetalVideoProcessMirrorRotateMotion())
|
||||
case 11:
|
||||
return (titleName: "向上旋入", transObject: MetalVideoProcessUpMoveInBlurMotion())
|
||||
case 12:
|
||||
return (titleName: "向上旋入II", transObject: MetalVideoProcessUpMoveInBlurIIMotion())
|
||||
case 13:
|
||||
return (titleName: "雨刷", transObject: MetalVideoProcessWiperMotion())
|
||||
case 14:
|
||||
return (titleName: "摆钟", transObject: MetalVideoProcessPendulumMotion())
|
||||
case 15:
|
||||
return (titleName: "向右甩入", transObject: MetalVideoProcessRightDropMotion())
|
||||
case 16:
|
||||
return (titleName: "向下甩入", transObject: MetalVideoProcessUpDropMotion())
|
||||
case 17:
|
||||
return (titleName: "动感放大", transObject: MetalVideoProcessZoomInBlurMotion())
|
||||
case 18:
|
||||
return (titleName: "动感缩小", transObject: MetalVideoProcessZoomOutBlurMotion())
|
||||
/*
|
||||
case 15:
|
||||
return (titleName: "向右转入", transObject: MetalVideoProcessRotateInRightMotion())
|
||||
|
||||
*/
|
||||
default:
|
||||
return (titleName: "放大", transObject: MetalVideoProcessMoveUpMotion())
|
||||
|
||||
}
|
||||
}
|
||||
private func getButton(index: Int) -> UIButton {
|
||||
|
||||
@@ -20,7 +20,7 @@ class ViewController: UIViewController {
|
||||
|
||||
var player: MetalVideoProcessPlayer?
|
||||
var editor: MetalVideoEditor?
|
||||
public var motionIn: MetalVideoProcessMotion = MetalVideoProcessMoveInMotion()
|
||||
public var motionIn: MetalVideoProcessMotion = MetalVideoProcessMoveUpMotion()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -16,7 +16,7 @@ class NaviViewController: UIViewController {
|
||||
|
||||
var transitionTimeRange = CMTimeRange.init()
|
||||
|
||||
let N = 7
|
||||
let N = 14
|
||||
private func getTransition(index: Int) -> (titleName: String, transObject: MetalVideoProcessTransition) {
|
||||
switch index {
|
||||
case 0:
|
||||
@@ -33,6 +33,18 @@ class NaviViewController: UIViewController {
|
||||
return (titleName: "燃烧", transObject: MetalVideoProcessBurnTransition())
|
||||
case 6:
|
||||
return (titleName: "立方体", transObject: MetalVideoProcessCubeTransition())
|
||||
case 7:
|
||||
return (titleName: "向上擦除", transObject: MetalVideoProcessEraseUpTransition())
|
||||
case 8:
|
||||
return (titleName: "向左擦除", transObject: MetalVideoProcessEraseLeftTransition())
|
||||
case 9:
|
||||
return (titleName: "向右擦除", transObject: MetalVideoProcessEraseRightTransition())
|
||||
case 10:
|
||||
return (titleName: "变形", transObject: MetalVideoProcessMorphTransition())
|
||||
case 11:
|
||||
return (titleName: "圆形蒙版", transObject: MetalVideoProcessCircleEraseTransition())
|
||||
case 12:
|
||||
return (titleName: "上移", transObject: MetalVideoProcessVerticalUpGlitchTransition())
|
||||
default:
|
||||
return (titleName: "倒影", transObject: MetalVideoProcessReflectTransition())
|
||||
}
|
||||
|
||||
@@ -7,6 +7,18 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
6A24CA0724ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FB24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal */; };
|
||||
6A24CA0824ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FC24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal */; };
|
||||
6A24CA0924ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FD24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal */; };
|
||||
6A24CA0A24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FE24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift */; };
|
||||
6A24CA0B24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FF24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift */; };
|
||||
6A24CA0C24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0024ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal */; };
|
||||
6A24CA0D24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0124ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift */; };
|
||||
6A24CA0E24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0224ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift */; };
|
||||
6A24CA0F24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0324ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift */; };
|
||||
6A24CA1024ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0424ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal */; };
|
||||
6A24CA1124ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0524ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift */; };
|
||||
6A24CA1224ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0624ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal */; };
|
||||
6A3E705924BD9099009A0AC9 /* MetalVideoProcessTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A3E705824BD9099009A0AC9 /* MetalVideoProcessTransition.swift */; };
|
||||
6A874BC224C594EC00ADFD8A /* MetalVideoProcessMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A874BC124C594EC00ADFD8A /* MetalVideoProcessMotion.swift */; };
|
||||
6A874BD024C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A874BCF24C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift */; };
|
||||
@@ -85,6 +97,30 @@
|
||||
6ADB072A24ADCC250010A817 /* MetalVideoProcessColorFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB072724ADCC250010A817 /* MetalVideoProcessColorFilter.swift */; };
|
||||
6ADB072B24ADCC250010A817 /* MetalVideoProcessColorFilter.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB072824ADCC250010A817 /* MetalVideoProcessColorFilter.metal */; };
|
||||
6ADB07E124AEDC9B0010A817 /* default.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB07E024AEDC9B0010A817 /* default.metal */; };
|
||||
AB00F87324D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87124D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal */; };
|
||||
AB00F87424D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87224D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift */; };
|
||||
AB00F87724D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87524D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal */; };
|
||||
AB00F87824D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87624D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift */; };
|
||||
AB00F87B24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87924D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.metal */; };
|
||||
AB00F87C24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87A24D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.swift */; };
|
||||
AB00F87F24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87D24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal */; };
|
||||
AB00F88024D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87E24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift */; };
|
||||
AB4C45D024D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45CE24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift */; };
|
||||
AB4C45D124D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45CF24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal */; };
|
||||
AB4C45D524D0125700315A52 /* MetalVideoProcessSwirlMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D324D0125700315A52 /* MetalVideoProcessSwirlMotion.swift */; };
|
||||
AB4C45D624D0125700315A52 /* MetalVideoProcessSwirlMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D424D0125700315A52 /* MetalVideoProcessSwirlMotion.metal */; };
|
||||
AB4C45D924D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D724D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift */; };
|
||||
AB4C45DA24D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D824D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal */; };
|
||||
AB4C45DD24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45DB24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal */; };
|
||||
AB4C45DE24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45DC24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift */; };
|
||||
AB4C45E124D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45DF24D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal */; };
|
||||
AB4C45E224D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45E024D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift */; };
|
||||
AB4C45E524D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45E324D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift */; };
|
||||
AB4C45E624D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45E424D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal */; };
|
||||
AB4F025F24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4F025D24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift */; };
|
||||
AB4F026024D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4F025E24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal */; };
|
||||
AB4F026324D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4F026124D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal */; };
|
||||
AB4F026424D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4F026224D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift */; };
|
||||
AB59B92924C831D900943BE2 /* MetalVideoProcessCubeTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B91B24C831D700943BE2 /* MetalVideoProcessCubeTransition.metal */; };
|
||||
AB59B92A24C831D900943BE2 /* MetalVideoProcessShanBaiTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B91C24C831D700943BE2 /* MetalVideoProcessShanBaiTransition.swift */; };
|
||||
AB59B92B24C831D900943BE2 /* MetalVideoProcessFadeTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B91D24C831D700943BE2 /* MetalVideoProcessFadeTransition.swift */; };
|
||||
@@ -103,11 +139,31 @@
|
||||
AB59B94224C921F300943BE2 /* MetalVideoProcessRotateMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94024C921F300943BE2 /* MetalVideoProcessRotateMotion.metal */; };
|
||||
AB59B94924C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94724C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.metal */; };
|
||||
AB59B94A24C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94824C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.swift */; };
|
||||
AB59B94D24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94B24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal */; };
|
||||
AB59B94E24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94C24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift */; };
|
||||
AB59B94D24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94B24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal */; };
|
||||
AB59B94E24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94C24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift */; };
|
||||
AB603FA424D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB603FA224D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal */; };
|
||||
AB603FA524D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB603FA324D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift */; };
|
||||
AB603FE524D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB603FE324D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift */; };
|
||||
AB603FE624D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB603FE424D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal */; };
|
||||
AB7B931E24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB7B931C24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal */; };
|
||||
AB7B931F24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB7B931D24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift */; };
|
||||
AB7B932224D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB7B932024D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal */; };
|
||||
AB7B932324D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB7B932124D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
6A24C9FB24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessEraseLeftTransition.metal; sourceTree = "<group>"; };
|
||||
6A24C9FC24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessVerticalUpGlitchTransition.metal; sourceTree = "<group>"; };
|
||||
6A24C9FD24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessEraseRightTransition.metal; sourceTree = "<group>"; };
|
||||
6A24C9FE24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessEraseRightTransition.swift; sourceTree = "<group>"; };
|
||||
6A24C9FF24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMorphTransition.swift; sourceTree = "<group>"; };
|
||||
6A24CA0024ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessEraseUpTransition.metal; sourceTree = "<group>"; };
|
||||
6A24CA0124ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessVerticalUpGlitchTransition.swift; sourceTree = "<group>"; };
|
||||
6A24CA0224ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessEraseUpTransition.swift; sourceTree = "<group>"; };
|
||||
6A24CA0324ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessEraseLeftTransition.swift; sourceTree = "<group>"; };
|
||||
6A24CA0424ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMorphTransition.metal; sourceTree = "<group>"; };
|
||||
6A24CA0524ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessCircleEraseTransition.swift; sourceTree = "<group>"; };
|
||||
6A24CA0624ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessCircleEraseTransition.metal; sourceTree = "<group>"; };
|
||||
6A3E705824BD9099009A0AC9 /* MetalVideoProcessTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessTransition.swift; sourceTree = "<group>"; };
|
||||
6A874BC124C594EC00ADFD8A /* MetalVideoProcessMotion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMotion.swift; sourceTree = "<group>"; };
|
||||
6A874BCF24C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessFadeInMotion.swift; sourceTree = "<group>"; };
|
||||
@@ -189,6 +245,30 @@
|
||||
6ADB072824ADCC250010A817 /* MetalVideoProcessColorFilter.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessColorFilter.metal; sourceTree = "<group>"; };
|
||||
6ADB07D524AED1260010A817 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
6ADB07E024AEDC9B0010A817 /* default.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = default.metal; sourceTree = "<group>"; };
|
||||
AB00F87124D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessPendulumMotion.metal; sourceTree = "<group>"; };
|
||||
AB00F87224D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessPendulumMotion.swift; sourceTree = "<group>"; };
|
||||
AB00F87524D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessRightDropMotion.metal; sourceTree = "<group>"; };
|
||||
AB00F87624D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessRightDropMotion.swift; sourceTree = "<group>"; };
|
||||
AB00F87924D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessUpDropMotion.metal; sourceTree = "<group>"; };
|
||||
AB00F87A24D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessUpDropMotion.swift; sourceTree = "<group>"; };
|
||||
AB00F87D24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomInBlurMotion.metal; sourceTree = "<group>"; };
|
||||
AB00F87E24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomInBlurMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45CE24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessRotateInRightMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45CF24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessRotateInRightMotion.metal; sourceTree = "<group>"; };
|
||||
AB4C45D324D0125700315A52 /* MetalVideoProcessSwirlMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessSwirlMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45D424D0125700315A52 /* MetalVideoProcessSwirlMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessSwirlMotion.metal; sourceTree = "<group>"; };
|
||||
AB4C45D724D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomOutMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45D824D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomOutMotion.metal; sourceTree = "<group>"; };
|
||||
AB4C45DB24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveLeftMotion.metal; sourceTree = "<group>"; };
|
||||
AB4C45DC24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveLeftMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45DF24D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveRightMotion.metal; sourceTree = "<group>"; };
|
||||
AB4C45E024D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveRightMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45E324D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveDownMotion.swift; sourceTree = "<group>"; };
|
||||
AB4C45E424D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveDownMotion.metal; sourceTree = "<group>"; };
|
||||
AB4F025D24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessUpMoveInBlurIIMotion.swift; sourceTree = "<group>"; };
|
||||
AB4F025E24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessUpMoveInBlurIIMotion.metal; sourceTree = "<group>"; };
|
||||
AB4F026124D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessWiperMotion.metal; sourceTree = "<group>"; };
|
||||
AB4F026224D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessWiperMotion.swift; sourceTree = "<group>"; };
|
||||
AB59B91B24C831D700943BE2 /* MetalVideoProcessCubeTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessCubeTransition.metal; sourceTree = "<group>"; };
|
||||
AB59B91C24C831D700943BE2 /* MetalVideoProcessShanBaiTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessShanBaiTransition.swift; sourceTree = "<group>"; };
|
||||
AB59B91D24C831D700943BE2 /* MetalVideoProcessFadeTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessFadeTransition.swift; sourceTree = "<group>"; };
|
||||
@@ -207,8 +287,16 @@
|
||||
AB59B94024C921F300943BE2 /* MetalVideoProcessRotateMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessRotateMotion.metal; sourceTree = "<group>"; };
|
||||
AB59B94724C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveUpMotion.metal; sourceTree = "<group>"; };
|
||||
AB59B94824C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveUpMotion.swift; sourceTree = "<group>"; };
|
||||
AB59B94B24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveInMotion.metal; sourceTree = "<group>"; };
|
||||
AB59B94C24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveInMotion.swift; sourceTree = "<group>"; };
|
||||
AB59B94B24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomInMotion.metal; sourceTree = "<group>"; };
|
||||
AB59B94C24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomInMotion.swift; sourceTree = "<group>"; };
|
||||
AB603FA224D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessSlimZoomInMotion.metal; sourceTree = "<group>"; };
|
||||
AB603FA324D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessSlimZoomInMotion.swift; sourceTree = "<group>"; };
|
||||
AB603FE324D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMirrorRotateMotion.swift; sourceTree = "<group>"; };
|
||||
AB603FE424D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMirrorRotateMotion.metal; sourceTree = "<group>"; };
|
||||
AB7B931C24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessUpMoveInBlurMotion.metal; sourceTree = "<group>"; };
|
||||
AB7B931D24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessUpMoveInBlurMotion.swift; sourceTree = "<group>"; };
|
||||
AB7B932024D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomOutBlurMotion.metal; sourceTree = "<group>"; };
|
||||
AB7B932124D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomOutBlurMotion.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -225,10 +313,42 @@
|
||||
6A874BCE24C6E10500ADFD8A /* Motions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AB59B94B24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal */,
|
||||
AB59B94C24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift */,
|
||||
AB7B932024D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal */,
|
||||
AB7B932124D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift */,
|
||||
AB00F87D24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal */,
|
||||
AB00F87E24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift */,
|
||||
AB00F87924D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.metal */,
|
||||
AB00F87A24D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.swift */,
|
||||
AB00F87524D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal */,
|
||||
AB00F87624D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift */,
|
||||
AB00F87124D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal */,
|
||||
AB00F87224D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift */,
|
||||
AB4F026124D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal */,
|
||||
AB4F026224D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift */,
|
||||
AB4F025E24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal */,
|
||||
AB4F025D24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift */,
|
||||
AB603FE424D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal */,
|
||||
AB603FE324D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift */,
|
||||
AB603FA224D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal */,
|
||||
AB603FA324D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift */,
|
||||
AB7B931C24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal */,
|
||||
AB7B931D24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift */,
|
||||
AB4C45E424D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal */,
|
||||
AB4C45E324D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift */,
|
||||
AB4C45DF24D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal */,
|
||||
AB4C45E024D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift */,
|
||||
AB4C45DB24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal */,
|
||||
AB4C45DC24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift */,
|
||||
AB59B94724C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.metal */,
|
||||
AB59B94824C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.swift */,
|
||||
AB4C45D824D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal */,
|
||||
AB4C45D724D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift */,
|
||||
AB4C45D424D0125700315A52 /* MetalVideoProcessSwirlMotion.metal */,
|
||||
AB4C45D324D0125700315A52 /* MetalVideoProcessSwirlMotion.swift */,
|
||||
AB4C45CF24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal */,
|
||||
AB4C45CE24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift */,
|
||||
AB59B94B24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal */,
|
||||
AB59B94C24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift */,
|
||||
AB59B94024C921F300943BE2 /* MetalVideoProcessRotateMotion.metal */,
|
||||
AB59B93F24C921F300943BE2 /* MetalVideoProcessRotateMotion.swift */,
|
||||
6A874BCF24C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift */,
|
||||
@@ -487,6 +607,18 @@
|
||||
AB64835724C03CEA00A0266B /* Transitions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6A24CA0624ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal */,
|
||||
6A24CA0524ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift */,
|
||||
6A24C9FB24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal */,
|
||||
6A24CA0324ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift */,
|
||||
6A24C9FD24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal */,
|
||||
6A24C9FE24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift */,
|
||||
6A24CA0024ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal */,
|
||||
6A24CA0224ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift */,
|
||||
6A24CA0424ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal */,
|
||||
6A24C9FF24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift */,
|
||||
6A24C9FC24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal */,
|
||||
6A24CA0124ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift */,
|
||||
AB59B91E24C831D800943BE2 /* MetalVideoProcessBurnTransition.metal */,
|
||||
AB59B92224C831D800943BE2 /* MetalVideoProcessBurnTransition.swift */,
|
||||
AB59B91B24C831D700943BE2 /* MetalVideoProcessCubeTransition.metal */,
|
||||
@@ -589,14 +721,20 @@
|
||||
files = (
|
||||
6ADB072A24ADCC250010A817 /* MetalVideoProcessColorFilter.swift in Sources */,
|
||||
6ADB071124ADC4DC0010A817 /* MetalVideoProcessMovieWriter.swift in Sources */,
|
||||
AB4C45E624D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal in Sources */,
|
||||
6A24CA1124ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift in Sources */,
|
||||
6ADB06A224ADB3B70010A817 /* CompositionProvider.swift in Sources */,
|
||||
6ADB06F924ADBE1D0010A817 /* YUVToRGBConversion.metal in Sources */,
|
||||
AB59B92B24C831D900943BE2 /* MetalVideoProcessFadeTransition.swift in Sources */,
|
||||
AB00F87824D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift in Sources */,
|
||||
6ADB065E24AD8B7E0010A817 /* MetalRendering.swift in Sources */,
|
||||
6ADB06B524ADB3B70010A817 /* CMTimeExtensition.swift in Sources */,
|
||||
AB59B94924C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.metal in Sources */,
|
||||
AB4C45D024D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift in Sources */,
|
||||
6ADB06B024ADB3B70010A817 /* AVAssetReverseImageResource.swift in Sources */,
|
||||
6ADB070524ADC4100010A817 /* PictureOutput.swift in Sources */,
|
||||
AB4C45DE24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift in Sources */,
|
||||
AB4C45D624D0125700315A52 /* MetalVideoProcessSwirlMotion.metal in Sources */,
|
||||
6A874BD424C6F98100ADFD8A /* MetalVideoProcessFadeMotion.metal in Sources */,
|
||||
6ADB070F24ADC4DC0010A817 /* MetalVideoProcessPlayer.swift in Sources */,
|
||||
6ADB06AE24ADB3B70010A817 /* Resource.swift in Sources */,
|
||||
@@ -607,29 +745,42 @@
|
||||
6ADB066C24AD8B7E0010A817 /* ImageOrientation.swift in Sources */,
|
||||
AB59B93524C831D900943BE2 /* MetalVideoProcessEraseDownTransition.swift in Sources */,
|
||||
6ADB069E24ADB3B70010A817 /* AudioMixer.swift in Sources */,
|
||||
AB59B94E24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift in Sources */,
|
||||
6A24CA1224ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal in Sources */,
|
||||
AB59B94E24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift in Sources */,
|
||||
6ADB071824ADC4F80010A817 /* MetalVideoProcessTransformFilter.metal in Sources */,
|
||||
AB59B93124C831D900943BE2 /* MetalVideoProcessEraseDownTransition.metal in Sources */,
|
||||
AB00F87724D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal in Sources */,
|
||||
AB59B93424C831D900943BE2 /* MetalVideoProcessReflectTransition.metal in Sources */,
|
||||
AB59B92A24C831D900943BE2 /* MetalVideoProcessShanBaiTransition.swift in Sources */,
|
||||
6ADB065824AD8B7E0010A817 /* Color.swift in Sources */,
|
||||
AB00F87F24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal in Sources */,
|
||||
6ADB06A324ADB3B70010A817 /* AudioTransition.swift in Sources */,
|
||||
AB00F87324D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal in Sources */,
|
||||
AB59B93624C831D900943BE2 /* MetalVideoProcessCubeTransition.swift in Sources */,
|
||||
AB7B931F24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift in Sources */,
|
||||
AB00F87C24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.swift in Sources */,
|
||||
6ADB069C24ADB3B70010A817 /* CompositionGenerator.swift in Sources */,
|
||||
6ADB06EF24ADBBDA0010A817 /* SolidColorGenerator.swift in Sources */,
|
||||
6A24CA0824ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal in Sources */,
|
||||
AB59B94124C921F300943BE2 /* MetalVideoProcessRotateMotion.swift in Sources */,
|
||||
6ADB06AD24ADB3B70010A817 /* AVAssetTrackResource.swift in Sources */,
|
||||
AB00F87424D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift in Sources */,
|
||||
6ADB066B24AD8B7E0010A817 /* MetalRenderingDevice.swift in Sources */,
|
||||
6ADB06A124ADB3B70010A817 /* Timeline.swift in Sources */,
|
||||
6ADB06B324ADB3B70010A817 /* Log.swift in Sources */,
|
||||
AB4F026324D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal in Sources */,
|
||||
6ADB065D24AD8B7E0010A817 /* Size.swift in Sources */,
|
||||
AB4C45D124D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal in Sources */,
|
||||
6ADB070024ADC1930010A817 /* MetalVideoProcessBlendFilter.metal in Sources */,
|
||||
6A874BC224C594EC00ADFD8A /* MetalVideoProcessMotion.swift in Sources */,
|
||||
AB7B932224D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal in Sources */,
|
||||
6ADB06B124ADB3B70010A817 /* CoreImageExtension.swift in Sources */,
|
||||
AB603FE624D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal in Sources */,
|
||||
6ADB06E024ADB8B80010A817 /* MetalVideoProcessOperation.swift in Sources */,
|
||||
6ADB071A24ADC4F80010A817 /* MetalVideoProcessBeautyFilter.metal in Sources */,
|
||||
6ADB06EB24ADBBDA0010A817 /* ImageGenerator.swift in Sources */,
|
||||
6ADB06B724ADB3B70010A817 /* TimeRangeExtension.swift in Sources */,
|
||||
AB4C45D524D0125700315A52 /* MetalVideoProcessSwirlMotion.swift in Sources */,
|
||||
6ADB06CA24ADB55D0010A817 /* MetalVideoEditor.swift in Sources */,
|
||||
6ADB07E124AEDC9B0010A817 /* default.metal in Sources */,
|
||||
6ADB06ED24ADBBDA0010A817 /* PictureInput.swift in Sources */,
|
||||
@@ -641,43 +792,68 @@
|
||||
6ADB071724ADC4F80010A817 /* MetalVideoProcessBeautyFilter.swift in Sources */,
|
||||
AB59B93324C831D900943BE2 /* MetalVideoProcessReflectTransition.swift in Sources */,
|
||||
6ADB06AF24ADB3B70010A817 /* AVAssetReaderImageResource.swift in Sources */,
|
||||
6A24CA1024ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal in Sources */,
|
||||
6ADB072B24ADCC250010A817 /* MetalVideoProcessColorFilter.metal in Sources */,
|
||||
6A24CA0C24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal in Sources */,
|
||||
AB4C45D924D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift in Sources */,
|
||||
6ADB072624ADCC1C0010A817 /* MetalVideoProcessBackground.swift in Sources */,
|
||||
AB4C45E524D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift in Sources */,
|
||||
AB59B93024C831D900943BE2 /* MetalVideoProcessBurnTransition.swift in Sources */,
|
||||
AB7B931E24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal in Sources */,
|
||||
AB603FE524D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift in Sources */,
|
||||
AB4F026424D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift in Sources */,
|
||||
AB603FA524D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift in Sources */,
|
||||
6ADB071D24ADC8750010A817 /* MetalVideoProcessCompositor.swift in Sources */,
|
||||
6ADB06B424ADB3B70010A817 /* CGMathFunctions.swift in Sources */,
|
||||
6AA561D324BC57F3004894F7 /* MetalVideoProcessLuminance.metal in Sources */,
|
||||
6ADB065A24AD8B7E0010A817 /* Matrix.swift in Sources */,
|
||||
AB603FA424D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal in Sources */,
|
||||
6ADB069F24ADB3B70010A817 /* AudioProcessingChain.swift in Sources */,
|
||||
AB59B92E24C831D900943BE2 /* MetalVideoProcessMirrorRotateTransition.swift in Sources */,
|
||||
AB59B92F24C831D900943BE2 /* MetalVideoProcessMirrorRotateTransition.metal in Sources */,
|
||||
AB4F025F24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift in Sources */,
|
||||
6A24CA0E24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift in Sources */,
|
||||
AB7B932324D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift in Sources */,
|
||||
AB59B94A24C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.swift in Sources */,
|
||||
6A24CA0724ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal in Sources */,
|
||||
6ADB06A424ADB3B70010A817 /* ImageOverlayItem.swift in Sources */,
|
||||
AB4C45DD24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal in Sources */,
|
||||
AB59B92C24C831D900943BE2 /* MetalVideoProcessBurnTransition.metal in Sources */,
|
||||
AB4C45DA24D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal in Sources */,
|
||||
AB4C45E224D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift in Sources */,
|
||||
AB00F88024D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift in Sources */,
|
||||
6ADB071924ADC4F80010A817 /* MetalVideoProcessTransformFilter.swift in Sources */,
|
||||
6ADB06FC24ADBF8F0010A817 /* MetalVideoProcessRenderView.swift in Sources */,
|
||||
6ADB06AB24ADB3B70010A817 /* ImageResource.swift in Sources */,
|
||||
6AA561D424BC57F3004894F7 /* MetalVideoProcessLuminance.swift in Sources */,
|
||||
6ADB06A724ADB3B70010A817 /* TrackItem.swift in Sources */,
|
||||
AB59B94D24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal in Sources */,
|
||||
AB59B94D24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal in Sources */,
|
||||
6ADB066924AD8B7E0010A817 /* ShaderUniformSettings.swift in Sources */,
|
||||
AB59B94224C921F300943BE2 /* MetalVideoProcessRotateMotion.metal in Sources */,
|
||||
6ADB071024ADC4DC0010A817 /* MetalVideoProcessPlayer+CompositorDelegate.swift in Sources */,
|
||||
6A24CA0B24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift in Sources */,
|
||||
6ADB06B224ADB3B70010A817 /* TimingFunctionFactory.swift in Sources */,
|
||||
AB4F026024D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal in Sources */,
|
||||
6ADB072424ADCBC30010A817 /* MetalVideoProcessGaussianBlurFilter.swift in Sources */,
|
||||
AB59B92924C831D900943BE2 /* MetalVideoProcessCubeTransition.metal in Sources */,
|
||||
6ADB070624ADC4100010A817 /* RenderView.swift in Sources */,
|
||||
6A24CA0924ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal in Sources */,
|
||||
6A24CA0F24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift in Sources */,
|
||||
6A24CA0A24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift in Sources */,
|
||||
6A24CA0D24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift in Sources */,
|
||||
6ADB06F824ADBE1D0010A817 /* YUVToRGBConversion.swift in Sources */,
|
||||
6ADB069D24ADB3B70010A817 /* AudioProcessingTapHolder.swift in Sources */,
|
||||
6ADB067024AD8B7E0010A817 /* Position.swift in Sources */,
|
||||
6ADB06A024ADB3B70010A817 /* VideoTransition.swift in Sources */,
|
||||
6ADB067124AD8B7E0010A817 /* Texture.swift in Sources */,
|
||||
6ADB069A24ADB3B70010A817 /* VideoCompositionInstruction.swift in Sources */,
|
||||
AB00F87B24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.metal in Sources */,
|
||||
6ADB072224ADCB2A0010A817 /* MetalVideoProcessFilterGroup.swift in Sources */,
|
||||
6ADB06AC24ADB3B70010A817 /* PHAssetImageResource.swift in Sources */,
|
||||
AB59B92D24C831D900943BE2 /* MetalVideoProcessFadeTransition.metal in Sources */,
|
||||
6ADB066024AD8B7E0010A817 /* Pipeline.swift in Sources */,
|
||||
6ADB06A924ADB3B70010A817 /* PHAssetLivePhotoResource.swift in Sources */,
|
||||
AB4C45E124D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal in Sources */,
|
||||
AB59B93224C831D900943BE2 /* MetalVideoProcessShanBaiTransition.metal in Sources */,
|
||||
6A3E705924BD9099009A0AC9 /* MetalVideoProcessTransition.swift in Sources */,
|
||||
6ADB06FA24ADBE1D0010A817 /* Camera.swift in Sources */,
|
||||
|
||||
@@ -143,7 +143,7 @@ public class MetalVideoProcessBackground: MetalVideoProcessFilterGroup {
|
||||
}
|
||||
}
|
||||
|
||||
public override init(trackID: Int32) {
|
||||
public init(trackID: Int32) {
|
||||
super.init(trackID: trackID)
|
||||
self.trackID = trackID
|
||||
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreMedia
|
||||
import Metal
|
||||
|
||||
open class MetalVideoProcessFilterGroup: ImageProcessingOperation {
|
||||
public var debugName: String = ""
|
||||
|
||||
public var trackID: Int32 = 0
|
||||
/// 时间轴信息,创建FIlter后默认为Zero 则全部纹理接受后都处理,若有值则匹配后处理
|
||||
public var timelineRange: CMTimeRange = CMTimeRange.zero
|
||||
public var trackID: Int32 = 0 //默认全部生效
|
||||
|
||||
public var isEnable: Bool = true
|
||||
|
||||
@@ -21,12 +25,36 @@ open class MetalVideoProcessFilterGroup: ImageProcessingOperation {
|
||||
public var targets: TargetContainer { get { return outputImageRelay.targets } }
|
||||
public let maximumInputs: UInt = 1
|
||||
|
||||
public init(trackID: Int32) {
|
||||
public func saveUniformSettings(forTimelineRange timeline: CMTimeRange, trackID: Int32) {
|
||||
self.timelineRange = timeline
|
||||
self.trackID = trackID
|
||||
}
|
||||
|
||||
public init(trackID: Int32, timelineRange: CMTimeRange = CMTimeRange.zero) {
|
||||
self.timelineRange = timelineRange
|
||||
self.trackID = trackID
|
||||
|
||||
}
|
||||
|
||||
public func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
if self.timelineRange == .zero {
|
||||
return true
|
||||
} else {
|
||||
guard let time = texture.timingStyle.timestamp else {
|
||||
let seconds = texture.timingStyle.timestamp!.asCMTime.seconds
|
||||
let cmTime = CMTime(seconds: seconds, preferredTimescale: 1)
|
||||
|
||||
return self.timelineRange.containsTime(cmTime) ||
|
||||
self.timelineRange.end == cmTime
|
||||
}
|
||||
|
||||
return self.timelineRange.containsTime(time.asCMTime) || self.timelineRange.end == time.asCMTime
|
||||
}
|
||||
}
|
||||
|
||||
open func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
inputImageRelay.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
|
||||
inputImageRelay.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
|
||||
public func configureGroup(_ configurationOperation: (_ input: ImageRelay, _ output: ImageRelay) -> ()) {
|
||||
|
||||
@@ -145,7 +145,7 @@ public class MetalVideoProcessPlayer: ImageSource {
|
||||
self.playerItem = playerItem
|
||||
|
||||
self.player = AVPlayer(playerItem: self.playerItem)
|
||||
|
||||
|
||||
self.player.volume = 1.0
|
||||
self.playerItem.add(self.videoOutput)
|
||||
self.videoOutput.requestNotificationOfMediaDataChange(withAdvanceInterval: 0.1)
|
||||
@@ -160,6 +160,7 @@ public class MetalVideoProcessPlayer: ImageSource {
|
||||
self.playbackCompositor = compositor
|
||||
compositor.delegate = self
|
||||
self.playerItem.preferredForwardBufferDuration = 0.5
|
||||
self.seekTo(time: 0.0)
|
||||
}
|
||||
|
||||
public func updatePlayerItem(playerItem: AVPlayerItem) {
|
||||
@@ -524,9 +525,6 @@ public class MetalVideoProcessPlayer: ImageSource {
|
||||
self.play()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public func suspend() {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// mirrorRotateMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace mirrorRotateMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 mirrorRotateMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float2 tempUv = uv;
|
||||
float curve = uniform.factor;
|
||||
half4 outCol = half4(0.0);
|
||||
if (curve < 0.5) {
|
||||
tempUv = float2((tempUv.x - center.x) * -(1. + curve * 200.0) + center.x, uv.y);
|
||||
outCol = inputTexture2.sample(quadSampler, tempUv.xy);
|
||||
} else {
|
||||
tempUv = float2((tempUv.x - center.x) * (1. + (1.0 - curve) * 200.0) + center.x, uv.y);
|
||||
outCol = inputTexture2.sample(quadSampler, tempUv.xy);
|
||||
}
|
||||
|
||||
return half4(bgCol.rgb * (1. - outCol.a) + outCol.rgb, outCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// MetalVideoProcessMirrorRotateMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessMirrorRotateMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "mirrorRotateMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
debugPrint("mirrorRotateMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// moveDownMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace moveDownMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 moveDownMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv + float2(0.0, uniform.roi.a) - float2(0.0, uniform.roi.a * uniform.factor));
|
||||
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MetalVideoProcessMoveDownMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessMoveDownMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "moveDownMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseIn
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
debugPrint("moveUpMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// rotateMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace moveLeftMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 moveLeftMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv - float2(uniform.roi.b, 0.0) + float2(uniform.roi.b * uniform.factor, 0.0));
|
||||
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MetalVideoProcessMoveLeftMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessMoveLeftMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "moveLeftMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
debugPrint("moveLeftMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// moveRightMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace moveRightMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 moveRightMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv + float2(uniform.roi.b, 0.0) - float2(uniform.roi.b * uniform.factor, 0.0));
|
||||
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MetalVideoProcessMoveRightMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessMoveRightMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "moveRightMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
debugPrint("moveLeftMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,9 @@ namespace moveUpMotion {
|
||||
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv - float2(0.0, uniform.roi.b) + float2(0.0, uniform.roi.b * uniform.factor));
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv - float2(0.0, uniform.roi.a) + float2(0.0, uniform.roi.a * uniform.factor));
|
||||
|
||||
return half4(mix(bgCol.rgb, fgCol.rgb, fgCol.a), fgCol.a);
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// pendulumMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
#define PI 3.1415926
|
||||
namespace pendulumMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 pendulumMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g);
|
||||
float time = sin(uniform.factor * PI * 6.0) * exp(-uniform.factor);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float rotCorner = time * 1.5707963;
|
||||
float2 rot = float2(cos(rotCorner), sin(rotCorner));
|
||||
|
||||
uv = (uv - center) * uniform.iResolution;
|
||||
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
|
||||
uv = uv / uniform.iResolution + center;
|
||||
|
||||
float2 dir = float2(uv - center) * 0.5 * time;
|
||||
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.6;
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessPendulumMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessPendulumMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "pendulumMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("pendulumMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// pendulumMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
#define PI 3.1415926
|
||||
namespace rightDropMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 rightDropMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g);
|
||||
float time = cos(uniform.factor * PI * 2.5) * exp(-uniform.factor);
|
||||
float2 uv = fragmentInput.textureCoordinate2 + float2(0.5, 0.0) * time;
|
||||
|
||||
float2 dir = float2(0.1, 0.0) * time;
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessRightDropMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessRightDropMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "rightDropMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("rightDropMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// rotateMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace rotateInRightMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 rotateInRightMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float rotCorner = -(1. - uniform.factor) * 1.5707963;
|
||||
float2 rot = float2(cos(rotCorner), sin(rotCorner));
|
||||
|
||||
uv = (uv - center + float2(uniform.roi.b * (1.0 - uniform.factor), 0.0)) * uniform.iResolution;
|
||||
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
|
||||
uv = uv / uniform.iResolution + center;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv);
|
||||
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessRotateMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessRotateInRightMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "rotateInRightMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseOut
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("rotateMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace rotateMotion {
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv);
|
||||
|
||||
return half4(mix(bgCol.rgb, fgCol.rgb, fgCol.a), fgCol.a);
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// slimZoomInMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace slimZoomInMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 slimZoomInMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, (uv - center) * (1.2 - uniform.factor * 0.2) + center);
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// MetalVideoProcessSlimZoomInMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessSlimZoomInMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "slimZoomInMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseIn
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
debugPrint("slimZoomInMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// swirlMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace swirlMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 swirlMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float2 tempUv = uv - center;
|
||||
float theta = atan2(tempUv.y, tempUv.x);
|
||||
float r = length(tempUv);
|
||||
theta = theta + r * 20.0 * (1. - uniform.factor);
|
||||
uv = float2(r * cos(theta), r * sin(theta)) + center;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, uv);
|
||||
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessSwirlMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessSwirlMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "swirlMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseOut
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("rotateMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// pendulumMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
#define PI 3.1415926
|
||||
namespace upDropMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 upDropMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g);
|
||||
float time = cos(uniform.factor * PI * 2.5) * exp(-uniform.factor);
|
||||
float2 uv = fragmentInput.textureCoordinate2 + float2(0.0, 0.5) * time;
|
||||
|
||||
float2 dir = float2(0.0, 0.1) * time;
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessUpDropMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessUpDropMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "upDropMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("upDropMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// upMoveInBlurIIMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace upMoveInBlurIIMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 upMoveInBlurIIMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float time = uniform.factor;
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float rotCorner = -(1. - time) * 1.5707963;
|
||||
float2 rot = float2(cos(rotCorner), sin(rotCorner));
|
||||
|
||||
uv = (uv - center) * uniform.iResolution;
|
||||
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
|
||||
uv = uv / uniform.iResolution + center;
|
||||
|
||||
float2 dir = float2(uv - center) * 0.5 * (1. - time);
|
||||
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.6;
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessUpMoveInBlurIIMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessUpMoveInBlurIIMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "upMoveInBlurIIMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseOut
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("upMoveInBlurMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// upMoveInBlurMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace upMoveInBlurMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 upMoveInBlurMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.0, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float time = clamp(uniform.factor * 2.0, 0.0, 1.0);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float rotCorner = (1. - time) * 1.5707963;
|
||||
float2 rot = float2(cos(rotCorner), sin(rotCorner));
|
||||
|
||||
uv = (uv - center) * uniform.iResolution;
|
||||
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
|
||||
uv = uv / uniform.iResolution + center;
|
||||
|
||||
float2 dir = float2(uv - center) * 0.5 * (1. - time);
|
||||
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.3;
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessUpMoveInBlurMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessUpMoveInBlurMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "upMoveInBlurMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseOut
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("upMoveInBlurMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// upMoveInBlurIIMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
#define PI 3.1415926
|
||||
namespace wiperMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 wiperMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a);
|
||||
float time = sin(uniform.factor * PI * 6.0) * exp(-uniform.factor);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
float rotCorner = time * 1.5707963;
|
||||
float2 rot = float2(cos(rotCorner), sin(rotCorner));
|
||||
|
||||
uv = (uv - center) * uniform.iResolution;
|
||||
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
|
||||
uv = uv / uniform.iResolution + center;
|
||||
|
||||
float2 dir = float2(uv - center) * 0.5 * time;
|
||||
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.6;
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessUpMoveInBlurIIMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessWiperMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "wiperMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("wiperMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// zoomOutBluMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace zoomInBlurMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 zoomInBlurMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float time = clamp(uniform.factor * 2.0, 0.0, 1.0);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
uv = (uv - center);
|
||||
uv = uv * (3.0 - 2.0 * uniform.factor) + center;
|
||||
|
||||
float2 dir = float2(uv - center) * 0.5 * (1. - time);
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessZoomOutBlurMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessZoomInBlurMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "zoomInBlurMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseOut
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("zoomInBlurMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace moveInMotion {
|
||||
namespace zoomInMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
@@ -18,7 +18,7 @@ namespace moveInMotion {
|
||||
//float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 moveInMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
fragment half4 zoomInMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
@@ -32,7 +32,7 @@ namespace moveInMotion {
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, (uv - center) * (2. - uniform.factor) + center);
|
||||
|
||||
return half4(mix(bgCol.rgb, fgCol.rgb, fgCol.a), fgCol.a);
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,10 +8,10 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessMoveInMotion: MetalVideoProcessMotion {
|
||||
public class MetalVideoProcessZoomInMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "moveInMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
super.init(fragmentFunctionName: "zoomInMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseIn
|
||||
self.factor = 0.0
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// zoomOutBluMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace zoomOutBlurMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 zoomOutBlurMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float time = clamp(uniform.factor * 2.0, 0.0, 1.0);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
uv = (uv - center);
|
||||
uv = uv * (0.4 + 0.6 * uniform.factor) + center;
|
||||
|
||||
float2 dir = float2(uv - center) * 0.5 * (1. - time);
|
||||
|
||||
half4 fgCol = half4(0.0);
|
||||
for(float i = 0.0; i < 1.0; i = i + 0.1) {
|
||||
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
|
||||
}
|
||||
|
||||
fgCol /= 10.0;
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MetalVideoProcessZoomOutBlurMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessZoomOutBlurMotion: MetalVideoProcessMotion {
|
||||
|
||||
var iResolution: Position {
|
||||
set {
|
||||
uniformSettings["iResolution"] = newValue
|
||||
}
|
||||
get {
|
||||
return uniformSettings["iResolution"]
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "zoomOutBlurMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseOut
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
|
||||
debugPrint("zoomOutBlurMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// zoomOutMotion.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace zoomOutMotion {
|
||||
typedef struct
|
||||
{
|
||||
float factor;
|
||||
float4 roi;
|
||||
//float2 iResolution;
|
||||
} MotionUniform;
|
||||
|
||||
fragment half4 zoomOutMotion(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant MotionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
|
||||
|
||||
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
|
||||
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
|
||||
float2 uv = fragmentInput.textureCoordinate2;
|
||||
|
||||
half4 fgCol = inputTexture2.sample(quadSampler, (uv - center) * (1. + uniform.factor) + center);
|
||||
|
||||
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MetalVideoProcessZoomOutMotion.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/21.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MetalVideoProcessZoomOutMotion: MetalVideoProcessMotion {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "zoomOutMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .quadraticEaseIn
|
||||
self.factor = 0.0
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
if let time = texture.timingStyle.timestamp?.asCMTime {
|
||||
if time < timelineRange.start {
|
||||
factor = 0.0
|
||||
}
|
||||
|
||||
debugPrint("moveInMotion:", factor, " frameTime:", texture.frameTime)
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
}
|
||||
}
|
||||
|
||||
/// before fade in, we need the texture alpha keep to zero
|
||||
/// - Parameter texture: texture
|
||||
/// - Returns: result
|
||||
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MetalVideoProcessFadeTransition.metal
|
||||
// MetalVideoProcessBurnTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// MetalVideoProcessBurnTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by RenZhu Macro on 2020/7/16.
|
||||
// Copyright © 2020 RenZhu Macro. All rights reserved.
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// MetalVideoProcessCircleEraseTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace morph {
|
||||
#define vec2 float2
|
||||
#define vec3 float3
|
||||
#define vec4 float4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float tweenFactor;
|
||||
float2 iResolution;
|
||||
} FadeTransitionUniform;
|
||||
|
||||
fragment half4 circleErase(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mag_filter:: linear,
|
||||
min_filter:: linear,
|
||||
address:: clamp_to_zero);
|
||||
float progress = uniform.tweenFactor;
|
||||
float2 uv = fragmentInput.textureCoordinate;
|
||||
|
||||
float mProgress = 1.0 - progress;
|
||||
vec2 resolution = uniform.iResolution;
|
||||
if(distance(uv * resolution, vec2(0.5,0.5) * resolution) < mProgress * length(resolution) * 0.5)
|
||||
return inputTexture.sample(quadSampler, uv);
|
||||
else
|
||||
return inputTexture2.sample(quadSampler, uv);
|
||||
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// MetalVideoProcessCircleEraseTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
public class MetalVideoProcessCircleEraseTransition: MetalVideoProcessTransition {
|
||||
public var iResolution: Size = Size(width: 1, height: 1) { didSet { uniformSettings["iResolution"] = iResolution } }
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "circleErase", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
iResolution = Size(width: 1, height: 1)
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
self.iResolution = Size(width: Float(texture.texture.width), height: Float(texture.texture.height))
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MetalVideoProcessFadeTransition.metal
|
||||
// MetalVideoProcessCubeTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//
|
||||
// MetalVideoProcessBurnTransition.swift
|
||||
// MetalVideoProcessCubeTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by RenZhu Macro on 2020/7/16.
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 RenZhu Macro. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MetalVideoProcessFadeTransition.metal
|
||||
// MetalVideoProcessEraseDownTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// MetalVideoProcessEraseLeftTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace eraseLeft {
|
||||
typedef struct
|
||||
{
|
||||
float tweenFactor;
|
||||
} FadeTransitionUniform;
|
||||
|
||||
fragment half4 eraseLeft(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mag_filter:: linear,
|
||||
min_filter:: linear,
|
||||
address:: clamp_to_zero);
|
||||
float2 uv = fragmentInput.textureCoordinate;
|
||||
half4 input0 = inputTexture.sample(quadSampler, uv);
|
||||
half4 input1 = inputTexture2.sample(quadSampler, uv);
|
||||
float process = uniform.tweenFactor;
|
||||
|
||||
float curve0 = process * process;
|
||||
float curve1 = 3. * curve0 - 2. * curve0 * process;
|
||||
return mix(input0, input1, step(1. - uv.x, process));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MetalVideoProcessEraseLeftTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
public class MetalVideoProcessEraseLeftTransition: MetalVideoProcessTransition {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "eraseLeft", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// MetalVideoProcessEraseRightTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace eraseLeft {
|
||||
typedef struct
|
||||
{
|
||||
float tweenFactor;
|
||||
} FadeTransitionUniform;
|
||||
|
||||
fragment half4 eraseRight(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mag_filter:: linear,
|
||||
min_filter:: linear,
|
||||
address:: clamp_to_zero);
|
||||
float2 uv = fragmentInput.textureCoordinate;
|
||||
half4 input0 = inputTexture.sample(quadSampler, uv);
|
||||
half4 input1 = inputTexture2.sample(quadSampler, uv);
|
||||
float process = uniform.tweenFactor;
|
||||
|
||||
float curve0 = process * process;
|
||||
float curve1 = 3. * curve0 - 2. * curve0 * process;
|
||||
return mix(input0, input1, step(uv.x, process));
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MetalVideoProcessEraseRightTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
public class MetalVideoProcessEraseRightTransition: MetalVideoProcessTransition {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "eraseRight", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// MetalVideoProcessEraseUpTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace eraseUp {
|
||||
typedef struct
|
||||
{
|
||||
float tweenFactor;
|
||||
} FadeTransitionUniform;
|
||||
|
||||
fragment half4 eraseUpTransition(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mag_filter:: linear,
|
||||
min_filter:: linear,
|
||||
address:: clamp_to_zero);
|
||||
float2 uv = fragmentInput.textureCoordinate;
|
||||
half4 input0 = inputTexture.sample(quadSampler, uv);
|
||||
half4 input1 = inputTexture2.sample(quadSampler, uv);
|
||||
float process = uniform.tweenFactor;
|
||||
|
||||
float curve0 = process * process;
|
||||
float curve1 = 3. * curve0 - 2. * curve0 * process;
|
||||
return mix(input0, input1, step(1. - uv.y, process));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MetalVideoProcessEraseUpTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
public class MetalVideoProcessEraseUpTransition: MetalVideoProcessTransition {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "eraseUpTransition", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// MetalVideoProcessFadeTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by RenZhu Macro on 2020/7/16.
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 RenZhu Macro. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// MetalVideoProcessFadeTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by RenZhu Macro on 2020/7/16.
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 RenZhu Macro. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MetalVideoProcessFadeTransition.metal
|
||||
// MetalVideoProcessMirrorRotateTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// MetalVideoProcessEraseRightTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace morph {
|
||||
#define vec2 float2
|
||||
#define vec3 float3
|
||||
#define vec4 float4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float tweenFactor;
|
||||
} FadeTransitionUniform;
|
||||
|
||||
constant float strength=0.1;
|
||||
|
||||
fragment half4 morph(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mag_filter:: linear,
|
||||
min_filter:: linear,
|
||||
address:: clamp_to_zero);
|
||||
float progress = uniform.tweenFactor;
|
||||
float2 uv = fragmentInput.textureCoordinate;
|
||||
vec2 p = uv;
|
||||
|
||||
vec4 ca = vec4(inputTexture.sample(quadSampler, p));
|
||||
vec4 cb = vec4(inputTexture2.sample(quadSampler, p));
|
||||
|
||||
vec2 oa = (((ca.rg + ca.b) * 0.5) * 2.0 - 1.0);
|
||||
vec2 ob = (((cb.rg + cb.b) * 0.5) * 2.0 - 1.0);
|
||||
vec2 oc = mix(oa,ob,0.5) * strength;
|
||||
// float progress = clamp(timer, 0.0, 1.0);
|
||||
float w0 = progress;
|
||||
float w1 = 1.0 - w0;
|
||||
|
||||
return mix(inputTexture.sample(quadSampler, p + oc * w0), inputTexture2.sample(quadSampler, p - oc * w1), progress);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MetalVideoProcessEraseRightTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
public class MetalVideoProcessMorphTransition: MetalVideoProcessTransition {
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "morph", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MetalVideoProcessEraseDownTransition.swift
|
||||
// MetalVideoProcessReflectTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// MetalVideoProcessVerticalGlitchTransition.metal
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
#include <metal_stdlib>
|
||||
using namespace metal;
|
||||
#include "../../Vender/Render/Base/OperationShaderTypes.h"
|
||||
|
||||
namespace morph {
|
||||
#define vec2 float2
|
||||
#define vec3 float3
|
||||
#define vec4 float4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float tweenFactor;
|
||||
float2 iResolution;
|
||||
} FadeTransitionUniform;
|
||||
|
||||
float easeInOutQuint(float t)
|
||||
{
|
||||
return t < 0.5 ? 16.0 * t * t * t * t * t : 1.0 + 16.0 * (--t) * t * t * t * t;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
fragment half4 verticalupGlitch(TwoInputVertexIO fragmentInput [[stage_in]],
|
||||
texture2d<half> inputTexture [[texture(0)]],
|
||||
texture2d<half> inputTexture2 [[texture(1)]],
|
||||
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
|
||||
{
|
||||
|
||||
constexpr sampler quadSampler(mag_filter:: linear,
|
||||
min_filter:: linear,
|
||||
address:: clamp_to_zero);
|
||||
float progress = uniform.tweenFactor;
|
||||
float2 uv = fragmentInput.textureCoordinate;
|
||||
vec2 resolution = uniform.iResolution;
|
||||
|
||||
float mProgress = 1.0 - easeInOutQuint(progress);
|
||||
if(uv.y < mProgress)
|
||||
return inputTexture.sample(quadSampler, uv + vec2(0.0, 1.0 - mProgress));
|
||||
else
|
||||
return inputTexture2.sample(quadSampler, uv - vec2(0.0, mProgress));
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// MetalVideoProcessVerticalGlitchTransition.swift
|
||||
// MetalVideoProcess
|
||||
//
|
||||
// Created by Ruanshengqiang Macro on 2020/7/16.
|
||||
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
public class MetalVideoProcessVerticalUpGlitchTransition: MetalVideoProcessTransition {
|
||||
public var iResolution: Size = Size(width: 1, height: 1) { didSet { uniformSettings["iResolution"] = iResolution } }
|
||||
|
||||
public init() {
|
||||
super.init(fragmentFunctionName: "verticalupGlitch", numberOfInputs: 2, device: sharedMetalRenderingDevice)
|
||||
self.timingType = .linearInterpolation
|
||||
iResolution = Size(width: 1, height: 1)
|
||||
}
|
||||
|
||||
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
|
||||
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
|
||||
self.iResolution = Size(width: Float(texture.texture.width), height: Float(texture.texture.height))
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,26 @@ MetalVideoProcess is a High-Performance video effects processing framework. It's
|
||||
## Technical requirements
|
||||
|
||||
- Swift 5.0
|
||||
|
||||
- Xcode 10.2 or higher on Mac or iOS
|
||||
|
||||
- iOS: 11.0 or higher
|
||||
|
||||
- OSX: 10.11 or higher
|
||||
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- Realtime smooth playback with filters
|
||||
- Support two video transitions
|
||||
- Support video motions
|
||||
- Video picture in picture
|
||||
- Transform video with multitouch
|
||||
- Support export video with H.265
|
||||
- Support video split, delete, insert, merge
|
||||
- High performance metal rendering
|
||||
|
||||
|
||||
|
||||
## General architecture
|
||||
|
||||
Reference in New Issue
Block a user