├── UnityAndroidCameraPlugin ├── settings.gradle ├── camera │ ├── src │ │ └── main │ │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ │ ├── java │ │ │ └── arp │ │ │ │ └── camera │ │ │ │ ├── UsedThroughReflection.java │ │ │ │ ├── YuvToRgb.java │ │ │ │ └── CameraPluginActivity.java │ │ │ ├── library │ │ │ ├── unity_android_player.jar │ │ │ └── libandroid_tensorflow_inference_java.jar │ │ │ ├── cpp │ │ │ ├── RenderingPlugin.h │ │ │ ├── Unity │ │ │ │ ├── IUnityGraphicsD3D11.h │ │ │ │ ├── IUnityGraphicsD3D9.h │ │ │ │ ├── IUnityGraphicsD3D12.h │ │ │ │ ├── IUnityGraphics.h │ │ │ │ └── IUnityInterface.h │ │ │ ├── CMakeLists.txt │ │ │ └── RenderingPlugin.cpp │ │ │ ├── AndroidManifest.xml │ │ │ └── rs │ │ │ └── yuv2rgb.rs │ ├── proguard-rules.pro │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── README.md ├── build.gradle ├── gradle.properties ├── .gitignore ├── gradlew.bat ├── gradlew └── import-summary.txt ├── screen.png ├── UnityAndroidCamera ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── PresetManager.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── XRSettings.asset │ ├── VersionControlSettings.asset │ ├── EditorBuildSettings.asset │ ├── AudioManager.asset │ ├── VFXManager.asset │ ├── TimelineSettings.asset │ ├── EditorSettings.asset │ ├── TagManager.asset │ ├── DynamicsManager.asset │ ├── UnityConnectSettings.asset │ ├── NavMeshAreas.asset │ ├── Physics2DSettings.asset │ ├── GraphicsSettings.asset │ ├── QualitySettings.asset │ ├── InputManager.asset │ └── ProjectSettings.asset ├── Assets │ ├── Plugins │ │ ├── Android │ │ │ ├── camera-release.aar │ │ │ ├── AndroidManifest.xml.meta │ │ │ ├── AndroidManifest.xml.backup.meta │ │ │ ├── AndroidManifest.xml │ │ │ ├── AndroidManifest.xml.backup │ │ │ └── camera-release.aar.meta │ │ └── Android.meta │ ├── Scenes │ │ ├── MainScene.unity.meta │ │ └── MainScene.unity │ ├── Materials │ │ ├── Skybox2dMaterial.mat.meta │ │ ├── CubeMaterial.mat.meta │ │ ├── CubeMaterial.mat │ │ └── Skybox2dMaterial.mat │ ├── Materials.meta │ ├── Plugins.meta │ ├── Scenes.meta │ ├── Scripts.meta │ ├── Shaders.meta │ ├── Shaders │ │ ├── SkyboxBackgroundTexture.shader.meta │ │ └── SkyboxBackgroundTexture.shader │ └── Scripts │ │ ├── CameraPermissionTest.cs.meta │ │ ├── PermissionsRationaleDialog.cs.meta │ │ ├── CameraPluginWrapper.cs.meta │ │ ├── CameraPermissionTest.cs │ │ ├── PermissionsRationaleDialog.cs │ │ └── CameraPluginWrapper.cs ├── UserSettings │ └── EditorUserSettings.asset ├── .gitignore └── .gitattributes ├── NativeCameraPlugin ├── jni │ ├── Application.mk │ ├── src │ │ ├── RenderingPlugin.h │ │ ├── Unity │ │ │ ├── IUnityGraphicsD3D11.h │ │ │ ├── IUnityGraphicsD3D9.h │ │ │ ├── IUnityGraphicsD3D12.h │ │ │ ├── IUnityGraphics.h │ │ │ └── IUnityInterface.h │ │ └── RenderingPlugin.cpp │ └── Android.mk ├── build.sh ├── build.bat ├── README.md └── .gitignore ├── .gitignore ├── LICENSE └── README.md /UnityAndroidCameraPlugin/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':camera' 2 | -------------------------------------------------------------------------------- /screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robsondepaula/unity-android-native-camera/HEAD/screen.png -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.1.3f1 2 | m_EditorVersionWithRevision: 2020.1.3f1 (cf5c4788e1d8) 3 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Camera 3 | 4 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-28 2 | APP_ABI := armeabi-v7a 3 | APP_OPTIM := release 4 | APP_STL := c++_static 5 | APP_CPPFLAGS := -frtti -fexceptions -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/java/arp/camera/UsedThroughReflection.java: -------------------------------------------------------------------------------- 1 | package arp.camera; 2 | 3 | 4 | public @interface UsedThroughReflection { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robsondepaula/unity-android-native-camera/HEAD/UnityAndroidCameraPlugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android/camera-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robsondepaula/unity-android-native-camera/HEAD/UnityAndroidCamera/Assets/Plugins/Android/camera-release.aar -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/RenderingPlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Unity/IUnityInterface.h" 4 | #include "Unity/IUnityGraphics.h" 5 | 6 | #define SUPPORT_OPENGL_UNIFIED 1 7 | #define SUPPORT_OPENGL_ES 1 -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/library/unity_android_player.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robsondepaula/unity-android-native-camera/HEAD/UnityAndroidCameraPlugin/camera/src/main/library/unity_android_player.jar -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/RenderingPlugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Unity/IUnityInterface.h" 4 | #include "Unity/IUnityGraphics.h" 5 | 6 | #define SUPPORT_OPENGL_UNIFIED 1 7 | #define SUPPORT_OPENGL_ES 1 -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android/AndroidManifest.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21476ffea67154eb08c603348b48e76c 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android/AndroidManifest.xml.backup.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7617f6c23e2fd4207b17b185c87c3989 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/library/libandroid_tensorflow_inference_java.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robsondepaula/unity-android-native-camera/HEAD/UnityAndroidCameraPlugin/camera/src/main/library/libandroid_tensorflow_inference_java.jar -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scenes/MainScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c0e4d2afb4ab4b9ba79cae9f81bfb78 3 | timeCreated: 1482248194 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Materials/Skybox2dMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5430711f42d144a82a5e6e0a8b3052a4 3 | timeCreated: 1483101419 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46a160c5edccf4b1598ee87d63318b94 3 | folderAsset: yes 4 | timeCreated: 1482410213 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Materials/CubeMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29e4f4d5415de49738b5aebad29612cf 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04010b28df5672a4bb1950c737c08746 3 | folderAsset: yes 4 | timeCreated: 1482165404 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7653b73bbbe4a4ba286fb9399369077b 3 | folderAsset: yes 4 | timeCreated: 1482248172 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64c5f3d2d79834d0b8e331333fb1fafa 3 | folderAsset: yes 4 | timeCreated: 1482247940 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c3a7cacc5718435aa936ec136ee1a62 3 | folderAsset: yes 4 | timeCreated: 1483101530 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91b4d74398cd3fb48bb05928141ef795 3 | folderAsset: yes 4 | timeCreated: 1482165404 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/MainScene.unity 10 | -------------------------------------------------------------------------------- /NativeCameraPlugin/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NDK_ROOT="/Users/robson.p/Library/Android/sdk/ndk/21.3.6528147" 4 | cd "jni" 5 | $NDK_ROOT/ndk-build -B V=1 6 | cd .. 7 | cp -R libs/armeabi-v7a/libNativeCameraPlugin.so ../UnityAndroidCamera/Assets/Plugins/Android/libs/armeabi-v7a/libNativeCameraPlugin.so 8 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Shaders/SkyboxBackgroundTexture.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1baaa7eaca58c4ab08f3ca2e555ac6ff 3 | timeCreated: 1483101644 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Aug 24 10:51:40 BRT 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/README.md: -------------------------------------------------------------------------------- 1 | # UnityAndroidCameraPlugin 2 | 3 | Open the project in Android Studio and wait for it to resolve the depencies. 4 | 5 | To build and update the aar library into [UnityAndroidCamera](UnityAndroidCamera), just execute the *assemble* task available in the Gradle panel for the 'camera' project. 6 | 7 | -------------------------------------------------------------------------------- /NativeCameraPlugin/build.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | setlocal 4 | 5 | SET NDK_ROOT=D:\android-sdk\ndk\21.3.6528147 6 | CD "jni" 7 | CALL %NDK_ROOT%/ndk-build -B V=1 8 | CD .. 9 | COPY /Y .\libs\armeabi-v7a\libNativeCameraPlugin.so ..\UnityAndroidCamera\Assets\Plugins\Android\libs\armeabi-v7a\libNativeCameraPlugin.so 10 | 11 | endlocal 12 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := NativeCameraPlugin 6 | LOCAL_SRC_FILES := src/RenderingPlugin.cpp 7 | LOCAL_LDLIBS += -llog -ldl -lGLESv2 8 | LOCAL_ARM_MODE := arm 9 | LOCAL_CFLAGS := -DUNITY_ANDROID 10 | 11 | 12 | include $(BUILD_SHARED_LIBRARY) 13 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts/CameraPermissionTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49c50bf1b475d4ff89409320caef62d6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts/PermissionsRationaleDialog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b34be1e5c196d40f4903b1d6a2072430 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts/CameraPluginWrapper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a37fda7ae3f24728940be3965e43842 3 | timeCreated: 1482247953 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/Unity/IUnityGraphicsD3D11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) 6 | { 7 | ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); 8 | }; 9 | UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL,0xBF76967F07EFB177ULL,IUnityGraphicsD3D11) 10 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/Unity/IUnityGraphicsD3D11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) 6 | { 7 | ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); 8 | }; 9 | UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL,0xBF76967F07EFB177ULL,IUnityGraphicsD3D11) 10 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/Unity/IUnityGraphicsD3D9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) 6 | { 7 | IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); 8 | IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); 9 | }; 10 | UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL,0xAC825B19B6F82AC3ULL,IUnityGraphicsD3D9) 11 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | m_CompiledVersion: 0 14 | m_RuntimeVersion: 0 15 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/Unity/IUnityGraphicsD3D9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) 6 | { 7 | IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); 8 | IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); 9 | }; 10 | UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL,0xAC825B19B6F82AC3ULL,IUnityGraphicsD3D9) 11 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/TimelineSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | assetDefaultFramerate: 60 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### macOS ### 2 | # General 3 | .DS_Store 4 | .AppleDouble 5 | .LSOverride 6 | 7 | # Icon must end with two \r 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear in the root of a volume 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk -------------------------------------------------------------------------------- /UnityAndroidCamera/UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | vcSharedLogLevel: 9 | value: 0d5e400f0650 10 | flags: 0 11 | m_VCAutomaticAdd: 1 12 | m_VCDebugCom: 0 13 | m_VCDebugCmd: 0 14 | m_VCDebugOut: 0 15 | m_SemanticMergeMode: 2 16 | m_VCShowFailedCheckout: 1 17 | m_VCOverwriteFailedCheckoutAssets: 1 18 | m_VCOverlayIcons: 1 19 | m_VCAllowAsyncUpdate: 0 20 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 0 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /NativeCameraPlugin/README.md: -------------------------------------------------------------------------------- 1 | # NOTICE 2 | 3 | Moved to [UnityAndroidCameraPlugin](UnityAndroidCameraPlugin). 4 | 5 | This folder was not deleted in order to keep the original reference to it and, if needed, troubleshooting the .so generated by CMake. 6 | 7 | # NativeCameraPlugin 8 | 9 | An NDK library as the low level rendering plugin. 10 | 11 | Update the build script for your OS to point to the location of your Android NDK folder. 12 | 13 | Run: 14 | ``` 15 | ./build.sh 16 | ``` 17 | 18 | To compile the code and copy the updated native library binary into [UnityAndroidCamera](UnityAndroidCamera). 19 | -------------------------------------------------------------------------------- /NativeCameraPlugin/.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibs/ 2 | /[Oo]bj/ 3 | 4 | # OS-specific files 5 | ### macOS ### 6 | # General 7 | .DS_Store 8 | .AppleDouble 9 | .LSOverride 10 | 11 | # Icon must end with two \r 12 | Icon 13 | 14 | # Thumbnails 15 | ._* 16 | 17 | # Files that might appear in the root of a volume 18 | .DocumentRevisions-V100 19 | .fseventsd 20 | .Spotlight-V100 21 | .TemporaryItems 22 | .Trashes 23 | .VolumeIcon.icns 24 | .com.apple.timemachine.donotpresent 25 | 26 | # Directories potentially created on remote AFP share 27 | .AppleDB 28 | .AppleDesktop 29 | Network Trash Folder 30 | Temporary Items 31 | .apdisk 32 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - NativeCameraBackground 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.6.4' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_SolverIterationCount: 6 13 | m_SolverVelocityIterations: 1 14 | m_QueriesHitTriggers: 1 15 | m_EnableAdaptiveForce: 0 16 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 17 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Shaders/SkyboxBackgroundTexture.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 2 | 3 | // Skybox shader that just draws flat texture in the background 4 | Shader "Skybox/Background Texture" 5 | { 6 | Properties 7 | { 8 | _MainTex ("Texture", 2D) = "white" {} 9 | } 10 | SubShader 11 | { 12 | Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" } 13 | Cull Off ZWrite Off 14 | 15 | Pass 16 | { 17 | CGPROGRAM 18 | #pragma vertex vert 19 | #pragma fragment frag 20 | #include "UnityCG.cginc" 21 | 22 | void vert (float4 pos : POSITION, out float4 outUV : TEXCOORD0, out float4 outPos : SV_POSITION) 23 | { 24 | outPos = UnityObjectToClipPos(pos); 25 | outUV = ComputeScreenPos(outPos); 26 | } 27 | 28 | sampler2D _MainTex; 29 | 30 | fixed4 frag (float4 uv : TEXCOORD0) : SV_Target 31 | { 32 | uv.y = 1 - uv.y; 33 | fixed4 col = tex2Dproj(_MainTex, uv); 34 | return col; 35 | } 36 | ENDCG 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/Unity/IUnityGraphicsD3D12.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | #ifndef __cplusplus 4 | #include 5 | #endif 6 | 7 | // Should only be used on the rendering thread unless noted otherwise. 8 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) 9 | { 10 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 11 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 12 | 13 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 14 | // Returns the value set on the frame fence once the current frame completes 15 | UINT64 (UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 16 | 17 | // Returns the state a resource will be in after the last command list is executed 18 | bool (UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES* outState); 19 | // Specifies the state a resource will be in after a plugin command list with resource barriers is executed 20 | void (UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES state); 21 | }; 22 | UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL,0xBD295B6F2A38D9DEULL,IUnityGraphicsD3D12) 23 | -------------------------------------------------------------------------------- /UnityAndroidCamera/.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /[Pp]ackages/ 7 | /Assets/AssetStoreTools* 8 | /Logs/ 9 | 10 | # Autogenerated VS/MD/Consulo solution and project files 11 | ExportedObj/ 12 | .consulo/ 13 | *.csproj 14 | *.unityproj 15 | *.sln 16 | *.suo 17 | *.tmp 18 | *.user 19 | *.userprefs 20 | *.pidb 21 | *.booproj 22 | *.svd 23 | .vscode/ 24 | 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | *.app 36 | 37 | # OS-specific files 38 | ### macOS ### 39 | # General 40 | .DS_Store 41 | .AppleDouble 42 | .LSOverride 43 | 44 | # Icon must end with two \r 45 | Icon 46 | 47 | # Thumbnails 48 | ._* 49 | 50 | # Files that might appear in the root of a volume 51 | .DocumentRevisions-V100 52 | .fseventsd 53 | .Spotlight-V100 54 | .TemporaryItems 55 | .Trashes 56 | .VolumeIcon.icns 57 | .com.apple.timemachine.donotpresent 58 | 59 | # Directories potentially created on remote AFP share 60 | .AppleDB 61 | .AppleDesktop 62 | Network Trash Folder 63 | Temporary Items 64 | .apdisk -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Antonio Robson de Paula 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/Unity/IUnityGraphicsD3D12.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | #ifndef __cplusplus 4 | #include 5 | #endif 6 | 7 | // Should only be used on the rendering thread unless noted otherwise. 8 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) 9 | { 10 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 11 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 12 | 13 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 14 | // Returns the value set on the frame fence once the current frame completes 15 | UINT64 (UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 16 | 17 | // Returns the state a resource will be in after the last command list is executed 18 | bool (UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES* outState); 19 | // Specifies the state a resource will be in after a plugin command list with resource barriers is executed 20 | void (UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES state); 21 | }; 22 | UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL,0xBD295B6F2A38D9DEULL,IUnityGraphicsD3D12) 23 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts/CameraPermissionTest.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | #if PLATFORM_ANDROID 3 | using UnityEngine.Android; 4 | #endif 5 | 6 | public class CameraPermissionTest : MonoBehaviour 7 | { 8 | GameObject dialog = null; 9 | 10 | void Start () 11 | { 12 | #if PLATFORM_ANDROID 13 | if (!Permission.HasUserAuthorizedPermission(Permission.Camera)) 14 | { 15 | Permission.RequestUserPermission(Permission.Camera); 16 | dialog = new GameObject(); 17 | } 18 | #endif 19 | } 20 | 21 | void OnGUI () 22 | { 23 | #if PLATFORM_ANDROID 24 | if (!Permission.HasUserAuthorizedPermission(Permission.Camera)) 25 | { 26 | // The user denied permission to use the camera. 27 | // Display a message explaining why you need it with Yes/No buttons. 28 | // If the user says yes then present the request again 29 | // Display a dialog here. 30 | dialog.AddComponent(); 31 | return; 32 | } 33 | else if (dialog != null) 34 | { 35 | Destroy(dialog); 36 | } 37 | #endif 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts/PermissionsRationaleDialog.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | #if PLATFORM_ANDROID 3 | using UnityEngine.Android; 4 | #endif 5 | 6 | public class PermissionsRationaleDialog : MonoBehaviour 7 | { 8 | const int kDialogWidth = 300; 9 | const int kDialogHeight = 100; 10 | private bool windowOpen = true; 11 | 12 | void DoMyWindow(int windowID) 13 | { 14 | GUI.Label(new Rect(10, 20, kDialogWidth - 20, kDialogHeight - 50), "Please let me use the camera. It is mandatory!"); 15 | GUI.Button(new Rect(10, kDialogHeight - 30, 100, 20), "No"); 16 | if (GUI.Button(new Rect(kDialogWidth - 110, kDialogHeight - 30, 100, 20), "Yes")) 17 | { 18 | #if PLATFORM_ANDROID 19 | Permission.RequestUserPermission(Permission.Camera); 20 | #endif 21 | windowOpen = false; 22 | } 23 | } 24 | 25 | void OnGUI () 26 | { 27 | if (windowOpen) 28 | { 29 | Rect rect = new Rect((Screen.width / 2) - (kDialogWidth / 2), (Screen.height / 2) - (kDialogHeight / 2), kDialogWidth, kDialogHeight); 30 | GUI.ModalWindow(0, rect, DoMyWindow, "Permissions Request Dialog"); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # unity-android-native-camera 2 | 3 | On this repository you'll find an experiment to draw the Native Android Camera feed onto a Unity GameObject. 4 | 5 | The inspiration comes from [Unity Technologies NativeRenderingPlugin](https://github.com/Unity-Technologies/NativeRenderingPlugin). 6 | 7 | The folder structure contains the following code: 8 | 9 | [UnityAndroidCameraPlugin](UnityAndroidCameraPlugin): an Android Studio project to create and AAR library as Unity Native Plugin. It includes an NDK library as the low level rendering plugin. 10 | 11 | [UnityAndroidCamera](UnityAndroidCamera): the Unity project that integrates the plugin. 12 | 13 | Upon success you'll see something like the below image on your Android device: 14 | ![Screenshot](screen.png) 15 | 16 | ## Setup 17 | 18 | ### 2020 19 | Toolchain: 20 | * Android Studio 4.0.1 21 | * Android SDK 9.0 (API 28) Rev 6 22 | * Android NDK (Side by side) 21.3.6528147 23 | * CMake 3.4.1 24 | * Unity Hub 2.3.2 25 | * Unity 2020.1.3f1 26 | 27 | ## Troubleshooting 28 | 29 | If you have trouble building the Unity project, please try the following: 30 | ``` 31 | Open "Build Settings" and make sure that you have switched to the "Android" platform. 32 | 33 | This should allow you to build successfully. 34 | ``` 35 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | **/build/ 3 | **/.cxx/ 4 | **/generatedJava/ 5 | 6 | # Crashlytics configuations 7 | **/com_crashlytics_export_strings.xml 8 | 9 | # Local configuration file (sdk path, etc) 10 | **/local.properties 11 | 12 | # Gradle generated files 13 | **/.gradle/ 14 | 15 | # Signing files 16 | **/.signing/ 17 | 18 | # User-specific configurations 19 | **/.idea/assetWizardSettings.xml 20 | **/.idea/libraries/ 21 | **/.idea/workspace.xml 22 | **/.idea/tasks.xml 23 | **/.idea/.name 24 | **/.idea/caches/build_file_checksums.ser 25 | **/.idea/compiler.xml 26 | **/.idea/copyright/profiles_settings.xml 27 | **/.idea/encodings.xml 28 | **/.idea/misc.xml 29 | **/.idea/modules.xml 30 | **/.idea/scopes/scope_settings.xml 31 | **/.idea/vcs.xml 32 | **/.idea/* 33 | **/*.iml 34 | 35 | # OS-specific files 36 | ### macOS ### 37 | # General 38 | .DS_Store 39 | .AppleDouble 40 | .LSOverride 41 | 42 | # Icon must end with two \r 43 | Icon 44 | 45 | # Thumbnails 46 | ._* 47 | 48 | # Files that might appear in the root of a volume 49 | .DocumentRevisions-V100 50 | .fseventsd 51 | .Spotlight-V100 52 | .TemporaryItems 53 | .Trashes 54 | .VolumeIcon.icns 55 | .com.apple.timemachine.donotpresent 56 | 57 | # Directories potentially created on remote AFP share 58 | .AppleDB 59 | .AppleDesktop 60 | Network Trash Folder 61 | Temporary Items 62 | .apdisk -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 9 | 12 | 15 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 9 | 12 | 15 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ContactArrowScale: 0.2 29 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 30 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 31 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 32 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 33 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/rs/yuv2rgb.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma version(1) 17 | #pragma rs java_package_name(arp.camera) 18 | #pragma rs_fp_relaxed 19 | 20 | rs_allocation gCurrentFrame; 21 | rs_allocation gIntFrame; 22 | 23 | uchar4 __attribute__((kernel)) yuv2rgbFrames(uint32_t x, uint32_t y) 24 | { 25 | uchar yuvY = rsGetElementAtYuv_uchar_Y(gCurrentFrame, x, y); 26 | uchar yuvU = rsGetElementAtYuv_uchar_U(gCurrentFrame, x, y); 27 | uchar yuvV = rsGetElementAtYuv_uchar_V(gCurrentFrame, x, y); 28 | 29 | uchar4 out = rsYuvToRGBA_uchar4(yuvY, yuvU, yuvV); 30 | 31 | // Since the rendering is performed in OpenGL we need this odd layout of ABGR 32 | uint32_t px = 0xff000000 | out.b << 16 | out.g << 8 | out.r; 33 | 34 | rsSetElementAt_int(gIntFrame, px, x, y); 35 | 36 | return out; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android/AndroidManifest.xml.backup: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 16 | 19 | 22 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Plugins/Android/camera-release.aar.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5254a71ca7352435090dd0b555ea4cfa 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Standalone: Linux64 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Standalone: OSXUniversal 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: x86_64 56 | - first: 57 | Standalone: Win 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: x86 62 | - first: 63 | Standalone: Win64 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: x86_64 68 | userData: 69 | assetBundleName: 70 | assetBundleVariant: 71 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html 3 | 4 | # Sets the minimum version of CMake required to build the native library. 5 | 6 | cmake_minimum_required(VERSION 3.4.1) 7 | 8 | # Creates and names a library, sets it as either STATIC 9 | # or SHARED, and provides the relative paths to its source code. 10 | # You can define multiple libraries, and CMake builds them for you. 11 | # Gradle automatically packages shared libraries with your APK. 12 | 13 | add_library( # Sets the name of the library. 14 | NativeCameraPlugin 15 | 16 | # Sets the library as a shared library, otherwise it won't be 17 | # packaged with AAR. 18 | SHARED 19 | 20 | # Provides a relative path to your source file(s). 21 | RenderingPlugin.cpp ) 22 | 23 | # Searches for a specified prebuilt library and stores the path as a 24 | # variable. Because CMake includes system libraries in the search path by 25 | # default, you only need to specify the name of the public NDK library 26 | # you want to add. CMake verifies that the library exists before 27 | # completing its build. 28 | 29 | find_library( # Sets the name of the path variable. 30 | dl 31 | GLESv2 32 | 33 | # Specifies the name of the NDK library that 34 | # you want CMake to locate. 35 | log ) 36 | 37 | # Specifies libraries CMake should link to your target library. You 38 | # can link multiple libraries, such as libraries you define in this 39 | # build script, prebuilt third-party libraries, or system libraries. 40 | 41 | target_link_libraries( # Specifies the target library. 42 | NativeCameraPlugin 43 | log 44 | 45 | # Links the target library to the log library 46 | # included in the NDK. 47 | ${log-lib} ) -------------------------------------------------------------------------------- /UnityAndroidCamera/.gitattributes: -------------------------------------------------------------------------------- 1 | # 3D models 2 | *.3dm filter=lfs diff=lfs merge=lfs -text 3 | *.3ds filter=lfs diff=lfs merge=lfs -text 4 | *.blend filter=lfs diff=lfs merge=lfs -text 5 | *.c4d filter=lfs diff=lfs merge=lfs -text 6 | *.collada filter=lfs diff=lfs merge=lfs -text 7 | *.dae filter=lfs diff=lfs merge=lfs -text 8 | *.dxf filter=lfs diff=lfs merge=lfs -text 9 | *.fbx filter=lfs diff=lfs merge=lfs -text 10 | *.jas filter=lfs diff=lfs merge=lfs -text 11 | *.lws filter=lfs diff=lfs merge=lfs -text 12 | *.lxo filter=lfs diff=lfs merge=lfs -text 13 | *.ma filter=lfs diff=lfs merge=lfs -text 14 | *.max filter=lfs diff=lfs merge=lfs -text 15 | *.mb filter=lfs diff=lfs merge=lfs -text 16 | *.obj filter=lfs diff=lfs merge=lfs -text 17 | *.ply filter=lfs diff=lfs merge=lfs -text 18 | *.skp filter=lfs diff=lfs merge=lfs -text 19 | *.stl filter=lfs diff=lfs merge=lfs -text 20 | *.ztl filter=lfs diff=lfs merge=lfs -text 21 | # Audio 22 | *.aif filter=lfs diff=lfs merge=lfs -text 23 | *.aiff filter=lfs diff=lfs merge=lfs -text 24 | *.it filter=lfs diff=lfs merge=lfs -text 25 | *.mod filter=lfs diff=lfs merge=lfs -text 26 | *.mp3 filter=lfs diff=lfs merge=lfs -text 27 | *.ogg filter=lfs diff=lfs merge=lfs -text 28 | *.s3m filter=lfs diff=lfs merge=lfs -text 29 | *.wav filter=lfs diff=lfs merge=lfs -text 30 | *.xm filter=lfs diff=lfs merge=lfs -text 31 | # Fonts 32 | *.otf filter=lfs diff=lfs merge=lfs -text 33 | *.ttf filter=lfs diff=lfs merge=lfs -text 34 | # Images 35 | *.bmp filter=lfs diff=lfs merge=lfs -text 36 | *.exr filter=lfs diff=lfs merge=lfs -text 37 | *.gif filter=lfs diff=lfs merge=lfs -text 38 | *.hdr filter=lfs diff=lfs merge=lfs -text 39 | *.iff filter=lfs diff=lfs merge=lfs -text 40 | *.jpeg filter=lfs diff=lfs merge=lfs -text 41 | *.jpg filter=lfs diff=lfs merge=lfs -text 42 | *.pict filter=lfs diff=lfs merge=lfs -text 43 | *.png filter=lfs diff=lfs merge=lfs -text 44 | *.psd filter=lfs diff=lfs merge=lfs -text 45 | *.tga filter=lfs diff=lfs merge=lfs -text 46 | *.tif filter=lfs diff=lfs merge=lfs -text 47 | *.tiff filter=lfs diff=lfs merge=lfs -text 48 | # Collapse Unity-generated files on GitHub 49 | *.asset linguist-generated 50 | *.mat linguist-generated 51 | *.meta linguist-generated 52 | *.prefab linguist-generated 53 | *.unity linguist-generated -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Materials/CubeMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: CubeMaterial 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scripts/CameraPluginWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Runtime.InteropServices; 5 | using UnityEngine; 6 | 7 | public class CameraPluginWrapper : MonoBehaviour { 8 | [DllImport ("NativeCameraPlugin")] 9 | private static extern void SetTextureFromUnity (System.IntPtr texture); 10 | 11 | [DllImport ("NativeCameraPlugin")] 12 | private static extern IntPtr GetRenderEventFunc (); 13 | 14 | public Material displayMaterial; 15 | 16 | private AndroidJavaObject _androidJavaPlugin = null; 17 | 18 | IEnumerator Start () { 19 | if (Application.platform == RuntimePlatform.Android) { 20 | using (AndroidJavaClass javaClass = new AndroidJavaClass ("arp.camera.CameraPluginActivity")) { 21 | _androidJavaPlugin = javaClass.GetStatic ("_context"); 22 | } 23 | 24 | CreateTextureAndPassToPlugin (); 25 | yield return StartCoroutine ("CallPluginAtEndOfFrames"); 26 | } 27 | } 28 | 29 | private void CreateTextureAndPassToPlugin () { 30 | Texture2D tex = new Texture2D (640, 480, TextureFormat.RGBA32, false); 31 | // Set point filtering just so we can see the pixels clearly 32 | tex.filterMode = FilterMode.Point; 33 | // Call Apply() so it's actually uploaded to the GPU 34 | tex.Apply (); 35 | 36 | displayMaterial.mainTexture = tex; 37 | 38 | SetTextureFromUnity (tex.GetNativeTexturePtr ()); 39 | 40 | EnablePreview (true); 41 | } 42 | 43 | private IEnumerator CallPluginAtEndOfFrames () { 44 | while (true) { 45 | // Wait until all frame rendering is done 46 | yield return new WaitForEndOfFrame (); 47 | 48 | // Issue a plugin event with arbitrary integer identifier. 49 | // The plugin can distinguish between different 50 | // things it needs to do based on this ID. 51 | // For our simple plugin, it does not matter which ID we pass here. 52 | GL.IssuePluginEvent (GetRenderEventFunc (), 1); 53 | 54 | // skip one frame 55 | yield return new WaitForEndOfFrame (); 56 | } 57 | } 58 | 59 | public void EnablePreview (bool enable) { 60 | if (_androidJavaPlugin != null) { 61 | _androidJavaPlugin.Call ("enablePreviewUpdater", enable); 62 | } 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/Unity/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | kUnityGfxRendererOpenGL = 0, // Desktop OpenGL 2 (deprecated) 7 | kUnityGfxRendererD3D9 = 1, // Direct3D 9 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererXenon = 6, // Xbox 360 12 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 13 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.x 14 | kUnityGfxRendererGXM = 12, // PlayStation Vita 15 | kUnityGfxRendererPS4 = 13, // PlayStation 4 16 | kUnityGfxRendererXboxOne = 14, // Xbox One 17 | kUnityGfxRendererMetal = 16, // iOS Metal 18 | kUnityGfxRendererOpenGLCore = 17, // Desktop OpenGL core 19 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 20 | } UnityGfxRenderer; 21 | 22 | typedef enum UnityGfxDeviceEventType 23 | { 24 | kUnityGfxDeviceEventInitialize = 0, 25 | kUnityGfxDeviceEventShutdown = 1, 26 | kUnityGfxDeviceEventBeforeReset = 2, 27 | kUnityGfxDeviceEventAfterReset = 3, 28 | } UnityGfxDeviceEventType; 29 | 30 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 31 | 32 | // Should only be used on the rendering thread unless noted otherwise. 33 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 34 | { 35 | UnityGfxRenderer (UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 36 | 37 | // This callback will be called when graphics device is created, destroyed, reset, etc. 38 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 39 | // when the graphics device is already created. 40 | void (UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 41 | void (UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 42 | }; 43 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL,0x8C5AD4926EB17B11ULL,IUnityGraphics) 44 | 45 | 46 | 47 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 48 | // Provide them with an address to a function of this signature. 49 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 50 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/Unity/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | typedef enum UnityGfxRenderer 5 | { 6 | kUnityGfxRendererOpenGL = 0, // Desktop OpenGL 2 (deprecated) 7 | kUnityGfxRendererD3D9 = 1, // Direct3D 9 8 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 9 | kUnityGfxRendererGCM = 3, // PlayStation 3 10 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 11 | kUnityGfxRendererXenon = 6, // Xbox 360 12 | kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 13 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.x 14 | kUnityGfxRendererGXM = 12, // PlayStation Vita 15 | kUnityGfxRendererPS4 = 13, // PlayStation 4 16 | kUnityGfxRendererXboxOne = 14, // Xbox One 17 | kUnityGfxRendererMetal = 16, // iOS Metal 18 | kUnityGfxRendererOpenGLCore = 17, // Desktop OpenGL core 19 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 20 | } UnityGfxRenderer; 21 | 22 | typedef enum UnityGfxDeviceEventType 23 | { 24 | kUnityGfxDeviceEventInitialize = 0, 25 | kUnityGfxDeviceEventShutdown = 1, 26 | kUnityGfxDeviceEventBeforeReset = 2, 27 | kUnityGfxDeviceEventAfterReset = 3, 28 | } UnityGfxDeviceEventType; 29 | 30 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 31 | 32 | // Should only be used on the rendering thread unless noted otherwise. 33 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 34 | { 35 | UnityGfxRenderer (UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 36 | 37 | // This callback will be called when graphics device is created, destroyed, reset, etc. 38 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 39 | // when the graphics device is already created. 40 | void (UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 41 | void (UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 42 | }; 43 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL,0x8C5AD4926EB17B11ULL,IUnityGraphics) 44 | 45 | 46 | 47 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 48 | // Provide them with an address to a function of this signature. 49 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 50 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0} 41 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 42 | m_PreloadedShaders: [] 43 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 44 | type: 0} 45 | m_CustomRenderPipeline: {fileID: 0} 46 | m_TransparencySortMode: 0 47 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 48 | m_DefaultRenderingPath: 1 49 | m_DefaultMobileRenderingPath: 1 50 | m_TierSettings: [] 51 | m_LightmapStripping: 0 52 | m_FogStripping: 0 53 | m_InstancingStripping: 0 54 | m_LightmapKeepPlain: 1 55 | m_LightmapKeepDirCombined: 1 56 | m_LightmapKeepDynamicPlain: 1 57 | m_LightmapKeepDynamicDirCombined: 1 58 | m_LightmapKeepShadowMask: 1 59 | m_LightmapKeepSubtractive: 1 60 | m_FogKeepLinear: 1 61 | m_FogKeepExp: 1 62 | m_FogKeepExp2: 1 63 | m_AlbedoSwatchInfos: [] 64 | m_LightsUseLinearIntensity: 0 65 | m_LightsUseColorTemperature: 0 66 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/RenderingPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderingPlugin.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define LOG_TAG "RENDERING_PLUGIN" 8 | 9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) 10 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) 11 | 12 | static void *g_TexturePointer = NULL; 13 | static JavaVM *gJavaVM; 14 | static jobject gCallbackObject = NULL; 15 | 16 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetTextureFromUnity(void *texturePtr) 17 | { 18 | // A script calls this at initialization time; just remember the texture pointer here. 19 | // Will update texture pixels each frame from the plugin rendering event (texture update 20 | // needs to happen on the rendering thread). 21 | g_TexturePointer = texturePtr; 22 | 23 | LOGD("########################## SetTextureFromUnity texturePtr=%p\n", g_TexturePointer); 24 | } 25 | 26 | static void UNITY_INTERFACE_API OnRenderEvent(int eventID) 27 | { 28 | if (g_TexturePointer) 29 | { 30 | int status; 31 | JNIEnv *env; 32 | int isAttached = 0; 33 | 34 | if (!gCallbackObject) 35 | return; 36 | 37 | if ((status = gJavaVM->GetEnv((void **)&env, JNI_VERSION_1_6)) < 0) 38 | { 39 | if ((status = gJavaVM->AttachCurrentThread(&env, NULL)) < 0) 40 | { 41 | return; 42 | } 43 | isAttached = 1; 44 | } 45 | 46 | jclass cls = env->GetObjectClass(gCallbackObject); 47 | if (!cls) 48 | { 49 | if (isAttached) 50 | gJavaVM->DetachCurrentThread(); 51 | return; 52 | } 53 | 54 | jmethodID method = env->GetMethodID(cls, "requestJavaRendering", "(I)V"); 55 | if (!method) 56 | { 57 | if (isAttached) 58 | gJavaVM->DetachCurrentThread(); 59 | return; 60 | } 61 | 62 | GLuint gltex = (GLuint)(size_t)(g_TexturePointer); 63 | env->CallVoidMethod(gCallbackObject, method, (int)gltex); 64 | 65 | if (isAttached) 66 | gJavaVM->DetachCurrentThread(); 67 | } 68 | } 69 | 70 | // -------------------------------------------------------------------------- 71 | // GetRenderEventFunc, used to get a rendering event callback function. 72 | extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API GetRenderEventFunc() 73 | { 74 | return OnRenderEvent; 75 | } 76 | 77 | jint JNI_OnLoad(JavaVM *vm, void *reserved) 78 | { 79 | gJavaVM = vm; 80 | 81 | return JNI_VERSION_1_6; 82 | } 83 | 84 | extern "C" JNIEXPORT void JNICALL 85 | Java_arp_camera_CameraPluginActivity_nativeInit(JNIEnv *env, jobject obj) 86 | { 87 | gCallbackObject = env->NewGlobalRef(obj); 88 | } 89 | 90 | extern "C" JNIEXPORT void JNICALL 91 | Java_arp_camera_CameraPluginActivity_nativeRelease(JNIEnv *env, jobject obj) 92 | { 93 | env->DeleteGlobalRef(gCallbackObject); 94 | gCallbackObject = NULL; 95 | } -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/RenderingPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderingPlugin.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define LOG_TAG "RENDERING_PLUGIN" 8 | 9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) 10 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) 11 | 12 | static void *g_TexturePointer = NULL; 13 | static JavaVM *gJavaVM; 14 | static jobject gCallbackObject = NULL; 15 | 16 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetTextureFromUnity(void *texturePtr) 17 | { 18 | // A script calls this at initialization time; just remember the texture pointer here. 19 | // Will update texture pixels each frame from the plugin rendering event (texture update 20 | // needs to happen on the rendering thread). 21 | g_TexturePointer = texturePtr; 22 | 23 | LOGD("########################## SetTextureFromUnity texturePtr=%p\n", g_TexturePointer); 24 | } 25 | 26 | static void UNITY_INTERFACE_API OnRenderEvent(int eventID) 27 | { 28 | if (g_TexturePointer) 29 | { 30 | int status; 31 | JNIEnv *env; 32 | int isAttached = 0; 33 | 34 | if (!gCallbackObject) 35 | return; 36 | 37 | if ((status = gJavaVM->GetEnv((void **)&env, JNI_VERSION_1_6)) < 0) 38 | { 39 | if ((status = gJavaVM->AttachCurrentThread(&env, NULL)) < 0) 40 | { 41 | return; 42 | } 43 | isAttached = 1; 44 | } 45 | 46 | jclass cls = env->GetObjectClass(gCallbackObject); 47 | if (!cls) 48 | { 49 | if (isAttached) 50 | gJavaVM->DetachCurrentThread(); 51 | return; 52 | } 53 | 54 | jmethodID method = env->GetMethodID(cls, "requestJavaRendering", "(I)V"); 55 | if (!method) 56 | { 57 | if (isAttached) 58 | gJavaVM->DetachCurrentThread(); 59 | return; 60 | } 61 | 62 | GLuint gltex = (GLuint)(size_t)(g_TexturePointer); 63 | env->CallVoidMethod(gCallbackObject, method, (int)gltex); 64 | 65 | if (isAttached) 66 | gJavaVM->DetachCurrentThread(); 67 | } 68 | } 69 | 70 | // -------------------------------------------------------------------------- 71 | // GetRenderEventFunc, used to get a rendering event callback function. 72 | extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API GetRenderEventFunc() 73 | { 74 | return OnRenderEvent; 75 | } 76 | 77 | jint JNI_OnLoad(JavaVM *vm, void *reserved) 78 | { 79 | gJavaVM = vm; 80 | 81 | return JNI_VERSION_1_6; 82 | } 83 | 84 | extern "C" JNIEXPORT void JNICALL 85 | Java_arp_camera_CameraPluginActivity_nativeInit(JNIEnv *env, jobject obj) 86 | { 87 | gCallbackObject = env->NewGlobalRef(obj); 88 | } 89 | 90 | extern "C" JNIEXPORT void JNICALL 91 | Java_arp_camera_CameraPluginActivity_nativeRelease(JNIEnv *env, jobject obj) 92 | { 93 | env->DeleteGlobalRef(gCallbackObject); 94 | gCallbackObject = NULL; 95 | } -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext.buildWithDebug = false 4 | 5 | // command line argument parsing 6 | gradle.startParameter.taskRequests.each { taskRequest -> 7 | taskRequest.args.each { taskName -> 8 | if (taskName.contains("Debug")) { 9 | buildWithDebug = true 10 | } 11 | } 12 | } 13 | 14 | ext.unityPluginPath = "../../UnityAndroidCamera/Assets/Plugins/Android/" 15 | ext.unityManifestPath = "../../UnityAndroidCamera/Assets/Plugins/Android/LauncherManifest.xml" 16 | ext.unityPluginArtifact = "camera-release.aar" 17 | ext.artifactPath = "build/outputs/aar/" 18 | ext.manifestPath = "src/main/" 19 | ext.artifactName = "camera" 20 | 21 | // convenience method to deploy release Android archive and manifest to the Unity application project 22 | gradle.buildFinished { buildResult -> 23 | 24 | if (buildResult.failure == null) { 25 | copy { 26 | println(".................... deploy ..............................") 27 | 28 | if (buildWithDebug) { 29 | artifactName = artifactName + "-debug.aar" 30 | manifestPath = manifestPath + "AndroidManifest.xml" 31 | } else { 32 | artifactName = artifactName + "-release.aar" 33 | manifestPath = manifestPath + "AndroidManifest.xml" 34 | } 35 | 36 | from(artifactPath + artifactName) 37 | into(unityPluginPath) 38 | rename { String fileName -> 39 | fileName.replace(artifactName, unityPluginArtifact) 40 | } 41 | from(manifestPath) 42 | into(unityPluginPath) 43 | println(".................... build and deploy finished ..............................") 44 | } 45 | } 46 | } 47 | 48 | android { 49 | compileSdkVersion 28 50 | buildToolsVersion "28.0.3" 51 | 52 | lintOptions { 53 | abortOnError false 54 | } 55 | 56 | defaultConfig { 57 | minSdkVersion 28 58 | targetSdkVersion 28 59 | versionCode 1 60 | versionName "1.0" 61 | renderscriptTargetApi 28 62 | renderscriptSupportModeEnabled false 63 | ndk { 64 | abiFilters 'armeabi-v7a', 'arm64-v8a' 65 | } 66 | 67 | externalNativeBuild { 68 | cmake { 69 | cppFlags "-frtti -fexceptions" 70 | } 71 | } 72 | } 73 | buildTypes { 74 | debug { 75 | minifyEnabled false 76 | debuggable true 77 | testCoverageEnabled = false 78 | } 79 | release { 80 | minifyEnabled false 81 | debuggable false 82 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 83 | testCoverageEnabled = false 84 | } 85 | } 86 | 87 | externalNativeBuild { 88 | cmake { 89 | path "src/main/cpp/CMakeLists.txt" 90 | version "3.10.2" 91 | } 92 | } 93 | ndkVersion '21.0.6113669' 94 | } 95 | 96 | dependencies { 97 | compileOnly files('src/main/library/unity_android_player.jar') 98 | } 99 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Materials/Skybox2dMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Skybox2dMaterial 10 | m_Shader: {fileID: 4800000, guid: 1baaa7eaca58c4ab08f3ca2e555ac6ff, type: 3} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | - first: 19 | name: _BumpMap 20 | second: 21 | m_Texture: {fileID: 0} 22 | m_Scale: {x: 1, y: 1} 23 | m_Offset: {x: 0, y: 0} 24 | - first: 25 | name: _DetailAlbedoMap 26 | second: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - first: 31 | name: _DetailMask 32 | second: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - first: 37 | name: _DetailNormalMap 38 | second: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - first: 43 | name: _EmissionMap 44 | second: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - first: 49 | name: _MainTex 50 | second: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - first: 55 | name: _MetallicGlossMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - first: 61 | name: _OcclusionMap 62 | second: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - first: 67 | name: _ParallaxMap 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | m_Floats: 73 | - first: 74 | name: _BumpScale 75 | second: 1 76 | - first: 77 | name: _Cutoff 78 | second: 0.5 79 | - first: 80 | name: _DetailNormalMapScale 81 | second: 1 82 | - first: 83 | name: _DstBlend 84 | second: 0 85 | - first: 86 | name: _GlossMapScale 87 | second: 1 88 | - first: 89 | name: _Glossiness 90 | second: 0.5 91 | - first: 92 | name: _GlossyReflections 93 | second: 1 94 | - first: 95 | name: _Metallic 96 | second: 0 97 | - first: 98 | name: _Mode 99 | second: 0 100 | - first: 101 | name: _OcclusionStrength 102 | second: 1 103 | - first: 104 | name: _Parallax 105 | second: 0.02 106 | - first: 107 | name: _SmoothnessTextureChannel 108 | second: 0 109 | - first: 110 | name: _SpecularHighlights 111 | second: 1 112 | - first: 113 | name: _SrcBlend 114 | second: 1 115 | - first: 116 | name: _UVSec 117 | second: 0 118 | - first: 119 | name: _ZWrite 120 | second: 1 121 | m_Colors: 122 | - first: 123 | name: _Color 124 | second: {r: 1, g: 1, b: 1, a: 1} 125 | - first: 126 | name: _EmissionColor 127 | second: {r: 0, g: 0, b: 0, a: 1} 128 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/java/arp/camera/YuvToRgb.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package arp.camera; 17 | 18 | import android.graphics.ImageFormat; 19 | import android.renderscript.Allocation; 20 | import android.renderscript.Element; 21 | import android.renderscript.RenderScript; 22 | import android.renderscript.Type; 23 | import android.util.Size; 24 | import android.view.Surface; 25 | 26 | 27 | public class YuvToRgb implements Allocation.OnBufferAvailableListener { 28 | private Allocation mInputAllocation; 29 | private Allocation mOutputAllocation; 30 | private Allocation mOutputAllocationInt; 31 | private Size mInputSize; 32 | private ScriptC_yuv2rgb mScriptYuv2Rgb; 33 | 34 | private int[] mOutBufferInt; 35 | private long mLastProcessed; 36 | 37 | private final int mFrameEveryMs; 38 | 39 | 40 | YuvToRgb(RenderScript rs, Size dimensions, int frameMs) { 41 | mInputSize = dimensions; 42 | mFrameEveryMs = frameMs; 43 | 44 | createAllocations(rs); 45 | 46 | mInputAllocation.setOnBufferAvailableListener(this); 47 | 48 | mScriptYuv2Rgb = new ScriptC_yuv2rgb(rs); 49 | mScriptYuv2Rgb.set_gCurrentFrame(mInputAllocation); 50 | mScriptYuv2Rgb.set_gIntFrame(mOutputAllocationInt); 51 | } 52 | 53 | private void createAllocations(RenderScript rs) { 54 | 55 | final int width = mInputSize.getWidth(); 56 | final int height = mInputSize.getHeight(); 57 | 58 | mOutBufferInt = new int[width * height]; 59 | 60 | Type.Builder yuvTypeBuilder = new Type.Builder(rs, Element.YUV(rs)); 61 | yuvTypeBuilder.setX(width); 62 | yuvTypeBuilder.setY(height); 63 | yuvTypeBuilder.setYuvFormat(ImageFormat.YUV_420_888); 64 | mInputAllocation = Allocation.createTyped(rs, yuvTypeBuilder.create(), 65 | Allocation.USAGE_IO_INPUT | Allocation.USAGE_SCRIPT); 66 | 67 | Type rgbType = Type.createXY(rs, Element.RGBA_8888(rs), width, height); 68 | Type intType = Type.createXY(rs, Element.U32(rs), width, height); 69 | 70 | mOutputAllocation = Allocation.createTyped(rs, rgbType, 71 | Allocation.USAGE_IO_OUTPUT | Allocation.USAGE_SCRIPT); 72 | mOutputAllocationInt = Allocation.createTyped(rs, intType, 73 | Allocation.USAGE_SCRIPT); 74 | } 75 | 76 | Surface getInputSurface() { 77 | return mInputAllocation.getSurface(); 78 | } 79 | 80 | void setOutputSurface(Surface output) { 81 | mOutputAllocation.setSurface(output); 82 | } 83 | 84 | @Override 85 | public void onBufferAvailable(Allocation a) { 86 | // Get the new frame into the input allocation 87 | mInputAllocation.ioReceive(); 88 | 89 | final long current = System.currentTimeMillis(); 90 | if ((current - mLastProcessed) >= mFrameEveryMs) { 91 | mScriptYuv2Rgb.forEach_yuv2rgbFrames(mOutputAllocation); 92 | 93 | // update output buffer 94 | mOutputAllocationInt.copyTo(mOutBufferInt); 95 | 96 | mLastProcessed = current; 97 | } 98 | } 99 | 100 | public int[] getOutputBuffer() { 101 | return mOutBufferInt; 102 | } 103 | 104 | } -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 0 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 2 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 2 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 2 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 2 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 2 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS3: 5 169 | PS4: 5 170 | PSM: 5 171 | PSP2: 2 172 | Samsung TV: 2 173 | Standalone: 5 174 | Tizen: 2 175 | Web: 5 176 | WebGL: 3 177 | WiiU: 5 178 | Windows Store Apps: 5 179 | XBOX360: 5 180 | XboxOne: 5 181 | iPhone: 2 182 | tvOS: 5 183 | -------------------------------------------------------------------------------- /NativeCameraPlugin/jni/src/Unity/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | 21 | 22 | // Unity Interface GUID 23 | // Ensures cross plugin uniqueness. 24 | // 25 | // Template specialization is used to produce a means of looking up a GUID from it's payload type at compile time. 26 | // The net result should compile down to passing around the GUID. 27 | // 28 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any payload definition outside of all namespaces. 29 | // The payload structure and the registration GUID are all that is required to expose the interface to other systems. 30 | struct UnityInterfaceGUID 31 | { 32 | #ifdef __cplusplus 33 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 34 | : m_GUIDHigh(high) 35 | , m_GUIDLow(low) 36 | { 37 | } 38 | 39 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 40 | { 41 | m_GUIDHigh = other.m_GUIDHigh; 42 | m_GUIDLow = other.m_GUIDLow; 43 | } 44 | 45 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 46 | { 47 | m_GUIDHigh = other.m_GUIDHigh; 48 | m_GUIDLow = other.m_GUIDLow; 49 | return *this; 50 | } 51 | 52 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 53 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 54 | #endif 55 | unsigned long long m_GUIDHigh; 56 | unsigned long long m_GUIDLow; 57 | }; 58 | #ifdef __cplusplus 59 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 60 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 61 | inline bool operator< (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 62 | inline bool operator> (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 63 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator< (left,right); } 64 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator> (left,right); } 65 | #else 66 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 67 | #endif 68 | 69 | 70 | 71 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 72 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterface(UNITY_GET_INTERFACE_GUID(TYPE)); 73 | 74 | #ifdef __cplusplus 75 | #define UNITY_DECLARE_INTERFACE(NAME) \ 76 | struct NAME : IUnityInterface 77 | 78 | template \ 79 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); \ 80 | 81 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 82 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 83 | template<> \ 84 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 85 | { \ 86 | return UNITY_GET_INTERFACE_GUID(TYPE); \ 87 | } 88 | #else 89 | #define UNITY_DECLARE_INTERFACE(NAME) \ 90 | typedef struct NAME NAME; \ 91 | struct NAME 92 | 93 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 94 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 95 | #endif 96 | 97 | 98 | 99 | #ifdef __cplusplus 100 | struct IUnityInterface 101 | { 102 | }; 103 | #else 104 | typedef void IUnityInterface; 105 | #endif 106 | 107 | 108 | 109 | typedef struct IUnityInterfaces 110 | { 111 | // Returns an interface matching the guid. 112 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 113 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 114 | 115 | // Registers a new interface. 116 | void (UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface* ptr); 117 | 118 | #ifdef __cplusplus 119 | // Helper for GetInterface. 120 | template 121 | INTERFACE* Get() 122 | { 123 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 124 | } 125 | 126 | // Helper for RegisterInterface. 127 | template 128 | void Register(IUnityInterface* ptr) 129 | { 130 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 131 | } 132 | #endif 133 | } IUnityInterfaces; 134 | 135 | 136 | 137 | #ifdef __cplusplus 138 | extern "C" { 139 | #endif 140 | 141 | // If exported by a plugin, this function will be called when the plugin is loaded. 142 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 143 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 144 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/cpp/Unity/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Unity native plugin API 4 | // Compatible with C99 5 | 6 | #if defined(__CYGWIN32__) 7 | #define UNITY_INTERFACE_API __stdcall 8 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 9 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 10 | #define UNITY_INTERFACE_API __stdcall 11 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 12 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) 13 | #define UNITY_INTERFACE_API 14 | #define UNITY_INTERFACE_EXPORT 15 | #else 16 | #define UNITY_INTERFACE_API 17 | #define UNITY_INTERFACE_EXPORT 18 | #endif 19 | 20 | 21 | 22 | // Unity Interface GUID 23 | // Ensures cross plugin uniqueness. 24 | // 25 | // Template specialization is used to produce a means of looking up a GUID from it's payload type at compile time. 26 | // The net result should compile down to passing around the GUID. 27 | // 28 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any payload definition outside of all namespaces. 29 | // The payload structure and the registration GUID are all that is required to expose the interface to other systems. 30 | struct UnityInterfaceGUID 31 | { 32 | #ifdef __cplusplus 33 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 34 | : m_GUIDHigh(high) 35 | , m_GUIDLow(low) 36 | { 37 | } 38 | 39 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 40 | { 41 | m_GUIDHigh = other.m_GUIDHigh; 42 | m_GUIDLow = other.m_GUIDLow; 43 | } 44 | 45 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 46 | { 47 | m_GUIDHigh = other.m_GUIDHigh; 48 | m_GUIDLow = other.m_GUIDLow; 49 | return *this; 50 | } 51 | 52 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 53 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 54 | #endif 55 | unsigned long long m_GUIDHigh; 56 | unsigned long long m_GUIDLow; 57 | }; 58 | #ifdef __cplusplus 59 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 60 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 61 | inline bool operator< (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 62 | inline bool operator> (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 63 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator< (left,right); } 64 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator> (left,right); } 65 | #else 66 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 67 | #endif 68 | 69 | 70 | 71 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 72 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterface(UNITY_GET_INTERFACE_GUID(TYPE)); 73 | 74 | #ifdef __cplusplus 75 | #define UNITY_DECLARE_INTERFACE(NAME) \ 76 | struct NAME : IUnityInterface 77 | 78 | template \ 79 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); \ 80 | 81 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 82 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 83 | template<> \ 84 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 85 | { \ 86 | return UNITY_GET_INTERFACE_GUID(TYPE); \ 87 | } 88 | #else 89 | #define UNITY_DECLARE_INTERFACE(NAME) \ 90 | typedef struct NAME NAME; \ 91 | struct NAME 92 | 93 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 94 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 95 | #endif 96 | 97 | 98 | 99 | #ifdef __cplusplus 100 | struct IUnityInterface 101 | { 102 | }; 103 | #else 104 | typedef void IUnityInterface; 105 | #endif 106 | 107 | 108 | 109 | typedef struct IUnityInterfaces 110 | { 111 | // Returns an interface matching the guid. 112 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 113 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 114 | 115 | // Registers a new interface. 116 | void (UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface* ptr); 117 | 118 | #ifdef __cplusplus 119 | // Helper for GetInterface. 120 | template 121 | INTERFACE* Get() 122 | { 123 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 124 | } 125 | 126 | // Helper for RegisterInterface. 127 | template 128 | void Register(IUnityInterface* ptr) 129 | { 130 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 131 | } 132 | #endif 133 | } IUnityInterfaces; 134 | 135 | 136 | 137 | #ifdef __cplusplus 138 | extern "C" { 139 | #endif 140 | 141 | // If exported by a plugin, this function will be called when the plugin is loaded. 142 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 143 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 144 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/camera/src/main/java/arp/camera/CameraPluginActivity.java: -------------------------------------------------------------------------------- 1 | package arp.camera; 2 | 3 | import android.Manifest; 4 | import android.content.pm.PackageManager; 5 | import android.graphics.PixelFormat; 6 | import android.hardware.camera2.CameraAccessException; 7 | import android.hardware.camera2.CameraCaptureSession; 8 | import android.hardware.camera2.CameraCharacteristics; 9 | import android.hardware.camera2.CameraDevice; 10 | import android.hardware.camera2.CameraManager; 11 | import android.hardware.camera2.CameraMetadata; 12 | import android.hardware.camera2.CaptureRequest; 13 | import android.media.Image; 14 | import android.media.ImageReader; 15 | import android.opengl.GLES20; 16 | import android.os.Build; 17 | import android.os.Bundle; 18 | import android.os.HandlerThread; 19 | import android.renderscript.RenderScript; 20 | import android.util.Log; 21 | import android.util.Size; 22 | import android.view.Surface; 23 | 24 | import com.unity3d.player.UnityPlayerActivity; 25 | 26 | import java.nio.IntBuffer; 27 | import java.util.Arrays; 28 | 29 | 30 | public class CameraPluginActivity extends UnityPlayerActivity { 31 | 32 | private static final String TAG = "CameraPluginActivity"; 33 | 34 | // Enable access to non-static methods from Unity 35 | public static CameraPluginActivity _context; 36 | private boolean _update; 37 | 38 | private static final int MAX_IMAGES = 4; 39 | private static final int CONVERSION_FRAME_RATE = 60; 40 | private Size _previewSize = new Size(640, 480); 41 | private CameraDevice _cameraDevice; 42 | private CameraCaptureSession _captureSession; 43 | 44 | 45 | private ImageReader _imagePreviewReader; 46 | private RenderScript _renderScript; 47 | private YuvToRgb _conversionScript; 48 | private Surface _previewSurface; 49 | 50 | private HandlerThread _handlerThread; 51 | 52 | 53 | @SuppressWarnings("JniMissingFunction") 54 | public native void nativeInit(); 55 | 56 | @SuppressWarnings("JniMissingFunction") 57 | public native void nativeRelease(); 58 | 59 | @Override 60 | protected void onCreate(Bundle bundle) { 61 | super.onCreate(bundle); 62 | 63 | System.loadLibrary("NativeCameraPlugin"); 64 | nativeInit(); 65 | 66 | setContext(this); 67 | 68 | _renderScript = RenderScript.create(this); 69 | 70 | } 71 | 72 | private synchronized static void setContext(CameraPluginActivity context) { 73 | CameraPluginActivity._context = context; 74 | } 75 | 76 | @Override 77 | public void onResume() { 78 | super.onResume(); 79 | 80 | _handlerThread = new HandlerThread(TAG); 81 | _handlerThread.start(); 82 | 83 | startCamera(); 84 | } 85 | 86 | @Override 87 | protected void onDestroy() { 88 | super.onDestroy(); 89 | 90 | nativeRelease(); 91 | 92 | setContext(null); 93 | } 94 | 95 | @Override 96 | public void onPause() { 97 | 98 | _handlerThread.quitSafely(); 99 | try { 100 | _handlerThread.join(); 101 | _handlerThread = null; 102 | } catch (final Exception e) { 103 | e.printStackTrace(); 104 | } 105 | 106 | stopCamera(); 107 | 108 | super.onPause(); 109 | } 110 | 111 | private final CameraDevice.StateCallback _cameraStateCallback = new CameraDevice.StateCallback() { 112 | @Override 113 | public void onOpened(CameraDevice camera) { 114 | _cameraDevice = camera; 115 | setupCameraDevice(); 116 | } 117 | 118 | @Override 119 | public void onDisconnected(CameraDevice camera) { 120 | Log.w(TAG, "CameraDevice.StateCallback onDisconnected"); 121 | } 122 | 123 | @Override 124 | public void onError(CameraDevice camera, int error) { 125 | Log.e(TAG, "CameraDevice.StateCallback onError[" + error + "]"); 126 | } 127 | }; 128 | 129 | private CameraCaptureSession.StateCallback _sessionStateCallback = new CameraCaptureSession.StateCallback() { 130 | @Override 131 | public void onConfigured(CameraCaptureSession session) { 132 | CameraPluginActivity.this._captureSession = session; 133 | try { 134 | session.setRepeatingRequest(createCaptureRequest(), null, null); 135 | } catch (CameraAccessException e) { 136 | e.printStackTrace(); 137 | } 138 | } 139 | 140 | @Override 141 | public void onConfigureFailed(CameraCaptureSession session) { 142 | Log.e(TAG, "CameraCaptureSession.StateCallback onConfigureFailed"); 143 | } 144 | }; 145 | 146 | 147 | /* 148 | * 149 | * Called from NDK to update the texture in Unity. 150 | * It is done this way since Unity does not allow Java callbacks for GL.IssuePluginEvent 151 | * 152 | */ 153 | private void requestJavaRendering(int texturePointer) { 154 | 155 | if (!_update) { 156 | return; 157 | } 158 | 159 | int[] imageBuffer = new int[0]; 160 | 161 | if (_conversionScript != null) { 162 | imageBuffer = _conversionScript.getOutputBuffer(); 163 | } 164 | 165 | if (imageBuffer.length > 1) { 166 | GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texturePointer); 167 | 168 | GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, _previewSize.getWidth(), 169 | _previewSize.getHeight(), GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, 170 | IntBuffer.wrap(imageBuffer)); 171 | 172 | } 173 | } 174 | 175 | private void setupCameraDevice() { 176 | try { 177 | if (_previewSurface != null) { 178 | _cameraDevice.createCaptureSession(Arrays.asList(_previewSurface), 179 | _sessionStateCallback, null); 180 | } else { 181 | Log.e(TAG, "failed creating preview surface"); 182 | } 183 | } catch (CameraAccessException e) { 184 | e.printStackTrace(); 185 | } 186 | } 187 | 188 | private CaptureRequest createCaptureRequest() { 189 | try { 190 | CaptureRequest.Builder builder = 191 | _cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); 192 | 193 | builder.set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE); 194 | 195 | builder.addTarget(_previewSurface); 196 | return builder.build(); 197 | } catch (CameraAccessException e) { 198 | e.printStackTrace(); 199 | return null; 200 | } 201 | } 202 | 203 | private void startCamera() { 204 | CameraManager manager = (CameraManager) getSystemService(CAMERA_SERVICE); 205 | try { 206 | 207 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 208 | if (checkSelfPermission(Manifest.permission.CAMERA) 209 | != PackageManager.PERMISSION_GRANTED) { 210 | return; 211 | } 212 | } 213 | 214 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { 215 | 216 | String pickedCamera = getCamera(manager); 217 | manager.openCamera(pickedCamera, _cameraStateCallback, null); 218 | 219 | final int previewHeight = _previewSize.getHeight(); 220 | final int previewWidth = _previewSize.getWidth(); 221 | _imagePreviewReader = ImageReader.newInstance(previewWidth, previewHeight, 222 | PixelFormat.RGBA_8888, MAX_IMAGES); 223 | 224 | _conversionScript = new YuvToRgb(_renderScript, _previewSize, CONVERSION_FRAME_RATE); 225 | _conversionScript.setOutputSurface(_imagePreviewReader.getSurface()); 226 | _previewSurface = _conversionScript.getInputSurface(); 227 | } 228 | 229 | } catch (CameraAccessException e) { 230 | e.printStackTrace(); 231 | } catch (SecurityException e) { 232 | e.printStackTrace(); 233 | } 234 | } 235 | 236 | private void stopCamera() { 237 | try { 238 | _captureSession.abortCaptures(); 239 | _captureSession.close(); 240 | } catch (Exception e) { 241 | e.printStackTrace(); 242 | } 243 | 244 | try { 245 | Image image = _imagePreviewReader.acquireLatestImage(); 246 | if (image != null) { 247 | image.close(); 248 | } 249 | } catch (Exception e) { 250 | e.printStackTrace(); 251 | } finally { 252 | if (_imagePreviewReader != null) { 253 | _imagePreviewReader.close(); 254 | _imagePreviewReader = null; 255 | } 256 | } 257 | 258 | try { 259 | _cameraDevice.close(); 260 | } catch (Exception e) { 261 | e.printStackTrace(); 262 | } 263 | _conversionScript = null; 264 | 265 | } 266 | 267 | private String getCamera(CameraManager manager) { 268 | try { 269 | for (String cameraId : manager.getCameraIdList()) { 270 | CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId); 271 | int cameraOrientation = characteristics.get(CameraCharacteristics.LENS_FACING); 272 | if (cameraOrientation == CameraCharacteristics.LENS_FACING_BACK) { 273 | return cameraId; 274 | } 275 | } 276 | } catch (CameraAccessException e) { 277 | e.printStackTrace(); 278 | } 279 | return null; 280 | } 281 | 282 | @UsedThroughReflection 283 | public void enablePreviewUpdater(boolean update) { 284 | _update = update; 285 | } 286 | 287 | 288 | } 289 | -------------------------------------------------------------------------------- /UnityAndroidCameraPlugin/import-summary.txt: -------------------------------------------------------------------------------- 1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY 2 | ====================================== 3 | 4 | Ignored Files: 5 | -------------- 6 | The following files were *not* copied into the new Gradle project; you 7 | should evaluate whether these are still needed in your project and if 8 | so manually move them: 9 | 10 | * .DS_Store 11 | * javadoc/ 12 | * javadoc/allclasses-frame.html 13 | * javadoc/allclasses-noframe.html 14 | * javadoc/constant-values.html 15 | * javadoc/help-doc.html 16 | * javadoc/index-all.html 17 | * javadoc/index.html 18 | * javadoc/org/ 19 | * javadoc/org/opencv/ 20 | * javadoc/org/opencv/android/ 21 | * javadoc/org/opencv/android/BaseLoaderCallback.html 22 | * javadoc/org/opencv/android/CameraBridgeViewBase.CvCameraViewFrame.html 23 | * javadoc/org/opencv/android/CameraBridgeViewBase.CvCameraViewListener.html 24 | * javadoc/org/opencv/android/CameraBridgeViewBase.CvCameraViewListener2.html 25 | * javadoc/org/opencv/android/CameraBridgeViewBase.ListItemAccessor.html 26 | * javadoc/org/opencv/android/CameraBridgeViewBase.html 27 | * javadoc/org/opencv/android/FpsMeter.html 28 | * javadoc/org/opencv/android/InstallCallbackInterface.html 29 | * javadoc/org/opencv/android/JavaCameraView.JavaCameraSizeAccessor.html 30 | * javadoc/org/opencv/android/JavaCameraView.html 31 | * javadoc/org/opencv/android/LoaderCallbackInterface.html 32 | * javadoc/org/opencv/android/OpenCVLoader.html 33 | * javadoc/org/opencv/android/Utils.html 34 | * javadoc/org/opencv/android/package-frame.html 35 | * javadoc/org/opencv/android/package-summary.html 36 | * javadoc/org/opencv/android/package-tree.html 37 | * javadoc/org/opencv/calib3d/ 38 | * javadoc/org/opencv/calib3d/Calib3d.html 39 | * javadoc/org/opencv/calib3d/StereoBM.html 40 | * javadoc/org/opencv/calib3d/StereoMatcher.html 41 | * javadoc/org/opencv/calib3d/StereoSGBM.html 42 | * javadoc/org/opencv/calib3d/package-frame.html 43 | * javadoc/org/opencv/calib3d/package-summary.html 44 | * javadoc/org/opencv/calib3d/package-tree.html 45 | * javadoc/org/opencv/core/ 46 | * javadoc/org/opencv/core/Algorithm.html 47 | * javadoc/org/opencv/core/Core.MinMaxLocResult.html 48 | * javadoc/org/opencv/core/Core.html 49 | * javadoc/org/opencv/core/CvException.html 50 | * javadoc/org/opencv/core/CvType.html 51 | * javadoc/org/opencv/core/DMatch.html 52 | * javadoc/org/opencv/core/KeyPoint.html 53 | * javadoc/org/opencv/core/Mat.html 54 | * javadoc/org/opencv/core/MatOfByte.html 55 | * javadoc/org/opencv/core/MatOfDMatch.html 56 | * javadoc/org/opencv/core/MatOfDouble.html 57 | * javadoc/org/opencv/core/MatOfFloat.html 58 | * javadoc/org/opencv/core/MatOfFloat4.html 59 | * javadoc/org/opencv/core/MatOfFloat6.html 60 | * javadoc/org/opencv/core/MatOfInt.html 61 | * javadoc/org/opencv/core/MatOfInt4.html 62 | * javadoc/org/opencv/core/MatOfKeyPoint.html 63 | * javadoc/org/opencv/core/MatOfPoint.html 64 | * javadoc/org/opencv/core/MatOfPoint2f.html 65 | * javadoc/org/opencv/core/MatOfPoint3.html 66 | * javadoc/org/opencv/core/MatOfPoint3f.html 67 | * javadoc/org/opencv/core/MatOfRect.html 68 | * javadoc/org/opencv/core/Point.html 69 | * javadoc/org/opencv/core/Point3.html 70 | * javadoc/org/opencv/core/Range.html 71 | * javadoc/org/opencv/core/Rect.html 72 | * javadoc/org/opencv/core/RotatedRect.html 73 | * javadoc/org/opencv/core/Scalar.html 74 | * javadoc/org/opencv/core/Size.html 75 | * javadoc/org/opencv/core/TermCriteria.html 76 | * javadoc/org/opencv/core/TickMeter.html 77 | * javadoc/org/opencv/core/package-frame.html 78 | * javadoc/org/opencv/core/package-summary.html 79 | * javadoc/org/opencv/core/package-tree.html 80 | * javadoc/org/opencv/engine/ 81 | * javadoc/org/opencv/engine/package-frame.html 82 | * javadoc/org/opencv/engine/package-summary.html 83 | * javadoc/org/opencv/engine/package-tree.html 84 | * javadoc/org/opencv/features2d/ 85 | * javadoc/org/opencv/features2d/AKAZE.html 86 | * javadoc/org/opencv/features2d/AgastFeatureDetector.html 87 | * javadoc/org/opencv/features2d/BFMatcher.html 88 | * javadoc/org/opencv/features2d/BOWImgDescriptorExtractor.html 89 | * javadoc/org/opencv/features2d/BOWKMeansTrainer.html 90 | * javadoc/org/opencv/features2d/BOWTrainer.html 91 | * javadoc/org/opencv/features2d/BRISK.html 92 | * javadoc/org/opencv/features2d/DescriptorExtractor.html 93 | * javadoc/org/opencv/features2d/DescriptorMatcher.html 94 | * javadoc/org/opencv/features2d/FastFeatureDetector.html 95 | * javadoc/org/opencv/features2d/Feature2D.html 96 | * javadoc/org/opencv/features2d/FeatureDetector.html 97 | * javadoc/org/opencv/features2d/Features2d.html 98 | * javadoc/org/opencv/features2d/FlannBasedMatcher.html 99 | * javadoc/org/opencv/features2d/GFTTDetector.html 100 | * javadoc/org/opencv/features2d/KAZE.html 101 | * javadoc/org/opencv/features2d/MSER.html 102 | * javadoc/org/opencv/features2d/ORB.html 103 | * javadoc/org/opencv/features2d/Params.html 104 | * javadoc/org/opencv/features2d/package-frame.html 105 | * javadoc/org/opencv/features2d/package-summary.html 106 | * javadoc/org/opencv/features2d/package-tree.html 107 | * javadoc/org/opencv/imgcodecs/ 108 | * javadoc/org/opencv/imgcodecs/Imgcodecs.html 109 | * javadoc/org/opencv/imgcodecs/package-frame.html 110 | * javadoc/org/opencv/imgcodecs/package-summary.html 111 | * javadoc/org/opencv/imgcodecs/package-tree.html 112 | * javadoc/org/opencv/imgproc/ 113 | * javadoc/org/opencv/imgproc/CLAHE.html 114 | * javadoc/org/opencv/imgproc/Imgproc.html 115 | * javadoc/org/opencv/imgproc/LineSegmentDetector.html 116 | * javadoc/org/opencv/imgproc/Moments.html 117 | * javadoc/org/opencv/imgproc/Subdiv2D.html 118 | * javadoc/org/opencv/imgproc/package-frame.html 119 | * javadoc/org/opencv/imgproc/package-summary.html 120 | * javadoc/org/opencv/imgproc/package-tree.html 121 | * javadoc/org/opencv/ml/ 122 | * javadoc/org/opencv/ml/ANN_MLP.html 123 | * javadoc/org/opencv/ml/Boost.html 124 | * javadoc/org/opencv/ml/DTrees.html 125 | * javadoc/org/opencv/ml/EM.html 126 | * javadoc/org/opencv/ml/KNearest.html 127 | * javadoc/org/opencv/ml/LogisticRegression.html 128 | * javadoc/org/opencv/ml/Ml.html 129 | * javadoc/org/opencv/ml/NormalBayesClassifier.html 130 | * javadoc/org/opencv/ml/RTrees.html 131 | * javadoc/org/opencv/ml/SVM.html 132 | * javadoc/org/opencv/ml/SVMSGD.html 133 | * javadoc/org/opencv/ml/StatModel.html 134 | * javadoc/org/opencv/ml/TrainData.html 135 | * javadoc/org/opencv/ml/package-frame.html 136 | * javadoc/org/opencv/ml/package-summary.html 137 | * javadoc/org/opencv/ml/package-tree.html 138 | * javadoc/org/opencv/objdetect/ 139 | * javadoc/org/opencv/objdetect/BaseCascadeClassifier.html 140 | * javadoc/org/opencv/objdetect/CascadeClassifier.html 141 | * javadoc/org/opencv/objdetect/HOGDescriptor.html 142 | * javadoc/org/opencv/objdetect/Objdetect.html 143 | * javadoc/org/opencv/objdetect/package-frame.html 144 | * javadoc/org/opencv/objdetect/package-summary.html 145 | * javadoc/org/opencv/objdetect/package-tree.html 146 | * javadoc/org/opencv/photo/ 147 | * javadoc/org/opencv/photo/AlignExposures.html 148 | * javadoc/org/opencv/photo/AlignMTB.html 149 | * javadoc/org/opencv/photo/CalibrateCRF.html 150 | * javadoc/org/opencv/photo/CalibrateDebevec.html 151 | * javadoc/org/opencv/photo/CalibrateRobertson.html 152 | * javadoc/org/opencv/photo/MergeDebevec.html 153 | * javadoc/org/opencv/photo/MergeExposures.html 154 | * javadoc/org/opencv/photo/MergeMertens.html 155 | * javadoc/org/opencv/photo/MergeRobertson.html 156 | * javadoc/org/opencv/photo/Photo.html 157 | * javadoc/org/opencv/photo/Tonemap.html 158 | * javadoc/org/opencv/photo/TonemapDrago.html 159 | * javadoc/org/opencv/photo/TonemapDurand.html 160 | * javadoc/org/opencv/photo/TonemapMantiuk.html 161 | * javadoc/org/opencv/photo/TonemapReinhard.html 162 | * javadoc/org/opencv/photo/package-frame.html 163 | * javadoc/org/opencv/photo/package-summary.html 164 | * javadoc/org/opencv/photo/package-tree.html 165 | * javadoc/org/opencv/utils/ 166 | * javadoc/org/opencv/utils/Converters.html 167 | * javadoc/org/opencv/utils/package-frame.html 168 | * javadoc/org/opencv/utils/package-summary.html 169 | * javadoc/org/opencv/utils/package-tree.html 170 | * javadoc/org/opencv/video/ 171 | * javadoc/org/opencv/video/BackgroundSubtractor.html 172 | * javadoc/org/opencv/video/BackgroundSubtractorKNN.html 173 | * javadoc/org/opencv/video/BackgroundSubtractorMOG2.html 174 | * javadoc/org/opencv/video/DenseOpticalFlow.html 175 | * javadoc/org/opencv/video/DualTVL1OpticalFlow.html 176 | * javadoc/org/opencv/video/FarnebackOpticalFlow.html 177 | * javadoc/org/opencv/video/KalmanFilter.html 178 | * javadoc/org/opencv/video/SparseOpticalFlow.html 179 | * javadoc/org/opencv/video/SparsePyrLKOpticalFlow.html 180 | * javadoc/org/opencv/video/Video.html 181 | * javadoc/org/opencv/video/package-frame.html 182 | * javadoc/org/opencv/video/package-summary.html 183 | * javadoc/org/opencv/video/package-tree.html 184 | * javadoc/org/opencv/videoio/ 185 | * javadoc/org/opencv/videoio/VideoCapture.html 186 | * javadoc/org/opencv/videoio/VideoWriter.html 187 | * javadoc/org/opencv/videoio/Videoio.html 188 | * javadoc/org/opencv/videoio/package-frame.html 189 | * javadoc/org/opencv/videoio/package-summary.html 190 | * javadoc/org/opencv/videoio/package-tree.html 191 | * javadoc/overview-frame.html 192 | * javadoc/overview-summary.html 193 | * javadoc/overview-tree.html 194 | * javadoc/package-list 195 | * javadoc/resources/ 196 | * javadoc/resources/background.gif 197 | * javadoc/resources/tab.gif 198 | * javadoc/resources/titlebar.gif 199 | * javadoc/resources/titlebar_end.gif 200 | * javadoc/serialized-form.html 201 | * javadoc/stylesheet.css 202 | 203 | Moved Files: 204 | ------------ 205 | Android Gradle projects use a different directory structure than ADT 206 | Eclipse projects. Here's how the projects were restructured: 207 | 208 | * AndroidManifest.xml => openCVLibrary320/src/main/AndroidManifest.xml 209 | * lint.xml => openCVLibrary320/lint.xml 210 | * res/ => openCVLibrary320/src/main/res/ 211 | * src/ => openCVLibrary320/src/main/java/ 212 | * src/.DS_Store => openCVLibrary320/src/main/resources/.DS_Store 213 | * src/org/.DS_Store => openCVLibrary320/src/main/resources/org/.DS_Store 214 | * src/org/opencv/engine/OpenCVEngineInterface.aidl => openCVLibrary320/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl 215 | 216 | Next Steps: 217 | ----------- 218 | You can now build the project. The Gradle project needs network 219 | connectivity to download dependencies. 220 | 221 | Bugs: 222 | ----- 223 | If for some reason your project does not build, and you determine that 224 | it is due to a bug or limitation of the Eclipse to Gradle importer, 225 | please file a bug at http://b.android.com with category 226 | Component-Tools. 227 | 228 | (This import summary is for your information only, and can be deleted 229 | after import once you are satisfied with the results.) 230 | -------------------------------------------------------------------------------- /UnityAndroidCamera/Assets/Scenes/MainScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641275, b: 0.5748172, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 1 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 0 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 221761685} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &143563605 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 143563610} 135 | - component: {fileID: 143563609} 136 | - component: {fileID: 143563607} 137 | - component: {fileID: 143563606} 138 | m_Layer: 0 139 | m_Name: Main Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!81 &143563606 146 | AudioListener: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 143563605} 152 | m_Enabled: 1 153 | --- !u!124 &143563607 154 | Behaviour: 155 | m_ObjectHideFlags: 0 156 | m_CorrespondingSourceObject: {fileID: 0} 157 | m_PrefabInstance: {fileID: 0} 158 | m_PrefabAsset: {fileID: 0} 159 | m_GameObject: {fileID: 143563605} 160 | m_Enabled: 1 161 | --- !u!20 &143563609 162 | Camera: 163 | m_ObjectHideFlags: 0 164 | m_CorrespondingSourceObject: {fileID: 0} 165 | m_PrefabInstance: {fileID: 0} 166 | m_PrefabAsset: {fileID: 0} 167 | m_GameObject: {fileID: 143563605} 168 | m_Enabled: 1 169 | serializedVersion: 2 170 | m_ClearFlags: 1 171 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 1} 172 | m_projectionMatrixMode: 1 173 | m_GateFitMode: 2 174 | m_FOVAxisMode: 0 175 | m_SensorSize: {x: 36, y: 24} 176 | m_LensShift: {x: 0, y: 0} 177 | m_FocalLength: 50 178 | m_NormalizedViewPortRect: 179 | serializedVersion: 2 180 | x: 0 181 | y: 0 182 | width: 1 183 | height: 1 184 | near clip plane: 0.3 185 | far clip plane: 1500 186 | field of view: 30 187 | orthographic: 0 188 | orthographic size: 5 189 | m_Depth: -1 190 | m_CullingMask: 191 | serializedVersion: 2 192 | m_Bits: 4294967295 193 | m_RenderingPath: -1 194 | m_TargetTexture: {fileID: 0} 195 | m_TargetDisplay: 0 196 | m_TargetEye: 3 197 | m_HDR: 0 198 | m_AllowMSAA: 0 199 | m_AllowDynamicResolution: 0 200 | m_ForceIntoRT: 0 201 | m_OcclusionCulling: 1 202 | m_StereoConvergence: 10 203 | m_StereoSeparation: 0.022 204 | --- !u!4 &143563610 205 | Transform: 206 | m_ObjectHideFlags: 0 207 | m_CorrespondingSourceObject: {fileID: 0} 208 | m_PrefabInstance: {fileID: 0} 209 | m_PrefabAsset: {fileID: 0} 210 | m_GameObject: {fileID: 143563605} 211 | m_LocalRotation: {x: -0.12131728, y: 0.055652466, z: -0.006812726, w: -0.9910291} 212 | m_LocalPosition: {x: 3.54, y: 0.93, z: -13.47} 213 | m_LocalScale: {x: 1, y: 1, z: 1} 214 | m_Children: [] 215 | m_Father: {fileID: 0} 216 | m_RootOrder: 0 217 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 218 | --- !u!850595691 &221761685 219 | LightingSettings: 220 | m_ObjectHideFlags: 0 221 | m_CorrespondingSourceObject: {fileID: 0} 222 | m_PrefabInstance: {fileID: 0} 223 | m_PrefabAsset: {fileID: 0} 224 | m_Name: Settings.lighting 225 | serializedVersion: 2 226 | m_GIWorkflowMode: 0 227 | m_EnableBakedLightmaps: 1 228 | m_EnableRealtimeLightmaps: 0 229 | m_RealtimeEnvironmentLighting: 1 230 | m_BounceScale: 1 231 | m_AlbedoBoost: 1 232 | m_IndirectOutputScale: 1 233 | m_UsingShadowmask: 0 234 | m_BakeBackend: 0 235 | m_LightmapMaxSize: 1024 236 | m_BakeResolution: 40 237 | m_Padding: 2 238 | m_TextureCompression: 1 239 | m_AO: 0 240 | m_AOMaxDistance: 1 241 | m_CompAOExponent: 1 242 | m_CompAOExponentDirect: 0 243 | m_ExtractAO: 0 244 | m_MixedBakeMode: 1 245 | m_LightmapsBakeMode: 1 246 | m_FilterMode: 1 247 | m_LightmapParameters: {fileID: 0} 248 | m_ExportTrainingData: 0 249 | m_TrainingDataDestination: TrainingData 250 | m_RealtimeResolution: 2 251 | m_ForceWhiteAlbedo: 0 252 | m_ForceUpdates: 0 253 | m_FinalGather: 0 254 | m_FinalGatherRayCount: 256 255 | m_FinalGatherFiltering: 1 256 | m_PVRCulling: 1 257 | m_PVRSampling: 1 258 | m_PVRDirectSampleCount: 32 259 | m_PVRSampleCount: 500 260 | m_PVREnvironmentSampleCount: 500 261 | m_PVREnvironmentReferencePointCount: 2048 262 | m_LightProbeSampleCountMultiplier: 4 263 | m_PVRBounces: 2 264 | m_PVRRussianRouletteStartBounce: 2 265 | m_PVREnvironmentMIS: 0 266 | m_PVRFilteringMode: 0 267 | m_PVRDenoiserTypeDirect: 0 268 | m_PVRDenoiserTypeIndirect: 0 269 | m_PVRDenoiserTypeAO: 0 270 | m_PVRFilterTypeDirect: 0 271 | m_PVRFilterTypeIndirect: 0 272 | m_PVRFilterTypeAO: 0 273 | m_PVRFilteringGaussRadiusDirect: 1 274 | m_PVRFilteringGaussRadiusIndirect: 5 275 | m_PVRFilteringGaussRadiusAO: 2 276 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 277 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 278 | m_PVRFilteringAtrousPositionSigmaAO: 1 279 | --- !u!1 &288215475 280 | GameObject: 281 | m_ObjectHideFlags: 0 282 | m_CorrespondingSourceObject: {fileID: 0} 283 | m_PrefabInstance: {fileID: 0} 284 | m_PrefabAsset: {fileID: 0} 285 | serializedVersion: 6 286 | m_Component: 287 | - component: {fileID: 288215476} 288 | - component: {fileID: 288215478} 289 | - component: {fileID: 288215477} 290 | m_Layer: 0 291 | m_Name: CubeMaterialUpdater 292 | m_TagString: Untagged 293 | m_Icon: {fileID: 0} 294 | m_NavMeshLayer: 0 295 | m_StaticEditorFlags: 0 296 | m_IsActive: 1 297 | --- !u!4 &288215476 298 | Transform: 299 | m_ObjectHideFlags: 0 300 | m_CorrespondingSourceObject: {fileID: 0} 301 | m_PrefabInstance: {fileID: 0} 302 | m_PrefabAsset: {fileID: 0} 303 | m_GameObject: {fileID: 288215475} 304 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 305 | m_LocalPosition: {x: 0, y: 0, z: 0} 306 | m_LocalScale: {x: 1, y: 1, z: 1} 307 | m_Children: [] 308 | m_Father: {fileID: 0} 309 | m_RootOrder: 2 310 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 311 | --- !u!114 &288215477 312 | MonoBehaviour: 313 | m_ObjectHideFlags: 0 314 | m_CorrespondingSourceObject: {fileID: 0} 315 | m_PrefabInstance: {fileID: 0} 316 | m_PrefabAsset: {fileID: 0} 317 | m_GameObject: {fileID: 288215475} 318 | m_Enabled: 1 319 | m_EditorHideFlags: 0 320 | m_Script: {fileID: 11500000, guid: 1a37fda7ae3f24728940be3965e43842, type: 3} 321 | m_Name: 322 | m_EditorClassIdentifier: 323 | displayMaterial: {fileID: 2100000, guid: 29e4f4d5415de49738b5aebad29612cf, type: 2} 324 | --- !u!114 &288215478 325 | MonoBehaviour: 326 | m_ObjectHideFlags: 0 327 | m_CorrespondingSourceObject: {fileID: 0} 328 | m_PrefabInstance: {fileID: 0} 329 | m_PrefabAsset: {fileID: 0} 330 | m_GameObject: {fileID: 288215475} 331 | m_Enabled: 1 332 | m_EditorHideFlags: 0 333 | m_Script: {fileID: 11500000, guid: 49c50bf1b475d4ff89409320caef62d6, type: 3} 334 | m_Name: 335 | m_EditorClassIdentifier: 336 | --- !u!1 &331580691 337 | GameObject: 338 | m_ObjectHideFlags: 0 339 | m_CorrespondingSourceObject: {fileID: 0} 340 | m_PrefabInstance: {fileID: 0} 341 | m_PrefabAsset: {fileID: 0} 342 | serializedVersion: 6 343 | m_Component: 344 | - component: {fileID: 331580693} 345 | - component: {fileID: 331580692} 346 | m_Layer: 0 347 | m_Name: Directional Light 348 | m_TagString: Untagged 349 | m_Icon: {fileID: 0} 350 | m_NavMeshLayer: 0 351 | m_StaticEditorFlags: 0 352 | m_IsActive: 1 353 | --- !u!108 &331580692 354 | Light: 355 | m_ObjectHideFlags: 0 356 | m_CorrespondingSourceObject: {fileID: 0} 357 | m_PrefabInstance: {fileID: 0} 358 | m_PrefabAsset: {fileID: 0} 359 | m_GameObject: {fileID: 331580691} 360 | m_Enabled: 1 361 | serializedVersion: 10 362 | m_Type: 1 363 | m_Shape: 0 364 | m_Color: {r: 1, g: 1, b: 1, a: 1} 365 | m_Intensity: 1 366 | m_Range: 10 367 | m_SpotAngle: 30 368 | m_InnerSpotAngle: 21.802082 369 | m_CookieSize: 10 370 | m_Shadows: 371 | m_Type: 0 372 | m_Resolution: -1 373 | m_CustomResolution: -1 374 | m_Strength: 1 375 | m_Bias: 0.05 376 | m_NormalBias: 0.4 377 | m_NearPlane: 0.2 378 | m_CullingMatrixOverride: 379 | e00: 1 380 | e01: 0 381 | e02: 0 382 | e03: 0 383 | e10: 0 384 | e11: 1 385 | e12: 0 386 | e13: 0 387 | e20: 0 388 | e21: 0 389 | e22: 1 390 | e23: 0 391 | e30: 0 392 | e31: 0 393 | e32: 0 394 | e33: 1 395 | m_UseCullingMatrixOverride: 0 396 | m_Cookie: {fileID: 0} 397 | m_DrawHalo: 0 398 | m_Flare: {fileID: 0} 399 | m_RenderMode: 0 400 | m_CullingMask: 401 | serializedVersion: 2 402 | m_Bits: 4294967295 403 | m_RenderingLayerMask: 1 404 | m_Lightmapping: 4 405 | m_LightShadowCasterMode: 0 406 | m_AreaSize: {x: 1, y: 1} 407 | m_BounceIntensity: 1 408 | m_ColorTemperature: 6570 409 | m_UseColorTemperature: 0 410 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 411 | m_UseBoundingSphereOverride: 0 412 | m_ShadowRadius: 0 413 | m_ShadowAngle: 0 414 | --- !u!4 &331580693 415 | Transform: 416 | m_ObjectHideFlags: 0 417 | m_CorrespondingSourceObject: {fileID: 0} 418 | m_PrefabInstance: {fileID: 0} 419 | m_PrefabAsset: {fileID: 0} 420 | m_GameObject: {fileID: 331580691} 421 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 422 | m_LocalPosition: {x: -2.060934, y: -0.0470438, z: -3.4370213} 423 | m_LocalScale: {x: 1, y: 1, z: 1} 424 | m_Children: [] 425 | m_Father: {fileID: 0} 426 | m_RootOrder: 1 427 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 428 | --- !u!1 &2065857115 429 | GameObject: 430 | m_ObjectHideFlags: 0 431 | m_CorrespondingSourceObject: {fileID: 0} 432 | m_PrefabInstance: {fileID: 0} 433 | m_PrefabAsset: {fileID: 0} 434 | serializedVersion: 6 435 | m_Component: 436 | - component: {fileID: 2065857119} 437 | - component: {fileID: 2065857118} 438 | - component: {fileID: 2065857117} 439 | - component: {fileID: 2065857116} 440 | m_Layer: 0 441 | m_Name: Cube 442 | m_TagString: Untagged 443 | m_Icon: {fileID: 0} 444 | m_NavMeshLayer: 0 445 | m_StaticEditorFlags: 0 446 | m_IsActive: 1 447 | --- !u!65 &2065857116 448 | BoxCollider: 449 | m_ObjectHideFlags: 0 450 | m_CorrespondingSourceObject: {fileID: 0} 451 | m_PrefabInstance: {fileID: 0} 452 | m_PrefabAsset: {fileID: 0} 453 | m_GameObject: {fileID: 2065857115} 454 | m_Material: {fileID: 0} 455 | m_IsTrigger: 0 456 | m_Enabled: 1 457 | serializedVersion: 2 458 | m_Size: {x: 1, y: 1, z: 1} 459 | m_Center: {x: 0, y: 0, z: 0} 460 | --- !u!23 &2065857117 461 | MeshRenderer: 462 | m_ObjectHideFlags: 0 463 | m_CorrespondingSourceObject: {fileID: 0} 464 | m_PrefabInstance: {fileID: 0} 465 | m_PrefabAsset: {fileID: 0} 466 | m_GameObject: {fileID: 2065857115} 467 | m_Enabled: 1 468 | m_CastShadows: 1 469 | m_ReceiveShadows: 1 470 | m_DynamicOccludee: 1 471 | m_MotionVectors: 1 472 | m_LightProbeUsage: 1 473 | m_ReflectionProbeUsage: 1 474 | m_RayTracingMode: 2 475 | m_RayTraceProcedural: 0 476 | m_RenderingLayerMask: 4294967295 477 | m_RendererPriority: 0 478 | m_Materials: 479 | - {fileID: 2100000, guid: 29e4f4d5415de49738b5aebad29612cf, type: 2} 480 | m_StaticBatchInfo: 481 | firstSubMesh: 0 482 | subMeshCount: 0 483 | m_StaticBatchRoot: {fileID: 0} 484 | m_ProbeAnchor: {fileID: 0} 485 | m_LightProbeVolumeOverride: {fileID: 0} 486 | m_ScaleInLightmap: 1 487 | m_ReceiveGI: 1 488 | m_PreserveUVs: 0 489 | m_IgnoreNormalsForChartDetection: 0 490 | m_ImportantGI: 0 491 | m_StitchLightmapSeams: 0 492 | m_SelectedEditorRenderState: 3 493 | m_MinimumChartSize: 4 494 | m_AutoUVMaxDistance: 0.5 495 | m_AutoUVMaxAngle: 89 496 | m_LightmapParameters: {fileID: 0} 497 | m_SortingLayerID: 0 498 | m_SortingLayer: 0 499 | m_SortingOrder: 0 500 | m_AdditionalVertexStreams: {fileID: 0} 501 | --- !u!33 &2065857118 502 | MeshFilter: 503 | m_ObjectHideFlags: 0 504 | m_CorrespondingSourceObject: {fileID: 0} 505 | m_PrefabInstance: {fileID: 0} 506 | m_PrefabAsset: {fileID: 0} 507 | m_GameObject: {fileID: 2065857115} 508 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 509 | --- !u!4 &2065857119 510 | Transform: 511 | m_ObjectHideFlags: 0 512 | m_CorrespondingSourceObject: {fileID: 0} 513 | m_PrefabInstance: {fileID: 0} 514 | m_PrefabAsset: {fileID: 0} 515 | m_GameObject: {fileID: 2065857115} 516 | m_LocalRotation: {x: -0.03495319, y: 0.079860404, z: 0.0015395093, w: 0.99619186} 517 | m_LocalPosition: {x: 2.96, y: 0, z: -8.56} 518 | m_LocalScale: {x: 1, y: 1, z: 1} 519 | m_Children: [] 520 | m_Father: {fileID: 0} 521 | m_RootOrder: 3 522 | m_LocalEulerAnglesHint: {x: -4.007, y: 9.172001, z: -0.14400001} 523 | -------------------------------------------------------------------------------- /UnityAndroidCamera/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 20 7 | productGUID: 32a9ed3910e651c4fb3108defcdb76a0 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 3 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: ARP 16 | productName: Camera 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | mipStripping: 0 53 | numberOfMipsStripped: 0 54 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 55 | iosShowActivityIndicatorOnLoading: -1 56 | androidShowActivityIndicatorOnLoading: -1 57 | iosUseCustomAppBackgroundBehavior: 0 58 | iosAllowHTTPDownload: 1 59 | allowedAutorotateToPortrait: 1 60 | allowedAutorotateToPortraitUpsideDown: 1 61 | allowedAutorotateToLandscapeRight: 0 62 | allowedAutorotateToLandscapeLeft: 0 63 | useOSAutorotation: 1 64 | use32BitDisplayBuffer: 1 65 | preserveFramebufferAlpha: 0 66 | disableDepthAndStencilBuffers: 0 67 | androidStartInFullscreen: 1 68 | androidRenderOutsideSafeArea: 1 69 | androidUseSwappy: 0 70 | androidBlitType: 0 71 | defaultIsNativeResolution: 1 72 | macRetinaSupport: 1 73 | runInBackground: 0 74 | captureSingleScreen: 0 75 | muteOtherAudioSources: 0 76 | Prepare IOS For Recording: 0 77 | Force IOS Speakers When Recording: 0 78 | deferSystemGesturesMode: 0 79 | hideHomeButton: 0 80 | submitAnalytics: 1 81 | usePlayerLog: 1 82 | bakeCollisionMeshes: 0 83 | forceSingleInstance: 0 84 | useFlipModelSwapchain: 1 85 | resizableWindow: 0 86 | useMacAppStoreValidation: 0 87 | macAppStoreCategory: public.app-category.games 88 | gpuSkinning: 0 89 | xboxPIXTextureCapture: 0 90 | xboxEnableAvatar: 0 91 | xboxEnableKinect: 0 92 | xboxEnableKinectAutoTracking: 0 93 | xboxEnableFitness: 0 94 | visibleInBackground: 0 95 | allowFullscreenSwitch: 1 96 | fullscreenMode: 2 97 | xboxSpeechDB: 0 98 | xboxEnableHeadOrientation: 0 99 | xboxEnableGuest: 0 100 | xboxEnablePIXSampling: 0 101 | metalFramebufferOnly: 0 102 | xboxOneResolution: 0 103 | xboxOneSResolution: 0 104 | xboxOneXResolution: 3 105 | xboxOneMonoLoggingLevel: 0 106 | xboxOneLoggingLevel: 1 107 | xboxOneDisableEsram: 0 108 | xboxOneEnableTypeOptimization: 0 109 | xboxOnePresentImmediateThreshold: 0 110 | switchQueueCommandMemory: 0 111 | switchQueueControlMemory: 16384 112 | switchQueueComputeMemory: 262144 113 | switchNVNShaderPoolsGranularity: 33554432 114 | switchNVNDefaultPoolsGranularity: 16777216 115 | switchNVNOtherPoolsGranularity: 16777216 116 | switchNVNMaxPublicTextureIDCount: 0 117 | switchNVNMaxPublicSamplerIDCount: 0 118 | stadiaPresentMode: 0 119 | stadiaTargetFramerate: 0 120 | vulkanNumSwapchainBuffers: 3 121 | vulkanEnableSetSRGBWrite: 0 122 | m_SupportedAspectRatios: 123 | 4:3: 1 124 | 5:4: 1 125 | 16:10: 1 126 | 16:9: 1 127 | Others: 1 128 | bundleVersion: 1.0 129 | preloadedAssets: [] 130 | metroInputSource: 0 131 | wsaTransparentSwapchain: 0 132 | m_HolographicPauseOnTrackingLoss: 1 133 | xboxOneDisableKinectGpuReservation: 0 134 | xboxOneEnable7thCore: 1 135 | vrSettings: 136 | cardboard: 137 | depthFormat: 0 138 | enableTransitionView: 0 139 | daydream: 140 | depthFormat: 0 141 | useSustainedPerformanceMode: 0 142 | enableVideoLayer: 0 143 | useProtectedVideoMemory: 0 144 | minimumSupportedHeadTracking: 0 145 | maximumSupportedHeadTracking: 1 146 | hololens: 147 | depthFormat: 1 148 | depthBufferSharingEnabled: 0 149 | lumin: 150 | depthFormat: 0 151 | frameTiming: 2 152 | enableGLCache: 0 153 | glCacheMaxBlobSize: 524288 154 | glCacheMaxFileSize: 8388608 155 | oculus: 156 | sharedDepthBuffer: 0 157 | dashSupport: 0 158 | lowOverheadMode: 0 159 | protectedContext: 0 160 | v2Signing: 1 161 | enable360StereoCapture: 0 162 | isWsaHolographicRemotingEnabled: 0 163 | enableFrameTimingStats: 0 164 | useHDRDisplay: 0 165 | D3DHDRBitDepth: 0 166 | m_ColorGamuts: 00000000 167 | targetPixelDensity: 30 168 | resolutionScalingMode: 0 169 | androidSupportedAspectRatio: 1 170 | androidMaxAspectRatio: 2.1 171 | applicationIdentifier: 172 | Android: arp.camera 173 | Standalone: arp.Camera 174 | iPhone: arp.camera 175 | tvOS: arp.camera 176 | buildNumber: 177 | iPhone: 0 178 | AndroidBundleVersionCode: 1 179 | AndroidMinSdkVersion: 28 180 | AndroidTargetSdkVersion: 0 181 | AndroidPreferredInstallLocation: 1 182 | aotOptions: 183 | stripEngineCode: 1 184 | iPhoneStrippingLevel: 0 185 | iPhoneScriptCallOptimization: 0 186 | ForceInternetPermission: 0 187 | ForceSDCardPermission: 0 188 | CreateWallpaper: 0 189 | APKExpansionFiles: 0 190 | keepLoadedShadersAlive: 0 191 | StripUnusedMeshComponents: 0 192 | VertexChannelCompressionMask: 214 193 | iPhoneSdkVersion: 988 194 | iOSTargetOSVersionString: 11.0 195 | tvOSSdkVersion: 0 196 | tvOSRequireExtendedGameController: 0 197 | tvOSTargetOSVersionString: 11.0 198 | uIPrerenderedIcon: 0 199 | uIRequiresPersistentWiFi: 0 200 | uIRequiresFullScreen: 1 201 | uIStatusBarHidden: 1 202 | uIExitOnSuspend: 0 203 | uIStatusBarStyle: 0 204 | appleTVSplashScreen: {fileID: 0} 205 | appleTVSplashScreen2x: {fileID: 0} 206 | tvOSSmallIconLayers: [] 207 | tvOSSmallIconLayers2x: [] 208 | tvOSLargeIconLayers: [] 209 | tvOSLargeIconLayers2x: [] 210 | tvOSTopShelfImageLayers: [] 211 | tvOSTopShelfImageLayers2x: [] 212 | tvOSTopShelfImageWideLayers: [] 213 | tvOSTopShelfImageWideLayers2x: [] 214 | iOSLaunchScreenType: 0 215 | iOSLaunchScreenPortrait: {fileID: 0} 216 | iOSLaunchScreenLandscape: {fileID: 0} 217 | iOSLaunchScreenBackgroundColor: 218 | serializedVersion: 2 219 | rgba: 0 220 | iOSLaunchScreenFillPct: 100 221 | iOSLaunchScreenSize: 100 222 | iOSLaunchScreenCustomXibPath: 223 | iOSLaunchScreeniPadType: 0 224 | iOSLaunchScreeniPadImage: {fileID: 0} 225 | iOSLaunchScreeniPadBackgroundColor: 226 | serializedVersion: 2 227 | rgba: 0 228 | iOSLaunchScreeniPadFillPct: 100 229 | iOSLaunchScreeniPadSize: 100 230 | iOSLaunchScreeniPadCustomXibPath: 231 | iOSUseLaunchScreenStoryboard: 0 232 | iOSLaunchScreenCustomStoryboardPath: 233 | iOSDeviceRequirements: [] 234 | iOSURLSchemes: [] 235 | iOSBackgroundModes: 0 236 | iOSMetalForceHardShadows: 0 237 | metalEditorSupport: 1 238 | metalAPIValidation: 1 239 | iOSRenderExtraFrameOnPause: 1 240 | appleDeveloperTeamID: 241 | iOSManualSigningProvisioningProfileID: 242 | tvOSManualSigningProvisioningProfileID: 243 | iOSManualSigningProvisioningProfileType: 0 244 | tvOSManualSigningProvisioningProfileType: 0 245 | appleEnableAutomaticSigning: 0 246 | iOSRequireARKit: 0 247 | iOSAutomaticallyDetectAndAddCapabilities: 1 248 | appleEnableProMotion: 0 249 | clonedFromGUID: 00000000000000000000000000000000 250 | templatePackageId: 251 | templateDefaultScene: 252 | AndroidTargetArchitectures: 1 253 | AndroidSplashScreenScale: 2 254 | androidSplashScreen: {fileID: 0} 255 | AndroidKeystoreName: '{inproject}: ' 256 | AndroidKeyaliasName: 257 | AndroidBuildApkPerCpuArchitecture: 0 258 | AndroidTVCompatibility: 0 259 | AndroidIsGame: 1 260 | AndroidEnableTango: 0 261 | androidEnableBanner: 0 262 | androidUseLowAccuracyLocation: 0 263 | androidUseCustomKeystore: 0 264 | m_AndroidBanners: 265 | - width: 320 266 | height: 180 267 | banner: {fileID: 0} 268 | androidGamepadSupportLevel: 0 269 | AndroidMinifyWithR8: 0 270 | AndroidMinifyRelease: 0 271 | AndroidMinifyDebug: 0 272 | AndroidValidateAppBundleSize: 1 273 | AndroidAppBundleSizeToValidate: 150 274 | m_BuildTargetIcons: 275 | - m_BuildTarget: 276 | m_Icons: 277 | - serializedVersion: 2 278 | m_Icon: {fileID: 2800000, guid: e0188f49132dcd14ab8487e755ba112d, type: 3} 279 | m_Width: 128 280 | m_Height: 128 281 | m_Kind: 0 282 | - m_BuildTarget: Android 283 | m_Icons: 284 | - serializedVersion: 2 285 | m_Icon: {fileID: 2800000, guid: e0188f49132dcd14ab8487e755ba112d, type: 3} 286 | m_Width: 192 287 | m_Height: 192 288 | m_Kind: 0 289 | - serializedVersion: 2 290 | m_Icon: {fileID: 2800000, guid: 3c286970d212b3f4291e76e132b84923, type: 3} 291 | m_Width: 144 292 | m_Height: 144 293 | m_Kind: 0 294 | - serializedVersion: 2 295 | m_Icon: {fileID: 2800000, guid: 181f743a2dd93254a80c8009f167c67c, type: 3} 296 | m_Width: 96 297 | m_Height: 96 298 | m_Kind: 0 299 | - serializedVersion: 2 300 | m_Icon: {fileID: 2800000, guid: 1516205c523e79947a17c3077f9cb03f, type: 3} 301 | m_Width: 72 302 | m_Height: 72 303 | m_Kind: 0 304 | - serializedVersion: 2 305 | m_Icon: {fileID: 2800000, guid: 6b1eb82ae52523b40bd3bd8e39c7ae57, type: 3} 306 | m_Width: 48 307 | m_Height: 48 308 | m_Kind: 0 309 | - serializedVersion: 2 310 | m_Icon: {fileID: 2800000, guid: 2ad4b8305465c7e4695165bf261b5106, type: 3} 311 | m_Width: 36 312 | m_Height: 36 313 | m_Kind: 0 314 | m_BuildTargetPlatformIcons: 315 | - m_BuildTarget: Android 316 | m_Icons: 317 | - m_Textures: [] 318 | m_Width: 432 319 | m_Height: 432 320 | m_Kind: 2 321 | m_SubKind: 322 | - m_Textures: [] 323 | m_Width: 324 324 | m_Height: 324 325 | m_Kind: 2 326 | m_SubKind: 327 | - m_Textures: [] 328 | m_Width: 216 329 | m_Height: 216 330 | m_Kind: 2 331 | m_SubKind: 332 | - m_Textures: [] 333 | m_Width: 162 334 | m_Height: 162 335 | m_Kind: 2 336 | m_SubKind: 337 | - m_Textures: [] 338 | m_Width: 108 339 | m_Height: 108 340 | m_Kind: 2 341 | m_SubKind: 342 | - m_Textures: [] 343 | m_Width: 81 344 | m_Height: 81 345 | m_Kind: 2 346 | m_SubKind: 347 | - m_Textures: 348 | - {fileID: 0} 349 | m_Width: 192 350 | m_Height: 192 351 | m_Kind: 1 352 | m_SubKind: 353 | - m_Textures: 354 | - {fileID: 0} 355 | m_Width: 144 356 | m_Height: 144 357 | m_Kind: 1 358 | m_SubKind: 359 | - m_Textures: 360 | - {fileID: 0} 361 | m_Width: 96 362 | m_Height: 96 363 | m_Kind: 1 364 | m_SubKind: 365 | - m_Textures: 366 | - {fileID: 0} 367 | m_Width: 72 368 | m_Height: 72 369 | m_Kind: 1 370 | m_SubKind: 371 | - m_Textures: 372 | - {fileID: 0} 373 | m_Width: 48 374 | m_Height: 48 375 | m_Kind: 1 376 | m_SubKind: 377 | - m_Textures: 378 | - {fileID: 0} 379 | m_Width: 36 380 | m_Height: 36 381 | m_Kind: 1 382 | m_SubKind: 383 | - m_Textures: 384 | - {fileID: 0} 385 | m_Width: 192 386 | m_Height: 192 387 | m_Kind: 0 388 | m_SubKind: 389 | - m_Textures: 390 | - {fileID: 0} 391 | m_Width: 144 392 | m_Height: 144 393 | m_Kind: 0 394 | m_SubKind: 395 | - m_Textures: 396 | - {fileID: 0} 397 | m_Width: 96 398 | m_Height: 96 399 | m_Kind: 0 400 | m_SubKind: 401 | - m_Textures: 402 | - {fileID: 0} 403 | m_Width: 72 404 | m_Height: 72 405 | m_Kind: 0 406 | m_SubKind: 407 | - m_Textures: 408 | - {fileID: 0} 409 | m_Width: 48 410 | m_Height: 48 411 | m_Kind: 0 412 | m_SubKind: 413 | - m_Textures: 414 | - {fileID: 0} 415 | m_Width: 36 416 | m_Height: 36 417 | m_Kind: 0 418 | m_SubKind: 419 | m_BuildTargetBatching: [] 420 | m_BuildTargetGraphicsJobs: 421 | - m_BuildTarget: MacStandaloneSupport 422 | m_GraphicsJobs: 0 423 | - m_BuildTarget: Switch 424 | m_GraphicsJobs: 0 425 | - m_BuildTarget: MetroSupport 426 | m_GraphicsJobs: 0 427 | - m_BuildTarget: AppleTVSupport 428 | m_GraphicsJobs: 0 429 | - m_BuildTarget: BJMSupport 430 | m_GraphicsJobs: 0 431 | - m_BuildTarget: LinuxStandaloneSupport 432 | m_GraphicsJobs: 0 433 | - m_BuildTarget: PS4Player 434 | m_GraphicsJobs: 0 435 | - m_BuildTarget: iOSSupport 436 | m_GraphicsJobs: 0 437 | - m_BuildTarget: WindowsStandaloneSupport 438 | m_GraphicsJobs: 0 439 | - m_BuildTarget: XboxOnePlayer 440 | m_GraphicsJobs: 0 441 | - m_BuildTarget: LuminSupport 442 | m_GraphicsJobs: 0 443 | - m_BuildTarget: AndroidPlayer 444 | m_GraphicsJobs: 0 445 | - m_BuildTarget: WebGLSupport 446 | m_GraphicsJobs: 0 447 | m_BuildTargetGraphicsJobMode: 448 | - m_BuildTarget: PS4Player 449 | m_GraphicsJobMode: 0 450 | - m_BuildTarget: XboxOnePlayer 451 | m_GraphicsJobMode: 0 452 | m_BuildTargetGraphicsAPIs: 453 | - m_BuildTarget: AndroidPlayer 454 | m_APIs: 08000000 455 | m_Automatic: 0 456 | m_BuildTargetVRSettings: 457 | - m_BuildTarget: Android 458 | m_Enabled: 0 459 | m_Devices: 460 | - Oculus 461 | - m_BuildTarget: Windows Store Apps 462 | m_Enabled: 0 463 | m_Devices: [] 464 | - m_BuildTarget: N3DS 465 | m_Enabled: 0 466 | m_Devices: [] 467 | - m_BuildTarget: PS3 468 | m_Enabled: 0 469 | m_Devices: [] 470 | - m_BuildTarget: PS4 471 | m_Enabled: 0 472 | m_Devices: 473 | - PlayStationVR 474 | - m_BuildTarget: PSM 475 | m_Enabled: 0 476 | m_Devices: [] 477 | - m_BuildTarget: PSP2 478 | m_Enabled: 0 479 | m_Devices: [] 480 | - m_BuildTarget: SamsungTV 481 | m_Enabled: 0 482 | m_Devices: [] 483 | - m_BuildTarget: Standalone 484 | m_Enabled: 0 485 | m_Devices: 486 | - Oculus 487 | - m_BuildTarget: Tizen 488 | m_Enabled: 0 489 | m_Devices: [] 490 | - m_BuildTarget: WebGL 491 | m_Enabled: 0 492 | m_Devices: [] 493 | - m_BuildTarget: WebPlayer 494 | m_Enabled: 0 495 | m_Devices: [] 496 | - m_BuildTarget: WiiU 497 | m_Enabled: 0 498 | m_Devices: [] 499 | - m_BuildTarget: Xbox360 500 | m_Enabled: 0 501 | m_Devices: [] 502 | - m_BuildTarget: XboxOne 503 | m_Enabled: 0 504 | m_Devices: [] 505 | - m_BuildTarget: iPhone 506 | m_Enabled: 0 507 | m_Devices: [] 508 | - m_BuildTarget: tvOS 509 | m_Enabled: 0 510 | m_Devices: [] 511 | openGLRequireES31: 0 512 | openGLRequireES31AEP: 0 513 | openGLRequireES32: 0 514 | m_TemplateCustomTags: {} 515 | mobileMTRendering: 516 | iPhone: 1 517 | tvOS: 1 518 | m_BuildTargetGroupLightmapEncodingQuality: 519 | - m_BuildTarget: Standalone 520 | m_EncodingQuality: 1 521 | - m_BuildTarget: XboxOne 522 | m_EncodingQuality: 1 523 | - m_BuildTarget: PS4 524 | m_EncodingQuality: 1 525 | m_BuildTargetGroupLightmapSettings: [] 526 | playModeTestRunnerEnabled: 0 527 | runPlayModeTestAsEditModeTest: 0 528 | actionOnDotNetUnhandledException: 1 529 | enableInternalProfiler: 0 530 | logObjCUncaughtExceptions: 1 531 | enableCrashReportAPI: 0 532 | cameraUsageDescription: 533 | locationUsageDescription: 534 | microphoneUsageDescription: 535 | switchNMETAOverride: 536 | switchNetLibKey: 537 | switchSocketMemoryPoolSize: 6144 538 | switchSocketAllocatorPoolSize: 128 539 | switchSocketConcurrencyLimit: 14 540 | switchScreenResolutionBehavior: 2 541 | switchUseCPUProfiler: 0 542 | switchUseGOLDLinker: 0 543 | switchApplicationID: 0x01004b9000490000 544 | switchNSODependencies: 545 | switchTitleNames_0: 546 | switchTitleNames_1: 547 | switchTitleNames_2: 548 | switchTitleNames_3: 549 | switchTitleNames_4: 550 | switchTitleNames_5: 551 | switchTitleNames_6: 552 | switchTitleNames_7: 553 | switchTitleNames_8: 554 | switchTitleNames_9: 555 | switchTitleNames_10: 556 | switchTitleNames_11: 557 | switchTitleNames_12: 558 | switchTitleNames_13: 559 | switchTitleNames_14: 560 | switchPublisherNames_0: 561 | switchPublisherNames_1: 562 | switchPublisherNames_2: 563 | switchPublisherNames_3: 564 | switchPublisherNames_4: 565 | switchPublisherNames_5: 566 | switchPublisherNames_6: 567 | switchPublisherNames_7: 568 | switchPublisherNames_8: 569 | switchPublisherNames_9: 570 | switchPublisherNames_10: 571 | switchPublisherNames_11: 572 | switchPublisherNames_12: 573 | switchPublisherNames_13: 574 | switchPublisherNames_14: 575 | switchIcons_0: {fileID: 0} 576 | switchIcons_1: {fileID: 0} 577 | switchIcons_2: {fileID: 0} 578 | switchIcons_3: {fileID: 0} 579 | switchIcons_4: {fileID: 0} 580 | switchIcons_5: {fileID: 0} 581 | switchIcons_6: {fileID: 0} 582 | switchIcons_7: {fileID: 0} 583 | switchIcons_8: {fileID: 0} 584 | switchIcons_9: {fileID: 0} 585 | switchIcons_10: {fileID: 0} 586 | switchIcons_11: {fileID: 0} 587 | switchIcons_12: {fileID: 0} 588 | switchIcons_13: {fileID: 0} 589 | switchIcons_14: {fileID: 0} 590 | switchSmallIcons_0: {fileID: 0} 591 | switchSmallIcons_1: {fileID: 0} 592 | switchSmallIcons_2: {fileID: 0} 593 | switchSmallIcons_3: {fileID: 0} 594 | switchSmallIcons_4: {fileID: 0} 595 | switchSmallIcons_5: {fileID: 0} 596 | switchSmallIcons_6: {fileID: 0} 597 | switchSmallIcons_7: {fileID: 0} 598 | switchSmallIcons_8: {fileID: 0} 599 | switchSmallIcons_9: {fileID: 0} 600 | switchSmallIcons_10: {fileID: 0} 601 | switchSmallIcons_11: {fileID: 0} 602 | switchSmallIcons_12: {fileID: 0} 603 | switchSmallIcons_13: {fileID: 0} 604 | switchSmallIcons_14: {fileID: 0} 605 | switchManualHTML: 606 | switchAccessibleURLs: 607 | switchLegalInformation: 608 | switchMainThreadStackSize: 1048576 609 | switchPresenceGroupId: 610 | switchLogoHandling: 0 611 | switchReleaseVersion: 0 612 | switchDisplayVersion: 1.0.0 613 | switchStartupUserAccount: 0 614 | switchTouchScreenUsage: 0 615 | switchSupportedLanguagesMask: 0 616 | switchLogoType: 0 617 | switchApplicationErrorCodeCategory: 618 | switchUserAccountSaveDataSize: 0 619 | switchUserAccountSaveDataJournalSize: 0 620 | switchApplicationAttribute: 0 621 | switchCardSpecSize: -1 622 | switchCardSpecClock: -1 623 | switchRatingsMask: 0 624 | switchRatingsInt_0: 0 625 | switchRatingsInt_1: 0 626 | switchRatingsInt_2: 0 627 | switchRatingsInt_3: 0 628 | switchRatingsInt_4: 0 629 | switchRatingsInt_5: 0 630 | switchRatingsInt_6: 0 631 | switchRatingsInt_7: 0 632 | switchRatingsInt_8: 0 633 | switchRatingsInt_9: 0 634 | switchRatingsInt_10: 0 635 | switchRatingsInt_11: 0 636 | switchRatingsInt_12: 0 637 | switchLocalCommunicationIds_0: 638 | switchLocalCommunicationIds_1: 639 | switchLocalCommunicationIds_2: 640 | switchLocalCommunicationIds_3: 641 | switchLocalCommunicationIds_4: 642 | switchLocalCommunicationIds_5: 643 | switchLocalCommunicationIds_6: 644 | switchLocalCommunicationIds_7: 645 | switchParentalControl: 0 646 | switchAllowsScreenshot: 1 647 | switchAllowsVideoCapturing: 1 648 | switchAllowsRuntimeAddOnContentInstall: 0 649 | switchDataLossConfirmation: 0 650 | switchUserAccountLockEnabled: 0 651 | switchSystemResourceMemory: 16777216 652 | switchSupportedNpadStyles: 3 653 | switchNativeFsCacheSize: 32 654 | switchIsHoldTypeHorizontal: 0 655 | switchSupportedNpadCount: 8 656 | switchSocketConfigEnabled: 0 657 | switchTcpInitialSendBufferSize: 32 658 | switchTcpInitialReceiveBufferSize: 64 659 | switchTcpAutoSendBufferSizeMax: 256 660 | switchTcpAutoReceiveBufferSizeMax: 256 661 | switchUdpSendBufferSize: 9 662 | switchUdpReceiveBufferSize: 42 663 | switchSocketBufferEfficiency: 4 664 | switchSocketInitializeEnabled: 1 665 | switchNetworkInterfaceManagerInitializeEnabled: 1 666 | switchPlayerConnectionEnabled: 1 667 | ps4NPAgeRating: 12 668 | ps4NPTitleSecret: 669 | ps4NPTrophyPackPath: 670 | ps4ParentalLevel: 1 671 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 672 | ps4Category: 0 673 | ps4MasterVersion: 01.00 674 | ps4AppVersion: 01.00 675 | ps4AppType: 0 676 | ps4ParamSfxPath: 677 | ps4VideoOutPixelFormat: 0 678 | ps4VideoOutInitialWidth: 1920 679 | ps4VideoOutBaseModeInitialWidth: 1920 680 | ps4VideoOutReprojectionRate: 120 681 | ps4PronunciationXMLPath: 682 | ps4PronunciationSIGPath: 683 | ps4BackgroundImagePath: 684 | ps4StartupImagePath: 685 | ps4StartupImagesFolder: 686 | ps4IconImagesFolder: 687 | ps4SaveDataImagePath: 688 | ps4SdkOverride: 689 | ps4BGMPath: 690 | ps4ShareFilePath: 691 | ps4ShareOverlayImagePath: 692 | ps4PrivacyGuardImagePath: 693 | ps4ExtraSceSysFile: 694 | ps4NPtitleDatPath: 695 | ps4RemotePlayKeyAssignment: -1 696 | ps4RemotePlayKeyMappingDir: 697 | ps4PlayTogetherPlayerCount: 0 698 | ps4EnterButtonAssignment: 1 699 | ps4ApplicationParam1: 0 700 | ps4ApplicationParam2: 0 701 | ps4ApplicationParam3: 0 702 | ps4ApplicationParam4: 0 703 | ps4DownloadDataSize: 0 704 | ps4GarlicHeapSize: 2048 705 | ps4ProGarlicHeapSize: 2560 706 | playerPrefsMaxSize: 32768 707 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 708 | ps4pnSessions: 1 709 | ps4pnPresence: 1 710 | ps4pnFriends: 1 711 | ps4pnGameCustomData: 1 712 | playerPrefsSupport: 0 713 | enableApplicationExit: 0 714 | resetTempFolder: 1 715 | restrictedAudioUsageRights: 0 716 | ps4UseResolutionFallback: 0 717 | ps4ReprojectionSupport: 0 718 | ps4UseAudio3dBackend: 0 719 | ps4UseLowGarlicFragmentationMode: 1 720 | ps4SocialScreenEnabled: 0 721 | ps4ScriptOptimizationLevel: 3 722 | ps4Audio3dVirtualSpeakerCount: 14 723 | ps4attribCpuUsage: 0 724 | ps4PatchPkgPath: 725 | ps4PatchLatestPkgPath: 726 | ps4PatchChangeinfoPath: 727 | ps4PatchDayOne: 0 728 | ps4attribUserManagement: 0 729 | ps4attribMoveSupport: 0 730 | ps4attrib3DSupport: 0 731 | ps4attribShareSupport: 0 732 | ps4attribExclusiveVR: 0 733 | ps4disableAutoHideSplash: 0 734 | ps4videoRecordingFeaturesUsed: 0 735 | ps4contentSearchFeaturesUsed: 0 736 | ps4CompatibilityPS5: 0 737 | ps4GPU800MHz: 1 738 | ps4attribEyeToEyeDistanceSettingVR: 0 739 | ps4IncludedModules: [] 740 | ps4attribVROutputEnabled: 0 741 | monoEnv: 742 | splashScreenBackgroundSourceLandscape: {fileID: 0} 743 | splashScreenBackgroundSourcePortrait: {fileID: 0} 744 | blurSplashScreenBackground: 1 745 | spritePackerPolicy: 746 | webGLMemorySize: 256 747 | webGLExceptionSupport: 1 748 | webGLNameFilesAsHashes: 0 749 | webGLDataCaching: 0 750 | webGLDebugSymbols: 0 751 | webGLEmscriptenArgs: 752 | webGLModulesDirectory: 753 | webGLTemplate: APPLICATION:Default 754 | webGLAnalyzeBuildSize: 0 755 | webGLUseEmbeddedResources: 0 756 | webGLCompressionFormat: 1 757 | webGLWasmArithmeticExceptions: 0 758 | webGLLinkerTarget: 1 759 | webGLThreadsSupport: 0 760 | webGLDecompressionFallback: 0 761 | scriptingDefineSymbols: {} 762 | platformArchitecture: {} 763 | scriptingBackend: 764 | Android: 0 765 | Standalone: 0 766 | WebGL: 1 767 | il2cppCompilerConfiguration: {} 768 | managedStrippingLevel: {} 769 | incrementalIl2cppBuild: {} 770 | allowUnsafeCode: 0 771 | useDeterministicCompilation: 1 772 | additionalIl2CppArgs: 773 | scriptingRuntimeVersion: 1 774 | gcIncremental: 1 775 | gcWBarrierValidation: 0 776 | apiCompatibilityLevelPerPlatform: {} 777 | m_RenderingPath: 1 778 | m_MobileRenderingPath: 1 779 | metroPackageName: UnityAndroidCamera 780 | metroPackageVersion: 781 | metroCertificatePath: 782 | metroCertificatePassword: 783 | metroCertificateSubject: 784 | metroCertificateIssuer: 785 | metroCertificateNotAfter: 0000000000000000 786 | metroApplicationDescription: UnityAndroidCamera 787 | wsaImages: {} 788 | metroTileShortName: 789 | metroTileShowName: 0 790 | metroMediumTileShowName: 0 791 | metroLargeTileShowName: 0 792 | metroWideTileShowName: 0 793 | metroSupportStreamingInstall: 0 794 | metroLastRequiredScene: 0 795 | metroDefaultTileSize: 1 796 | metroTileForegroundText: 1 797 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 798 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 799 | a: 1} 800 | metroSplashScreenUseBackgroundColor: 0 801 | platformCapabilities: {} 802 | metroTargetDeviceFamilies: {} 803 | metroFTAName: 804 | metroFTAFileTypes: [] 805 | metroProtocolName: 806 | XboxOneProductId: 807 | XboxOneUpdateKey: 808 | XboxOneSandboxId: 809 | XboxOneContentId: 810 | XboxOneTitleId: 811 | XboxOneSCId: 812 | XboxOneGameOsOverridePath: 813 | XboxOnePackagingOverridePath: 814 | XboxOneAppManifestOverridePath: 815 | XboxOneVersion: 1.0.0.0 816 | XboxOnePackageEncryption: 0 817 | XboxOnePackageUpdateGranularity: 2 818 | XboxOneDescription: 819 | XboxOneLanguage: 820 | - enus 821 | XboxOneCapability: [] 822 | XboxOneGameRating: {} 823 | XboxOneIsContentPackage: 0 824 | XboxOneEnableGPUVariability: 0 825 | XboxOneSockets: {} 826 | XboxOneSplashScreen: {fileID: 0} 827 | XboxOneAllowedProductIds: [] 828 | XboxOnePersistentLocalStorageSize: 0 829 | XboxOneXTitleMemory: 8 830 | XboxOneOverrideIdentityName: 831 | XboxOneOverrideIdentityPublisher: 832 | vrEditorSettings: 833 | daydream: 834 | daydreamIconForeground: {fileID: 0} 835 | daydreamIconBackground: {fileID: 0} 836 | cloudServicesEnabled: 837 | Analytics: 0 838 | Build: 0 839 | Collab: 0 840 | ErrorHub: 0 841 | Game_Performance: 0 842 | Hub: 0 843 | Purchasing: 0 844 | UNet: 0 845 | Unity_Ads: 0 846 | luminIcon: 847 | m_Name: 848 | m_ModelFolderPath: 849 | m_PortalFolderPath: 850 | luminCert: 851 | m_CertPath: 852 | m_SignPackage: 1 853 | luminIsChannelApp: 0 854 | luminVersion: 855 | m_VersionCode: 1 856 | m_VersionName: 857 | apiCompatibilityLevel: 6 858 | cloudProjectId: 859 | framebufferDepthMemorylessMode: 0 860 | projectName: 861 | organizationId: 862 | cloudEnabled: 0 863 | enableNativePlatformBackendsForNewInputSystem: 0 864 | disableOldInputManagerSupport: 0 865 | legacyClampBlendShapeWeights: 0 866 | virtualTexturingSupportEnabled: 0 867 | --------------------------------------------------------------------------------