diff --git a/JoystickProxy/JoystickProxy/settings.ini b/JoystickProxy/JoystickProxy/settings.ini index 182b82b..d9e38d7 100644 --- a/JoystickProxy/JoystickProxy/settings.ini +++ b/JoystickProxy/JoystickProxy/settings.ini @@ -1,6 +1,6 @@ [Config] Host = 127.0.0.1 -Port = 11000 +Port = 11011 [Devices] 044f:0402 = Warthog Joystick diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick.meta b/JoystickVisualizer/Assets/Devices/Generic Stick.meta new file mode 100644 index 0000000..28acbba --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 335168a7fafb9a84082b428461b5e23f +folderAsset: yes +timeCreated: 1519756655 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend new file mode 100644 index 0000000..495bc80 Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend.meta new file mode 100644 index 0000000..e3cea87 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend.meta @@ -0,0 +1,132 @@ +fileFormatVersion: 2 +guid: dc0ca155149cd6d4280c26aa7541590f +timeCreated: 1519757052 +licenseType: Free +ModelImporter: + serializedVersion: 22 + fileIDToRecycleName: + 100000: //RootNode + 100002: Stick + 100004: Trigger + 100006: BaseRing + 400000: //RootNode + 400002: Stick + 400004: Trigger + 400006: BaseRing + 2300000: //RootNode + 2300002: Stick + 2300004: Trigger + 2300006: BaseRing + 3300000: //RootNode + 3300002: Stick + 3300004: Trigger + 3300006: BaseRing + 4300000: Base + 4300002: Stick + 4300004: Trigger + 4300006: BaseRing + 7400000: Default Take + 9500000: //RootNode + externalObjects: + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Material_001 + second: {fileID: 2100000, guid: cd2999e111f87ea49a66ba6054b0ec56, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Material_002 + second: {fileID: 2100000, guid: c069c313893dd054db6d4a8392d64b9d, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Material_003 + second: {fileID: 2100000, guid: 60ddd9317e112b44a893298384cd8cb1, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: Material_004 + second: {fileID: 2100000, guid: 53da874446f8f5f48bfa21bbd35cf674, type: 2} + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: unnamed + second: {fileID: 2100000, guid: 8e476b08e12f9ce4c811db7c02a67e79, type: 2} + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + materialLocation: 0 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend1 b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend1 new file mode 100644 index 0000000..71cdd52 Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend1 differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend1.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend1.meta new file mode 100644 index 0000000..2cababb --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Generic Stick.blend1.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 046a9332b589ee34b9fee4b1eec2c42f +timeCreated: 1519759871 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials.meta new file mode 100644 index 0000000..35522e4 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 22deddb4dad1bba47870de1ef06ec342 +folderAsset: yes +timeCreated: 1519759873 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black Plastic.mat b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black Plastic.mat new file mode 100644 index 0000000..27ba27d Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black Plastic.mat.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black Plastic.mat.meta new file mode 100644 index 0000000..8940758 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e58f0ef28fae6e5419b6978b166a473a +timeCreated: 1519760306 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black_Plastic.mat b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black_Plastic.mat new file mode 100644 index 0000000..c93d01a Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black_Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black_Plastic.mat.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black_Plastic.mat.meta new file mode 100644 index 0000000..93f2dcc --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Black_Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5fdf08e45005fb54a87e958fbe1c9628 +timeCreated: 1519759874 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed Metal.mat b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed Metal.mat new file mode 100644 index 0000000..268c3fc Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed Metal.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed Metal.mat.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed Metal.mat.meta new file mode 100644 index 0000000..10d34c7 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed Metal.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 922ec41231212364ab054500dbdcd641 +timeCreated: 1519760306 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed_Metal.mat b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed_Metal.mat new file mode 100644 index 0000000..3805819 Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed_Metal.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed_Metal.mat.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed_Metal.mat.meta new file mode 100644 index 0000000..9eec920 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Brushed_Metal.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: da68dff8bc275e5499f295ccd4acc3c8 +timeCreated: 1519759874 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red Plastic.mat b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red Plastic.mat new file mode 100644 index 0000000..9937df1 Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red Plastic.mat.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red Plastic.mat.meta new file mode 100644 index 0000000..033dfb9 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 3b6e0e57ce831d245990fb39f0db0f8a +timeCreated: 1519760307 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red_Plastic.mat b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red_Plastic.mat new file mode 100644 index 0000000..ee63e4c Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red_Plastic.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red_Plastic.mat.meta b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red_Plastic.mat.meta new file mode 100644 index 0000000..72c0553 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Generic Stick/Materials/Red_Plastic.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 312def60e7dcc994688865ce6f7bfaec +timeCreated: 1519759875 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Joystick - HOTAS Warthog-_6.mat b/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Joystick - HOTAS Warthog-_6.mat index 63ca42c..9bccea8 100644 Binary files a/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Joystick - HOTAS Warthog-_6.mat and b/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Joystick - HOTAS Warthog-_6.mat differ diff --git a/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat b/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat index 07b04ac..c2e1b18 100644 Binary files a/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat and b/JoystickVisualizer/Assets/Devices/HOTAS Warthog/Materials/Throttle - HOTAS Warthog-Color_A06.mat differ diff --git a/JoystickVisualizer/Assets/Devices/HOTAS Warthog/TMWarthogJoystick.cs b/JoystickVisualizer/Assets/Devices/HOTAS Warthog/TMWarthogJoystick.cs index c5575a2..33a65ca 100644 --- a/JoystickVisualizer/Assets/Devices/HOTAS Warthog/TMWarthogJoystick.cs +++ b/JoystickVisualizer/Assets/Devices/HOTAS Warthog/TMWarthogJoystick.cs @@ -2,10 +2,15 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using System; public class TMWarthogJoystick : MonoBehaviour { public const string USB_ID = "044f:0402"; + public Boolean ButtonIndicator = false; + + public GameObject Particles; + public GameObject Model; public GameObject StickGimbal; @@ -61,15 +66,19 @@ void StickEvent(JoystickState state) case "Buttons10": DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z); + SpawnIndicator(DMS); break; case "Buttons11": DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.z); + SpawnIndicator(DMS); break; case "Buttons12": DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z); + SpawnIndicator(DMS); break; case "Buttons13": DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.z); + SpawnIndicator(DMS); break; case "Buttons14": @@ -103,25 +112,31 @@ void StickEvent(JoystickState state) case "Buttons1": Pickle.transform.localPosition = new Vector3(Pickle.transform.localPosition.x, Pickle.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : 0.25f)); + SpawnIndicator(Pickle); break; case "Buttons4": MasterMode.transform.localPosition = new Vector3(((entry.Value == 0) ? 0.0f : -0.20f), MasterMode.transform.localPosition.y, MasterMode.transform.localPosition.z); + SpawnIndicator(MasterMode); break; case "Buttons2": PinkyButton.transform.localPosition = new Vector3(PinkyButton.transform.localPosition.x, PinkyButton.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : -0.20f)); + SpawnIndicator(PinkyButton); break; case "Buttons3": PinkyLever.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), PinkyLever.transform.localEulerAngles.y, PinkyLever.transform.localEulerAngles.z); + SpawnIndicator(PinkyLever); break; case "Buttons0": Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z); + SpawnIndicator(Trigger); break; case "Buttons5": Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 10.0f : 20.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z); + SpawnIndicator(Trigger); break; case "PointOfViewControllers0": @@ -160,6 +175,18 @@ void StickEvent(JoystickState state) } } + private void SpawnIndicator(GameObject gimbal) + { + if (ButtonIndicator) + { + GameObject indicator = Instantiate(Particles, gimbal.transform) as GameObject; + Transform parent = gimbal.GetComponentInChildren().transform; + indicator.transform.position = parent.GetComponent().bounds.center; + indicator.SetActive(true); + Destroy(indicator, 1); + } + } + public static float ConvertRange( double value, // value to convert double originalStart, double originalEnd, // original range diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle.meta b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle.meta new file mode 100644 index 0000000..32ba064 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: dc884d522e9156c419d3660d98ffcc7e +folderAsset: yes +timeCreated: 1520166176 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials.meta b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials.meta new file mode 100644 index 0000000..01d6f4b --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1b5b675ac9d0c2f46b25191ad03a7ac2 +folderAsset: yes +timeCreated: 1520166191 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/No Name.mat b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/No Name.mat new file mode 100644 index 0000000..26abafb Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/No Name.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/No Name.mat.meta b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/No Name.mat.meta new file mode 100644 index 0000000..e5b38cb --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/No Name.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 38128a05324326b4db7885cb4ad84395 +timeCreated: 1520170576 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/unnamed.mat b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/unnamed.mat new file mode 100644 index 0000000..d7a267f Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/unnamed.mat differ diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/unnamed.mat.meta b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/unnamed.mat.meta new file mode 100644 index 0000000..f7871fe --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/Materials/unnamed.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 92be59e96beb7c141b3a6ce3d3676c79 +timeCreated: 1520166191 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/SaitekX55Throttle.cs b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/SaitekX55Throttle.cs new file mode 100644 index 0000000..0bb70ae --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/SaitekX55Throttle.cs @@ -0,0 +1,64 @@ +using Assets; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SaitekX55Throttle : MonoBehaviour { + public const string USB_ID = "0738:a215"; + //public const string USB_ID = "044f:0404"; + + public GameObject Model; + + public GameObject LeftThrottle; + public GameObject RightThrottle; + + // Use this for initialization + void Start() + { + UDPListener.StickEventListener += StickEvent; + } + + // Update is called once per frame + void Update() + { + } + + void StickEvent(JoystickState state) + { + if (state.UsbID != USB_ID) + { + return; + } + + Model.SetActive(true); + + foreach (KeyValuePair entry in state.Data) + { + switch (entry.Key) + { + case "Connected": + if (Model.activeInHierarchy) + Model.SetActive(entry.Value == 1); + break; + + case "X": // Left brake + // Rotate Z between 0 and 20 + LeftThrottle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 0, 40), 0, 0); + break; + case "Y": // Right brake + RightThrottle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 0, 40), 0, 0); + break; + } + } + } + + public static float ConvertRange( + double value, // value to convert + double originalStart, double originalEnd, // original range + double newStart, double newEnd) // desired range + { + double scale = (double)(newEnd - newStart) / (originalEnd - originalStart); + return (float)(newStart + ((value - originalStart) * scale)); + } + +} diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/SaitekX55Throttle.cs.meta b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/SaitekX55Throttle.cs.meta new file mode 100644 index 0000000..4d48f32 --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/SaitekX55Throttle.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 01305fd6072dbba4f8cdd596e2535e03 +timeCreated: 1520170928 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/x55.fbx b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/x55.fbx new file mode 100644 index 0000000..8870eb0 Binary files /dev/null and b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/x55.fbx differ diff --git a/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/x55.fbx.meta b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/x55.fbx.meta new file mode 100644 index 0000000..172622e --- /dev/null +++ b/JoystickVisualizer/Assets/Devices/Saitek X55 Throttle/x55.fbx.meta @@ -0,0 +1,205 @@ +fileFormatVersion: 2 +guid: 3938e89069101804c86ee241ce24d732 +timeCreated: 1520170576 +licenseType: Free +ModelImporter: + serializedVersion: 22 + fileIDToRecycleName: + 100000: BTN E + 100002: BTN H + 100004: BTN I + 100006: BTN KI + 100008: HAT 3 + 100010: HAT 4 + 100012: INF WHEEL + 100014: Mouse + 100016: RTY 1 + 100018: RTY 2 + 100020: RTY 3 + 100022: RTY 4 + 100024: SLD + 100026: SW 1-2 + 100028: SW 3-4 + 100030: SW 5-6 + 100032: Throttle Left + 100034: Throttle Right + 100036: TLG 1 + 100038: TLG 2 + 100040: TLG 3 + 100042: TLG 4 + 100044: //RootNode + 400000: BTN E + 400002: BTN H + 400004: BTN I + 400006: BTN KI + 400008: HAT 3 + 400010: HAT 4 + 400012: INF WHEEL + 400014: Mouse + 400016: RTY 1 + 400018: RTY 2 + 400020: RTY 3 + 400022: RTY 4 + 400024: SLD + 400026: SW 1-2 + 400028: SW 3-4 + 400030: SW 5-6 + 400032: Throttle Left + 400034: Throttle Right + 400036: TLG 1 + 400038: TLG 2 + 400040: TLG 3 + 400042: TLG 4 + 400044: //RootNode + 2300000: BTN E + 2300002: BTN H + 2300004: BTN I + 2300006: BTN KI + 2300008: HAT 3 + 2300010: HAT 4 + 2300012: INF WHEEL + 2300014: Mouse + 2300016: RTY 1 + 2300018: RTY 2 + 2300020: RTY 3 + 2300022: RTY 4 + 2300024: SLD + 2300026: SW 1-2 + 2300028: SW 3-4 + 2300030: SW 5-6 + 2300032: Throttle Left + 2300034: Throttle Right + 2300036: TLG 1 + 2300038: TLG 2 + 2300040: TLG 3 + 2300042: TLG 4 + 2300044: //RootNode + 3300000: BTN E + 3300002: BTN H + 3300004: BTN I + 3300006: BTN KI + 3300008: HAT 3 + 3300010: HAT 4 + 3300012: INF WHEEL + 3300014: Mouse + 3300016: RTY 1 + 3300018: RTY 2 + 3300020: RTY 3 + 3300022: RTY 4 + 3300024: SLD + 3300026: SW 1-2 + 3300028: SW 3-4 + 3300030: SW 5-6 + 3300032: Throttle Left + 3300034: Throttle Right + 3300036: TLG 1 + 3300038: TLG 2 + 3300040: TLG 3 + 3300042: TLG 4 + 3300044: //RootNode + 4300000: Throttle Base + 4300002: SW 1-2 + 4300004: RTY 4 + 4300006: RTY 3 + 4300008: SW 3-4 + 4300010: SW 5-6 + 4300012: TLG 1 + 4300014: TLG 2 + 4300016: TLG 3 + 4300018: TLG 4 + 4300020: Throttle Right + 4300022: BTN H + 4300024: HAT 3 + 4300026: Mouse + 4300028: BTN E + 4300030: SLD + 4300032: RTY 1 + 4300034: RTY 2 + 4300036: HAT 4 + 4300038: BTN I + 4300040: Throttle Left + 4300042: INF WHEEL + 4300044: BTN KI + externalObjects: + - first: + type: UnityEngine:Material + assembly: UnityEngine.CoreModule + name: No Name + second: {fileID: 2100000, guid: 38128a05324326b4db7885cb4ad84395, type: 2} + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + materialLocation: 0 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/JoystickVisualizer.unity b/JoystickVisualizer/Assets/JoystickVisualizer.unity index 0c84e4b..561038d 100644 Binary files a/JoystickVisualizer/Assets/JoystickVisualizer.unity and b/JoystickVisualizer/Assets/JoystickVisualizer.unity differ diff --git a/JoystickVisualizer/Assets/Materials/OverlayShader.shader b/JoystickVisualizer/Assets/Materials/OverlayShader.shader new file mode 100644 index 0000000..9caf7ce --- /dev/null +++ b/JoystickVisualizer/Assets/Materials/OverlayShader.shader @@ -0,0 +1,85 @@ +Shader "Custom/OverlayShader" { + Properties{ + _TintColor("Tint Color", Color) = (0.5,0.5,0.5,0.5) + _MainTex("Particle Texture", 2D) = "white" {} + _InvFade("Soft Particles Factor", Range(0.01,3.0)) = 1.0 + } + Category{ + Tags{ "Queue" = "Overlay" "IgnoreProjector" = "True" "RenderType" = "Overlay" "PreviewType" = "Plane" } + ZTest Always + Blend SrcAlpha OneMinusSrcAlpha + ColorMask RGB + Cull Off Lighting Off ZWrite Off + + SubShader{ + Pass{ + + CGPROGRAM +#pragma vertex vert +#pragma fragment frag +#pragma target 2.0 +#pragma multi_compile_particles +#pragma multi_compile_fog + +#include "UnityCG.cginc" + + sampler2D _MainTex; + fixed4 _TintColor; + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + UNITY_FOG_COORDS(1) +#ifdef SOFTPARTICLES_ON + float4 projPos : TEXCOORD2; +#endif + UNITY_VERTEX_OUTPUT_STEREO + }; + + float4 _MainTex_ST; + + v2f vert(appdata_t v) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + o.vertex = UnityObjectToClipPos(v.vertex); +#ifdef SOFTPARTICLES_ON + o.projPos = ComputeScreenPos(o.vertex); + COMPUTE_EYEDEPTH(o.projPos.z); +#endif + o.color = v.color * _TintColor; + o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex); + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float _InvFade; + + fixed4 frag(v2f i) : SV_Target + { +#ifdef SOFTPARTICLES_ON + float sceneZ = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))); + float partZ = i.projPos.z; + float fade = saturate(_InvFade * (sceneZ - partZ)); + i.color.a *= fade; +#endif + + fixed4 col = 2.0f * i.color * tex2D(_MainTex, i.texcoord); + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } + } +} \ No newline at end of file diff --git a/JoystickVisualizer/Assets/Materials/OverlayShader.shader.meta b/JoystickVisualizer/Assets/Materials/OverlayShader.shader.meta new file mode 100644 index 0000000..f6ba9b5 --- /dev/null +++ b/JoystickVisualizer/Assets/Materials/OverlayShader.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: fd89d21133ba2a444a6c2201f8e46334 +timeCreated: 1520156532 +licenseType: Free +ShaderImporter: + externalObjects: {} + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Materials/ParticleMat.mat b/JoystickVisualizer/Assets/Materials/ParticleMat.mat new file mode 100644 index 0000000..db8ce9c Binary files /dev/null and b/JoystickVisualizer/Assets/Materials/ParticleMat.mat differ diff --git a/JoystickVisualizer/Assets/Materials/ParticleMat.mat.meta b/JoystickVisualizer/Assets/Materials/ParticleMat.mat.meta new file mode 100644 index 0000000..4f6237a --- /dev/null +++ b/JoystickVisualizer/Assets/Materials/ParticleMat.mat.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 8e0bcac33c541fd448e0953070f93ce9 +timeCreated: 1520150298 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/Materials/RippleFXImage.png b/JoystickVisualizer/Assets/Materials/RippleFXImage.png new file mode 100644 index 0000000..2847c5a Binary files /dev/null and b/JoystickVisualizer/Assets/Materials/RippleFXImage.png differ diff --git a/JoystickVisualizer/Assets/Materials/RippleFXImage.png.meta b/JoystickVisualizer/Assets/Materials/RippleFXImage.png.meta new file mode 100644 index 0000000..5e7ca34 --- /dev/null +++ b/JoystickVisualizer/Assets/Materials/RippleFXImage.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 43407f5845d501f4e973fbc1c15c5932 +timeCreated: 1520150195 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/PP_Profile.asset b/JoystickVisualizer/Assets/PP_Profile.asset new file mode 100644 index 0000000..db7dea2 Binary files /dev/null and b/JoystickVisualizer/Assets/PP_Profile.asset differ diff --git a/JoystickVisualizer/Assets/PP_Profile.asset.meta b/JoystickVisualizer/Assets/PP_Profile.asset.meta new file mode 100644 index 0000000..4757473 --- /dev/null +++ b/JoystickVisualizer/Assets/PP_Profile.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7be38cf8bcadd704aa923514399629fd +timeCreated: 1520120435 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/JoystickVisualizer/Assets/PostProcessing/Editor/Models/FogModelEditor.cs b/JoystickVisualizer/Assets/PostProcessing/Editor/Models/FogModelEditor.cs index 5f19467..b5b17c4 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Editor/Models/FogModelEditor.cs +++ b/JoystickVisualizer/Assets/PostProcessing/Editor/Models/FogModelEditor.cs @@ -4,7 +4,7 @@ namespace UnityEditor.PostProcessing { using Settings = FogModel.Settings; - [PostProcessingModelEditor(typeof(FogModel), alwaysEnabled: true)] + [PostProcessingModelEditor(typeof(FogModel))] public class FogModelEditor : PostProcessingModelEditor { SerializedProperty m_ExcludeSkybox; @@ -16,8 +16,8 @@ public override void OnEnable() public override void OnInspectorGUI() { - EditorGUILayout.HelpBox("This effect adds fog compatibility to the deferred rendering path; actual fog settings should be set in the Lighting panel.", MessageType.Info); - EditorGUILayout.PropertyField(m_ExcludeSkybox, EditorGUIHelper.GetContent("Exclude Skybox (deferred only)")); + EditorGUILayout.HelpBox("This effect adds fog compatibility to the deferred rendering path; enabling it with the forward rendering path won't have any effect. Actual fog settings should be set in the Lighting panel.", MessageType.Info); + EditorGUILayout.PropertyField(m_ExcludeSkybox); EditorGUI.indentLevel--; } } diff --git a/JoystickVisualizer/Assets/PostProcessing/Editor/PostProcessingFactory.cs b/JoystickVisualizer/Assets/PostProcessing/Editor/PostProcessingFactory.cs index d655755..6ac50f2 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Editor/PostProcessingFactory.cs +++ b/JoystickVisualizer/Assets/PostProcessing/Editor/PostProcessingFactory.cs @@ -18,6 +18,7 @@ internal static PostProcessingProfile CreatePostProcessingProfileAtPath(string p { var profile = ScriptableObject.CreateInstance(); profile.name = Path.GetFileName(path); + profile.fog.enabled = true; AssetDatabase.CreateAsset(profile, path); return profile; } diff --git a/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc b/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc index 0fd0ff6..5a66bc1 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc +++ b/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc @@ -209,8 +209,10 @@ float3 PickSamplePoint(float2 uv, float index) // Uniformaly distributed points on a unit sphere http://goo.gl/X2F1Ho #if defined(FIX_SAMPLING_PATTERN) float gn = GradientNoise(uv * _Downsample); - float u = frac(UVRandom(0.0, index) + gn) * 2.0 - 1.0; - float theta = (UVRandom(1.0, index) + gn) * UNITY_PI_2; + // FIXME: This was added to avoid a NVIDIA driver issue. + // vvvvvvvvvvvv + float u = frac(UVRandom(0.0, index + uv.x * 1e-10) + gn) * 2.0 - 1.0; + float theta = (UVRandom(1.0, index + uv.x * 1e-10) + gn) * UNITY_PI_2; #else float u = UVRandom(uv.x + _Time.x, uv.y + index) * 2.0 - 1.0; float theta = UVRandom(-uv.x - _Time.x, uv.y + index) * UNITY_PI_2; diff --git a/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/LutGen.shader b/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/LutGen.shader index fcd24f4..659ab54 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/LutGen.shader +++ b/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/LutGen.shader @@ -61,7 +61,7 @@ Shader "Hidden/Post FX/Lut Generator" acescg = WhiteBalance(acescg, _Balance); acescg = LiftGammaGain(acescg, _Lift, _InvGamma, _Gain); - half3 hsv = RgbToHsv(acescg); + half3 hsv = RgbToHsv(max(acescg, 0.0)); hsv.x = SecondaryHueHue(hsv.x + _HueShift, _Curves); acescg = HsvToRgb(hsv); diff --git a/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/ScreenSpaceReflection.shader b/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/ScreenSpaceReflection.shader index 7f2fa91..f6b3b4f 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/ScreenSpaceReflection.shader +++ b/JoystickVisualizer/Assets/PostProcessing/Resources/Shaders/ScreenSpaceReflection.shader @@ -749,16 +749,15 @@ Shader "Hidden/Post FX/Screen Space Reflection" float confidence = temp.w; float3 colorResult = confidence > 0.0 ? tex2D(_MainTex, hitPoint).rgb : tex2D(_CameraReflectionsTexture, tsP).rgb; -#ifdef UNITY_COMPILER_HLSL - /*if (any(isnan(colorResult))) + if (any(isnan(colorResult))) colorResult = float3(0.0, 0.0, 0.0); // As of 11/29/2015, on Unity 5.3 on a Windows 8.1 computer with a NVIDIA GeForce 980, // with driver 347.62, the above check does not actually work to get rid of NaNs! // So we add this "redundant" check. if (!all(isfinite(colorResult))) - colorResult = float3(0.0, 0.0, 0.0);*/ -#endif + colorResult = float3(0.0, 0.0, 0.0); + return float4(colorResult, confidence); } diff --git a/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/ColorGradingComponent.cs b/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/ColorGradingComponent.cs index c468409..3948e7b 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/ColorGradingComponent.cs +++ b/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/ColorGradingComponent.cs @@ -223,11 +223,19 @@ public static void CalculateSlopePowerOffset(Color slope, Color power, Color off outOffset = GetOffsetValue(offset); } + TextureFormat GetCurveFormat() + { + if (SystemInfo.SupportsTextureFormat(TextureFormat.RGBAHalf)) + return TextureFormat.RGBAHalf; + + return TextureFormat.RGBA32; + } + Texture2D GetCurveTexture() { if (m_GradingCurves == null) { - m_GradingCurves = new Texture2D(k_CurvePrecision, 2, TextureFormat.RGBAHalf, false, true) + m_GradingCurves = new Texture2D(k_CurvePrecision, 2, GetCurveFormat(), false, true) { name = "Internal Curves Texture", hideFlags = HideFlags.DontSave, @@ -271,6 +279,14 @@ bool IsLogLutValid(RenderTexture lut) return lut != null && lut.IsCreated() && lut.height == k_InternalLogLutSize; } + RenderTextureFormat GetLutFormat() + { + if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf)) + return RenderTextureFormat.ARGBHalf; + + return RenderTextureFormat.ARGB32; + } + void GenerateLut() { var settings = model.settings; @@ -279,7 +295,7 @@ void GenerateLut() { GraphicsUtils.Destroy(model.bakedLut); - model.bakedLut = new RenderTexture(k_InternalLogLutSize * k_InternalLogLutSize, k_InternalLogLutSize, 0, RenderTextureFormat.ARGBHalf) + model.bakedLut = new RenderTexture(k_InternalLogLutSize * k_InternalLogLutSize, k_InternalLogLutSize, 0, GetLutFormat()) { name = "Color Grading Log LUT", hideFlags = HideFlags.DontSave, diff --git a/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/DepthOfFieldComponent.cs b/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/DepthOfFieldComponent.cs index 694888c..c79a333 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/DepthOfFieldComponent.cs +++ b/JoystickVisualizer/Assets/PostProcessing/Runtime/Components/DepthOfFieldComponent.cs @@ -28,7 +28,6 @@ public override bool active get { return model.enabled - && SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf) && !context.interrupted; } } @@ -81,11 +80,11 @@ RenderTextureFormat SelectFormat(RenderTextureFormat primary, RenderTextureForma public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasCoC, Vector2 taaJitter, float taaBlending) { var settings = model.settings; - var colorFormat = RenderTextureFormat.ARGBHalf; + var colorFormat = RenderTextureFormat.DefaultHDR; var cocFormat = SelectFormat(RenderTextureFormat.R8, RenderTextureFormat.RHalf); // Avoid using R8 on OSX with Metal. #896121, https://goo.gl/MgKqu6 - #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + #if (UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX) && !UNITY_2017_1_OR_NEWER if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal) cocFormat = SelectFormat(RenderTextureFormat.RHalf, RenderTextureFormat.Default); #endif @@ -105,7 +104,7 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC material.SetFloat(Uniforms._RcpAspect, 1f / aspect); // CoC calculation pass - var rtCoC = context.renderTextureFactory.Get(context.width, context.height, 0, cocFormat); + var rtCoC = context.renderTextureFactory.Get(context.width, context.height, 0, cocFormat, RenderTextureReadWrite.Linear); Graphics.Blit(null, rtCoC, material, 0); if (antialiasCoC) diff --git a/JoystickVisualizer/Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs b/JoystickVisualizer/Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs index ed2af8f..6f292d2 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs +++ b/JoystickVisualizer/Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs @@ -143,7 +143,7 @@ void OnPreCull() // Find out which camera flags are needed before rendering begins // Note that motion vectors will only be available one frame after being enabled - var flags = DepthTextureMode.None; + var flags = context.camera.depthTextureMode; foreach (var component in m_Components) { if (component.active) @@ -182,8 +182,6 @@ void OnPostRender() } // Classic render target pipeline for RT-based effects - // Note that any effect that happens after this stack will work in LDR - [ImageEffectTransformsToLDR] void OnRenderImage(RenderTexture source, RenderTexture destination) { if (profile == null || m_Camera == null) @@ -329,10 +327,6 @@ void OnDisable() m_Components.Clear(); - // Reset camera mode - if (m_Camera != null) - m_Camera.depthTextureMode = DepthTextureMode.None; - // Factories m_MaterialFactory.Dispose(); m_RenderTextureFactory.Dispose(); diff --git a/JoystickVisualizer/Assets/PostProcessing/Runtime/Utils/RenderTextureFactory.cs b/JoystickVisualizer/Assets/PostProcessing/Runtime/Utils/RenderTextureFactory.cs index d51bf6c..a386473 100644 --- a/JoystickVisualizer/Assets/PostProcessing/Runtime/Utils/RenderTextureFactory.cs +++ b/JoystickVisualizer/Assets/PostProcessing/Runtime/Utils/RenderTextureFactory.cs @@ -27,7 +27,7 @@ public RenderTexture Get(RenderTexture baseRenderTexture) public RenderTexture Get(int width, int height, int depthBuffer = 0, RenderTextureFormat format = RenderTextureFormat.ARGBHalf, RenderTextureReadWrite rw = RenderTextureReadWrite.Default, FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, string name = "FactoryTempTexture") { - var rt = RenderTexture.GetTemporary(width, height, depthBuffer, format); + var rt = RenderTexture.GetTemporary(width, height, depthBuffer, format, rw); // add forgotten param rw rt.filterMode = filterMode; rt.wrapMode = wrapMode; rt.name = name; diff --git a/JoystickVisualizer/Assets/PostProcessing/Utilities/CustomMotionTexture/CustomMotionVectorDebugProfile.asset b/JoystickVisualizer/Assets/PostProcessing/Utilities/CustomMotionTexture/CustomMotionVectorDebugProfile.asset index e716b6c..63873b1 100644 Binary files a/JoystickVisualizer/Assets/PostProcessing/Utilities/CustomMotionTexture/CustomMotionVectorDebugProfile.asset and b/JoystickVisualizer/Assets/PostProcessing/Utilities/CustomMotionTexture/CustomMotionVectorDebugProfile.asset differ diff --git a/JoystickVisualizer/Assets/UDPListener.cs b/JoystickVisualizer/Assets/UDPListener.cs index f5d3b60..d01a0ef 100644 --- a/JoystickVisualizer/Assets/UDPListener.cs +++ b/JoystickVisualizer/Assets/UDPListener.cs @@ -9,7 +9,7 @@ public class UDPListener : MonoBehaviour { - public int Port = 11000; + public int Port = 11011; public delegate void StickEvent (JoystickState state); public static event StickEvent StickEventListener;