commit da5f268d21d61f31940fd38ba82d4d57964b8ab6 Author: oxidiert Date: Wed Jul 9 11:02:37 2025 +0200 Initialer Upload neues Unity-Projekt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fef8f9e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +*.psd filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.fbx filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.unity filter=lfs diff=lfs merge=lfs -text +*.prefab filter=lfs diff=lfs merge=lfs -text +*.asset filter=lfs diff=lfs merge=lfs -text +*.dll filter=lfs diff=lfs merge=lfs -text +*.tga filter=lfs diff=lfs merge=lfs -text +*.exr filter=lfs diff=lfs merge=lfs -text +*.mov filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text +*.anim filter=lfs diff=lfs merge=lfs -text +*.controller filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..181710a --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +[Ll]ibrary/ +[Tt]emp/ +[Oo]bj/ +[Bb]uild/ +[Bb]uilds/ +[Ll]ogs/ +[Mm]emoryCaptures/ +[Rr]ecordings/ +UserSettings/ + +*.apk +*.aab +*.unitypackage +*.app +*.exe +*.tmp +*.bak +*.old + +sysinfo.txt +*.pidb +*.pdb +*.mdb +*.pidb.meta +*.pdb.meta +*.mdb.meta + +Assets/AddressableAssetsData/*/*.bin* +Assets/StreamingAssets/aa/Data* +Assets/StreamingAssets/aa/*.bin* +Assets/StreamingAssets/aa/linker.json + +.vs/ +*.csproj +*.sln +*.suo +*.user +*.userprefs +*.booproj +*.unityproj +*.opendb +*.VC.db + +.consulo/ +.idea/ +Assets/Plugins/Editor/JetBrains* + +.vscode/ + +.DS_Store +Thumbs.db + +.collabignore +.collab/ + +Packages/packages-lock.json \ No newline at end of file diff --git a/Assets/0_free_pack.meta b/Assets/0_free_pack.meta new file mode 100644 index 0000000..736e985 --- /dev/null +++ b/Assets/0_free_pack.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7d066724336faeb4eaeccd8df44b40ef +folderAsset: yes +timeCreated: 1499081191 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Materials.meta b/Assets/0_free_pack/Materials.meta new file mode 100644 index 0000000..4b9e77d --- /dev/null +++ b/Assets/0_free_pack/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: add649a81dcfa3445857ddd3df898340 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/0_free_pack/Materials/bricks_02.mat b/Assets/0_free_pack/Materials/bricks_02.mat new file mode 100644 index 0000000..6128615 Binary files /dev/null and b/Assets/0_free_pack/Materials/bricks_02.mat differ diff --git a/Assets/0_free_pack/Materials/bricks_02.mat.meta b/Assets/0_free_pack/Materials/bricks_02.mat.meta new file mode 100644 index 0000000..be69ee8 --- /dev/null +++ b/Assets/0_free_pack/Materials/bricks_02.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 828929aeaf1e435419cd3352f01e9b33 +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/bricks_02_spec.mat b/Assets/0_free_pack/Materials/bricks_02_spec.mat new file mode 100644 index 0000000..69fa551 Binary files /dev/null and b/Assets/0_free_pack/Materials/bricks_02_spec.mat differ diff --git a/Assets/0_free_pack/Materials/bricks_02_spec.mat.meta b/Assets/0_free_pack/Materials/bricks_02_spec.mat.meta new file mode 100644 index 0000000..035c0e1 --- /dev/null +++ b/Assets/0_free_pack/Materials/bricks_02_spec.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: aeff8cb8b567ad24fa8f9219f4fd3b91 +timeCreated: 1502204367 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Materials/bricks_03_dif_granite.mat b/Assets/0_free_pack/Materials/bricks_03_dif_granite.mat new file mode 100644 index 0000000..b323e41 Binary files /dev/null and b/Assets/0_free_pack/Materials/bricks_03_dif_granite.mat differ diff --git a/Assets/0_free_pack/Materials/bricks_03_dif_granite.mat.meta b/Assets/0_free_pack/Materials/bricks_03_dif_granite.mat.meta new file mode 100644 index 0000000..0f7c48c --- /dev/null +++ b/Assets/0_free_pack/Materials/bricks_03_dif_granite.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1ed797d14de285e47a9f5836bbc93981 +timeCreated: 1502204338 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Materials/bricks_03_granite.mat b/Assets/0_free_pack/Materials/bricks_03_granite.mat new file mode 100644 index 0000000..8c230d5 Binary files /dev/null and b/Assets/0_free_pack/Materials/bricks_03_granite.mat differ diff --git a/Assets/0_free_pack/Materials/bricks_03_granite.mat.meta b/Assets/0_free_pack/Materials/bricks_03_granite.mat.meta new file mode 100644 index 0000000..7ce4a78 --- /dev/null +++ b/Assets/0_free_pack/Materials/bricks_03_granite.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9ab5b5d587e8e4c4f80957fe730f246b +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/bricks_03_grey.mat b/Assets/0_free_pack/Materials/bricks_03_grey.mat new file mode 100644 index 0000000..2d91e00 Binary files /dev/null and b/Assets/0_free_pack/Materials/bricks_03_grey.mat differ diff --git a/Assets/0_free_pack/Materials/bricks_03_grey.mat.meta b/Assets/0_free_pack/Materials/bricks_03_grey.mat.meta new file mode 100644 index 0000000..dafdd85 --- /dev/null +++ b/Assets/0_free_pack/Materials/bricks_03_grey.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3f38a4eb00edb444bb3bdddcc74d548f +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/bricks_03_red.mat b/Assets/0_free_pack/Materials/bricks_03_red.mat new file mode 100644 index 0000000..95d2643 Binary files /dev/null and b/Assets/0_free_pack/Materials/bricks_03_red.mat differ diff --git a/Assets/0_free_pack/Materials/bricks_03_red.mat.meta b/Assets/0_free_pack/Materials/bricks_03_red.mat.meta new file mode 100644 index 0000000..cabb614 --- /dev/null +++ b/Assets/0_free_pack/Materials/bricks_03_red.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: bbb3b746f075eb94da1fe36e0d032528 +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/granite_01.mat b/Assets/0_free_pack/Materials/granite_01.mat new file mode 100644 index 0000000..594cdf5 Binary files /dev/null and b/Assets/0_free_pack/Materials/granite_01.mat differ diff --git a/Assets/0_free_pack/Materials/granite_01.mat.meta b/Assets/0_free_pack/Materials/granite_01.mat.meta new file mode 100644 index 0000000..162063c --- /dev/null +++ b/Assets/0_free_pack/Materials/granite_01.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 465f68ac9399fea438bcb16e4ac9d3a3 +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/paving_02.mat b/Assets/0_free_pack/Materials/paving_02.mat new file mode 100644 index 0000000..a88ba0f Binary files /dev/null and b/Assets/0_free_pack/Materials/paving_02.mat differ diff --git a/Assets/0_free_pack/Materials/paving_02.mat.meta b/Assets/0_free_pack/Materials/paving_02.mat.meta new file mode 100644 index 0000000..65e401c --- /dev/null +++ b/Assets/0_free_pack/Materials/paving_02.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b7c7b5ef468ed764fbc2a90f524fa638 +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/plaster_02_dif_white.mat b/Assets/0_free_pack/Materials/plaster_02_dif_white.mat new file mode 100644 index 0000000..0918bca Binary files /dev/null and b/Assets/0_free_pack/Materials/plaster_02_dif_white.mat differ diff --git a/Assets/0_free_pack/Materials/plaster_02_dif_white.mat.meta b/Assets/0_free_pack/Materials/plaster_02_dif_white.mat.meta new file mode 100644 index 0000000..f80cdba --- /dev/null +++ b/Assets/0_free_pack/Materials/plaster_02_dif_white.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e376fc6c52abaf7489919fa96d35f42a +timeCreated: 1502204352 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Materials/plaster_02_green.mat b/Assets/0_free_pack/Materials/plaster_02_green.mat new file mode 100644 index 0000000..f9fdc46 Binary files /dev/null and b/Assets/0_free_pack/Materials/plaster_02_green.mat differ diff --git a/Assets/0_free_pack/Materials/plaster_02_green.mat.meta b/Assets/0_free_pack/Materials/plaster_02_green.mat.meta new file mode 100644 index 0000000..cd469be --- /dev/null +++ b/Assets/0_free_pack/Materials/plaster_02_green.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 82fac6dfccb2712459638b23b59d4f6b +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/plaster_02_white.mat b/Assets/0_free_pack/Materials/plaster_02_white.mat new file mode 100644 index 0000000..fba8b81 Binary files /dev/null and b/Assets/0_free_pack/Materials/plaster_02_white.mat differ diff --git a/Assets/0_free_pack/Materials/plaster_02_white.mat.meta b/Assets/0_free_pack/Materials/plaster_02_white.mat.meta new file mode 100644 index 0000000..1f6c7b2 --- /dev/null +++ b/Assets/0_free_pack/Materials/plaster_02_white.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: dd83204045ff3a74ab2d1ecf29a1fa13 +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/plaster_02_yellow.mat b/Assets/0_free_pack/Materials/plaster_02_yellow.mat new file mode 100644 index 0000000..f15ac44 Binary files /dev/null and b/Assets/0_free_pack/Materials/plaster_02_yellow.mat differ diff --git a/Assets/0_free_pack/Materials/plaster_02_yellow.mat.meta b/Assets/0_free_pack/Materials/plaster_02_yellow.mat.meta new file mode 100644 index 0000000..4638428 --- /dev/null +++ b/Assets/0_free_pack/Materials/plaster_02_yellow.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d4d8a0a4ba48ed0499fc65b502f911a7 +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Materials/wood_plates_05.mat b/Assets/0_free_pack/Materials/wood_plates_05.mat new file mode 100644 index 0000000..78753ec Binary files /dev/null and b/Assets/0_free_pack/Materials/wood_plates_05.mat differ diff --git a/Assets/0_free_pack/Materials/wood_plates_05.mat.meta b/Assets/0_free_pack/Materials/wood_plates_05.mat.meta new file mode 100644 index 0000000..c2f973f --- /dev/null +++ b/Assets/0_free_pack/Materials/wood_plates_05.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: beacaa5348e17c141b8368b04be021fa +NativeFormatImporter: + userData: diff --git a/Assets/0_free_pack/Textures.meta b/Assets/0_free_pack/Textures.meta new file mode 100644 index 0000000..edaf148 --- /dev/null +++ b/Assets/0_free_pack/Textures.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 230cf55765c1a0c4699c2b9327931a5c +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/0_free_pack/Textures/bricks_02_ao.tga b/Assets/0_free_pack/Textures/bricks_02_ao.tga new file mode 100644 index 0000000..0af7ea8 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_ao.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c30ae2b98383dee698985b87a3bd558700608d697ead650cf65888e0f06ede30 +size 1048620 diff --git a/Assets/0_free_pack/Textures/bricks_02_ao.tga.meta b/Assets/0_free_pack/Textures/bricks_02_ao.tga.meta new file mode 100644 index 0000000..4540e44 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_ao.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: fed32e0cc2800634682afdcc0f1cdfe7 +timeCreated: 1431705983 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_02_dif.tga b/Assets/0_free_pack/Textures/bricks_02_dif.tga new file mode 100644 index 0000000..78b93ea --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_dif.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5810b83de1ff808c8cd69d46e76c5ad97a66f9c17e947ba2338f900b1b6bd845 +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_02_dif.tga.meta b/Assets/0_free_pack/Textures/bricks_02_dif.tga.meta new file mode 100644 index 0000000..0e05f80 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_dif.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 9a95c672f663d8245a0f58dcb0605b11 +timeCreated: 1431705983 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_02_hm.tga b/Assets/0_free_pack/Textures/bricks_02_hm.tga new file mode 100644 index 0000000..7e01bfb --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_hm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56b62c3c32e87f51fea8c2b73f01792bb1124d9dff86a7dada91c19ad094da5b +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_02_hm.tga.meta b/Assets/0_free_pack/Textures/bricks_02_hm.tga.meta new file mode 100644 index 0000000..8775b72 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_hm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 2661713161b05e3408821938323bbc69 +timeCreated: 1431705980 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_02_nm.tga b/Assets/0_free_pack/Textures/bricks_02_nm.tga new file mode 100644 index 0000000..14426da --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_nm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e816b0bb7b30fa95b6f74a77ceee671d086495404135513808d009883fdd406d +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_02_nm.tga.meta b/Assets/0_free_pack/Textures/bricks_02_nm.tga.meta new file mode 100644 index 0000000..503d0c8 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_nm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 7fe234e67beadb14486e0f283881a091 +timeCreated: 1431706030 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_02_spec.tga b/Assets/0_free_pack/Textures/bricks_02_spec.tga new file mode 100644 index 0000000..ca5a70c --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_spec.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82c8fdf75e0435907ee5acb90a81c228f5a34b4552f414c557f186c562400c36 +size 4194348 diff --git a/Assets/0_free_pack/Textures/bricks_02_spec.tga.meta b/Assets/0_free_pack/Textures/bricks_02_spec.tga.meta new file mode 100644 index 0000000..97fb903 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_02_spec.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 185c89103722e9c419c59f6763162840 +timeCreated: 1431705980 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_ao.tga b/Assets/0_free_pack/Textures/bricks_03_dif_ao.tga new file mode 100644 index 0000000..06c4cf4 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_ao.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e643941222b4f732b6599c8b50af86c964313b8489f7dc8609437edd5d50ae1f +size 1048620 diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_ao.tga.meta b/Assets/0_free_pack/Textures/bricks_03_dif_ao.tga.meta new file mode 100644 index 0000000..e0b2769 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_ao.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 968b1ad3eef62bb4fb139a904e0cff7b +timeCreated: 1431706206 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_granite.tga b/Assets/0_free_pack/Textures/bricks_03_dif_granite.tga new file mode 100644 index 0000000..d3341c7 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_granite.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdfba13e455433f9ca497ad10ca0392989f1f82976e5d139ccf8a459fce329c5 +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_granite.tga.meta b/Assets/0_free_pack/Textures/bricks_03_dif_granite.tga.meta new file mode 100644 index 0000000..d983765 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_granite.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: f11d8728ef652d046bf30ea2c7ac2a8d +timeCreated: 1431706172 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_grey.tga b/Assets/0_free_pack/Textures/bricks_03_dif_grey.tga new file mode 100644 index 0000000..72c647d --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_grey.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:471b071876683f125bfedea399d2107803cf4a07849a172d3043e82082204047 +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_grey.tga.meta b/Assets/0_free_pack/Textures/bricks_03_dif_grey.tga.meta new file mode 100644 index 0000000..35e0cd2 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_grey.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 8166d49c5a02be344a4354fcd9cf7722 +timeCreated: 1431706265 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_old_red.tga b/Assets/0_free_pack/Textures/bricks_03_dif_old_red.tga new file mode 100644 index 0000000..778a0c6 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_old_red.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35b1881d153729ed1ec270717a56de67d7ca2b05378f5fe79ad60ef50481fe53 +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_03_dif_old_red.tga.meta b/Assets/0_free_pack/Textures/bricks_03_dif_old_red.tga.meta new file mode 100644 index 0000000..ead2d0f --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_dif_old_red.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 98aa369b53b23804f84c62ddff764f37 +timeCreated: 1431706267 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_hm.tga b/Assets/0_free_pack/Textures/bricks_03_hm.tga new file mode 100644 index 0000000..824e6ed --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_hm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00fecd5e75bd31e0c0ef3cf816f2d67cb93ba64b894cc0182997044a013dd1e9 +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_03_hm.tga.meta b/Assets/0_free_pack/Textures/bricks_03_hm.tga.meta new file mode 100644 index 0000000..bc33117 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_hm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 70c6cbbf220039a469ac45bb81939327 +timeCreated: 1431706185 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_nm.tga b/Assets/0_free_pack/Textures/bricks_03_nm.tga new file mode 100644 index 0000000..97802e0 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_nm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff411450d65521e2b0b0a540fa3a2e362cd2ee616f7b98a916ce026ddeb24747 +size 3145772 diff --git a/Assets/0_free_pack/Textures/bricks_03_nm.tga.meta b/Assets/0_free_pack/Textures/bricks_03_nm.tga.meta new file mode 100644 index 0000000..a7e9b2b --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_nm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 54e4dca948e6e7f4fbe791454d596951 +timeCreated: 1431706215 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/bricks_03_spec.tga b/Assets/0_free_pack/Textures/bricks_03_spec.tga new file mode 100644 index 0000000..85c7f12 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_spec.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60f2e1bb6bf1d9b53daabdf8b5cf9935d4b39292ae181ec7d15b96c0dd98a4d1 +size 4194348 diff --git a/Assets/0_free_pack/Textures/bricks_03_spec.tga.meta b/Assets/0_free_pack/Textures/bricks_03_spec.tga.meta new file mode 100644 index 0000000..9d2d005 --- /dev/null +++ b/Assets/0_free_pack/Textures/bricks_03_spec.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: b52633f41d322a34780eaac9ece900b0 +timeCreated: 1431706186 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/granite_01_ao.tga b/Assets/0_free_pack/Textures/granite_01_ao.tga new file mode 100644 index 0000000..4e87c2c --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_ao.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd7971de7b12bfaf026fad2a65bc79095ee27caf6b719af03adb1083465fd227 +size 1048620 diff --git a/Assets/0_free_pack/Textures/granite_01_ao.tga.meta b/Assets/0_free_pack/Textures/granite_01_ao.tga.meta new file mode 100644 index 0000000..8854eed --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_ao.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: be9d3cbb603f64441b3debddaea869fc +timeCreated: 1431706649 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/granite_01_dif.tga b/Assets/0_free_pack/Textures/granite_01_dif.tga new file mode 100644 index 0000000..39e098f --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_dif.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6745df96abdb13130e980e672e7423541b87905a53d520695fac9458271f5e43 +size 3145772 diff --git a/Assets/0_free_pack/Textures/granite_01_dif.tga.meta b/Assets/0_free_pack/Textures/granite_01_dif.tga.meta new file mode 100644 index 0000000..a163830 --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_dif.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 728a7bed440685845879a4def6bc201c +timeCreated: 1431706870 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/granite_01_hm.tga b/Assets/0_free_pack/Textures/granite_01_hm.tga new file mode 100644 index 0000000..400a58a --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_hm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7711bb9e58f34c8fefd991b7f93503b296bc0236d01af40f85610a21896c253 +size 3145772 diff --git a/Assets/0_free_pack/Textures/granite_01_hm.tga.meta b/Assets/0_free_pack/Textures/granite_01_hm.tga.meta new file mode 100644 index 0000000..0e68d5a --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_hm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 4fb4b05117e0f6d4cb6fac0417253bd3 +timeCreated: 1431706644 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/granite_01_nm.tga b/Assets/0_free_pack/Textures/granite_01_nm.tga new file mode 100644 index 0000000..1917a7f --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_nm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61d1cdc5cbae071d8047f74265e177fc4b5701acd6ede4039ba9369169229d84 +size 3145772 diff --git a/Assets/0_free_pack/Textures/granite_01_nm.tga.meta b/Assets/0_free_pack/Textures/granite_01_nm.tga.meta new file mode 100644 index 0000000..2dbd241 --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_nm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 66ec305e9866ff6428469ab03ade3c6d +timeCreated: 1431706669 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/granite_01_spec.tga b/Assets/0_free_pack/Textures/granite_01_spec.tga new file mode 100644 index 0000000..12b285b --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_spec.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37fdea3982d3b4539fb5f60590eec8ebe877ba19c2fccf513601a6715f6bccae +size 4194348 diff --git a/Assets/0_free_pack/Textures/granite_01_spec.tga.meta b/Assets/0_free_pack/Textures/granite_01_spec.tga.meta new file mode 100644 index 0000000..e22e5ce --- /dev/null +++ b/Assets/0_free_pack/Textures/granite_01_spec.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 30e7c9ba1d57e3342b928b8d5530d7f5 +timeCreated: 1431706809 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/paving_02_ao.tga b/Assets/0_free_pack/Textures/paving_02_ao.tga new file mode 100644 index 0000000..8acf702 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_ao.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ba1716a965bb3c5cfb983abbcf22072033c438158c40695a96dd31644433ed2 +size 1048620 diff --git a/Assets/0_free_pack/Textures/paving_02_ao.tga.meta b/Assets/0_free_pack/Textures/paving_02_ao.tga.meta new file mode 100644 index 0000000..9b1e957 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_ao.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: cd7222f1a0b239f4a9873a5a8f472e91 +timeCreated: 1431706938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/paving_02_dif.tga b/Assets/0_free_pack/Textures/paving_02_dif.tga new file mode 100644 index 0000000..710d944 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_dif.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14a52ed19af3ec8071ac0e53a671d2234734cfee6b391b365973773b8e3a4afe +size 3145772 diff --git a/Assets/0_free_pack/Textures/paving_02_dif.tga.meta b/Assets/0_free_pack/Textures/paving_02_dif.tga.meta new file mode 100644 index 0000000..b393e27 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_dif.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: da5cc7f0be5ad8644bbcb081ffece5a5 +timeCreated: 1431706941 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/paving_02_hm.tga b/Assets/0_free_pack/Textures/paving_02_hm.tga new file mode 100644 index 0000000..1b1a64d --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_hm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a8c56d4d12e26d284fc2a1c2c591d55ae9714edde634ede09116a26b14da123 +size 3145772 diff --git a/Assets/0_free_pack/Textures/paving_02_hm.tga.meta b/Assets/0_free_pack/Textures/paving_02_hm.tga.meta new file mode 100644 index 0000000..97bdae5 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_hm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 8606e23e89efe104890acb25e840dfce +timeCreated: 1431706938 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/paving_02_nm.tga b/Assets/0_free_pack/Textures/paving_02_nm.tga new file mode 100644 index 0000000..cfbb0b7 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_nm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98e214c46896c4221980b9287355582febc3b0dced3acbf495ee035a16541cd0 +size 3145772 diff --git a/Assets/0_free_pack/Textures/paving_02_nm.tga.meta b/Assets/0_free_pack/Textures/paving_02_nm.tga.meta new file mode 100644 index 0000000..e21ff7b --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_nm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 6de12fbd8aacdfa4bb5d8c8711a3a929 +timeCreated: 1431706957 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/paving_02_spec.tga b/Assets/0_free_pack/Textures/paving_02_spec.tga new file mode 100644 index 0000000..3fd0f7d --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_spec.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61d515d6286b2e13999ea8f2dd73bb59237f7d6750a6aae666efe7970a639bbd +size 4194348 diff --git a/Assets/0_free_pack/Textures/paving_02_spec.tga.meta b/Assets/0_free_pack/Textures/paving_02_spec.tga.meta new file mode 100644 index 0000000..0f76940 --- /dev/null +++ b/Assets/0_free_pack/Textures/paving_02_spec.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: ff6132b24517cb44395b048d4b87227a +timeCreated: 1431706981 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/plaster_02_dif_green.tga b/Assets/0_free_pack/Textures/plaster_02_dif_green.tga new file mode 100644 index 0000000..1b93f84 --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_dif_green.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15d0324fa8475dbbb7517457b9a379628da0ee02d70e3c2a746616d351bd0e6d +size 3145772 diff --git a/Assets/0_free_pack/Textures/plaster_02_dif_green.tga.meta b/Assets/0_free_pack/Textures/plaster_02_dif_green.tga.meta new file mode 100644 index 0000000..0ad0061 --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_dif_green.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 9ef11ecfae0912c46a40d5c243f9d92e +timeCreated: 1431707093 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/plaster_02_dif_white.tga b/Assets/0_free_pack/Textures/plaster_02_dif_white.tga new file mode 100644 index 0000000..36264ca --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_dif_white.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc7000a43057a419f73889d21d34e2a6ef81f609f28e93a75a2a205fb215095d +size 3145772 diff --git a/Assets/0_free_pack/Textures/plaster_02_dif_white.tga.meta b/Assets/0_free_pack/Textures/plaster_02_dif_white.tga.meta new file mode 100644 index 0000000..749ddfb --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_dif_white.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 26d69848cbd72f14a8d496a5e7bce750 +timeCreated: 1431707090 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/plaster_02_dif_yellow.tga b/Assets/0_free_pack/Textures/plaster_02_dif_yellow.tga new file mode 100644 index 0000000..69f44d8 --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_dif_yellow.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5fcbba07b8cac43ce71a52001b408dfaf1a2c396d3edfca8a9c00ca47dc190b +size 3145772 diff --git a/Assets/0_free_pack/Textures/plaster_02_dif_yellow.tga.meta b/Assets/0_free_pack/Textures/plaster_02_dif_yellow.tga.meta new file mode 100644 index 0000000..dc1f051 --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_dif_yellow.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 7c68c4183a52bd6499df782aa3258d1c +timeCreated: 1431707091 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/plaster_02_nm.tga b/Assets/0_free_pack/Textures/plaster_02_nm.tga new file mode 100644 index 0000000..5e0b85b --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_nm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d510ae3fed1fa617a7ade3a429231fadc62d96fa9242f61d209beedfd5e23364 +size 3145772 diff --git a/Assets/0_free_pack/Textures/plaster_02_nm.tga.meta b/Assets/0_free_pack/Textures/plaster_02_nm.tga.meta new file mode 100644 index 0000000..1939f00 --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_nm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 9b2ccf6a152eb2841bcdce09d18a6012 +timeCreated: 1431707104 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/plaster_02_spec.tga b/Assets/0_free_pack/Textures/plaster_02_spec.tga new file mode 100644 index 0000000..8ad0ea8 --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_spec.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d122e5ba3ce990db1ecfef9ad8b9843c0f0409e8311c76853ac000fab9898f2a +size 4194348 diff --git a/Assets/0_free_pack/Textures/plaster_02_spec.tga.meta b/Assets/0_free_pack/Textures/plaster_02_spec.tga.meta new file mode 100644 index 0000000..5e7350e --- /dev/null +++ b/Assets/0_free_pack/Textures/plaster_02_spec.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 08c6ed70f7585464598eb69ac3ac56cd +timeCreated: 1431707140 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/wood_plates_05_ao.tga b/Assets/0_free_pack/Textures/wood_plates_05_ao.tga new file mode 100644 index 0000000..e04562f --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_ao.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab99786856a8ba33a3963f225758ca366de90c5bd07c51eae7a5162f8b12c26f +size 1048620 diff --git a/Assets/0_free_pack/Textures/wood_plates_05_ao.tga.meta b/Assets/0_free_pack/Textures/wood_plates_05_ao.tga.meta new file mode 100644 index 0000000..ae19858 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_ao.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: de98173d335c0b24c8da5a2eed94953a +timeCreated: 1431707263 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/wood_plates_05_dif.tga b/Assets/0_free_pack/Textures/wood_plates_05_dif.tga new file mode 100644 index 0000000..ac07bb4 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_dif.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3db20fd7657cede14b4c85c5ce724fb98af2b112931c600f1ea138f4a305f87a +size 4194348 diff --git a/Assets/0_free_pack/Textures/wood_plates_05_dif.tga.meta b/Assets/0_free_pack/Textures/wood_plates_05_dif.tga.meta new file mode 100644 index 0000000..12fbd6e --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_dif.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: b533067d22846de4b8a641f8807ef5a7 +timeCreated: 1431707261 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/wood_plates_05_hm.tga b/Assets/0_free_pack/Textures/wood_plates_05_hm.tga new file mode 100644 index 0000000..37e1d48 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_hm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bfab6ef6ef12cb29b9c08870fd249e5f7101640b911078b39a6aa86c40541f0 +size 3145772 diff --git a/Assets/0_free_pack/Textures/wood_plates_05_hm.tga.meta b/Assets/0_free_pack/Textures/wood_plates_05_hm.tga.meta new file mode 100644 index 0000000..7296345 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_hm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: c9d9110732d08ef429b6a79831cd613c +timeCreated: 1431707262 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/wood_plates_05_nm.tga b/Assets/0_free_pack/Textures/wood_plates_05_nm.tga new file mode 100644 index 0000000..c6eab5f --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_nm.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0892d5ce340fee43cd3add67b7877c251398b6b0e082542d21ee48a1f136355 +size 3145772 diff --git a/Assets/0_free_pack/Textures/wood_plates_05_nm.tga.meta b/Assets/0_free_pack/Textures/wood_plates_05_nm.tga.meta new file mode 100644 index 0000000..2ef3ec4 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_nm.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 7ecd19ca7d5928043b029929eb3a3052 +timeCreated: 1431707283 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/Textures/wood_plates_05_spec.tga b/Assets/0_free_pack/Textures/wood_plates_05_spec.tga new file mode 100644 index 0000000..b2ab741 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_spec.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0744fe2fa35978eb846878c3c1343c252b2504392302c8406cb8875c91019e3 +size 4194348 diff --git a/Assets/0_free_pack/Textures/wood_plates_05_spec.tga.meta b/Assets/0_free_pack/Textures/wood_plates_05_spec.tga.meta new file mode 100644 index 0000000..a6d8282 --- /dev/null +++ b/Assets/0_free_pack/Textures/wood_plates_05_spec.tga.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: ed58b2010c95f824aabae341b0289c3a +timeCreated: 1431707345 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/0_free_pack/tile.meta b/Assets/0_free_pack/tile.meta new file mode 100644 index 0000000..177cfc1 --- /dev/null +++ b/Assets/0_free_pack/tile.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 136910df011a8274fb19a457d9fd0ad5 +folderAsset: yes +timeCreated: 1499082263 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama.meta b/Assets/CapturePanorama.meta new file mode 100644 index 0000000..f798743 --- /dev/null +++ b/Assets/CapturePanorama.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f86cc09243f37ca4faea24deb3a06906 +folderAsset: yes +timeCreated: 1504010421 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/CapturePanorama.cs b/Assets/CapturePanorama/CapturePanorama.cs new file mode 100644 index 0000000..4c4430f --- /dev/null +++ b/Assets/CapturePanorama/CapturePanorama.cs @@ -0,0 +1,1877 @@ +// This is free and unencumbered software released into the public domain. +// For more information, please refer to + +// Uncomment to use in a VR project using the Oculus VR plugin +// This will avoid issues in which the captured panorama is pitched/rolled +// when the player pitches/rolls their headset. +//#define OVR_SUPPORT + +using CapturePanorama.Internals; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using UnityEngine; +using Bitmap = System.Drawing.Bitmap; +using DrawingImageFormat = System.Drawing.Imaging.ImageFormat; +using ImageLockMode = System.Drawing.Imaging.ImageLockMode; +using PixelFormat = System.Drawing.Imaging.PixelFormat; +using Process = System.Diagnostics.Process; +using Rectangle = System.Drawing.Rectangle; +#if UNITY_5_1 +using UnityEngine.VR; +#endif + +namespace CapturePanorama +{ + public class CapturePanorama : MonoBehaviour + { + public string panoramaName; + public string qualitySetting; + public KeyCode captureKey = KeyCode.P; + public ImageFormat imageFormat = ImageFormat.PNG; + public bool captureStereoscopic = false; + public float interpupillaryDistance = 0.0635f; // Average IPD of all subjects in US Army survey in meters + public int numCirclePoints = 128; + public int panoramaWidth = 8192; + public AntiAliasing antiAliasing = AntiAliasing._8; + public int ssaaFactor = 1; + public string saveImagePath = ""; + public bool saveCubemap = false; + public bool uploadImages = false; + public bool useDefaultOrientation = false; + public bool useGpuTransform = true; + public float cpuMillisecondsPerFrame = 1000.0f / 120.0f; + public bool captureEveryFrame = false; + public int frameRate = 30; + public int maxFramesToRecord = 0; + public int frameNumberDigits = 6; + public AudioClip startSound; + public AudioClip doneSound; + public AudioClip failSound; + public bool fadeDuringCapture = true; + public float fadeTime = 0.25f; + public Color fadeColor = new Color(0.0f, 0.0f, 0.0f, 1.0f); + public Material fadeMaterial = null; + public ComputeShader convertPanoramaShader; + public ComputeShader convertPanoramaStereoShader; + public ComputeShader textureToBufferShader; + public bool enableDebugging = false; + + public enum ImageFormat { PNG, JPEG, BMP }; + public enum AntiAliasing { _1 = 1, _2 = 2, _4 = 4, _8 = 8 }; + + string apiUrl = "http://alpha.vrchive.com/api/1/"; + string apiKey = "0b26e4dca20793a83fd92ad83e3e859e"; + + GameObject[] camGos; + Camera cam; + ImageEffectCopyCamera copyCameraScript; + + bool capturingEveryFrame = false; + bool usingGpuTransform; + CubemapFace[] faces; + int panoramaHeight, cameraWidth, cameraHeight; + RenderTexture cubemapRenderTexture = null; + Texture2D forceWaitTexture; + int convertPanoramaKernelIdx = -1, convertPanoramaYPositiveKernelIdx = -1, convertPanoramaYNegativeKernelIdx = -1, textureToBufferIdx = -1, renderStereoIdx = -1; + int[] convertPanoramaKernelIdxs; + byte[] imageFileBytes; + string videoBaseName = ""; + private int frameNumber; + const int ResultBufferSlices = 8; // Makes result buffer same pixel count as a cubemap texture + float hFov = -1.0f, vFov = -1.0f, hFovAdjustDegrees = -1.0f, vFovAdjustDegrees = -1.0f, circleRadius = -1.0f; + int threadsX = 32, threadsY = 32; // Must match all shaders + int numCameras; + const int CamerasPerCirclePoint = 4; + uint[] cameraPixels = null; + uint[] resultPixels = null; + float tanHalfHFov, tanHalfVFov, hFovAdjust, vFovAdjust; + int overlapTextures; + bool initializeFailed = true; + AudioSource audioSource; + + const uint BufferSentinelValue = 1419455993; // Must match value in TextureToBufferShader.compute + + // If any of these change, have to call Reinitialize() + int lastConfiguredPanoramaWidth, lastConfiguredNumCirclePoints, lastConfiguredSsaaFactor; + float lastConfiguredInterpupillaryDistance; + bool lastConfiguredCaptureStereoscopic, lastConfiguredSaveCubemap, lastConfiguredUseGpuTransform; + AntiAliasing lastConfiguredAntiAliasing = AntiAliasing._1; + + DrawingImageFormat FormatToDrawingFormat(ImageFormat format) + { + switch (format) + { + case ImageFormat.PNG: return DrawingImageFormat.Png; + case ImageFormat.JPEG: return DrawingImageFormat.Jpeg; + case ImageFormat.BMP: return DrawingImageFormat.Bmp; + default: Debug.Assert(false); return DrawingImageFormat.Png; + } + } + + string FormatMimeType(ImageFormat format) + { + switch (format) + { + case ImageFormat.PNG: return "image/png"; + case ImageFormat.JPEG: return "image/jpeg"; + case ImageFormat.BMP: return "image/bmp"; + default: Debug.Assert(false); return ""; + } + } + + string FormatToExtension(ImageFormat format) + { + switch (format) + { + case ImageFormat.PNG: return "png"; + case ImageFormat.JPEG: return "jpg"; + case ImageFormat.BMP: return "bmp"; + default: Debug.Assert(false); return ""; + } + } + + static CapturePanorama instance; + + public void Awake() + { + if (instance == null) + instance = this; + else + Debug.LogError("More than one CapturePanorama instance detected."); + } + + public void Start() + { + audioSource = this.gameObject.AddComponent(); + audioSource.spatialBlend = 0.0f; // Use 2D sound for sound effects + audioSource.Play(); + + Reinitialize(); + } + + // A function from [-1, 1] to [0, 1] which has f(0)=1, f(-1)=f(1)=0, + // is symmetric around the y axis, and is smooth near x=0 + float IpdScaleFunction(float latitudeNormalized) + { + // return 1.0f; // Most basic, has discontinuities at poles + // return 1 - latitudeNormalized * latitudeNormalized; + + // First constant is 1/(1 - 1/e^(-1)), second constant is -e^(-1)/(1 - e^(-1)), + // necessary to satisfy f(0)=1 and f(-1)=f(1)=0. + return 1.5819767068693265f * Mathf.Exp(-latitudeNormalized * latitudeNormalized) - 0.5819767068693265f; + + // return 1.1565176427496657f * Mathf.Exp(-2.0f * latitudeNormalized * latitudeNormalized) - 0.15651764274966568f; + // return 1.0000454019910097f * Mathf.Exp(-10.0f * latitudeNormalized * latitudeNormalized) - 0.00004540199100968779f; + } + + public void OnDestroy() + { + Cleanup(); + } + + void Cleanup() + { + faces = null; + + Destroy(copyCameraScript); + Destroy(cam); + if (camGos != null) + for (int i = camGos.Length - 1; i >= 0; i--) + if (camGos[i] != null) + Destroy(camGos[i]); + camGos = null; + + numCameras = -1; + hFov = vFov = -1.0f; + + if (cubemapRenderTexture != null) + Destroy(cubemapRenderTexture); + cubemapRenderTexture = null; + + convertPanoramaKernelIdx = renderStereoIdx = textureToBufferIdx = -1; + convertPanoramaKernelIdxs = null; + + resultPixels = cameraPixels = null; + + if (forceWaitTexture != null) + Destroy(forceWaitTexture); + forceWaitTexture = new Texture2D(1, 1); + } + + void Reinitialize() { + try + { + ReinitializeBody(); + } + catch (Exception) + { + Cleanup(); + throw; + } + } + + void ReinitializeBody() { + Log("Settings changed, calling Reinitialize()"); + + initializeFailed = true; + + if (!SystemInfo.supportsComputeShaders) + { + Debug.LogWarning("CapturePanorama requires compute shaders. Your system does not support them. " + + "On PC, compute shaders require DirectX 11, Windows Vista or later, and a GPU capable of Shader Model 5.0."); + return; + } + + lastConfiguredCaptureStereoscopic = captureStereoscopic; + lastConfiguredPanoramaWidth = panoramaWidth; + lastConfiguredInterpupillaryDistance = interpupillaryDistance; + lastConfiguredNumCirclePoints = numCirclePoints; + lastConfiguredSsaaFactor = ssaaFactor; + lastConfiguredAntiAliasing = antiAliasing; + lastConfiguredSaveCubemap = saveCubemap; + lastConfiguredUseGpuTransform = useGpuTransform; + + Cleanup(); + + faces = new CubemapFace[] { + CubemapFace.PositiveX, CubemapFace.NegativeX, + CubemapFace.PositiveY, CubemapFace.NegativeY, + CubemapFace.PositiveZ, CubemapFace.NegativeZ }; + + for (int i = 0; i < faces.Length; i++) + Debug.Assert((int)faces[i] == i); // Required for ConvertPanoramaShader + + panoramaHeight = panoramaWidth / 2; + + // We have a tower of 3 nested GameObjects. First gets the original camera position, + // second gets the eye rotation/position relative to it, and third holds the camera with default position/rotation. + camGos = new GameObject[3]; + for (int i = 0; i < 3; i++) + { + camGos[i] = new GameObject("PanoramaCaptureCamera" + i); + camGos[i].hideFlags = HideFlags.HideAndDontSave; + if (i > 0) camGos[i].transform.parent = camGos[i - 1].transform; + } + + camGos[2].AddComponent(); + cam = camGos[2].GetComponent(); + cam.enabled = false; + camGos[2].AddComponent(); + copyCameraScript = camGos[2].GetComponent(); + copyCameraScript.enabled = false; + + numCameras = faces.Length; + hFov = vFov = 90.0f; + if (captureStereoscopic) + { + // For stereoscopic rendering, there are a set of points lying on a horizontal circle around the origin. + // Will have four cameras per circle point, one turned left 45 deg, one turned right 45 deg, + // one turned up 45 deg, one turned down 45 deg. Allows covering >= 180 deg horizontal and 180 deg vertical. + // To be able to resolve all rays, we need to choose a large enough horizontal FOV for each camera. + + float maxAngleError = 360.0f / numCirclePoints; + + // TODO: Use different hFov/vFov for top/bottom cameras and left/right cameras (vFov of top/bottom cameras especially is a lot less) + + // Given our ipd adjustment scaling f(x), the IPD range of the top/bottom cameras will be up to f(0.5) + // of the original IPD. Hence the necessary hFov is given by 2*(pi/2 - acos(f(0.5))), usually in the 90-115 deg range. + float extraFovForRoundingErrors = 0.001f; + float hFovTopBottom = 2.0f * (Mathf.PI / 2.0f - Mathf.Acos(IpdScaleFunction(0.5f))) * 360.0f / (2.0f * Mathf.PI); + hFov = Mathf.Max(90f + maxAngleError, hFovTopBottom) + extraFovForRoundingErrors; // These will usually be similar so just use max for simplicity + vFov = 90.0f; + numCameras = 2 + numCirclePoints * CamerasPerCirclePoint; // 2 + for top/bottom + circleRadius = interpupillaryDistance / 2.0f; + hFovAdjustDegrees = hFov / 2.0f; + vFovAdjustDegrees = vFov / 2.0f; + } + + double ppd90 = panoramaWidth * 90.0 / 360.0; + // Match PPD at 90 degrees - if it's larger, central 90 degree section should match PPD + cameraWidth = (int)Math.Ceiling(Math.Tan(hFov * (2.0f*Mathf.PI)/360.0f / 2.0f) * ppd90 * ssaaFactor); + cameraHeight = (int)Math.Ceiling(Math.Tan(vFov * (2.0f * Mathf.PI) / 360.0f / 2.0f) * ppd90 * ssaaFactor); + + Log("Number of cameras: " + numCameras); + Log("Camera dimensions: " + cameraWidth + "x" + cameraHeight); + + usingGpuTransform = useGpuTransform && convertPanoramaShader != null; + + cubemapRenderTexture = new RenderTexture(cameraWidth, cameraHeight, /*depth*/24, RenderTextureFormat.ARGB32); + cubemapRenderTexture.antiAliasing = (int)antiAliasing; + cubemapRenderTexture.Create(); + + if (usingGpuTransform) + { + convertPanoramaKernelIdx = convertPanoramaShader.FindKernel("CubeMapToEquirectangular"); + convertPanoramaYPositiveKernelIdx = convertPanoramaShader.FindKernel("CubeMapToEquirectangularPositiveY"); + convertPanoramaYNegativeKernelIdx = convertPanoramaShader.FindKernel("CubeMapToEquirectangularNegativeY"); + convertPanoramaKernelIdxs = new int[] { convertPanoramaKernelIdx, convertPanoramaYPositiveKernelIdx, convertPanoramaYNegativeKernelIdx }; + convertPanoramaShader.SetInt("equirectangularWidth", panoramaWidth); + convertPanoramaShader.SetInt("equirectangularHeight", panoramaHeight); + convertPanoramaShader.SetInt("ssaaFactor", ssaaFactor); + convertPanoramaShader.SetInt("cameraWidth", cameraWidth); + convertPanoramaShader.SetInt("cameraHeight", cameraHeight); + + int sliceHeight = (panoramaHeight + ResultBufferSlices - 1) / ResultBufferSlices; + int bitmapWidth = panoramaWidth; + int bitmapHeight = (captureStereoscopic ? 2 * panoramaHeight : sliceHeight); + resultPixels = new uint[bitmapWidth * bitmapHeight + 1]; // + 1 for sentinel + } + + textureToBufferIdx = textureToBufferShader.FindKernel("TextureToBuffer"); + textureToBufferShader.SetInt("width", cameraWidth); + textureToBufferShader.SetInt("height", cameraHeight); + textureToBufferShader.SetFloat("gamma", QualitySettings.activeColorSpace == ColorSpace.Linear ? 1.0f/2.2f : 1.0f); + + renderStereoIdx = convertPanoramaStereoShader.FindKernel("RenderStereo"); + + if ((saveCubemap || !usingGpuTransform) && + (cameraPixels == null || cameraPixels.Length != numCameras * cameraWidth * cameraHeight)) + { + // Allocate once to avoid GC fragmentation + cameraPixels = new uint[numCameras * cameraWidth * cameraHeight + 1]; // + 1 for sentinel + } + + tanHalfHFov = Mathf.Tan(hFov * (2 * Mathf.PI) / 360.0f / 2.0f); + tanHalfVFov = Mathf.Tan(vFov * (2 * Mathf.PI) / 360.0f / 2.0f); + hFovAdjust = hFovAdjustDegrees * (2 * Mathf.PI) / 360.0f; + vFovAdjust = vFovAdjustDegrees * (2 * Mathf.PI) / 360.0f; + + if (captureStereoscopic && usingGpuTransform) + { + convertPanoramaStereoShader.SetFloat("tanHalfHFov", tanHalfHFov); + convertPanoramaStereoShader.SetFloat("tanHalfVFov", tanHalfVFov); + convertPanoramaStereoShader.SetFloat("hFovAdjust", hFovAdjust); + convertPanoramaStereoShader.SetFloat("vFovAdjust", vFovAdjust); + convertPanoramaStereoShader.SetFloat("interpupillaryDistance", interpupillaryDistance); + convertPanoramaStereoShader.SetFloat("circleRadius", circleRadius); + convertPanoramaStereoShader.SetInt("numCirclePoints", numCirclePoints); + convertPanoramaStereoShader.SetInt("equirectangularWidth", panoramaWidth); + convertPanoramaStereoShader.SetInt("equirectangularHeight", panoramaHeight); + convertPanoramaStereoShader.SetInt("cameraWidth", cameraWidth); + convertPanoramaStereoShader.SetInt("cameraHeight", cameraHeight); + convertPanoramaStereoShader.SetInt("ssaaFactor", ssaaFactor); + } + + initializeFailed = false; + } + + void Log(string s) + { + if (enableDebugging) + Debug.Log(s, this); + } + + public void Update() + { + bool captureKeyPressed = Input.GetKeyDown(captureKey); + + if (initializeFailed || panoramaWidth < 4 || (captureStereoscopic && numCirclePoints < 8)) // Can occur temporarily while modifying properties in editor + { + if (captureKeyPressed) + { + if (panoramaWidth < 4) + Debug.LogError("Panorama Width must be at least 4. No panorama captured."); + if (captureStereoscopic && numCirclePoints < 8) + Debug.LogError("Num Circle Points must be at least 8. No panorama captured."); + if (initializeFailed) + Debug.LogError("Initialization of Capture Panorama script failed. Cannot capture content."); + if (failSound != null && Camera.main != null) + audioSource.PlayOneShot(failSound); + } + return; + } + if (captureStereoscopic != lastConfiguredCaptureStereoscopic || + panoramaWidth != lastConfiguredPanoramaWidth || + interpupillaryDistance != lastConfiguredInterpupillaryDistance || + numCirclePoints != lastConfiguredNumCirclePoints || + ssaaFactor != lastConfiguredSsaaFactor || + antiAliasing != lastConfiguredAntiAliasing || + saveCubemap != lastConfiguredSaveCubemap || + useGpuTransform != lastConfiguredUseGpuTransform) + { + Reinitialize(); + } + + if (capturingEveryFrame) + { + if (captureKey != KeyCode.None && captureKeyPressed || (maxFramesToRecord > 0 && frameNumber >= maxFramesToRecord)) + { + StopCaptureEveryFrame(); + } + else + { + CaptureScreenshotSync(videoBaseName + "_" + frameNumber.ToString(new String('0', frameNumberDigits))); + frameNumber += 1; + } + } + else if (captureKey != KeyCode.None && captureKeyPressed && !Capturing) + { + if (captureEveryFrame) + { + StartCaptureEveryFrame(); + } + else + { + string filenameBase = String.Format("{0}_{1:yyyy-MM-dd_HH-mm-ss-fff}", panoramaName, DateTime.Now); + Log("Panorama capture key pressed, capturing " + filenameBase); + CaptureScreenshotAsync(filenameBase); + } + } + } + + public void StartCaptureEveryFrame() + { + Time.captureFramerate = frameRate; + videoBaseName = String.Format("{0}_{1:yyyy-MM-dd_HH-mm-ss-fff}", panoramaName, DateTime.Now); + frameNumber = 0; + + capturingEveryFrame = true; + } + + public void StopCaptureEveryFrame() + { + Time.captureFramerate = 0; + capturingEveryFrame = false; + } + + public void CaptureScreenshotSync(string filenameBase) + { + var enumerator = CaptureScreenshotAsyncHelper(filenameBase, /*async*/false); + while (enumerator.MoveNext()) { } + } + + + + public void CaptureScreenshotAsync(string filenameBase) + { + StartCoroutine(CaptureScreenshotAsyncHelper(filenameBase, /*async*/true)); + } + + internal bool Capturing; + + static List resizingProcessList = new List(); + static List resizingFilenames = new List(); + + void SetFadersEnabled(IEnumerable fadeControls, bool value) + { + foreach (ScreenFadeControl fadeControl in fadeControls) + fadeControl.enabled = value; + } + + public IEnumerator FadeOut(IEnumerable fadeControls) + { + Log("Doing fade out"); + // Derived from OVRScreenFade + float elapsedTime = 0.0f; + Color color = fadeColor; + color.a = 0.0f; + fadeMaterial.color = color; + SetFadersEnabled(fadeControls, true); + while (elapsedTime < fadeTime) + { + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + color.a = Mathf.Clamp01(elapsedTime / fadeTime); + fadeMaterial.color = color; + } + } + + public IEnumerator FadeIn(IEnumerable fadeControls) + { + Log("Fading back in"); + float elapsedTime = 0.0f; + Color color = fadeMaterial.color = fadeColor; + while (elapsedTime < fadeTime) + { + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + color.a = 1.0f - Mathf.Clamp01(elapsedTime / fadeTime); + fadeMaterial.color = color; + } + SetFadersEnabled(fadeControls, false); + } + + + public IEnumerator CaptureScreenshotAsyncHelper(string filenameBase, bool async) + { + if (async) + while (Capturing) + yield return null; // If CaptureScreenshot() was called programmatically multiple times, serialize the coroutines + Capturing = true; + + if (!OnCaptureStart()) + { + audioSource.PlayOneShot(failSound); + Capturing = false; + yield break; + } + + // Have to refresh cameras each frame during video in case cameras or image effects change - consider an option for this. + Camera[] cameras = GetCaptureCameras(); + Array.Sort(cameras, (x, y) => x.depth.CompareTo(y.depth)); + + if (cameras.Length == 0) + { + Debug.LogWarning("No cameras found to capture"); + audioSource.PlayOneShot(failSound); + Capturing = false; + yield break; + } + + // Need to do this first in case we need to reinitialize + if (antiAliasing != AntiAliasing._1) + { + foreach (Camera c in cameras) + { + if (c.actualRenderingPath == RenderingPath.DeferredLighting || + c.actualRenderingPath == RenderingPath.DeferredShading) + { + Debug.LogWarning("CapturePanorama: Setting Anti Aliasing=1 because at least one camera in deferred mode. Use SSAA setting or Antialiasing image effect if needed."); + antiAliasing = AntiAliasing._1; + Reinitialize(); + break; + } + } + } + + Log("Starting panorama capture"); + if (!captureEveryFrame && startSound != null && Camera.main != null) + { + audioSource.PlayOneShot(startSound); + } + + List fadeControls = new List(); + foreach (Camera c in Camera.allCameras) + { + if (c.isActiveAndEnabled && c.targetTexture == null) // Is a camera visible to the player + { + var fadeControl = c.gameObject.AddComponent(); + fadeControl.fadeMaterial = fadeMaterial; + fadeControls.Add(fadeControl); + } + } + SetFadersEnabled(fadeControls, false); + + if (fadeDuringCapture && async) + yield return StartCoroutine(FadeOut(fadeControls)); + + // Make sure black is shown before we start - sometimes two frames are needed + for (int i = 0; i < 2; i++) + yield return new WaitForEndOfFrame(); + + // Initialize compute buffers - do here instead of in Reinitialize() to work around error on Destroy() + ComputeBuffer convertPanoramaResultBuffer = null; + ComputeBuffer forceWaitResultConvertPanoramaStereoBuffer = null; + if (usingGpuTransform) + { + if (captureStereoscopic) + { + convertPanoramaResultBuffer = + new ComputeBuffer(/*count*/panoramaWidth * panoramaHeight * 2 + 1, /*stride*/4); // + 1 for sentinel + convertPanoramaStereoShader.SetBuffer(renderStereoIdx, "result", convertPanoramaResultBuffer); + + forceWaitResultConvertPanoramaStereoBuffer = new ComputeBuffer(/*count*/1, /*stride*/4); + convertPanoramaStereoShader.SetBuffer(renderStereoIdx, "forceWaitResultBuffer", forceWaitResultConvertPanoramaStereoBuffer); + } + else + { + int sliceHeight = (panoramaHeight + ResultBufferSlices - 1) / ResultBufferSlices; + convertPanoramaResultBuffer = + new ComputeBuffer(/*count*/panoramaWidth * sliceHeight + 1, /*stride*/4); // + 1 for sentinel + foreach (int kernelIdx in convertPanoramaKernelIdxs) + convertPanoramaShader.SetBuffer(kernelIdx, "result", convertPanoramaResultBuffer); + } + } + int cameraPixelsBufferNumTextures = numCameras; + overlapTextures = 0; + int circlePointCircularBufferSize = 0; + if (captureStereoscopic && usingGpuTransform) + { + overlapTextures = ssaaFactor == 1 ? 1 : 2; // Overlap of 1 supports blending between circle points, overlap of 2 supports it even with SSAA at boundaries + circlePointCircularBufferSize = 1 + overlapTextures; + // 2 + for top/bottom, and divide by 2 because we're doing left/right and up/down separately + cameraPixelsBufferNumTextures = Math.Min(numCameras, 2 + (CamerasPerCirclePoint / 2) * circlePointCircularBufferSize); + } + ComputeBuffer cameraPixelsBuffer = new ComputeBuffer(/*count*/cameraPixelsBufferNumTextures * cameraWidth * cameraHeight + 1, /*stride*/4); + textureToBufferShader.SetBuffer(textureToBufferIdx, "result", cameraPixelsBuffer); + + // Set up sentinels to detect out of graphics memory + textureToBufferShader.SetInt("sentinelIdx", cameraPixelsBuffer.count - 1); + if (usingGpuTransform && !captureStereoscopic) + { + convertPanoramaShader.SetInt("cameraPixelsSentinelIdx", cameraPixelsBuffer.count - 1); + convertPanoramaShader.SetInt("sentinelIdx", convertPanoramaResultBuffer.count - 1); + foreach (int kernelIdx in convertPanoramaKernelIdxs) + convertPanoramaShader.SetBuffer(kernelIdx, "cameraPixels", cameraPixelsBuffer); + } + if (usingGpuTransform && captureStereoscopic) + { + convertPanoramaStereoShader.SetInt("cameraPixelsSentinelIdx", cameraPixelsBuffer.count - 1); + convertPanoramaStereoShader.SetBuffer(renderStereoIdx, "cameraPixels", cameraPixelsBuffer); + } + + ComputeBuffer forceWaitResultTextureToBufferBuffer = new ComputeBuffer(/*count*/1, /*stride*/4); + textureToBufferShader.SetBuffer(textureToBufferIdx, "forceWaitResultBuffer", forceWaitResultTextureToBufferBuffer); + + float startTime = Time.realtimeSinceStartup; + + Quaternion headOrientation = Quaternion.identity; +#if OVR_SUPPORT + if (OVRManager.display != null) + { + headOrientation = OVRManager.display.GetHeadPose(0.0).orientation; + } +#endif +#if UNITY_5_1 + if (VRSettings.enabled && VRSettings.loadedDevice != VRDeviceType.None) + { + headOrientation = InputTracking.GetLocalRotation(0); + } +#endif + + Log("Rendering camera views"); + foreach (Camera c in cameras) + Log("Camera name: " + c.gameObject.name); + + var methodMap = new Dictionary>(); + foreach (Camera c in cameras) + methodMap[c] = ImageEffectCopyCamera.GenerateMethodList(c); + + // Need to extract each cubemap into a Texture2D so we can read the pixels, but Unity bug + // prevents this with antiAliasing: http://issuetracker.unity3d.com/issues/texture2d-dot-readpixels-fails-if-rendertexture-has-anti-aliasing-set + // We copy the cubemap textures using a shader as a workaround. + + string suffix = "." + FormatToExtension(imageFormat); + string filePath = ""; + // Save in separate thread to avoid hiccups + string imagePath = saveImagePath; + if (imagePath == null || imagePath == "") + { + imagePath = Application.dataPath + "/.."; + } + + convertPanoramaStereoShader.SetInt("circlePointCircularBufferSize", circlePointCircularBufferSize); + int nextCirclePointCircularBufferStart = 0, nextCirclePointStart = 0, writeIdx = 0; + int ilimit = usingGpuTransform ? numCameras + overlapTextures * CamerasPerCirclePoint : numCameras; + int leftRightPhaseEnd = (ilimit - 2) / 2 + 2; + int circlePointsRendered = 0; + int saveCubemapImageNum = 0; + + Log("Changing quality level"); + int saveQualityLevel = QualitySettings.GetQualityLevel(); + bool qualitySettingWasChanged = false; + string[] qualitySettingNames = QualitySettings.names; + if (qualitySetting != qualitySettingNames[saveQualityLevel]) // Don't change if already set to it + { + for (int i = 0; i < qualitySettingNames.Length; i++) + { + string name = qualitySettingNames[i]; + if (name == qualitySetting) + { + QualitySettings.SetQualityLevel(i, /*applyExpensiveChanges*/false); // applyExpensiveChanges causes trouble + qualitySettingWasChanged = true; + } + } + if (qualitySetting != "" && !qualitySettingWasChanged) + { + Debug.LogError("Quality setting specified for CapturePanorama is invalid, ignoring.", this); + } + } + + BeforeRenderPanorama(); + + RenderTexture.active = null; + for (int i = 0; i < ilimit; i++) + { + // Don't use RenderToCubemap - it causes problems with compositing multiple cameras, and requires + // more temporary VRAM. Just render cube map manually. + if (captureStereoscopic) + { + if (i < 2) + { + // 0, 1 are top/bottom caps + camGos[1].transform.localPosition = Vector3.zero; + camGos[1].transform.localRotation = Quaternion.Euler((i == 0) ? 90.0f : -90.0f, 0.0f, 0.0f); + } + else + { + // Do all left/right textures first then all up/down textures + int iAdjusted, numInGroupBias; + if (i < leftRightPhaseEnd) + { + iAdjusted = i - 2; + numInGroupBias = 0; + } + else + { + iAdjusted = i - leftRightPhaseEnd; + numInGroupBias = 2; + } + + int circlePointNum = (iAdjusted / (CamerasPerCirclePoint / 2)) % numCirclePoints; + int numInGroup = iAdjusted % (CamerasPerCirclePoint / 2) + numInGroupBias; + + float circleAngle = 360.0f * circlePointNum / numCirclePoints; + camGos[1].transform.localPosition = Quaternion.Euler(0.0f, circleAngle, 0.0f) * Vector3.forward * circleRadius; + + if (numInGroup < 2) + camGos[1].transform.localRotation = Quaternion.Euler(0.0f, circleAngle + (numInGroup == 0 ? -hFovAdjustDegrees : hFovAdjustDegrees), 0.0f); + else + camGos[1].transform.localRotation = Quaternion.Euler((numInGroup == 2 ? -vFovAdjustDegrees : vFovAdjustDegrees), circleAngle, 0.0f); + + if (numInGroup == 1 || numInGroup == 3) circlePointsRendered++; + } + } + else + { + switch ((CubemapFace)i) + { + case CubemapFace.PositiveX: camGos[1].transform.localRotation = Quaternion.Euler( 0.0f, 90.0f, 0.0f); break; + case CubemapFace.NegativeX: camGos[1].transform.localRotation = Quaternion.Euler( 0.0f, -90.0f, 0.0f); break; + case CubemapFace.PositiveY: camGos[1].transform.localRotation = Quaternion.Euler( 90.0f, 0.0f, 0.0f); break; + case CubemapFace.NegativeY: camGos[1].transform.localRotation = Quaternion.Euler(-90.0f, 0.0f, 0.0f); break; + case CubemapFace.PositiveZ: camGos[1].transform.localRotation = Quaternion.Euler( 0.0f, 0.0f, 0.0f); break; + case CubemapFace.NegativeZ: camGos[1].transform.localRotation = Quaternion.Euler( 0.0f, 180.0f, 0.0f); break; + } + } + + foreach (Camera c in cameras) + { + // To get the camera in the right eye position, migrate the camera transform to camGos[0] + camGos[2].transform.parent = null; + + cam.CopyFrom(c); + + // TODO: Determine if we should reset matrices of the camera in case it's using custom transform matrices + + camGos[0].transform.localPosition = cam.transform.localPosition; + camGos[0].transform.localRotation = cam.transform.localRotation; + camGos[2].transform.parent = camGos[1].transform; + cam.transform.localPosition = Vector3.zero; + cam.transform.localRotation = Quaternion.identity; + copyCameraScript.enabled = methodMap[c].Count > 0; + copyCameraScript.onRenderImageMethods = methodMap[c]; + cam.fieldOfView = vFov; // hFov inferred from aspect ratio of target + + // Question: Should we adjust near clip in stereoscopic mode based on circleRadius? + // (avoids clipping that doesn't occur in normal camera view but might lead to unexpected bad effects) + + camGos[0].transform.rotation *= Quaternion.Inverse(headOrientation); + if (useDefaultOrientation) + camGos[0].transform.rotation = Quaternion.identity; + + cam.targetTexture = cubemapRenderTexture; + // Aspect ratio must be determined by size of render target. This is critical when Unity native VR is enabled. + cam.ResetAspect(); + + // Temporarily set original camera to same position/rotation/field of view as + // rendering camera during render. If any image effects examine camera + // orientation/FOV this will ensure they behave correctly. + + Vector3 savePosition = c.transform.position; + Quaternion saveRotation = c.transform.rotation; + float saveFieldOfView = c.fieldOfView; + RenderTexture saveRenderTexture = c.targetTexture; + + c.transform.position = cam.transform.position; + c.transform.rotation = cam.transform.rotation; + c.fieldOfView = cam.fieldOfView; + + cam.Render(); + + c.transform.position = savePosition; + c.transform.rotation = saveRotation; + c.fieldOfView = saveFieldOfView; + c.targetTexture = saveRenderTexture; + } + + // Read one pixel from texture to force render to complete before continuing + RenderTexture.active = cubemapRenderTexture; + forceWaitTexture.ReadPixels(new Rect(cameraWidth - 1, cameraHeight - 1, 1, 1), 0, 0); + + int forceWaitValue = 1000000 + i; + textureToBufferShader.SetInt("forceWaitValue", forceWaitValue); + textureToBufferShader.SetTexture(textureToBufferIdx, "source", cubemapRenderTexture); + textureToBufferShader.SetInt("startIdx", writeIdx * cameraWidth * cameraHeight); + textureToBufferShader.Dispatch(textureToBufferIdx, (cameraWidth + threadsX - 1) / threadsX, (cameraHeight + threadsY - 1) / threadsY, 1); + + uint[] forceWaitResult = new uint[1]; + forceWaitResultTextureToBufferBuffer.GetData(forceWaitResult); + if (forceWaitResult[0] != forceWaitValue) + Debug.LogError("TextureToBufferShader: Unexpected forceWaitResult value " + forceWaitResult[0] + ", should be " + forceWaitValue); + + if (saveCubemap && + ((i < 2) || + (i >= 2 && i < 2 + numCirclePoints * 2) || + (i >= leftRightPhaseEnd && i < leftRightPhaseEnd + numCirclePoints * 2))) + { + // This is really slow - retrieving all cameraPixels data for just a portion of it. But this is mainly useful for debugging anyway. + cameraPixelsBuffer.GetData(cameraPixels); + if (cameraPixels[cameraPixelsBuffer.count - 1] != BufferSentinelValue) + ReportOutOfGraphicsMemory(); + + SaveCubemapImage(cameraPixels, filenameBase, suffix, imagePath, saveCubemapImageNum, writeIdx); + saveCubemapImageNum++; + } + + writeIdx++; + if (writeIdx >= cameraPixelsBufferNumTextures) writeIdx = 2; // Leave top/bottom in indexes 0/1 + + // For stereoscopic GPU transform, interleave capture and rendering to decrease VRAM consumption + if (captureStereoscopic && usingGpuTransform && + ((i - 2) + 1) % (CamerasPerCirclePoint / 2) == 0 && + (circlePointsRendered - nextCirclePointStart >= circlePointCircularBufferSize || i + 1 == 2 + (ilimit - 2) / 2 || i + 1 == ilimit)) + { + forceWaitValue = 2000000 + i; + convertPanoramaStereoShader.SetInt("forceWaitValue", forceWaitValue); + convertPanoramaStereoShader.SetInt("leftRightPass", i < leftRightPhaseEnd ? 1 : 0); + convertPanoramaStereoShader.SetInt("circlePointStart", nextCirclePointStart); + convertPanoramaStereoShader.SetInt("circlePointEnd", cameraPixelsBufferNumTextures < numCameras ? circlePointsRendered : circlePointsRendered + 1); + convertPanoramaStereoShader.SetInt("circlePointCircularBufferStart", nextCirclePointCircularBufferStart); + convertPanoramaStereoShader.Dispatch(renderStereoIdx, (panoramaWidth + threadsX - 1) / threadsX, (panoramaHeight + threadsY - 1) / threadsY, 2); + + forceWaitResultConvertPanoramaStereoBuffer.GetData(forceWaitResult); + if (forceWaitResult[0] != forceWaitValue) + Debug.LogError("ConvertPanoramaStereoShader: Unexpected forceWaitResult value " + forceWaitResult[0] + ", should be " + forceWaitValue); + + if (i + 1 == leftRightPhaseEnd) + { + nextCirclePointCircularBufferStart = (nextCirclePointCircularBufferStart + circlePointCircularBufferSize) % circlePointCircularBufferSize; + nextCirclePointStart = 0; + circlePointsRendered = 0; + } + else + { + nextCirclePointStart = circlePointsRendered - overlapTextures; + nextCirclePointCircularBufferStart = (nextCirclePointCircularBufferStart + circlePointCircularBufferSize - overlapTextures) % circlePointCircularBufferSize; + } + } + + RenderTexture.active = null; + } + + AfterRenderPanorama(); + + Log("Resetting quality level"); + if (qualitySettingWasChanged) + QualitySettings.SetQualityLevel(saveQualityLevel, /*applyExpensiveChanges*/false); + + // If we need to access the cubemap pixels on the CPU, retrieve them now + if (saveCubemap || !usingGpuTransform) + { + cameraPixelsBuffer.GetData(cameraPixels); + if (cameraPixels[cameraPixelsBuffer.count - 1] != BufferSentinelValue) + ReportOutOfGraphicsMemory(); + } + + RenderTexture.active = null; + + if (saveCubemap && + !(captureStereoscopic && usingGpuTransform)) // In this mode images are saved during capture + { + // Save cubemap while still faded, as fast as possible - should be pretty quick + for (int i = 0; i < numCameras; i++) + { + int bufferIdx = i; + SaveCubemapImage(cameraPixels, filenameBase, suffix, imagePath, i, bufferIdx); + } + } + + // If this is not here, the fade-in will drop frames. + for (int i = 0; i < 2; i++) + yield return new WaitForEndOfFrame(); + + if (async && !usingGpuTransform && fadeDuringCapture) + yield return StartCoroutine(FadeIn(fadeControls)); + + filePath = imagePath + "/" + filenameBase + suffix; + + bool producedImageSuccess = false; + + { + // Write pixels directly to .NET Bitmap for saving out + // Based on https://msdn.microsoft.com/en-us/library/5ey6h79d%28v=vs.110%29.aspx + Bitmap bitmap = new Bitmap(panoramaWidth, panoramaHeight * (captureStereoscopic ? 2 : 1), PixelFormat.Format32bppArgb); + var bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, bitmap.PixelFormat); + IntPtr ptr = bmpData.Scan0; + byte[] pixelValues = new byte[Math.Abs(bmpData.Stride) * bitmap.Height]; + + // Convert to equirectangular projection - use compute shader for better performance if supported by platform + + if (async) + yield return StartCoroutine(CubemapToEquirectangular(cameraPixelsBuffer, cameraPixels, convertPanoramaResultBuffer, cameraWidth, cameraHeight, pixelValues, bmpData.Stride, panoramaWidth, panoramaHeight, ssaaFactor, async)); + else + { + var enumerator = CubemapToEquirectangular(cameraPixelsBuffer, cameraPixels, convertPanoramaResultBuffer, cameraWidth, cameraHeight, pixelValues, bmpData.Stride, panoramaWidth, panoramaHeight, ssaaFactor, async); + while (enumerator.MoveNext()) { } + } + + producedImageSuccess = (pixelValues[3] == 255); + + yield return null; + System.Runtime.InteropServices.Marshal.Copy(pixelValues, 0, ptr, pixelValues.Length); + bitmap.UnlockBits(bmpData); + yield return null; + + Log("Time to take panorama screenshot: " + (Time.realtimeSinceStartup - startTime) + " sec"); + + if (producedImageSuccess) + { + var thread = new Thread(() => + { + Log("Saving equirectangular image"); + // TODO: Use better image processing library to get decent JPEG quality out. + bitmap.Save(filePath, FormatToDrawingFormat(imageFormat)); + }); + thread.Start(); + while (thread.ThreadState == ThreadState.Running) + if (async) + yield return null; + else + Thread.Sleep(0); + } + + bitmap.Dispose(); + } + + // Release ComputeBuffers - all done with these + foreach (var buffer in new ComputeBuffer[] { + convertPanoramaResultBuffer, + cameraPixelsBuffer, + forceWaitResultConvertPanoramaStereoBuffer, + forceWaitResultTextureToBufferBuffer }) + if (buffer != null) + buffer.Release(); + convertPanoramaResultBuffer = cameraPixelsBuffer = null; + + if (async && usingGpuTransform && fadeDuringCapture) + yield return StartCoroutine(FadeIn(fadeControls)); + + foreach (ScreenFadeControl fadeControl in fadeControls) + { + Destroy(fadeControl); + } + fadeControls.Clear(); + + if (producedImageSuccess && uploadImages && !captureEveryFrame) + { + Log("Uploading image"); + imageFileBytes = File.ReadAllBytes(filePath); + string mimeType = FormatMimeType(imageFormat); + if (async) + yield return StartCoroutine(UploadImage(imageFileBytes, filenameBase + suffix, mimeType, async)); + else + { + var enumerator = UploadImage(imageFileBytes, filenameBase + suffix, mimeType, async); + while (enumerator.MoveNext()) { } + } + } + else + { + if (!producedImageSuccess) + { + if (failSound != null && Camera.main != null) + audioSource.PlayOneShot(failSound); + } + else if (!captureEveryFrame && doneSound != null && Camera.main != null) + { + audioSource.PlayOneShot(doneSound); + } + Capturing = false; + } + } + + public virtual bool OnCaptureStart() + { + return true; + } + + public virtual Camera[] GetCaptureCameras() + { + Camera[] cameras = Camera.allCameras; + + var finalCameras = new List(); + foreach (Camera c in cameras) + { +#if OVR_SUPPORT + if (c.gameObject.name.Contains("RightEye")) + continue; // Only render left eyes +#endif + finalCameras.Add(c); + } + + return finalCameras.ToArray(); + } + + public virtual void BeforeRenderPanorama() + { + // Do nothing, for overriding only + } + + public virtual void AfterRenderPanorama() + { + // Do nothing, for overriding only + } + + private static void ReportOutOfGraphicsMemory() + { + throw new OutOfMemoryException("Exhausted graphics memory while capturing panorama. " + + "Lower Panorama Width, increase Num Circle Points for stereoscopic images, disable Anti Aliasing, or disable Stereoscopic Capture."); + } + + private void SaveCubemapImage(uint[] cameraPixels, string filenameBase, string suffix, string imagePath, int i, int bufferIdx) + { + Bitmap bitmap = new Bitmap(cameraWidth, cameraHeight, PixelFormat.Format32bppArgb); + var bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, bitmap.PixelFormat); + IntPtr ptr = bmpData.Scan0; + byte[] pixelValues = new byte[Math.Abs(bmpData.Stride) * bitmap.Height]; + int stride = bmpData.Stride; + int height = bmpData.Height; + int inputIdx = bufferIdx * cameraWidth * cameraHeight; + for (int y = 0; y < cameraHeight; y++) + { + int outputIdx = stride * (height - 1 - y); + for (int x = 0; x < cameraWidth; x++) + { + uint c = cameraPixels[inputIdx]; + pixelValues[outputIdx + 0] = (byte)(c & 0xFF); + pixelValues[outputIdx + 1] = (byte)((c >> 8) & 0xFF); + pixelValues[outputIdx + 2] = (byte)(c >> 16); + pixelValues[outputIdx + 3] = 255; + outputIdx += 4; + inputIdx++; + } + } + System.Runtime.InteropServices.Marshal.Copy(pixelValues, 0, ptr, pixelValues.Length); + bitmap.UnlockBits(bmpData); + + string cameraId; + if (captureStereoscopic) + { + cameraId = i.ToString(); + Log("Saving lightfield camera image number " + cameraId); + } + else + { + cameraId = ((CubemapFace)i).ToString(); + Log("Saving cubemap image " + cameraId); + } + string cubeFilepath = imagePath + "/" + filenameBase + "_" + cameraId + suffix; + // TODO: Use better image processing library to get decent JPEG quality out. + bitmap.Save(cubeFilepath, FormatToDrawingFormat(imageFormat)); + bitmap.Dispose(); + } + + private Color32 GetCameraPixelBilinear(uint[] cameraPixels, int cameraNum, float u, float v) + { + u *= cameraWidth; + v *= cameraHeight; + int left = (int)Math.Floor(u); + int right = (int)Math.Min(cameraWidth - 1, left + 1); + int top = (int)Math.Floor(v); + int bottom = (int)Math.Min(cameraHeight - 1, top + 1); + float uFrac = u - left; + float vFrac = v - top; + + int baseIdx = cameraNum * cameraWidth * cameraHeight; + int topRow = baseIdx + top * cameraWidth; + int bottomRow = baseIdx + bottom * cameraWidth; + uint topLeft = cameraPixels[topRow + left ]; + uint topRight = cameraPixels[topRow + right]; + uint bottomLeft = cameraPixels[bottomRow + left ]; + uint bottomRight = cameraPixels[bottomRow + right]; + + float r = Mathf.Lerp(Mathf.Lerp( topLeft >> 16 , bottomLeft >> 16 , vFrac), + Mathf.Lerp( topRight >> 16 , bottomRight >> 16 , vFrac), uFrac); + float g = Mathf.Lerp(Mathf.Lerp((topLeft >> 8) & 0xFF, (bottomLeft >> 8) & 0xFF, vFrac), + Mathf.Lerp((topRight >> 8) & 0xFF, (bottomRight >> 8) & 0xFF, vFrac), uFrac); + float b = Mathf.Lerp(Mathf.Lerp( topLeft & 0xFF, bottomLeft & 0xFF, vFrac), + Mathf.Lerp( topRight & 0xFF, bottomRight & 0xFF, vFrac), uFrac); + + return new Color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f); + } + + internal void ClearProcessQueue() + { + while (resizingProcessList.Count > 0) + { + resizingProcessList[0].WaitForExit(); + File.Delete(resizingFilenames[0]); + resizingProcessList.RemoveAt(0); + resizingFilenames.RemoveAt(0); + } + } + + // Based on http://docs.unity3d.com/ScriptReference/WWWForm.html and + // http://answers.unity3d.com/questions/48686/uploading-photo-and-video-on-a-web-server.html + IEnumerator UploadImage(byte[] imageFileBytes, string filename, string mimeType, bool async) + { + float startTime = Time.realtimeSinceStartup; + + WWWForm form = new WWWForm(); + + form.AddField("key", apiKey); + form.AddField("action", "upload"); + form.AddBinaryData("source", imageFileBytes, filename, mimeType); + + WWW w = new WWW(apiUrl + "upload", form); + yield return w; + if (!string.IsNullOrEmpty(w.error)) + { + Debug.LogError("Panorama upload failed: " + w.error, this); + if (failSound != null && Camera.main != null) + audioSource.PlayOneShot(failSound); + } + else + { + Log("Time to upload panorama screenshot: " + (Time.realtimeSinceStartup - startTime) + " sec"); + if (!captureEveryFrame && doneSound != null && Camera.main != null) + { + audioSource.PlayOneShot(doneSound); + } + } + Capturing = false; + } + + IEnumerator CubemapToEquirectangular(ComputeBuffer cameraPixelsBuffer, uint[] cameraPixels, ComputeBuffer convertPanoramaResultBuffer, int cameraWidth, int cameraHeight, byte[] pixelValues, + int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, bool async) + { + if (captureStereoscopic && usingGpuTransform) + { + // Was already done earlier, just grab the result + convertPanoramaResultBuffer.GetData(resultPixels); + if (resultPixels[convertPanoramaResultBuffer.count - 1] != BufferSentinelValue) + ReportOutOfGraphicsMemory(); + + writeOutputPixels(pixelValues, stride, panoramaWidth, panoramaHeight * 2, panoramaHeight * 2, /*yStart*/0); + } + else if (captureStereoscopic && !usingGpuTransform) + { + // TODO: Factor out into separate method + float startTime = Time.realtimeSinceStartup; + float processingTimePerFrame = cpuMillisecondsPerFrame / 1000.0f; + + for (int y = 0; y < panoramaHeight; y++) + for (int x = 0; x < panoramaWidth; x++) + { + float xcoord = (float)x / panoramaWidth; + float ycoord = (float)y / panoramaHeight; + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float sinLat = Mathf.Sin(latitude); + float cosLat = Mathf.Cos(latitude); + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + float sinLong = Mathf.Sin(longitude); + float cosLong = Mathf.Cos(longitude); + + // Scale IPD down as latitude moves toward poles to avoid discontinuities + float latitudeNormalized = latitude / (Mathf.PI / 2.0f); // Map to [-1, 1] + float ipdScale = IpdScaleFunction(latitudeNormalized); + float scaledEyeRadius = ipdScale * interpupillaryDistance / 2.0f; + + int cameraNum; + float u, v; + + float ipdScaleLerp = 1.0f - ipdScale * 5.0f; // Scale [0, 0.2] to [0, 1] and reverse + // Top/bottom cap + Color colorCap = new Color(0.0f, 0.0f, 0.0f, 0.0f); + if (ipdScaleLerp > 0.0f) + { + Vector3 equirectRayDirection = new Vector3(cosLat * sinLong, sinLat, cosLat * cosLong); + float distance = 1.0f / equirectRayDirection.y; + u = equirectRayDirection.x * distance; v = equirectRayDirection.z * distance; + if (u * u <= 1 && v * v <= 1) + { + if (equirectRayDirection.y > 0.0f) + { + cameraNum = 0; + } + else + { + u = -u; + cameraNum = 1; + } + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + colorCap = GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + } + } + + for (int i = 0; i < 2; i++) + { + // The following is equivalent to: + // Quaternion eyesRotation = Quaternion.Euler(0.0f, longitude * 360.0f / (2 * Mathf.PI), 0.0f); + // Vector3 initialEyePosition = (i == 0 ? Vector3.left : Vector3.right) * scaledEyeRadius; + // Vector3 pos = eyesRotation * initialEyePosition; // eye position + // Vector3 dir = eyesRotation * Vector3.forward; // gaze direction + + Vector3 dir = new Vector3(sinLong, 0.0f, cosLong); + + float angle = (Mathf.PI / 2.0f - Mathf.Acos(scaledEyeRadius / circleRadius)); + if (i == 0) angle = -angle; + float circlePointAngle = longitude + angle; + if (circlePointAngle < 0.0f) circlePointAngle += 2 * Mathf.PI; + if (circlePointAngle >= 2 * Mathf.PI) circlePointAngle -= 2 * Mathf.PI; + // Debug.Assert(circlePointAngle >= 0.0f && circlePointAngle < 2 * Mathf.PI); + + float circlePointNumber = circlePointAngle / (2 * Mathf.PI) * numCirclePoints; + int circlePoint0 = (int)Mathf.Floor(circlePointNumber) % numCirclePoints; + + // Get color from each adjacent circle point + Color color0 = new Color(), color1 = new Color(); + for (int j=0; j < 2; j++) + { + int circlePointIdx = (j == 0 ? circlePoint0 : (circlePoint0 + 1) % numCirclePoints); + float cameraPointAngle = 2 * Mathf.PI * circlePointIdx / numCirclePoints; + float sinCameraPointAngle = Mathf.Sin(cameraPointAngle); + float cosCameraPointAngle = Mathf.Cos(cameraPointAngle); + + // Equivalent to (using fact that both dir and circlePointNorm are unit vectors): + // Quaternion circlePointRotation = Quaternion.Euler(0.0f, cameraPointAngle * 360.0f / (2 * Mathf.PI), 0.0f); + // Vector3 circlePointNormal = circlePointRotation * Vector3.forward; + // float newLongitude = Mathf.Sign(Vector3.Cross(circlePointNormal, dir).y) * Vector3.Angle(circlePointNormal, dir) * (2 * Mathf.PI) / 360.0f; + + float newLongitude = Mathf.Sign(dir.x * cosCameraPointAngle - dir.z * sinCameraPointAngle) * + Mathf.Acos(dir.z * cosCameraPointAngle + dir.x * sinCameraPointAngle); + float cosNewLong = Mathf.Cos(newLongitude); + float sinNewLong = Mathf.Sin(newLongitude); + + // Select which of the two cameras for this point to use and adjust ray to make camera plane perpendicular to axes + cameraNum = 2 + circlePointIdx * (CamerasPerCirclePoint / 2) + (newLongitude >= 0.0f ? 1 : 0); + + float longitudeAdjust = (newLongitude >= 0.0f ? -hFovAdjust : hFovAdjust); + float longSum = newLongitude + longitudeAdjust; + + // Equivalent to: + // Vector3 textureRayDir = Quaternion.Euler(-latitude * 360.0f / (2 * Mathf.PI), newLongitude * 360.0f / (2 * Mathf.PI), 0.0f) * Vector3.forward; + // Vector3 textureRayDirAdjusted = Quaternion.Euler(0.0f, longitudeAdjust * 360.0f / (2 * Mathf.PI), 0.0f) * textureRayDir; + Vector3 textureRayDirAdjusted = new Vector3(cosLat * Mathf.Sin(longSum), sinLat, cosLat * Mathf.Cos(longSum)); + + u = textureRayDirAdjusted.x / textureRayDirAdjusted.z / tanHalfHFov; + v = -textureRayDirAdjusted.y / textureRayDirAdjusted.z / tanHalfVFov; + + // There's a lot of vertical overlap so don't accept v near the edge of the left/right cameras, to avoid artifact pixels + if (! (textureRayDirAdjusted.z > 0.0f && u * u <= 1.0f && v * v <= 1.0f - 0.1f) ) + { + cameraNum = 2 + numCirclePoints * (CamerasPerCirclePoint / 2) + circlePointIdx * (CamerasPerCirclePoint / 2) + (latitude >= 0.0f ? 1 : 0); + float latitudeAdjust = (latitude >= 0.0f ? vFovAdjust : -vFovAdjust); + float cosLatAdjust = Mathf.Cos(latitudeAdjust); + float sinLatAdjust = Mathf.Sin(latitudeAdjust); + // Equivalent to: + // textureRayDirAdjusted = Quaternion.Euler(latitudeAdjust * 360.0f / (2 * Mathf.PI), 0.0f, 0.0f) * textureRayDir; + textureRayDirAdjusted = new Vector3(cosLat * sinNewLong, + cosLatAdjust * sinLat - cosLat * cosNewLong * sinLatAdjust, + sinLatAdjust * sinLat + cosLat * cosNewLong * cosLatAdjust); + + u = textureRayDirAdjusted.x / textureRayDirAdjusted.z / tanHalfHFov; + v = -textureRayDirAdjusted.y / textureRayDirAdjusted.z / tanHalfVFov; + + // Debug.Assert(ipdScaleLerp >= 1.0 || (textureRayDirAdjusted.z > 0.0f && u * u <= 1.0f && v * v <= 1.0f)); + } + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + Color col = GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + if (j == 0) color0 = col; else color1 = col; + } + + Color32 c = Color.Lerp(color0, color1, circlePointNumber - Mathf.Floor(circlePointNumber)); + if (colorCap.a > 0.0f && ipdScaleLerp > 0.0f) + c = Color.Lerp(c, colorCap, ipdScaleLerp); + + int outputIdx = stride * (y + panoramaHeight * i) + x * 4; + pixelValues[outputIdx + 0] = c.b; + pixelValues[outputIdx + 1] = c.g; + pixelValues[outputIdx + 2] = c.r; + pixelValues[outputIdx + 3] = 255; + } + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + else if (!captureStereoscopic && usingGpuTransform) + { + int sliceHeight = (panoramaHeight + ResultBufferSlices - 1) / ResultBufferSlices; + + Log("Invoking GPU shader for equirectangular reprojection"); + int endYNegative = (int)Mathf.Floor(panoramaHeight * 0.25f); + int startYPositive = (int)Mathf.Ceil(panoramaHeight * 0.75f); + for (int sliceNum = 0; sliceNum < ResultBufferSlices; sliceNum++) + { + int startSlice = sliceNum * sliceHeight; + int endSlice = Math.Min(startSlice + sliceHeight, panoramaHeight); + convertPanoramaShader.SetInt("startY", sliceNum * sliceHeight); + convertPanoramaShader.SetInt("sliceHeight", endSlice - startSlice); + if (endSlice <= endYNegative) + convertPanoramaShader.Dispatch(convertPanoramaYNegativeKernelIdx, (panoramaWidth + threadsX - 1) / threadsX, (sliceHeight + threadsY - 1) / threadsY, 1); + else if (startSlice >= startYPositive) + convertPanoramaShader.Dispatch(convertPanoramaYPositiveKernelIdx, (panoramaWidth + threadsX - 1) / threadsX, (sliceHeight + threadsY - 1) / threadsY, 1); + else + convertPanoramaShader.Dispatch(convertPanoramaKernelIdx, (panoramaWidth + threadsX - 1) / threadsX, (panoramaHeight + threadsY - 1) / threadsY, 1); + + convertPanoramaResultBuffer.GetData(resultPixels); + if (resultPixels[convertPanoramaResultBuffer.count - 1] != BufferSentinelValue) + ReportOutOfGraphicsMemory(); + + writeOutputPixels(pixelValues, stride, panoramaWidth, sliceHeight, panoramaHeight, startSlice); + } + } + else // if (!captureStereoscopic && !usingGpuTransform) + { + if (async) + yield return StartCoroutine(CubemapToEquirectangularCpu(cameraPixels, cameraWidth, cameraHeight, pixelValues, + stride, panoramaWidth, panoramaHeight, ssaaFactor, async)); + else + { + var enumerator = CubemapToEquirectangularCpu(cameraPixels, cameraWidth, cameraHeight, pixelValues, + stride, panoramaWidth, panoramaHeight, ssaaFactor, async); + while (enumerator.MoveNext()) { } + } + } + } + + private void writeOutputPixels(byte[] pixelValues, int stride, int bitmapWidth, int inHeight, int outHeight, int yStart) + { + int inputIdx = 0; + for (int y = yStart; y < yStart + inHeight && y < outHeight; y++) + { + int outputIdx = stride * y; + for (int x = 0; x < bitmapWidth; x++) + { + uint packedCol = resultPixels[inputIdx]; + pixelValues[outputIdx + 0] = (byte)((packedCol >> 0) & 0xFF); + pixelValues[outputIdx + 1] = (byte)((packedCol >> 8) & 0xFF); + pixelValues[outputIdx + 2] = (byte)((packedCol >> 16) & 0xFF); + pixelValues[outputIdx + 3] = 255; + outputIdx += 4; + inputIdx++; + } + } + } + + IEnumerator CubemapToEquirectangularCpu(uint[] cameraPixels, int cameraWidth, int cameraHeight, byte[] pixelValues, + int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, bool async) + { + Log("Converting to equirectangular"); + + yield return null; // Wait for next frame at beginning - already used up some time capturing snapshot + + float startTime = Time.realtimeSinceStartup; + float processingTimePerFrame = cpuMillisecondsPerFrame / 1000.0f; + float maxWidth = 1.0f - 1.0f / cameraWidth; + float maxHeight = 1.0f - 1.0f / cameraHeight; + int numPixelsAveraged = ssaaFactor * ssaaFactor; + + // For efficiency we're going to do a series of rectangles each drawn from only one texture, + // only using the slow general-case reprojection where necessary. + + int endYPositive = (int)Mathf.Floor(panoramaHeight * 0.25f); + int startYNegative = (int)Mathf.Ceil(panoramaHeight * 0.75f); + + // 0.195913f is angle in radians between (1, 0, 1) and (1, 1, 1) over pi + int endTopMixedRegion = (int)Mathf.Ceil (panoramaHeight * (0.5f - 0.195913f)); + int startBottomMixedRegion = (int)Mathf.Floor(panoramaHeight * (0.5f + 0.195913f)); + + int startXNegative = (int)Mathf.Ceil (panoramaWidth * 1.0f / 8.0f); + int endXNegative = (int)Mathf.Floor(panoramaWidth * 3.0f / 8.0f); + + int startZPositive = (int)Mathf.Ceil (panoramaWidth * 3.0f / 8.0f); + int endZPositive = (int)Mathf.Floor(panoramaWidth * 5.0f / 8.0f); + + int startXPositive = (int)Mathf.Ceil(panoramaWidth * 5.0f / 8.0f); + int endXPositive = (int)Mathf.Floor(panoramaWidth * 7.0f / 8.0f); + + int startZNegative = (int)Mathf.Ceil(panoramaWidth * 7.0f / 8.0f); + int endZNegative = (int)Mathf.Floor(panoramaWidth * 1.0f / 8.0f); // z negative wraps/loops around + + if (async) + { + yield return StartCoroutine(CubemapToEquirectangularCpuPositiveY(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + 0, 0, panoramaWidth, endYPositive)); + yield return StartCoroutine(CubemapToEquirectangularCpuNegativeY(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + 0, startYNegative, panoramaWidth, panoramaHeight)); + + yield return StartCoroutine(CubemapToEquirectangularCpuPositiveX(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startXPositive, endTopMixedRegion, endXPositive, startBottomMixedRegion)); + yield return StartCoroutine(CubemapToEquirectangularCpuNegativeX(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startXNegative, endTopMixedRegion, endXNegative, startBottomMixedRegion)); + yield return StartCoroutine(CubemapToEquirectangularCpuPositiveZ(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startZPositive, endTopMixedRegion, endZPositive, startBottomMixedRegion)); + + // Do in two pieces since z negative wraps/loops around + yield return StartCoroutine(CubemapToEquirectangularCpuNegativeZ(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startZNegative, endTopMixedRegion, panoramaWidth, startBottomMixedRegion)); + yield return StartCoroutine(CubemapToEquirectangularCpuNegativeZ(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + 0, endTopMixedRegion, endZNegative, startBottomMixedRegion)); + + // Handle all remaining image areas with the general case + yield return StartCoroutine(CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + 0, endYPositive, panoramaWidth, endTopMixedRegion)); + yield return StartCoroutine(CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + 0, startBottomMixedRegion, panoramaWidth, startYNegative)); + + // If width is not multiple of 8, due to rounding, there may be one-column strips where the X/Z textures mix together + if (endZNegative < startXNegative) + yield return StartCoroutine(CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endZNegative, endTopMixedRegion, startXNegative, startBottomMixedRegion)); + if (endXNegative < startZPositive) + yield return StartCoroutine(CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endXNegative, endTopMixedRegion, startZPositive, startBottomMixedRegion)); + if (endZPositive < startXPositive) + yield return StartCoroutine(CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endZPositive, endTopMixedRegion, startXPositive, startBottomMixedRegion)); + if (endXPositive < startZNegative) + yield return StartCoroutine(CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endXPositive, endTopMixedRegion, startZNegative, startBottomMixedRegion)); + } + else + { + IEnumerator enumerator; + enumerator = CubemapToEquirectangularCpuPositiveY(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + 0, 0, panoramaWidth, endYPositive); + while (enumerator.MoveNext()) { } + enumerator = CubemapToEquirectangularCpuNegativeY(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + 0, startYNegative, panoramaWidth, panoramaHeight); + while (enumerator.MoveNext()) { } + + enumerator = CubemapToEquirectangularCpuPositiveX(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startXPositive, endTopMixedRegion, endXPositive, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + enumerator = CubemapToEquirectangularCpuNegativeX(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startXNegative, endTopMixedRegion, endXNegative, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + enumerator = CubemapToEquirectangularCpuPositiveZ(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startZPositive, endTopMixedRegion, endZPositive, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + + // Do in two pieces since z negative wraps/loops around + enumerator = CubemapToEquirectangularCpuNegativeZ(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + startZNegative, endTopMixedRegion, panoramaWidth, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + enumerator = CubemapToEquirectangularCpuNegativeZ(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, numPixelsAveraged, + 0, endTopMixedRegion, endZNegative, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + + // Handle all remaining image areas with the general case + enumerator = CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + 0, endYPositive, panoramaWidth, endTopMixedRegion); + while (enumerator.MoveNext()) { } + enumerator = CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + 0, startBottomMixedRegion, panoramaWidth, startYNegative); + while (enumerator.MoveNext()) { } + + // If width is not multiple of 8, due to rounding, there may be one-column strips where the X/Z textures mix together + if (endZNegative < startXNegative) + { + enumerator = CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endZNegative, endTopMixedRegion, startXNegative, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + } + if (endXNegative < startZPositive) + { + enumerator = CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endXNegative, endTopMixedRegion, startZPositive, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + } + if (endZPositive < startXPositive) + { + enumerator = CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endZPositive, endTopMixedRegion, startXPositive, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + } + if (endXPositive < startZNegative) + { + enumerator = CubemapToEquirectangularCpuGeneralCase(cameraPixels, pixelValues, stride, panoramaWidth, panoramaHeight, ssaaFactor, startTime, processingTimePerFrame, maxWidth, maxHeight, numPixelsAveraged, + endXPositive, endTopMixedRegion, startZNegative, startBottomMixedRegion); + while (enumerator.MoveNext()) { } + } + } + + yield return null; + } + + private IEnumerator CubemapToEquirectangularCpuPositiveY(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 1.0f / equirectRayDirection.y; + float u = equirectRayDirection.x * distance, v = equirectRayDirection.z * distance; + // Debug.Assert (equirectRayDirection.y > 0.0f); + // Debug.Assert (! (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) ); + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)CubemapFace.PositiveY, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + + private IEnumerator CubemapToEquirectangularCpuNegativeY(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 1.0f / equirectRayDirection.y; + float u = equirectRayDirection.x * distance, v = equirectRayDirection.z * distance; + u = -u; + // Debug.Assert (equirectRayDirection.y < 0.0f); + // Debug.Assert (! (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) ); + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)CubemapFace.NegativeY, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + + private IEnumerator CubemapToEquirectangularCpuPositiveX(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 1.0f / equirectRayDirection.x; + float u = -equirectRayDirection.z * distance, v = equirectRayDirection.y * distance; + v = -v; + // Debug.Assert(equirectRayDirection.x > 0.0f); + // Debug.Assert (! (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) ); + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)CubemapFace.PositiveX, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + + private IEnumerator CubemapToEquirectangularCpuNegativeX(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 1.0f / equirectRayDirection.x; + float u = -equirectRayDirection.z * distance, v = equirectRayDirection.y * distance; + // Debug.Assert(equirectRayDirection.x < 0.0f); + // Debug.Assert (! (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) ); + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)CubemapFace.NegativeX, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + + private IEnumerator CubemapToEquirectangularCpuPositiveZ(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 1.0f / equirectRayDirection.z; + float u = equirectRayDirection.x * distance, v = equirectRayDirection.y * distance; + v = -v; + // Debug.Assert (equirectRayDirection.z > 0.0f); + // Debug.Assert (! (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) ); + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)CubemapFace.PositiveZ, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + + private IEnumerator CubemapToEquirectangularCpuNegativeZ(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 1.0f / equirectRayDirection.z; + float u = equirectRayDirection.x * distance, v = equirectRayDirection.y * distance; + // Debug.Assert (equirectRayDirection.z < 0.0f); + // Debug.Assert (! (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) ); + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)CubemapFace.NegativeZ, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + + private IEnumerator CubemapToEquirectangularCpuGeneralCase(uint[] cameraPixels, byte[] pixelValues, int stride, int panoramaWidth, int panoramaHeight, int ssaaFactor, float startTime, float processingTimePerFrame, float maxWidth, float maxHeight, int numPixelsAveraged, + int startX, int startY, int endX, int endY) + { + for (int y = startY; y < endY; y++) + for (int x = startX; x < endX; x++) + { + int rTotal = 0, gTotal = 0, bTotal = 0, aTotal = 0; + for (int ySsaa = y * ssaaFactor; ySsaa < (y + 1) * ssaaFactor; ySsaa++) + for (int xSsaa = x * ssaaFactor; xSsaa < (x + 1) * ssaaFactor; xSsaa++) + { + float xcoord = (float)xSsaa / (panoramaWidth * ssaaFactor); + float ycoord = (float)ySsaa / (panoramaHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * Mathf.PI; + float longitude = (xcoord * 2.0f - 1.0f) * Mathf.PI; + + // Equivalent to: Vector3 equirectRayDirection = + // Quaternion.Euler(-latitude * 360/(2*Mathf.PI), longitude * 360/(2*Mathf.PI), 0.0f) * new Vector3(0, 0, 1); + float cosLat = Mathf.Cos(latitude); + Vector3 equirectRayDirection = new Vector3( + cosLat * Mathf.Sin(longitude), -Mathf.Sin(latitude), cosLat * Mathf.Cos(longitude)); + + float distance = 0.0f; + CubemapFace face; + float u, v; + + { + distance = 1.0f / equirectRayDirection.y; + u = equirectRayDirection.x * distance; v = equirectRayDirection.z * distance; + if (equirectRayDirection.y > 0.0f) + { + face = CubemapFace.PositiveY; + } + else + { + face = CubemapFace.NegativeY; + u = -u; + } + } + + if (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) + { + distance = 1.0f / equirectRayDirection.x; + u = -equirectRayDirection.z * distance; v = equirectRayDirection.y * distance; + if (equirectRayDirection.x > 0.0f) + { + face = CubemapFace.PositiveX; + v = -v; + } + else + { + face = CubemapFace.NegativeX; + } + } + if (Mathf.Abs(u) > 1.0f || Mathf.Abs(v) > 1.0f) + { + distance = 1.0f / equirectRayDirection.z; + u = equirectRayDirection.x * distance; v = equirectRayDirection.y * distance; + if (equirectRayDirection.z > 0.0f) + { + face = CubemapFace.PositiveZ; + v = -v; + } + else + { + face = CubemapFace.NegativeZ; + } + } + + u = (u + 1.0f) / 2.0f; + v = (v + 1.0f) / 2.0f; + + // Boundary: should blend between cubemap views, but for now just grab color + // of nearest pixel in selected cubemap view + u = Mathf.Min(u, maxWidth); + v = Mathf.Min(v, maxHeight); + + Color32 c = GetCameraPixelBilinear(cameraPixels, (int)face, u, v); + rTotal += c.r; gTotal += c.g; bTotal += c.b; aTotal += c.a; + } + + int baseIdx = stride * (panoramaHeight - 1 - y) + x * 4; + pixelValues[baseIdx + 0] = (byte)(bTotal / numPixelsAveraged); + pixelValues[baseIdx + 1] = (byte)(gTotal / numPixelsAveraged); + pixelValues[baseIdx + 2] = (byte)(rTotal / numPixelsAveraged); + pixelValues[baseIdx + 3] = (byte)(aTotal / numPixelsAveraged); + + if ((x & 0xFF) == 0 && Time.realtimeSinceStartup - startTime > processingTimePerFrame) + { + yield return null; // Wait until next frame + startTime = Time.realtimeSinceStartup; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/CapturePanorama/CapturePanorama.cs.meta b/Assets/CapturePanorama/CapturePanorama.cs.meta new file mode 100644 index 0000000..867b0eb --- /dev/null +++ b/Assets/CapturePanorama/CapturePanorama.cs.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 0b4a67630b216244f95a642a898628e1 +timeCreated: 1438629271 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: + - startSound: {fileID: 8300000, guid: 3b7a828a646174088aa48ee1db9c439c, type: 3} + - doneSound: {fileID: 8300000, guid: a22b8c429f521429084d616c68dda19a, type: 3} + - failSound: {fileID: 8300000, guid: b4ed406e6e315450f85fa2c0f65bce01, type: 3} + - fadeMaterial: {fileID: 2100000, guid: e642b458f4453e04ab7e2b711c58db98, type: 2} + - convertPanoramaShader: {fileID: 7200000, guid: 3f65e701d3d2eb0419c22d8a8f17431c, + type: 3} + - convertPanoramaStereoShader: {fileID: 7200000, guid: 3e480fbf28fbc684f8fe9ab2cef9dae1, + type: 3} + - textureToBufferShader: {fileID: 7200000, guid: d1cd5a67a32f22748a935ca069e561c0, + type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Compute Shaders.meta b/Assets/CapturePanorama/Compute Shaders.meta new file mode 100644 index 0000000..1984fe0 --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 376a7f47127e3134bab061cb12f146f8 +folderAsset: yes +timeCreated: 1438620153 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaShader.compute b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaShader.compute new file mode 100644 index 0000000..2152618 --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaShader.compute @@ -0,0 +1,275 @@ +#pragma kernel CubeMapToEquirectangular +#pragma kernel CubeMapToEquirectangularPositiveY +#pragma kernel CubeMapToEquirectangularNegativeY + +RWStructuredBuffer result; +StructuredBuffer cameraPixels; +SamplerState MyLinearClampSampler; +uint equirectangularWidth; +uint equirectangularHeight; +uint ssaaFactor; +uint cameraWidth; +uint cameraHeight; +uint startY; +uint sliceHeight; +uint cameraPixelsSentinelIdx; +uint sentinelIdx; + +[numthreads(32,32,1)] // Must match threadsX, threadsY in CapturePanorama.cs +void CubeMapToEquirectangular (uint3 dtid : SV_DispatchThreadID) +{ + if (dtid.x >= equirectangularWidth || dtid.y >= sliceHeight) // In case width/height not multiple of numthreads + return; + if (dtid.x == 0u && dtid.y == 0u) + result[sentinelIdx] = cameraPixels[cameraPixelsSentinelIdx]; // Sentinel value - set correctly only if set correctly in input buffer + + // Must match enum UnityEngine.CubemapFace + static const uint PositiveX = 0u; + static const uint NegativeX = 1u; + static const uint PositiveY = 2u; + static const uint NegativeY = 3u; + static const uint PositiveZ = 4u; + static const uint NegativeZ = 5u; + + static const float pi = 3.14159265f; + float4 totalColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + + uint2 pos = uint2(dtid.x, dtid.y + startY); + uint2 loopStart = pos * ssaaFactor; + uint2 loopEnd = loopStart + uint2(ssaaFactor, ssaaFactor); + + for (uint y = loopStart.y; y < loopEnd.y; y++) + { + for (uint x = loopStart.x; x < loopEnd.x; x++) + { + float xcoord = (float)x / (equirectangularWidth * ssaaFactor); + float ycoord = (float)y / (equirectangularHeight * ssaaFactor); + float latitude = (ycoord - 0.5f) * pi; + float longitude = (xcoord * 2.0f - 1.0f) * pi; + + float cosLat = cos(latitude); + float equirectRayDirectionX = cosLat * sin (longitude); + float equirectRayDirectionY = sin (latitude); + float equirectRayDirectionZ = cosLat * cos (longitude); + + float distance; + float u, v; + uint cameraNum; + + distance = 1.0f / equirectRayDirectionY; + u = equirectRayDirectionX * distance; v = equirectRayDirectionZ * distance; + if (u * u <= 1.0f && v * v <= 1.0f) { + if (equirectRayDirectionY > 0.0f) { + cameraNum = PositiveY; + } else { + u = -u; + cameraNum = NegativeY; + } + } + else + { + distance = 1.0f / equirectRayDirectionX; + u = -equirectRayDirectionZ * distance; v = equirectRayDirectionY * distance; + if (u * u <= 1.0f && v * v <= 1.0f) { + if (equirectRayDirectionX > 0.0f) { + v = -v; + cameraNum = PositiveX; + } else { + cameraNum = NegativeX; + } + } + else + { + distance = 1.0f / equirectRayDirectionZ; + u = equirectRayDirectionX * distance; v = equirectRayDirectionY * distance; + if (u * u <= 1.0f && v * v <= 1.0f) { + if (equirectRayDirectionZ > 0.0f) { + v = -v; + cameraNum = PositiveZ; + } else { + cameraNum = NegativeZ; + } + } + } + } + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + // GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + + u *= cameraWidth; + v *= cameraHeight; + uint left = min(cameraWidth - 1u, (uint)floor(u)); // Modified to add check + uint right = min(cameraWidth - 1u, left + 1u); + uint top = min(cameraHeight - 1u, (uint)floor(v)); // Modified to add check + uint bottom = min(cameraHeight - 1u, top + 1u); + float uFrac = frac(u); + float vFrac = frac(v); + + uint baseIdx = cameraNum * cameraWidth * cameraHeight; + uint topRow = baseIdx + top * cameraWidth; + uint bottomRow = baseIdx + bottom * cameraWidth; + uint topLeft = cameraPixels[topRow + left ]; + uint topRight = cameraPixels[topRow + right]; + uint bottomLeft = cameraPixels[bottomRow + left ]; + uint bottomRight = cameraPixels[bottomRow + right]; + + float r = lerp(lerp( topLeft >> 16u , bottomLeft >> 16u , vFrac), + lerp( topRight >> 16u , bottomRight >> 16u , vFrac), uFrac); + float g = lerp(lerp((topLeft >> 8u) & 0xFFu, (bottomLeft >> 8u) & 0xFFu, vFrac), + lerp((topRight >> 8u) & 0xFFu, (bottomRight >> 8u) & 0xFFu, vFrac), uFrac); + float b = lerp(lerp( topLeft & 0xFFu, bottomLeft & 0xFFu, vFrac), + lerp( topRight & 0xFFu, bottomRight & 0xFFu, vFrac), uFrac); + + totalColor += float4(r, g, b, 255.0f); + } + } + + totalColor /= ssaaFactor * ssaaFactor; + result[(dtid.y * equirectangularWidth) + dtid.x] = + ((uint)totalColor.r << 16u) | ((uint)totalColor.g << 8u) | (uint)totalColor.b; +} + +[numthreads(32,32,1)] // Must match threadsX, threadsY in CapturePanorama.cs +void CubeMapToEquirectangularPositiveY (uint3 dtid : SV_DispatchThreadID) +{ + if (dtid.x >= equirectangularWidth || dtid.y >= sliceHeight) // In case width/height not multiple of numthreads + return; + if (dtid.x == 0u && dtid.y == 0u) + result[sentinelIdx] = cameraPixels[cameraPixelsSentinelIdx]; // Sentinel value - set correctly only if set correctly in input buffer + + static const uint cameraNum = 2; /* PositiveY */ + static const float pi = 3.14159265f; + float4 totalColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + + uint2 pos = uint2(dtid.x, dtid.y + startY); + uint2 loopStart = pos * ssaaFactor; + uint2 loopEnd = loopStart + uint2(ssaaFactor, ssaaFactor); + + for (uint y = loopStart.y; y < loopEnd.y; y++) + { + for (uint x = loopStart.x; x < loopEnd.x; x++) + { + float xcoord = (float)x / (equirectangularWidth * ssaaFactor); + float ycoord = (float)y / (equirectangularHeight * ssaaFactor); + float latitude = (ycoord - 0.5f) * pi; + float longitude = (xcoord * 2.0f - 1.0f) * pi; + + float cosLat = cos(latitude); + float equirectRayDirectionX = cosLat * sin (longitude); + float equirectRayDirectionY = sin (latitude); + float equirectRayDirectionZ = cosLat * cos (longitude); + + float distance = 1.0f / equirectRayDirectionY; + float u = equirectRayDirectionX * distance, v = equirectRayDirectionZ * distance; + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + // GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + + u *= cameraWidth; + v *= cameraHeight; + uint left = (uint)floor(u); + uint right = min(cameraWidth - 1u, left + 1u); + uint top = (uint)floor(v); + uint bottom = min(cameraHeight - 1u, top + 1u); + float uFrac = frac(u); + float vFrac = frac(v); + + uint baseIdx = cameraNum * cameraWidth * cameraHeight; + uint topRow = baseIdx + top * cameraWidth; + uint bottomRow = baseIdx + bottom * cameraWidth; + uint topLeft = cameraPixels[topRow + left ]; + uint topRight = cameraPixels[topRow + right]; + uint bottomLeft = cameraPixels[bottomRow + left ]; + uint bottomRight = cameraPixels[bottomRow + right]; + + float r = lerp(lerp( topLeft >> 16u , bottomLeft >> 16u , vFrac), + lerp( topRight >> 16u , bottomRight >> 16u , vFrac), uFrac); + float g = lerp(lerp((topLeft >> 8u) & 0xFFu, (bottomLeft >> 8u) & 0xFFu, vFrac), + lerp((topRight >> 8u) & 0xFFu, (bottomRight >> 8u) & 0xFFu, vFrac), uFrac); + float b = lerp(lerp( topLeft & 0xFFu, bottomLeft & 0xFFu, vFrac), + lerp( topRight & 0xFFu, bottomRight & 0xFFu, vFrac), uFrac); + + totalColor += float4(r, g, b, 255.0f); + } + } + + totalColor /= ssaaFactor * ssaaFactor; + result[(dtid.y * equirectangularWidth) + dtid.x] = + ((uint)totalColor.r << 16u) | ((uint)totalColor.g << 8u) | (uint)totalColor.b; +} + +[numthreads(32,32,1)] // Must match threadsX, threadsY in CapturePanorama.cs +void CubeMapToEquirectangularNegativeY (uint3 dtid : SV_DispatchThreadID) +{ + if (dtid.x >= equirectangularWidth || dtid.y >= sliceHeight) // In case width/height not multiple of numthreads + return; + if (dtid.x == 0u && dtid.y == 0u) + result[sentinelIdx] = cameraPixels[cameraPixelsSentinelIdx]; // Sentinel value - set correctly only if set correctly in input buffer + + static const uint cameraNum = 3; /* NegativeY */ + static const float pi = 3.14159265f; + float4 totalColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + + uint2 pos = uint2(dtid.x, dtid.y + startY); + uint2 loopStart = pos * ssaaFactor; + uint2 loopEnd = loopStart + uint2(ssaaFactor, ssaaFactor); + + for (uint y = loopStart.y; y < loopEnd.y; y++) + { + for (uint x = loopStart.x; x < loopEnd.x; x++) + { + float xcoord = (float)x / (equirectangularWidth * ssaaFactor); + float ycoord = (float)y / (equirectangularHeight * ssaaFactor); + float latitude = (ycoord - 0.5f) * pi; + float longitude = (xcoord * 2.0f - 1.0f) * pi; + + float cosLat = cos(latitude); + float equirectRayDirectionX = cosLat * sin (longitude); + float equirectRayDirectionY = sin (latitude); + float equirectRayDirectionZ = cosLat * cos (longitude); + + float distance = 1.0f / equirectRayDirectionY; + float u = equirectRayDirectionX * distance, v = equirectRayDirectionZ * distance; + u = -u; + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + // GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + + u *= cameraWidth; + v *= cameraHeight; + uint left = (uint)floor(u); + uint right = min(cameraWidth - 1u, left + 1u); + uint top = (uint)floor(v); + uint bottom = min(cameraHeight - 1u, top + 1u); + float uFrac = frac(u); + float vFrac = frac(v); + + uint baseIdx = cameraNum * cameraWidth * cameraHeight; + uint topRow = baseIdx + top * cameraWidth; + uint bottomRow = baseIdx + bottom * cameraWidth; + uint topLeft = cameraPixels[topRow + left ]; + uint topRight = cameraPixels[topRow + right]; + uint bottomLeft = cameraPixels[bottomRow + left ]; + uint bottomRight = cameraPixels[bottomRow + right]; + + float r = lerp(lerp( topLeft >> 16u , bottomLeft >> 16u , vFrac), + lerp( topRight >> 16u , bottomRight >> 16u , vFrac), uFrac); + float g = lerp(lerp((topLeft >> 8u) & 0xFFu, (bottomLeft >> 8u) & 0xFFu, vFrac), + lerp((topRight >> 8u) & 0xFFu, (bottomRight >> 8u) & 0xFFu, vFrac), uFrac); + float b = lerp(lerp( topLeft & 0xFFu, bottomLeft & 0xFFu, vFrac), + lerp( topRight & 0xFFu, bottomRight & 0xFFu, vFrac), uFrac); + + totalColor += float4(r, g, b, 255.0f); + } + } + + totalColor /= ssaaFactor * ssaaFactor; + result[(dtid.y * equirectangularWidth) + dtid.x] = + ((uint)totalColor.r << 16u) | ((uint)totalColor.g << 8u) | (uint)totalColor.b; +} diff --git a/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaShader.compute.meta b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaShader.compute.meta new file mode 100644 index 0000000..6bb4241 --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaShader.compute.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3f65e701d3d2eb0419c22d8a8f17431c +timeCreated: 1437349860 +licenseType: Store +ComputeShaderImporter: + currentBuildTarget: 5 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaStereoShader.compute b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaStereoShader.compute new file mode 100644 index 0000000..52a6d0e --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaStereoShader.compute @@ -0,0 +1,256 @@ +#pragma kernel RenderStereo + +RWStructuredBuffer result; +RWStructuredBuffer forceWaitResultBuffer; +StructuredBuffer cameraPixels; +uint equirectangularWidth; +uint equirectangularHeight; +uint ssaaFactor; +uint cameraWidth; +uint cameraHeight; +float tanHalfHFov, tanHalfVFov, hFovAdjust, vFovAdjust, interpupillaryDistance, circleRadius; +uint numCirclePoints; +uint circlePointStart, circlePointEnd, circlePointCircularBufferStart, circlePointCircularBufferSize; +uint leftRightPass; +uint forceWaitValue; +uint cameraPixelsSentinelIdx; + +[numthreads(32,32,1)] // Must match threadsX, threadsY in CapturePanorama.cs +void RenderStereo (uint3 dtid : SV_DispatchThreadID) +{ + if (dtid.x >= equirectangularWidth || dtid.y >= equirectangularHeight) // In case width/height not multiple of numthreads + return; + if (dtid.x == equirectangularWidth - 1 && dtid.y == equirectangularHeight - 1 && dtid.z == 1) + { + forceWaitResultBuffer[0] = forceWaitValue; // Used on CPU side to force a wait for this operation to complete + result[equirectangularWidth * equirectangularHeight * 2] = + cameraPixels[cameraPixelsSentinelIdx]; // Sentinel value - set correctly only if set correctly in input buffer + } + + static const float pi = 3.14159265f; + uint2 pos = dtid.xy; + uint2 loopStart = pos * ssaaFactor; + uint2 loopEnd = loopStart + uint2(ssaaFactor, ssaaFactor); + + uint i = dtid.z; + + float4 totalColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + + for (uint y = loopStart.y; y < loopEnd.y; y++) + { + for (uint x = loopStart.x; x < loopEnd.x; x++) + { + float xcoord = (float)x / (equirectangularWidth * ssaaFactor); + float ycoord = (float)y / (equirectangularHeight * ssaaFactor); + + float latitude = (ycoord - 0.5f) * pi; + float sinLat, cosLat; + sincos(latitude, sinLat, cosLat); + + float longitude = (xcoord * 2.0f - 1.0f) * pi; + float sinLong, cosLong; + sincos(longitude, sinLong, cosLong); + + // Scale IPD down as latitude moves toward poles to avoid discontinuities + float latitudeNormalized = latitude / (pi / 2.0f); // Map to [-1, 1] + + // float ipdScale = 1.0f; + // float ipdScale = 1.0f - latitudeNormalized * latitudeNormalized; + float ipdScale = 1.5819767068693265f * exp(-latitudeNormalized * latitudeNormalized) - 0.5819767068693265f; + // float ipdScale = 1.1565176427496657f * exp(-2.0f * latitudeNormalized * latitudeNormalized) - 0.15651764274966568f; + // float ipdScale = 1.0000454019910097f * exp(-10.0f * latitudeNormalized * latitudeNormalized) - 0.00004540199100968779f; + + float scaledEyeRadius = ipdScale * interpupillaryDistance / 2.0f; + + // The following is equivalent to: + // Quaternion eyesRotation = Quaternion.Euler(0.0f, longitude * 360.0f / (2 * pi), 0.0f); + // float3 initialEyePosition = (i == 0 ? float3.left : float3.right) * scaledEyeRadius; + // float3 pos = eyesRotation * initialEyePosition; // eye position + // float3 dir = eyesRotation * float3.forward; // gaze direction + + float3 dir = float3(sinLong, 0.0f, cosLong); + + // Find place on circle where gaze ray crosses circle. + // Simplest way to do this is solve it geometrically assuming longitude=0, then rotate. + float angle = (pi/2.0f - acos(scaledEyeRadius/circleRadius)); + if (i == 0) angle = -angle; + float circlePointAngle = longitude + angle; + if (circlePointAngle < 0.0f) circlePointAngle += 2 * pi; + if (circlePointAngle >= 2 * pi) circlePointAngle -= 2 * pi; + + float circlePointNumber = circlePointAngle / (2 * pi) * numCirclePoints; + uint circlePoint0 = (uint)floor(circlePointNumber); + if (circlePoint0 < circlePointStart) + circlePoint0 += numCirclePoints; // Deal with an edge case when doing final slice with SSAA > 1 + if (circlePoint0 < circlePointStart || circlePoint0 + 1 >= circlePointEnd) + return; + + uint cameraNum; + float u, v; + + float ipdScaleLerp = 1.0f - ipdScale * 5.0f; // Scale [0, 0.2] to [0, 1] and reverse + + // Top/bottom cap + float4 colorCap = float4(0, 0, 0, 0); + if (ipdScaleLerp > 0.0f) + { + float equirectRayDirectionX = cosLat * sinLong; + float equirectRayDirectionY = sinLat; + float equirectRayDirectionZ = cosLat * cosLong; + float distance = 1.0f / equirectRayDirectionY; + u = equirectRayDirectionX * distance; v = equirectRayDirectionZ * distance; + if (u * u <= 1 && v * v <= 1) + { + if (equirectRayDirectionY > 0.0f) + { + cameraNum = 0; + } + else + { + u = -u; + cameraNum = 1; + } + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + // GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + + u *= cameraWidth; + v *= cameraHeight; + uint left = (uint)floor(u); + uint right = min(cameraWidth - 1, left + 1); + uint top = (uint)floor(v); + uint bottom = min(cameraHeight - 1, top + 1); + float uFrac = frac(u); + float vFrac = frac(v); + + uint baseIdx = cameraNum * cameraWidth * cameraHeight; + uint topRow = baseIdx + top * cameraWidth; + uint bottomRow = baseIdx + bottom * cameraWidth; + uint topLeft = cameraPixels[topRow + left ]; + uint topRight = cameraPixels[topRow + right]; + uint bottomLeft = cameraPixels[bottomRow + left ]; + uint bottomRight = cameraPixels[bottomRow + right]; + + float r = lerp(lerp( topLeft >> 16 , bottomLeft >> 16 , vFrac), + lerp( topRight >> 16 , bottomRight >> 16 , vFrac), uFrac); + float g = lerp(lerp((topLeft >> 8) & 0xFF, (bottomLeft >> 8) & 0xFF, vFrac), + lerp((topRight >> 8) & 0xFF, (bottomRight >> 8) & 0xFF, vFrac), uFrac); + float b = lerp(lerp( topLeft & 0xFF, bottomLeft & 0xFF, vFrac), + lerp( topRight & 0xFF, bottomRight & 0xFF, vFrac), uFrac); + + float4 col = float4(r, g, b, 255.0f); + colorCap = col; + } + } + + float4 color0 = float4(0, 0, 0, 0), color1 = float4(0, 0, 0, 0); + for (uint j=0; j < 2; j++) + { + uint circlePointIdx = (circlePoint0 + j) % numCirclePoints; + float cameraPointAngle = 2 * pi * circlePointIdx / numCirclePoints; + float sinCameraPointAngle, cosCameraPointAngle; + sincos(cameraPointAngle, sinCameraPointAngle, cosCameraPointAngle); + + // Equivalent to (using fact that both dir and circlePointNorm are unit vectors): + // Quaternion circlePointRotation = Quaternion.Euler(0.0f, cameraPointAngle * 360.0f / (2 * pi), 0.0f); + // float3 circlePointNormal = circlePointRotation * float3.forward; + // float newLongitudeDegrees = sign(cross(circlePointNormal, dir).y) * angle(circlePointNormal, dir); + + // Clamp here avoids numerical out-of-bounds trouble when circlePointAngle = longitude + float newLongitude = sign(dir.x * cosCameraPointAngle - dir.z * sinCameraPointAngle) * + acos(clamp(dir.z * cosCameraPointAngle + dir.x * sinCameraPointAngle, -1.0f, 1.0f)); + float sinNewLong, cosNewLong; + sincos(newLongitude, sinNewLong, cosNewLong); + + // Select which of the two cameras for this point to use and adjust ray to make camera plane perpendicular to axes + // 2 + because first two are top/bottom + uint cameraNumBase = 2 + ((circlePoint0 + j + circlePointCircularBufferStart - circlePointStart) % circlePointCircularBufferSize) * 2; + + float3 textureRayDirAdjusted; + + if (leftRightPass) + { + cameraNum = cameraNumBase + (newLongitude >= 0.0f ? 1 : 0); + + float longitudeAdjust = (newLongitude >= 0.0f ? -hFovAdjust : hFovAdjust); + float longSum = newLongitude + longitudeAdjust; + float sinLongSum, cosLongSum; + sincos(longSum, sinLongSum, cosLongSum); + + // Equivalent to: + // float3 textureRayDir = Quaternion.Euler(-latitude * 360.0f / (2 * pi), newLongitude * 360.0f / (2 * pi), 0.0f) * float3.forward; + // float3 textureRayDirAdjusted = Quaternion.Euler(0.0f, longitudeAdjust * 360.0f / (2 * pi), 0.0f) * textureRayDir; + textureRayDirAdjusted = float3(cosLat * sinLongSum, sinLat, cosLat * cosLongSum); + // float3 textureRayDirAdjusted = float3( + // sin(latitude + newLongitude + longitudeAdjust) - sinLat * cosLongSum, + // sinLat, + // cos(latitude + newLongitude + longitudeAdjust) + sinLat * sinLongSum); + } + else // if (!leftRightPass) + { + cameraNum = cameraNumBase + (latitude >= 0.0f ? 1 : 0); + float latitudeAdjust = (latitude >= 0.0f ? vFovAdjust : -vFovAdjust); + float sinLatAdjust, cosLatAdjust; + sincos(latitudeAdjust, sinLatAdjust, cosLatAdjust); + + // Equivalent to: + // textureRayDirAdjusted = Quaternion.Euler(latitudeAdjust * 360.0f / (2 * pi), 0.0f, 0.0f) * textureRayDir; + + textureRayDirAdjusted = float3(cosLat * sinNewLong, + cosLatAdjust * sinLat - cosLat * cosNewLong * sinLatAdjust, + sinLatAdjust * sinLat + cosLat * cosNewLong * cosLatAdjust); + } + + u = textureRayDirAdjusted.x / textureRayDirAdjusted.z / tanHalfHFov; + v = -textureRayDirAdjusted.y / textureRayDirAdjusted.z / tanHalfVFov; + + if (! (textureRayDirAdjusted.z > 0.0f && u * u <= 1.0f && v * v <= 1.0f) ) + return; + + u = (u + 1.0f) * 0.5f; + v = (v + 1.0f) * 0.5f; + + // GetCameraPixelBilinear(cameraPixels, cameraNum, u, v); + + u *= cameraWidth; + v *= cameraHeight; + uint left = (uint)floor(u); + uint right = min(cameraWidth - 1, left + 1); + uint top = (uint)floor(v); + uint bottom = min(cameraHeight - 1, top + 1); + float uFrac = frac(u); + float vFrac = frac(v); + + uint baseIdx = cameraNum * cameraWidth * cameraHeight; + uint topRow = baseIdx + top * cameraWidth; + uint bottomRow = baseIdx + bottom * cameraWidth; + uint topLeft = cameraPixels[topRow + left ]; + uint topRight = cameraPixels[topRow + right]; + uint bottomLeft = cameraPixels[bottomRow + left ]; + uint bottomRight = cameraPixels[bottomRow + right]; + + float r = lerp(lerp( topLeft >> 16 , bottomLeft >> 16 , vFrac), + lerp( topRight >> 16 , bottomRight >> 16 , vFrac), uFrac); + float g = lerp(lerp((topLeft >> 8) & 0xFF, (bottomLeft >> 8) & 0xFF, vFrac), + lerp((topRight >> 8) & 0xFF, (bottomRight >> 8) & 0xFF, vFrac), uFrac); + float b = lerp(lerp( topLeft & 0xFF, bottomLeft & 0xFF, vFrac), + lerp( topRight & 0xFF, bottomRight & 0xFF, vFrac), uFrac); + + float4 col = float4(r, g, b, 255.0f); + if (j == 0) color0 = col; else color1 = col; + } + + float4 c = lerp(color0, color1, frac(circlePointNumber)); + if (colorCap.a > 0.0f && ipdScaleLerp > 0.0f) + c = lerp(c, colorCap, ipdScaleLerp); + + totalColor += float4(c.r, c.g, c.b, 255.0f); + } + } + + totalColor /= ssaaFactor * ssaaFactor; + result[((dtid.y + equirectangularHeight * i) * equirectangularWidth) + dtid.x] = + ((uint)totalColor.r << 16) | ((uint)totalColor.g << 8) | (uint)totalColor.b; +} diff --git a/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaStereoShader.compute.meta b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaStereoShader.compute.meta new file mode 100644 index 0000000..0b04a59 --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders/ConvertPanoramaStereoShader.compute.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3e480fbf28fbc684f8fe9ab2cef9dae1 +timeCreated: 1438073809 +licenseType: Store +ComputeShaderImporter: + currentBuildTarget: 5 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Compute Shaders/TextureToBufferShader.compute b/Assets/CapturePanorama/Compute Shaders/TextureToBufferShader.compute new file mode 100644 index 0000000..648c4d2 --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders/TextureToBufferShader.compute @@ -0,0 +1,30 @@ +// Each #kernel tells which function to compile; you can have many kernels +#pragma kernel TextureToBuffer + +Texture2D source; +RWStructuredBuffer result; +RWStructuredBuffer forceWaitResultBuffer; +uint width, height; +SamplerState MyPointRepeatSampler; +uint startIdx; +uint sentinelIdx; +uint forceWaitValue; +float gamma; + +[numthreads(32,32,1)] // Must match threadsX, threadsY in CapturePanorama.cs +void TextureToBuffer (uint3 id : SV_DispatchThreadID) +{ + if (id.x >= width || id.y >= height) // In case width/height not multiple of numthreads + return; + + float4 color = source.SampleLevel(MyPointRepeatSampler, float2(((float)id.x + 0.5)/ width, ((float)id.y + 0.5)/ height), 0); + color = pow(color, gamma); + color *= 255.0; + result[startIdx + (id.y * width) + id.x] = ((int)color.r << 16u) | ((int)color.g << 8u) | (int)color.b; + + if (id.x == width - 1u && id.y == height - 1u && id.z == 0u) + { + forceWaitResultBuffer[0] = forceWaitValue; // Used on CPU side to force a wait for this operation to complete + result[sentinelIdx] = 1419455993u; // Sentinel value - must match BufferSentinelValue in CapturePanorama.cs + } +} diff --git a/Assets/CapturePanorama/Compute Shaders/TextureToBufferShader.compute.meta b/Assets/CapturePanorama/Compute Shaders/TextureToBufferShader.compute.meta new file mode 100644 index 0000000..8750583 --- /dev/null +++ b/Assets/CapturePanorama/Compute Shaders/TextureToBufferShader.compute.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d1cd5a67a32f22748a935ca069e561c0 +timeCreated: 1438086409 +licenseType: Store +ComputeShaderImporter: + currentBuildTarget: 5 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Config.meta b/Assets/CapturePanorama/Config.meta new file mode 100644 index 0000000..0e28b6d --- /dev/null +++ b/Assets/CapturePanorama/Config.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 01a5855c27b89474b989c86d9d005661 +folderAsset: yes +timeCreated: 1438621068 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Config/CapturePanorama.ini b/Assets/CapturePanorama/Config/CapturePanorama.ini new file mode 100644 index 0000000..f1602d0 --- /dev/null +++ b/Assets/CapturePanorama/Config/CapturePanorama.ini @@ -0,0 +1,22 @@ +Panorama Name= +Capture Key=P +Image Format=PNG +Capture Stereoscopic=false +Interpupillary Distance=0.0635 +Num Circle Points=128 +Panorama Width=8192 +Anti Aliasing=8 +Ssaa Factor=1 +Save Image Path= +Save Cubemap=false +Upload Images=false +Use Default Orientation=false +Use Gpu Transform=true +Cpu Milliseconds Per Frame=8.33333 +Capture Every Frame=false +Frame Rate=30 +Max Frames To Record= +Frame Number Digits=6 +Fade During Capture=true +Fade Time=0.25 +Enable Debugging=false diff --git a/Assets/CapturePanorama/Config/CapturePanorama.ini.meta b/Assets/CapturePanorama/Config/CapturePanorama.ini.meta new file mode 100644 index 0000000..5e50b14 --- /dev/null +++ b/Assets/CapturePanorama/Config/CapturePanorama.ini.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e752742b4f609e8469983b80636c062c +timeCreated: 1437749012 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Managed Plugins.meta b/Assets/CapturePanorama/Managed Plugins.meta new file mode 100644 index 0000000..2ce6141 --- /dev/null +++ b/Assets/CapturePanorama/Managed Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d5fc87615e05da54a956512369366f6b +folderAsset: yes +timeCreated: 1438621051 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Managed Plugins/System.Drawing.dll b/Assets/CapturePanorama/Managed Plugins/System.Drawing.dll new file mode 100644 index 0000000..e81ac4b --- /dev/null +++ b/Assets/CapturePanorama/Managed Plugins/System.Drawing.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e10aad975c903f5881885eedf9e3742dca889038253bb97038d011dd4463c6bf +size 630784 diff --git a/Assets/CapturePanorama/Managed Plugins/System.Drawing.dll.meta b/Assets/CapturePanorama/Managed Plugins/System.Drawing.dll.meta new file mode 100644 index 0000000..79ade79 --- /dev/null +++ b/Assets/CapturePanorama/Managed Plugins/System.Drawing.dll.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: ab398dea78c472c4688bea711055aa56 +timeCreated: 1433641128 +licenseType: Store +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Materials.meta b/Assets/CapturePanorama/Materials.meta new file mode 100644 index 0000000..9b26473 --- /dev/null +++ b/Assets/CapturePanorama/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ff9f323c0a0c77f46aa25cf5b93e45b7 +folderAsset: yes +timeCreated: 1438620635 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Materials/Fade material.mat b/Assets/CapturePanorama/Materials/Fade material.mat new file mode 100644 index 0000000..3aec47e Binary files /dev/null and b/Assets/CapturePanorama/Materials/Fade material.mat differ diff --git a/Assets/CapturePanorama/Materials/Fade material.mat.meta b/Assets/CapturePanorama/Materials/Fade material.mat.meta new file mode 100644 index 0000000..dfd382d --- /dev/null +++ b/Assets/CapturePanorama/Materials/Fade material.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e642b458f4453e04ab7e2b711c58db98 +timeCreated: 1432201072 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/README.txt b/Assets/CapturePanorama/README.txt new file mode 100644 index 0000000..5350d53 --- /dev/null +++ b/Assets/CapturePanorama/README.txt @@ -0,0 +1,192 @@ +Unity Script: 360 Panorama Capture +Version 1.3 - 2015 August 2 (Unity 5.1.2f1) + +Captures a 360-degree panorama of the player's in-game surroundings and saves/uploads it for later viewing. + +Requirements: This plugin currently requires Unity 5.x and a system supporting compute shaders. On PC, compute shaders require DirectX 11, Windows Vista or later, and a recent GPU capable of Shader Model 5.0. + +CAPTURING 360 IMAGES +-------------------- + +1. Create an empty game object and add the Capture Panorama script (CapturePanorama.cs) to it. +2. Under Edit->Project Settings->Player->Other Settings->Optimization, set "Api Compatibility Level" from ".NET 2.0 Subset" to ".NET 2.0". If you don't do this, the script will work in editor but not in builds. +3. If your application is a VR application using the old Oculus VR plugin, uncomment the line "#define OVR_SUPPORT" at the top of CapturePanorama.cs. If you are using Unity native VR support (with or without Oculus Utils), this is unnecessary. +4. Run your application. Press P to capture a panorama. A sound will play and the screen will fade to black. When it completes, a second sound will play and an 8192x4096 PNG file will be saved in the application directory. You can capture programmatically with CaptureScreenshotAsync(). +5. When you're ready, check the "Upload image" property to automatically upload all screenshots to the VRCHIVE panorama sharing website (http://alpha.vrchive.org). + +If the procedure does not complete as expected, check the "Enable Debugging" property on the Capture Panorama script, build and run the application, and then send the resulting image if any and "output_log.txt" file from your data directory to the developer (eVRydayVR@gmail.com). + +RECORDING 360 VIDEOS +-------------------- + +As of version 1.2, the "Capture Every Frame" option can be used to create 360 videos suitable for uploading to providers such as YouTube and Vrideo, or for viewing in Virtual Desktop or Gear VR. Steps follow. + +Preparation: +* Make sure your application is able to run correctly when "Time.captureFramerate" is set to your desired video frame rate. Modify code which depends on the real clock time, e.g. waiting for a certain amount of time to pass, or waiting for audio events to complete, to instead use Time.deltaTime in Update(). +* If you wish to capture gameplay and do not want to play the game at reduced frame rate during recording, implementing a replay system is recommended. This will also be useful for capturing the audio below. + +Capture: + +We will capture an image file for each frame of the video. + +1. Check "Capture Every Frame" and enter the desired frame for capture in "Frame Rate". +2. The "BMP" image format provides the fastest capture. "PNG" will use less disk space. +3. Set "Save Image Path" to a fast disk with sufficient capacity for the raw video frames. +4. Set "Panorama Width" to the desired width of your video. Test your playback environment to ensure it supports the video size. Typically mono uses 4096 or 3840 and stereo uses 2048, 2160, 2880, or 3048. +5. Enable "Use Gpu Transform". Disable "Save Cubemap" unless you want cube map images for each frame. +6. For highest quality with slower encoding, increase "Ssaa Factor" to 2, 3, or 4. +7. Start the application and use the capture hotkey ("P" by default) to toggle between capturing and not capturing. You can also programmatically call StartCaptureEveryFrame() and StopCaptureEveryFrame(). +8. Run the same scene again at normal speed and use any recording software to separately record the audio. + +Creating video: + +Install ffmpeg, add it to your path, and save the included asset "assemble.cmd" batch file with your image sequence. + +Example invocation of this script from the command line: + +assemble Test_2015-07-24_06-42-00-045_ bmp test.mp4 60 18 ultrafast + +The parameters are: +* The prefix and extension of each filename (e.g. in this case the filenames were of the form "Test_2015-07-24_06-42-00-045_000001.bmp"); +* The output filename; +* The output frame rate (should match the frame rate set during capture); +* The CRF quality, typical range 14 for very good with large file to 24 for mediocre with small file; +* The encoding preset which trades off encoding time and quality, with "ultrafast" producing the largest file the most quickly. This also avoids certain encoding failures. + +Alternatively, in Adobe Premiere Pro you can import the sequence directly using these instructions: + +https://helpx.adobe.com/premiere-pro/using/importing-still-images.html#import_numbered_still_image_sequences_as_video_clips + +Once the video is created, add the audio track and edit as desired. For viewing in Virtual Desktop on Windows 8, be sure to render the final video at H.264 Level 5.1. For viewing on Gear VR, ensure no dimension exceeds 2160. + +Encoding during capture will be added in future versions. + +REFERENCE +--------- + +Properties on the Capture Panorama script: + +* Panorama Name: Used as the prefix of the saved image filename. If "Upload Images" is enabled, this will appear in the title of the image on the web. + +* Quality Setting: Selects which of the quality settings (under Project Settings->Quality) to use during capture. Highest is recommended. Default is to use the player's current setting. + +* Capture Key (default "P"): the key to press to capture a 360 screenshot. If you wish to handle your own input, set this to "None" and invoke the CaptureScreenshotAsync() method from your script. If "Capture Every Frame" is enabled, this start and stop capturing of the image sequence. + +* Image Format (default PNG): Determines what format(s) to save/upload the image file in. JPEG produces smaller filesize but is much lower quality. BMP is faster to save than PNG but larger. + +* Capture Stereoscopic (default false): Captures a top/bottom (over/under) image suitable for stereoscopic (3D) viewing. May produce artifacts. Be sure to set Panorama Width, Interpupillary Distance, and Num Circle Points appropriately when enabling this option. + +* Interpupillary Distance (stereoscopic only): Distance between the eye pupils of the viewer in Unity units. Defaults to average IPD in meters from U.S. Army survey. + +* Num Circle Points (at least 8, stereoscopic only): Determines at how many points to capture the surroundings. Smaller values are faster while larger values reduce ghosting/doubling artifacts on nearby objects. A good starting point is Panorama Width divided by 32. Smaller values also counterintuitively require more graphics memory, while larger values require less. + +* Panorama Width (between 4 and 23800, default 8192): Determines width of the resulting panorama image. Height of the image will be half this in mono mode, or equal to this in stereo mode. Typical reasonable values are 4096 and 8192. Need not be a power of two. If this is too large, black bars may appear in output images, indicating graphics memory has been exhausted. + +* Anti Aliasing (default 8): Sets the MSAA anti-aliasing quality to use during rendering. Set to 1 if using deferred rendering. + +* Ssaa Factor (default 1): Set to a larger value such as 2, 3, or 4 to render at a higher resolution and then downsample to produce the final image. Produces superior anti-aliasing at a large performance cost. In stereoscopic mode, Ssaa Factor > 1 uses more graphics memory. + +* Save Image Path: Directory where screenshots will be saved. If blank, the root application directory will be used. + +* Save Cubemap (default off): Check to save the six captured cubemap images to disk. Some viewing software can view these directly. Will increase capture time. + +In stereoscopic mode this option will save all captured camera images (stereo cubemaps are not yet supported). The images saved will be first the bottom and top images, then for each circle point it will save 2 images, one turned left 45 degrees and one turned right 45 degrees. Then again for each circle point it will save 2 images, one turned up 45 degrees and one turned down 45 degrees. The viewing circle has diameter equal to IPD; the points are equally distributed starting at Z positive. + +* Upload Images (default off): Check to automatically publish panorama screenshots to VRCHIVE for sharing with others immediately after taking them. Visit alpha.vrchive.com to view them. Panoramas are currently uploaded anonymously (not under a user account). + +* Use Default Orientation (default off): Resets the camera to the default (directly forward) rotation/orientation before taking the screenshot. May interfere with correct compositing if you have multiple cameras with different rotations. In VR applications, this is usually unnecessary because the headset orientation is used instead to correct the camera orientation. + +* Use Gpu Transform (default on): Specifies whether to use the fast GPU-based shader to convert the captured cubemap to the final equirectangular image. + +* Cpu Milliseconds Per Frame: When "Use Gpu Transform" is disabled, this will determine the number of CPU milliseconds to spend each frame on processing the panorama. + +* Capture Every Frame (default off): When enabled, the Capture Key will start and stop the capturing of every frame to an image sequence. + +* Frame Rate (default 30): Sets the frame rate used during capturing when Capture Every Frame is enabled. Determines what Time.captureFramerate will be set to. + +* Max Frames To Record: If nonzero, will automatically stop after capturing this many frames. + +* Frame Number Digits: When Capture Every Frame is enabled, this determines the number of digits to use for the frame number in the filenames of the image sequence (default 6). If these digits are exceeded, more digits will be used as needed. + +* Start Sound: The sound played at the beginning of panorama processing. May be None. + +* Done Sound: The sound played at the end of panorama processing. May be None. + +* Fade During Capture: Whether to fade the screen to a solid color during capture. Helps to reduce simulator sickness, especially if Panorama Width is large. + +* Fade Time: How quickly to fade in/out. Affects total time needed for capture. A value of zero is not currently supported. + +* Fade Color: Solid color to fade the screen to during capture. + +* Fade Material: Material that will be placed in front of the camera during fade. + +* Enable Debugging: Shows debugging logs and time-to-capture on the console. + +CONFIG FILE +----------- + +The ReadPanoConfig script allows users to modify panorama capture parameters in a build without modifying the source Unity project. To use it: + +1. Add the ReadPanoConfig.cs script to the same object as the CapturePanorama.cs script. +2. After building, the first time the application is run, it will create "CapturePanorama.ini" in the data directory of the build, with settings initially equal to the settings specified in the Inspector for the Capture Panorama script. +3. To modify settings, modify the .ini file and restart the application. + +DEVELOPMENT NOTES +----------------- + +To extend the tool as needed for your application, you can subclass CapturePanorama.CapturePanorama and override virtual methods: + +* OnCaptureStart(): Called at the very beginning of each capture +* GetCaptureCameras(): Allows you to control the set of cameras rendered to produce the view +* BeforeRenderPanorama(): Called right before rendering camera views +* AfterRenderPanorama(): Called right after rendering camera views + +You can also provide your own MonoBehavior event handlers such as Start(), Update(), Awake(), etc. and then have them call the superclass version using "base.Start()", "base.Update()" etc. The use of subclassing will ease upgrading when future versions of the script are released. + +In scenes using the OVR plugin, the left eye will be used by default as the point of rendering. + +The package supports scenes with multiple cameras or OVR camera rigs, each with different culling masks. They will be composited based on depth to reproduce the player's view. + +In some cases the stereo camera may clip into surrounding objects. Reduce near clip or move the camera farther away to alleviate this. + +As of version 1.3 camera image effects will be reproduced. + +If you need to determine if a panorama capture is in process (e.g. to wait for the capture to complete), you can check the "Capturing" property. + +CREDITS +------- + +Developed by D Coetzee of eVRydayVR: http://youtube.com/user/eVRydayVR + +Funded by the panorama repository VRCHIVE: http://vrchive.com + +Default sound effects Clicks_13, Xylo_13, and DistClickBlocked1 from: +Free SFX Package - Bleep Blop Audio +https://www.assetstore.unity3d.com/en/#!/content/5178 + +LICENSE +------- +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to \ No newline at end of file diff --git a/Assets/CapturePanorama/README.txt.meta b/Assets/CapturePanorama/README.txt.meta new file mode 100644 index 0000000..e428fcf --- /dev/null +++ b/Assets/CapturePanorama/README.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ccb1bc2c1e41924f964f63490ad918a +timeCreated: 1433619554 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Scripts.meta b/Assets/CapturePanorama/Scripts.meta new file mode 100644 index 0000000..c284af2 --- /dev/null +++ b/Assets/CapturePanorama/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7ff819719ed240a48b07d539f2657cca +folderAsset: yes +timeCreated: 1438620459 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Scripts/Icosphere.cs b/Assets/CapturePanorama/Scripts/Icosphere.cs new file mode 100644 index 0000000..daea8c6 --- /dev/null +++ b/Assets/CapturePanorama/Scripts/Icosphere.cs @@ -0,0 +1,93 @@ +// This is free and unencumbered software released into the public domain. +// For more information, please refer to + +using System; +using UnityEngine; + +// Based on http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html +// Currently unused but planned for use with future features like seam-free mono capture. +namespace CapturePanorama +{ + public static class Icosphere + { + + // Use this for initialization + public static Mesh BuildIcosphere(float radius, int iterations) + { + Mesh result = BuildIcosahedron(radius); + for (int i = 0; i < iterations; i++) + Refine(result); + return result; + } + + public static Mesh BuildIcosahedron(float radius) // radius is distance to each vertex from origin + { + Mesh result = new Mesh(); + + // create 12 vertices of a icosahedron + float t = (float)((1.0 + Math.Sqrt(5.0)) / 2.0); + + Vector3[] vertices = new Vector3[] + { + new Vector3(-1.0f, t, 0.0f), + new Vector3( 1.0f, t, 0.0f), + new Vector3(-1.0f, -t, 0.0f), + new Vector3( 1.0f, -t, 0.0f), + + new Vector3( 0.0f, -1.0f, t), + new Vector3( 0.0f, 1.0f, t), + new Vector3( 0.0f, -1.0f, -t), + new Vector3( 0.0f, 1.0f, -t), + + new Vector3( t, 0.0f, -1.0f), + new Vector3( t, 0.0f, 1.0f), + new Vector3( -t, 0.0f, -1.0f), + new Vector3( -t, 0.0f, 1.0f), + }; + + float scale = radius / new Vector3(1.0f, t, 0.0f).magnitude; + for (int i = 0; i < vertices.Length; i++) + vertices[i] *= scale; + + result.vertices = vertices; + + result.triangles = new int[] + { + // 5 faces around point 0 + 0, 11, 5, + 0, 5, 1, + 0, 1, 7, + 0, 7, 10, + 0, 10, 11, + + // 5 adjacent faces + 1, 5, 9, + 5, 11, 4, + 11, 10, 2, + 10, 7, 6, + 7, 1, 8, + + // 5 faces around point 3 + 3, 9, 4, + 3, 4, 2, + 3, 2, 6, + 3, 6, 8, + 3, 8, 9, + + // 5 adjacent faces + 4, 9, 5, + 2, 4, 11, + 6, 2, 10, + 8, 6, 7, + 9, 8, 1, + }; + + return result; + } + + private static void Refine(Mesh m) + { + throw new Exception("TODO"); + } + } +} diff --git a/Assets/CapturePanorama/Scripts/Icosphere.cs.meta b/Assets/CapturePanorama/Scripts/Icosphere.cs.meta new file mode 100644 index 0000000..6d3fe21 --- /dev/null +++ b/Assets/CapturePanorama/Scripts/Icosphere.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0c30b5cc0105feb4a97840530aece901 +timeCreated: 1437825051 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Scripts/ImageEffectCopyCamera.cs b/Assets/CapturePanorama/Scripts/ImageEffectCopyCamera.cs new file mode 100644 index 0000000..03a8408 --- /dev/null +++ b/Assets/CapturePanorama/Scripts/ImageEffectCopyCamera.cs @@ -0,0 +1,83 @@ +// This is free and unencumbered software released into the public domain. +// For more information, please refer to + +using System; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; + +namespace CapturePanorama.Internals +{ + class ImageEffectCopyCamera : MonoBehaviour + { + public struct InstanceMethodPair { + public object Instance; + public MethodInfo Method; + } + public List onRenderImageMethods = new List(); + + public static List GenerateMethodList(Camera camToCopy) + { + var result = new List(); + foreach (var script in camToCopy.gameObject.GetComponents()) + { + if (script.enabled) + { + Type scriptType = script.GetType(); + MethodInfo m = scriptType.GetMethod("OnRenderImage", + BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, + new Type[] { typeof(RenderTexture), typeof(RenderTexture) }, null); + if (m != null) + { + InstanceMethodPair pair = new InstanceMethodPair(); + pair.Instance = script; + pair.Method = m; + result.Add(pair); + } + } + } + return result; + } + + RenderTexture[] temp = new RenderTexture[] { null, null }; + + void OnDestroy() + { + for (int i = 0; i < temp.Length; i++) + { + if (temp[i] != null) + Destroy(temp[i]); + temp[i] = null; + } + } + + void OnRenderImage(RenderTexture src, RenderTexture dest) + { + int desiredDepth = Math.Max(src.depth, dest.depth); + + for (int i = 0; i < temp.Length; i++) + { + if (onRenderImageMethods.Count > i + 1) + { + if (temp[i] != null && + (temp[i].width != dest.width || temp[i].height != dest.height || temp[i].depth != desiredDepth || temp[i].format != dest.format)) + { + Destroy(temp[i]); + temp[i] = null; + } + if (temp[i] == null) + temp[i] = new RenderTexture(dest.width, dest.height, desiredDepth, dest.format); + } + } + + var sequence = new List(); + sequence.Add(src); + for (int i = 0; i < onRenderImageMethods.Count - 1; i++) + sequence.Add(i % 2 == 0 ? temp[0] : temp[1]); + sequence.Add(dest); + + for (int i = 0; i < onRenderImageMethods.Count; i++) + onRenderImageMethods[i].Method.Invoke(onRenderImageMethods[i].Instance, new object[] { sequence[i], sequence[i + 1] }); + } + } +} diff --git a/Assets/CapturePanorama/Scripts/ImageEffectCopyCamera.cs.meta b/Assets/CapturePanorama/Scripts/ImageEffectCopyCamera.cs.meta new file mode 100644 index 0000000..2696e2c --- /dev/null +++ b/Assets/CapturePanorama/Scripts/ImageEffectCopyCamera.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 89b4b90d697c75942976465b0500b667 +timeCreated: 1438559789 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Scripts/ReadPanoConfig.cs b/Assets/CapturePanorama/Scripts/ReadPanoConfig.cs new file mode 100644 index 0000000..c21e68d --- /dev/null +++ b/Assets/CapturePanorama/Scripts/ReadPanoConfig.cs @@ -0,0 +1,120 @@ +// This is free and unencumbered software released into the public domain. +// For more information, please refer to + +using System; +using System.IO; +using UnityEngine; + +namespace CapturePanorama +{ + public class ReadPanoConfig : MonoBehaviour + { + public string iniPath; + + void Start() + { + if (Application.isEditor) + return; + + CapturePanorama pano = GetComponent(); + string path = iniPath; + if (path == "") + { + string filename = "CapturePanorama.ini"; + path = Application.dataPath + "/" + filename; + } + if (!File.Exists(path)) + { + // INI file does not exist, creating instead + WriteConfig(path, pano); + return; + } + + foreach (string line in File.ReadAllLines(path)) + { + if (line.Trim() == "") + continue; + + string[] splitLine = line.Split(new char[] { '=' }, 2); + string key = splitLine[0].Trim(); + string val = splitLine[1].Trim(); + + if (key == "Panorama Name") + pano.panoramaName = val; + else if (key == "Capture Key") + pano.captureKey = (KeyCode)Enum.Parse(typeof(KeyCode), val); + else if (key == "Image Format") + pano.imageFormat = (CapturePanorama.ImageFormat)Enum.Parse(typeof(CapturePanorama.ImageFormat), val); + else if (key == "Capture Stereoscopic") + pano.captureStereoscopic = bool.Parse(val); + else if (key == "Interpupillary Distance") + pano.interpupillaryDistance = float.Parse(val); + else if (key == "Num Circle Points") + pano.numCirclePoints = int.Parse(val); + else if (key == "Panorama Width") + pano.panoramaWidth = int.Parse(val); + else if (key == "Anti Aliasing") + pano.antiAliasing = (CapturePanorama.AntiAliasing)int.Parse(val); + else if (key == "Ssaa Factor") + pano.ssaaFactor = int.Parse(val); + else if (key == "Save Image Path") + pano.saveImagePath = val; + else if (key == "Save Cubemap") + pano.saveCubemap = bool.Parse(val); + else if (key == "Upload Images") + pano.uploadImages = bool.Parse(val); + else if (key == "Use Default Orientation") + pano.useDefaultOrientation = bool.Parse(val); + else if (key == "Use Gpu Transform") + pano.useGpuTransform = bool.Parse(val); + else if (key == "Cpu Milliseconds Per Frame") + pano.cpuMillisecondsPerFrame = (float)double.Parse(val); + else if (key == "Capture Every Frame") + pano.captureEveryFrame = bool.Parse(val); + else if (key == "Frame Rate") + pano.frameRate = int.Parse(val); + else if (key == "Max Frames To Record") + pano.maxFramesToRecord = val == "" ? 0 : int.Parse(val); + else if (key == "Frame Number Digits") + pano.frameNumberDigits = int.Parse(val); + else if (key == "Fade During Capture") + pano.fadeDuringCapture = bool.Parse(val); + else if (key == "Fade Time") + pano.fadeTime = float.Parse(val); + else if (key == "Enable Debugging") + pano.enableDebugging = bool.Parse(val); + else + Debug.LogError("Unrecognized key in line in CapturePanorama.ini: " + line); + } + } + + private void WriteConfig(string path, CapturePanorama pano) + { + using (var writer = new StreamWriter(path)) + { + writer.WriteLine("Panorama Name" + "=" + pano.panoramaName); + writer.WriteLine("Capture Key" + "=" + pano.captureKey); + writer.WriteLine("Image Format" + "=" + pano.imageFormat); + writer.WriteLine("Capture Stereoscopic" + "=" + pano.captureStereoscopic); + writer.WriteLine("Interpupillary Distance" + "=" + pano.interpupillaryDistance); + writer.WriteLine("Num Circle Points" + "=" + pano.numCirclePoints); + writer.WriteLine("Panorama Width" + "=" + pano.panoramaWidth); + writer.WriteLine("Anti Aliasing" + "=" + (int)pano.antiAliasing); + writer.WriteLine("Ssaa Factor" + "=" + pano.ssaaFactor); + writer.WriteLine("Save Image Path" + "=" + pano.saveImagePath); + writer.WriteLine("Save Cubemap" + "=" + pano.saveCubemap); + writer.WriteLine("Upload Images" + "=" + pano.uploadImages); + writer.WriteLine("Use Default Orientation" + "=" + pano.useDefaultOrientation); + writer.WriteLine("Use Gpu Transform" + "=" + pano.useGpuTransform); + writer.WriteLine("Cpu Milliseconds Per Frame" + "=" + pano.cpuMillisecondsPerFrame); + writer.WriteLine("Capture Every Frame" + "=" + pano.captureEveryFrame); + writer.WriteLine("Frame Rate" + "=" + pano.frameRate); + writer.WriteLine("Max Frames To Record" + "=" + pano.maxFramesToRecord); + writer.WriteLine("Frame Number Digits" + "=" + pano.frameNumberDigits); + writer.WriteLine("Fade During Capture" + "=" + pano.fadeDuringCapture); + writer.WriteLine("Fade Time" + "=" + pano.fadeTime); + writer.WriteLine("Enable Debugging" + "=" + pano.enableDebugging); + } + } + } +} diff --git a/Assets/CapturePanorama/Scripts/ReadPanoConfig.cs.meta b/Assets/CapturePanorama/Scripts/ReadPanoConfig.cs.meta new file mode 100644 index 0000000..8da0246 --- /dev/null +++ b/Assets/CapturePanorama/Scripts/ReadPanoConfig.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fa15e3b423ebd7c438d5e7c5c9e60a2a +timeCreated: 1437619670 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Scripts/ScreenFadeControl.cs b/Assets/CapturePanorama/Scripts/ScreenFadeControl.cs new file mode 100644 index 0000000..b2d1d3c --- /dev/null +++ b/Assets/CapturePanorama/Scripts/ScreenFadeControl.cs @@ -0,0 +1,32 @@ +// This is free and unencumbered software released into the public domain. +// For more information, please refer to + +using UnityEngine; + +namespace CapturePanorama.Internals +{ + public class ScreenFadeControl : MonoBehaviour + { + public Material fadeMaterial = null; + + // Based on OVRScreenFade +#if UNITY_ANDROID && !UNITY_EDITOR + void OnCustomPostRender() +#else + void OnPostRender() +#endif + { + fadeMaterial.SetPass(0); + GL.PushMatrix(); + GL.LoadOrtho(); + GL.Color(fadeMaterial.color); + GL.Begin(GL.QUADS); + GL.Vertex3(0f, 0f, -12f); + GL.Vertex3(0f, 1f, -12f); + GL.Vertex3(1f, 1f, -12f); + GL.Vertex3(1f, 0f, -12f); + GL.End(); + GL.PopMatrix(); + } + } +} \ No newline at end of file diff --git a/Assets/CapturePanorama/Scripts/ScreenFadeControl.cs.meta b/Assets/CapturePanorama/Scripts/ScreenFadeControl.cs.meta new file mode 100644 index 0000000..98abe08 --- /dev/null +++ b/Assets/CapturePanorama/Scripts/ScreenFadeControl.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d523dbe145a52c64aaf87e2287a4de1b +timeCreated: 1432449878 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Shaders.meta b/Assets/CapturePanorama/Shaders.meta new file mode 100644 index 0000000..c870b56 --- /dev/null +++ b/Assets/CapturePanorama/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 05d29e2dd63ef2c46a252cfd09f922ba +folderAsset: yes +timeCreated: 1438620654 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Shaders/Unlit Transparent HUD.shader b/Assets/CapturePanorama/Shaders/Unlit Transparent HUD.shader new file mode 100644 index 0000000..e516d92 --- /dev/null +++ b/Assets/CapturePanorama/Shaders/Unlit Transparent HUD.shader @@ -0,0 +1,102 @@ +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + +/************************************************************************************ + +Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, +which is provided at the time of installation or download, or which +otherwise accompanies this software in either electronic or hard copy form. + +You may obtain a copy of the License at + +http://www.oculusvr.com/licenses/LICENSE-3.2 + +Unless required by applicable law or agreed to in writing, the Oculus VR SDK +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +************************************************************************************/ + +// Unlit alpha-blended shader. +// - no lighting +// - no lightmap support +// - supports tint color + +Shader "Unlit/Transparent HUD (CapturePanorama)" { + + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + _Color ("Main Color", Color) = (0.5,0.5,0.5,0.5) + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent+99" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Cull Off + Lighting Off + ZTest Always + ZWrite Off + Fog { Mode Off } + Offset -1, -1 + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + float2 texcoord : TEXCOORD0; + fixed4 color : COLOR; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + half2 texcoord : TEXCOORD0; + fixed4 color : COLOR; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + fixed4 _Color; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + o.color = v.color; + return o; + } + + fixed4 frag (v2f i) : COLOR + { + fixed4 col = tex2D(_MainTex, i.texcoord) * i.color * _Color; + return col; + } + ENDCG + } + } + + +} + diff --git a/Assets/CapturePanorama/Shaders/Unlit Transparent HUD.shader.meta b/Assets/CapturePanorama/Shaders/Unlit Transparent HUD.shader.meta new file mode 100644 index 0000000..c665be1 --- /dev/null +++ b/Assets/CapturePanorama/Shaders/Unlit Transparent HUD.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c4de1d28bf5f7a74bb80869d3b2a246c +timeCreated: 1433688734 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Sounds.meta b/Assets/CapturePanorama/Sounds.meta new file mode 100644 index 0000000..f9b4015 --- /dev/null +++ b/Assets/CapturePanorama/Sounds.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f4f64c593f9b3404cb2b045e707feb20 +folderAsset: yes +timeCreated: 1438620619 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Sounds/Clicks_13.wav b/Assets/CapturePanorama/Sounds/Clicks_13.wav new file mode 100644 index 0000000..c5a8652 --- /dev/null +++ b/Assets/CapturePanorama/Sounds/Clicks_13.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f87c6f32b1b8cf683b36742a89eb551062227ea06ef01efc4f5d043f3353f9f3 +size 19444 diff --git a/Assets/CapturePanorama/Sounds/Clicks_13.wav.meta b/Assets/CapturePanorama/Sounds/Clicks_13.wav.meta new file mode 100644 index 0000000..c689b3e --- /dev/null +++ b/Assets/CapturePanorama/Sounds/Clicks_13.wav.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 3b7a828a646174088aa48ee1db9c439c +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Sounds/DistClickBlocked1.wav b/Assets/CapturePanorama/Sounds/DistClickBlocked1.wav new file mode 100644 index 0000000..b5578da --- /dev/null +++ b/Assets/CapturePanorama/Sounds/DistClickBlocked1.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c85d2517fb77ffac31adf217a5963830190edb6e869b8e1aad6b00d35979d76 +size 59812 diff --git a/Assets/CapturePanorama/Sounds/DistClickBlocked1.wav.meta b/Assets/CapturePanorama/Sounds/DistClickBlocked1.wav.meta new file mode 100644 index 0000000..f8aa07e --- /dev/null +++ b/Assets/CapturePanorama/Sounds/DistClickBlocked1.wav.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: b4ed406e6e315450f85fa2c0f65bce01 +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/Sounds/Xylo_13.wav b/Assets/CapturePanorama/Sounds/Xylo_13.wav new file mode 100644 index 0000000..43c0d0b --- /dev/null +++ b/Assets/CapturePanorama/Sounds/Xylo_13.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ff3843bd0862748f2dcfd2d51b45fe9a3aa9023383b4841a21832c09dc4d5a7 +size 179488 diff --git a/Assets/CapturePanorama/Sounds/Xylo_13.wav.meta b/Assets/CapturePanorama/Sounds/Xylo_13.wav.meta new file mode 100644 index 0000000..292a6ed --- /dev/null +++ b/Assets/CapturePanorama/Sounds/Xylo_13.wav.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a22b8c429f521429084d616c68dda19a +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CapturePanorama/assemble.cmd b/Assets/CapturePanorama/assemble.cmd new file mode 100644 index 0000000..5d96866 --- /dev/null +++ b/Assets/CapturePanorama/assemble.cmd @@ -0,0 +1 @@ +ffmpeg -framerate %4 -i %1%%06d.%2 -an -c:v libx264 -r %4 -pix_fmt yuv420p -preset %6 -crf %5 %3 \ No newline at end of file diff --git a/Assets/CapturePanorama/assemble.cmd.meta b/Assets/CapturePanorama/assemble.cmd.meta new file mode 100644 index 0000000..e63dcb8 --- /dev/null +++ b/Assets/CapturePanorama/assemble.cmd.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aadd2790d28a4fb46a82d27bd8ead3f6 +timeCreated: 1437750855 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System.meta b/Assets/Explosion System.meta new file mode 100644 index 0000000..5e73bb0 --- /dev/null +++ b/Assets/Explosion System.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a0b6c80a9d0da46449f6961e890bd99e +folderAsset: yes +timeCreated: 1502295281 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Animation.meta b/Assets/Explosion System/Animation.meta new file mode 100644 index 0000000..cff7079 --- /dev/null +++ b/Assets/Explosion System/Animation.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8d0f0fc9afa1e4d1da17a0ecdc884331 +folderAsset: yes +timeCreated: 1479658007 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Animation/Explosion Animation.anim b/Assets/Explosion System/Animation/Explosion Animation.anim new file mode 100644 index 0000000..200db53 --- /dev/null +++ b/Assets/Explosion System/Animation/Explosion Animation.anim @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22fe4bea1dd65c30ea2eaabc4c2604fd781b6e0beb7262fb7c952b3ee77cb413 +size 11332 diff --git a/Assets/Explosion System/Animation/Explosion Animation.anim.meta b/Assets/Explosion System/Animation/Explosion Animation.anim.meta new file mode 100644 index 0000000..15ee8ed --- /dev/null +++ b/Assets/Explosion System/Animation/Explosion Animation.anim.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 64191364c30de7248bed7e71771f93e4 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Audio.meta b/Assets/Explosion System/Audio.meta new file mode 100644 index 0000000..86b7125 --- /dev/null +++ b/Assets/Explosion System/Audio.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c826dd65608744c31a3ce5e9d4872edd +folderAsset: yes +timeCreated: 1481900201 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Audio/explosion.ogg b/Assets/Explosion System/Audio/explosion.ogg new file mode 100644 index 0000000..83a1a7e --- /dev/null +++ b/Assets/Explosion System/Audio/explosion.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f65d1c0a2733bd60b78989d90c74e4c78b0c02c2c1f9f8e0682c321fe18b63a +size 59273 diff --git a/Assets/Explosion System/Audio/explosion.ogg.meta b/Assets/Explosion System/Audio/explosion.ogg.meta new file mode 100644 index 0000000..017ee2c --- /dev/null +++ b/Assets/Explosion System/Audio/explosion.ogg.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 39455fb505320424a8f302690b0f0cbd +AudioImporter: + serializedVersion: 4 + format: 0 + quality: .360000014 + stream: 1 + 3D: 1 + forceToMono: 0 + useHardware: 0 + loopable: 0 + userData: diff --git a/Assets/Explosion System/Demo.meta b/Assets/Explosion System/Demo.meta new file mode 100644 index 0000000..dcfc55a --- /dev/null +++ b/Assets/Explosion System/Demo.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c862aaf5bb14e462bbf689878b69330c +folderAsset: yes +timeCreated: 1481807015 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/DemoScene.unity b/Assets/Explosion System/Demo/DemoScene.unity new file mode 100644 index 0000000..2a0fc4c --- /dev/null +++ b/Assets/Explosion System/Demo/DemoScene.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cb85fcad3baadd63c0084be76e76f68df2a3d528f8ebeb82809c2e775552925 +size 432020 diff --git a/Assets/Explosion System/Demo/DemoScene.unity.meta b/Assets/Explosion System/Demo/DemoScene.unity.meta new file mode 100644 index 0000000..8dacf37 --- /dev/null +++ b/Assets/Explosion System/Demo/DemoScene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cbadf461cad84fe185220fbfb07f906 +timeCreated: 1481827759 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Script (for Demo).meta b/Assets/Explosion System/Demo/Script (for Demo).meta new file mode 100644 index 0000000..7f2a88b --- /dev/null +++ b/Assets/Explosion System/Demo/Script (for Demo).meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 31a961f7b026b4827b34a360ad722c60 +folderAsset: yes +timeCreated: 1481900216 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Script (for Demo)/ExplosionControl.cs b/Assets/Explosion System/Demo/Script (for Demo)/ExplosionControl.cs new file mode 100644 index 0000000..ffd717a --- /dev/null +++ b/Assets/Explosion System/Demo/Script (for Demo)/ExplosionControl.cs @@ -0,0 +1,29 @@ +using UnityEngine; +using System.Collections; + +public class ExplosionControl : MonoBehaviour { + public GameObject explosion1; + public GameObject explosion2; + public GameObject wall2; + public GameObject wall1; + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + if (Input.GetKey (KeyCode.Q)) { + explosion1.SetActive (true); + } + if (Input.GetKey (KeyCode.W)) { + wall2.SetActive (true); + wall1.SetActive (false); + } + if (Input.GetKey (KeyCode.E)) { + explosion2.SetActive (true); + } + + } +} diff --git a/Assets/Explosion System/Demo/Script (for Demo)/ExplosionControl.cs.meta b/Assets/Explosion System/Demo/Script (for Demo)/ExplosionControl.cs.meta new file mode 100644 index 0000000..19df8c5 --- /dev/null +++ b/Assets/Explosion System/Demo/Script (for Demo)/ExplosionControl.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ef3405f79187c465cb84163ec9f94df5 +timeCreated: 1481898200 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo).meta b/Assets/Explosion System/Demo/Textures & models (for Demo).meta new file mode 100644 index 0000000..ba39a67 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo).meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c65a0e7725f444aaaa29f5b57c1a9bfb +folderAsset: yes +timeCreated: 1481900256 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1.meta new file mode 100644 index 0000000..4b48d47 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 52be21a1a5f07aa4f9de2fec6ea1f167 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/Metal pattern 01.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/Metal pattern 01.mat new file mode 100644 index 0000000..d4767c4 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/Metal pattern 01.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/Metal pattern 01.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/Metal pattern 01.mat.meta new file mode 100644 index 0000000..2c52d7f --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/Metal pattern 01.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 37db27cd90bcb064daf2429fa42e022f +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/diffuse.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/diffuse.tga new file mode 100644 index 0000000..6269e1f --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/diffuse.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ccf8900207a8b39898e5bae17e124ffc3b107b1f2608a0d92afd01e230f0720 +size 4194348 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/diffuse.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/diffuse.tga.meta new file mode 100644 index 0000000..7d48cc4 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/diffuse.tga.meta @@ -0,0 +1,67 @@ +fileFormatVersion: 2 +guid: 9b1dbb54b9c5f1143aa7e0be2921a7bb +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 512 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/normal.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/normal.tga new file mode 100644 index 0000000..f254c3e --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/normal.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:462f4d2f186df3054b381a23f363aebd8b5a323c80d15d83db954bbc29a46364 +size 3145772 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/normal.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/normal.tga.meta new file mode 100644 index 0000000..1f3f28e --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/normal.tga.meta @@ -0,0 +1,51 @@ +fileFormatVersion: 2 +guid: d5854954021862c4fa2da43144b07404 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/preview.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/preview.jpg new file mode 100644 index 0000000..8d301fe --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25d1a81d4dddbd5cd0d9bec445de4445903130df19089a7224d0f7fc43670e9d +size 378351 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/preview.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/preview.jpg.meta new file mode 100644 index 0000000..d9f5123 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture1/preview.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: aa0257eecdfa585408868c2a87a274b0 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2.meta new file mode 100644 index 0000000..e4f42a4 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 16dbd333ee0690d4fa6ceeeb59ca0e90 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/Metal pattern 02.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/Metal pattern 02.mat new file mode 100644 index 0000000..9bde9ae Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/Metal pattern 02.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/Metal pattern 02.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/Metal pattern 02.mat.meta new file mode 100644 index 0000000..cae4a93 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/Metal pattern 02.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a792762246421814b9b893a7e580ea87 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/diffuse.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/diffuse.tga new file mode 100644 index 0000000..a1f87a3 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/diffuse.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb28127b407b685deab958f15f71ad5c8379e49b3e3f4c0a1e0fbb27b7f5cbeb +size 4194348 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/diffuse.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/diffuse.tga.meta new file mode 100644 index 0000000..f20457d --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/diffuse.tga.meta @@ -0,0 +1,67 @@ +fileFormatVersion: 2 +guid: d889d2a44b4845649bcd8ce458bae837 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 512 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/glow.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/glow.tga new file mode 100644 index 0000000..6f91620 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/glow.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c34d71b45babcaba0481b0e15f59b2d3af97f573eafb8a781a51bdcb1a151b7 +size 4194348 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/glow.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/glow.tga.meta new file mode 100644 index 0000000..750d4bb --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/glow.tga.meta @@ -0,0 +1,51 @@ +fileFormatVersion: 2 +guid: ce1f22b4f74a54a49bd756acdb4b44c6 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/normal.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/normal.tga new file mode 100644 index 0000000..c87a4ea --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/normal.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51bb9036cc5cea8d013735db456be0ef6a12ee73dd761d065dc235ad4c659468 +size 3145772 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/normal.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/normal.tga.meta new file mode 100644 index 0000000..7577d6e --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/normal.tga.meta @@ -0,0 +1,51 @@ +fileFormatVersion: 2 +guid: 67281eba38c0da0429b588ccd843fc77 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/preview.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/preview.jpg new file mode 100644 index 0000000..40b65f1 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfa511c22b5ed4f94127e5c8eb0d3a11e14b8fa1713cb6aa28c7ad08778a8e8f +size 332977 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/preview.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/preview.jpg.meta new file mode 100644 index 0000000..5925ede --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture2/preview.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 6ef013bf690760148959c97deea14045 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3.meta new file mode 100644 index 0000000..918acb5 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cac0be0f96b9f794fb13e5c3327d4dc6 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials.meta new file mode 100644 index 0000000..46d5c24 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 63e699e66cb764c6eb88cca2c90c5c72 +folderAsset: yes +timeCreated: 1478805336 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials/diffuse.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials/diffuse.mat new file mode 100644 index 0000000..33169b8 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials/diffuse.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials/diffuse.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials/diffuse.mat.meta new file mode 100644 index 0000000..a639035 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Materials/diffuse.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74f3f4e5b3958408aadada1456e9a713 +timeCreated: 1478805336 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Metal pattern 04.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Metal pattern 04.mat new file mode 100644 index 0000000..f91ab56 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Metal pattern 04.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Metal pattern 04.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Metal pattern 04.mat.meta new file mode 100644 index 0000000..4e47193 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/Metal pattern 04.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5b8c01216e1b54c4eb59ab00cf82bd05 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/diffuse.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/diffuse.tga new file mode 100644 index 0000000..21d4f42 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/diffuse.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0320c160a796677f422c6ad419496d238267e05297fb5ed4c2840889285a6ec8 +size 4194348 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/diffuse.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/diffuse.tga.meta new file mode 100644 index 0000000..03af72d --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/diffuse.tga.meta @@ -0,0 +1,67 @@ +fileFormatVersion: 2 +guid: 555ee02ef69a5e34da1d4d961b7542af +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 512 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: -1 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/normal.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/normal.tga new file mode 100644 index 0000000..bd60ef8 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/normal.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a64559a179ce72fbea399a6c2f1a11195d9dcc2035178041f327454663a9fbd6 +size 3145772 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/normal.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/normal.tga.meta new file mode 100644 index 0000000..72803cb --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/normal.tga.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 627a1335b8727c348ac4edeb052e8423 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/preview.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/preview.jpg new file mode 100644 index 0000000..8c5137b --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b968bc3ad4d0b1d21a6b4006c10fdce526ff3c6e54c8567f0d075c01cec9a12 +size 326485 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/preview.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/preview.jpg.meta new file mode 100644 index 0000000..799c0dc --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture3/preview.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 7e5f58b131b7be14a8c4983374f3608b +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5.meta new file mode 100644 index 0000000..6f932f9 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 522525b87b2238d41980c94cdfb02d53 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/Metal pattern 19.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/Metal pattern 19.mat new file mode 100644 index 0000000..90d6ae6 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/Metal pattern 19.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/Metal pattern 19.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/Metal pattern 19.mat.meta new file mode 100644 index 0000000..6484809 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/Metal pattern 19.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ce088b712c3a9744c8c5baf1f1c153bc +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/diffuse.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/diffuse.tga new file mode 100644 index 0000000..a68530c --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/diffuse.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2db8332016b93c300c2001754e44ab6bd7bf065556536ece9bd515b5819986b8 +size 4194348 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/diffuse.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/diffuse.tga.meta new file mode 100644 index 0000000..26d24a0 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/diffuse.tga.meta @@ -0,0 +1,67 @@ +fileFormatVersion: 2 +guid: 943dc7f902136b942809f7902577ef7d +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 512 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/normal.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/normal.tga new file mode 100644 index 0000000..2cf8e28 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/normal.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3d5809e8440a0ddd86dc83e7e989a038cb7a8c48f0a52357e49df96a32be175 +size 3145772 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/normal.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/normal.tga.meta new file mode 100644 index 0000000..5be2027 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/normal.tga.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: e6728cfe016fdcf46976dd9ae81787ca +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/preview.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/preview.jpg new file mode 100644 index 0000000..4af5fcb --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ef5677f0f3e99d5b2841f611025eef93370d81258759dad6e4c65d56ec0f9f9 +size 331515 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/preview.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/preview.jpg.meta new file mode 100644 index 0000000..819e051 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture5/preview.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 3c32f74d16681a64a8ed62794cd3b983 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6.meta new file mode 100644 index 0000000..a9eedc0 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 86c3adafe3dc278479a6efd06240557e +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials.meta new file mode 100644 index 0000000..6f791e3 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e54c5337cf18848fc95aba892b280fd9 +folderAsset: yes +timeCreated: 1478805355 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials/diffuse.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials/diffuse.mat new file mode 100644 index 0000000..49009ac Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials/diffuse.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials/diffuse.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials/diffuse.mat.meta new file mode 100644 index 0000000..58ef6ef --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Materials/diffuse.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 86cba2532cf79453c96ce599b3af87a1 +timeCreated: 1478805355 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Metal pattern 24.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Metal pattern 24.mat new file mode 100644 index 0000000..d98136c Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Metal pattern 24.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Metal pattern 24.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Metal pattern 24.mat.meta new file mode 100644 index 0000000..9c7f6a8 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/Metal pattern 24.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a8b04144f147be6489581d4fc35eedca +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/diffuse.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/diffuse.tga new file mode 100644 index 0000000..e147c84 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/diffuse.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5f69e8a5a5549889241bb12ff0180bfe9ed337b67cf73878b5a03444fa0ef60 +size 4194348 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/diffuse.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/diffuse.tga.meta new file mode 100644 index 0000000..875ba3c --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/diffuse.tga.meta @@ -0,0 +1,67 @@ +fileFormatVersion: 2 +guid: deff49745631c2d4eaf512af939c3880 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 512 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/normal.tga b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/normal.tga new file mode 100644 index 0000000..3d45da6 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/normal.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f30c0aa422610aa0797a2b09d99a7b3daeca5b527813e9dd72db03affd74c740 +size 3145772 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/normal.tga.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/normal.tga.meta new file mode 100644 index 0000000..c3ebbb3 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/normal.tga.meta @@ -0,0 +1,51 @@ +fileFormatVersion: 2 +guid: cc9ff8eee97b16a4384de8db8b91ba80 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 1 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/preview.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/preview.jpg new file mode 100644 index 0000000..3b1d119 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95f336e9cb1d18a3e24dded99a39a7d428882168a085baf5df6b438ce211f73f +size 391534 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/preview.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/preview.jpg.meta new file mode 100644 index 0000000..0665dc3 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/MetalTexture6/preview.jpg.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: f8eba31df6a445d44a015cd2fa681b63 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 2 + aniso: -1 + mipBias: -1 + wrapMode: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot.meta new file mode 100644 index 0000000..8385d64 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0cce483272d4241419d626b718c058e0 +folderAsset: yes +timeCreated: 1473685442 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials.meta new file mode 100644 index 0000000..7f2030b --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7b711b1b8dcbb9f499f512f2af264929 +folderAsset: yes +timeCreated: 1473685442 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/A_Mech_Heavy_Self_Yellow.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/A_Mech_Heavy_Self_Yellow.mat new file mode 100644 index 0000000..327d3c9 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/A_Mech_Heavy_Self_Yellow.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/A_Mech_Heavy_Self_Yellow.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/A_Mech_Heavy_Self_Yellow.mat.meta new file mode 100644 index 0000000..be1bab9 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/A_Mech_Heavy_Self_Yellow.mat.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: 52e55ba2c3aec9840aede4d6bf7a1b88 +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Diffuse_Yellow.png b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Diffuse_Yellow.png new file mode 100644 index 0000000..0f0dac8 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Diffuse_Yellow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebb964f1ae5df3b0d75ba3edb804cf71f75b93278780e4a19438cfe8b69c5ab2 +size 11851477 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Diffuse_Yellow.png.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Diffuse_Yellow.png.meta new file mode 100644 index 0000000..10ef6c9 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Diffuse_Yellow.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 93ce942b7eb81cc48b155abae82c30cc +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 4096 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Self_Illum.png b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Self_Illum.png new file mode 100644 index 0000000..e6a69f9 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Self_Illum.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f96c88bcc951173108fef1a625e92175fbd43e1492c4c174941b3a5d2006ce +size 289482 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Self_Illum.png.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Self_Illum.png.meta new file mode 100644 index 0000000..013ff56 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Materials/Mech_Heavy_Self_Illum.png.meta @@ -0,0 +1,67 @@ +fileFormatVersion: 2 +guid: becdf55144502c64ebaaafb80c7e21c0 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 1 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 6 + buildTargetSettings: + - buildTarget: Standalone + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models.meta new file mode 100644 index 0000000..3dcd8ef --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fda6a7604ffc6ab4793c164c61eef6aa +folderAsset: yes +timeCreated: 1473685442 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Cockpit_Heavy.fbx b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Cockpit_Heavy.fbx new file mode 100644 index 0000000..5fda52a --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Cockpit_Heavy.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:089b4f402d178bf97115ab4fa8de415532f6d526f4273cca6bba1fd07583d946 +size 33824 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Cockpit_Heavy.fbx.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Cockpit_Heavy.fbx.meta new file mode 100644 index 0000000..7b1fcd9 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Cockpit_Heavy.fbx.meta @@ -0,0 +1,85 @@ +fileFormatVersion: 2 +guid: f35cbeb477d64424cb3fe158579508db +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 100002: Geom_Cockpit_heavy + 100004: Mount_backpack + 100006: Mount_Weapon_L + 100008: Mount_Weapon_R + 100010: Mount_Weapon_top + 400000: //RootNode + 400002: Geom_Cockpit_heavy + 400004: Mount_backpack + 400006: Mount_Weapon_L + 400008: Mount_Weapon_R + 400010: Mount_Weapon_top + 2300000: Geom_Cockpit_heavy + 3300000: Geom_Cockpit_heavy + 4300000: Geom_Cockpit_heavy + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 0.01 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 0 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 4 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Legs_Heavy_lvl1.fbx b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Legs_Heavy_lvl1.fbx new file mode 100644 index 0000000..33a37dc --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Legs_Heavy_lvl1.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f813ac22c752e7734afaeb5b2cca91834de556da9f1165f39a23eb97ef79c8ca +size 81424 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Legs_Heavy_lvl1.fbx.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Legs_Heavy_lvl1.fbx.meta new file mode 100644 index 0000000..de09be3 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Legs_Heavy_lvl1.fbx.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: f78f5c8e21cc48b4fbda3ee14dbadaed +timeCreated: 1476028087 +licenseType: Store +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: End_Heel_L + 100002: End_Heel_R + 100004: End_Toe_L + 100006: End_Toe_R + 100008: Foot_L + 100010: Foot_R + 100012: Geom_legs_heavy_lvl1 + 100014: Heel_L + 100016: Heel_R + 100018: Hip_L + 100020: Hip_R + 100022: HIPS + 100024: //RootNode + 100026: Mount_top + 100028: Pelvis + 100030: Shin_L + 100032: Shin_R + 100034: Toe_L + 100036: Toe_R + 100038: Top + 400000: End_Heel_L + 400002: End_Heel_R + 400004: End_Toe_L + 400006: End_Toe_R + 400008: Foot_L + 400010: Foot_R + 400012: Geom_legs_heavy_lvl1 + 400014: Heel_L + 400016: Heel_R + 400018: Hip_L + 400020: Hip_R + 400022: HIPS + 400024: //RootNode + 400026: Mount_top + 400028: Pelvis + 400030: Shin_L + 400032: Shin_R + 400034: Toe_L + 400036: Toe_R + 400038: Top + 4300000: Geom_legs_heavy_lvl1 + 9500000: //RootNode + 13700000: Geom_legs_heavy_lvl1 + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials.meta new file mode 100644 index 0000000..b1da2a4 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: eb82d0b79421833438e0979be1ccd21d +folderAsset: yes +timeCreated: 1502295290 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials/Mech_Heavy_Yellow.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials/Mech_Heavy_Yellow.mat new file mode 100644 index 0000000..698ef6b Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials/Mech_Heavy_Yellow.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials/Mech_Heavy_Yellow.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials/Mech_Heavy_Yellow.mat.meta new file mode 100644 index 0000000..0dcc71a --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Materials/Mech_Heavy_Yellow.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f0309587d32fb1e40b7108d7fdf28e5f +timeCreated: 1502295290 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Shoulders_Heavy_lvl1.fbx b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Shoulders_Heavy_lvl1.fbx new file mode 100644 index 0000000..5922743 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Shoulders_Heavy_lvl1.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:341ca99f0ef94b3b7047bde4ee27545d687120084a3f1f63f77fc1b714c581d4 +size 39216 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Shoulders_Heavy_lvl1.fbx.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Shoulders_Heavy_lvl1.fbx.meta new file mode 100644 index 0000000..6ea83b1 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Shoulders_Heavy_lvl1.fbx.meta @@ -0,0 +1,89 @@ +fileFormatVersion: 2 +guid: 21f1c5f837cb97d47866a522e0e805e4 +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: Geom_Shoulders_heavy_lvl1 + 100002: Mount_backpack + 100004: Mount_cockpit + 100006: Mount_Rockets_shoulder_L + 100008: Mount_Rockets_shoulder_R + 100010: Mount_Weapon_L + 100012: Mount_Weapon_R + 100014: //RootNode + 400000: Geom_Shoulders_heavy_lvl1 + 400002: Mount_backpack + 400004: Mount_cockpit + 400006: Mount_Rockets_shoulder_L + 400008: Mount_Rockets_shoulder_R + 400010: Mount_Weapon_L + 400012: Mount_Weapon_R + 400014: //RootNode + 2300000: Geom_Shoulders_heavy_lvl1 + 3300000: Geom_Shoulders_heavy_lvl1 + 4300000: Geom_Shoulders_heavy_lvl1 + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 0.01 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 0 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 4 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl4.fbx b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl4.fbx new file mode 100644 index 0000000..10cb0aa --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl4.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f26a610cd0f98b97bdf10ccfec7d245e346be0c0577420a449452d578f3332d +size 40064 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl4.fbx.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl4.fbx.meta new file mode 100644 index 0000000..59cf377 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl4.fbx.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: c74060575be97064099a9b610b66cdf0 +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: Barrel_1 + 100002: Barrel_base_1 + 100004: Barrel_end + 100006: Flak + 100008: Geom_barrel + 100010: Geom_barrel_base + 100012: Geom_body + 100014: //RootNode + 400000: Barrel_1 + 400002: Barrel_base_1 + 400004: Barrel_end + 400006: Flak + 400008: Geom_barrel + 400010: Geom_barrel_base + 400012: Geom_body + 400014: //RootNode + 2300000: Geom_barrel + 2300002: Geom_barrel_base + 2300004: Geom_body + 3300000: Geom_barrel + 3300002: Geom_barrel_base + 3300004: Geom_body + 4300000: Geom_barrel + 4300002: Geom_barrel_base + 4300004: Geom_body + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 0.01 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 0 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 4 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl5.fbx b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl5.fbx new file mode 100644 index 0000000..5b174e8 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl5.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c21db7fbf65078342ec2b1f7d06fd10c8b4ac1c1e64bce1c1947543c43fd26cb +size 40592 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl5.fbx.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl5.fbx.meta new file mode 100644 index 0000000..97eee28 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Robot/Models/Weapon_Flak_1x_Lvl5.fbx.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: dbc8ff2d358cb074abb15bf0738ca117 +timeCreated: 1476027812 +licenseType: Store +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: Barrel_1 + 100002: Barrel_base_1 + 100004: Barrel_end + 100006: Flak + 100008: Geom_barrel + 100010: Geom_barrel_base + 100012: Geom_body + 100014: //RootNode + 400000: Barrel_1 + 400002: Barrel_base_1 + 400004: Barrel_end + 400006: Flak + 400008: Geom_barrel + 400010: Geom_barrel_base + 400012: Geom_body + 400014: //RootNode + 2300000: Geom_barrel + 2300002: Geom_barrel_base + 2300004: Geom_body + 3300000: Geom_barrel + 3300002: Geom_barrel_base + 3300004: Geom_body + 4300000: Geom_barrel + 4300002: Geom_barrel_base + 4300004: Geom_body + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox.meta new file mode 100644 index 0000000..30c6196 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5f4999ad57637b643b9eed49519aff9a +folderAsset: yes +timeCreated: 1471976839 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials.meta new file mode 100644 index 0000000..8f224d6 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1dd264a6f85cb0d4b851b76fab04923e +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials/Skybox_BlueNebular.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials/Skybox_BlueNebular.mat new file mode 100644 index 0000000..aada6d6 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials/Skybox_BlueNebular.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials/Skybox_BlueNebular.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials/Skybox_BlueNebular.mat.meta new file mode 100644 index 0000000..7abcb2d --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Materials/Skybox_BlueNebular.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b6a3f8bca2c865243929bac258c89b96 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox.meta new file mode 100644 index 0000000..1728bb6 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 914e01bf37bd9624d8f3b0a55338a263 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_back.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_back.jpg new file mode 100644 index 0000000..73a6e1a --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_back.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ed16997274704bdc2733db626f0083efdd3140bc52c834de01ca672b148ba9a +size 1409157 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_back.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_back.jpg.meta new file mode 100644 index 0000000..2a95def --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_back.jpg.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: 714add663c6602a45ae7182a6c144323 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 8192 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_bottom.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_bottom.jpg new file mode 100644 index 0000000..6c0540b --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_bottom.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2523752004f85a133714b646c2b622454cd8f662e53c45f88c67c164be5a720 +size 1335213 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_bottom.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_bottom.jpg.meta new file mode 100644 index 0000000..9c1eb97 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_bottom.jpg.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: 8f042aa2fffc37643a0ca2fa3cfafbd1 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 8192 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_front.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_front.jpg new file mode 100644 index 0000000..4da8818 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_front.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:525f0575f6965edeb902a3a4f4022fe6d3d45f7ccd1a77f9d493137348038a34 +size 1077980 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_front.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_front.jpg.meta new file mode 100644 index 0000000..0fa60d0 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_front.jpg.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: 64256e95256b9064bb85c6658ea884aa +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 8192 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_left.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_left.jpg new file mode 100644 index 0000000..bc316a0 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_left.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4801cef4d3098d5146d5d755afb465f670bdee25f5617e789dc67b029dc23b59 +size 1680131 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_left.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_left.jpg.meta new file mode 100644 index 0000000..ad50081 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_left.jpg.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: d58c7aa74edd6ee4e843a8c54307a8dd +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 8192 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_right.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_right.jpg new file mode 100644 index 0000000..c2dd797 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_right.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f156ef9e9311e981298295bfdd5208bcbd6f6c80f4dc8d78c70a6e6e2a72204e +size 1227990 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_right.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_right.jpg.meta new file mode 100644 index 0000000..1f769d1 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_right.jpg.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: 06b96ca4707fbf24e80cbcfe2ab88549 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 8192 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_top.jpg b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_top.jpg new file mode 100644 index 0000000..cfc8143 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_top.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ba071722c84612fc2efcc52b7ebddbfe1bc72086137ef7883f610c189006801 +size 2130033 diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_top.jpg.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_top.jpg.meta new file mode 100644 index 0000000..c914672 --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Skybox/Skybox/BlueNebular_top.jpg.meta @@ -0,0 +1,62 @@ +fileFormatVersion: 2 +guid: dde976bcdaaea1143b8a48a75b7557be +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 8192 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 2048 + textureFormat: -3 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Wall.mat b/Assets/Explosion System/Demo/Textures & models (for Demo)/Wall.mat new file mode 100644 index 0000000..338ab36 Binary files /dev/null and b/Assets/Explosion System/Demo/Textures & models (for Demo)/Wall.mat differ diff --git a/Assets/Explosion System/Demo/Textures & models (for Demo)/Wall.mat.meta b/Assets/Explosion System/Demo/Textures & models (for Demo)/Wall.mat.meta new file mode 100644 index 0000000..e2052df --- /dev/null +++ b/Assets/Explosion System/Demo/Textures & models (for Demo)/Wall.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 529f3b3c5440342dcbb6a659bd36b032 +timeCreated: 1481895448 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Model.meta b/Assets/Explosion System/Model.meta new file mode 100644 index 0000000..07c6d9c --- /dev/null +++ b/Assets/Explosion System/Model.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 2c04ba1ddda94b04686d9ef6d945d136 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Model/Materials.meta b/Assets/Explosion System/Model/Materials.meta new file mode 100644 index 0000000..4b4e930 --- /dev/null +++ b/Assets/Explosion System/Model/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6ab1eb481e273b74fb0f7aed964ae85f +folderAsset: yes +timeCreated: 1460559088 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Model/Materials/unnamed 1.mat b/Assets/Explosion System/Model/Materials/unnamed 1.mat new file mode 100644 index 0000000..cfb0afd Binary files /dev/null and b/Assets/Explosion System/Model/Materials/unnamed 1.mat differ diff --git a/Assets/Explosion System/Model/Materials/unnamed 1.mat.meta b/Assets/Explosion System/Model/Materials/unnamed 1.mat.meta new file mode 100644 index 0000000..17d8c32 --- /dev/null +++ b/Assets/Explosion System/Model/Materials/unnamed 1.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 72f8d4fb19b34574e88c954149bd4e57 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Model/Materials/unnamed.mat b/Assets/Explosion System/Model/Materials/unnamed.mat new file mode 100644 index 0000000..8531505 Binary files /dev/null and b/Assets/Explosion System/Model/Materials/unnamed.mat differ diff --git a/Assets/Explosion System/Model/Materials/unnamed.mat.meta b/Assets/Explosion System/Model/Materials/unnamed.mat.meta new file mode 100644 index 0000000..e799a5c --- /dev/null +++ b/Assets/Explosion System/Model/Materials/unnamed.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f9917b76362eae4b9c2a0278a81b5f0 +timeCreated: 1460559088 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Model/Sphere.fbx b/Assets/Explosion System/Model/Sphere.fbx new file mode 100644 index 0000000..22e5e2a --- /dev/null +++ b/Assets/Explosion System/Model/Sphere.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b655cab6c22b64b28bbff41083aee3e64ed2535b658f97c5b9634212b3f8160 +size 274300 diff --git a/Assets/Explosion System/Model/Sphere.fbx.meta b/Assets/Explosion System/Model/Sphere.fbx.meta new file mode 100644 index 0000000..d24b8b0 --- /dev/null +++ b/Assets/Explosion System/Model/Sphere.fbx.meta @@ -0,0 +1,66 @@ +fileFormatVersion: 2 +guid: 8bb994523a673cb4ca6a4e4d65af961f +ModelImporter: + serializedVersion: 16 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: Sphere_001 + 7400000: Default Take + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + optimizeGameObjects: 0 + motionNodeName: + animationCompression: 1 + animationRotationError: .5 + animationPositionError: .5 + animationScaleError: .5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1.5 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + tangentSpace: + normalSmoothAngle: 60 + splitTangentsAcrossUV: 0 + normalImportMode: 1 + tangentImportMode: 1 + importAnimation: 0 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: .5 + foreArmTwist: .5 + upperLegTwist: .5 + legTwist: .5 + armStretch: .0500000007 + legStretch: .0500000007 + feetSpacing: 0 + rootMotionBoneName: + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + additionalBone: 1 + userData: diff --git a/Assets/Explosion System/Particles.meta b/Assets/Explosion System/Particles.meta new file mode 100644 index 0000000..0d46730 --- /dev/null +++ b/Assets/Explosion System/Particles.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0974e107e30984e40bde8f8ed794f692 +folderAsset: yes +timeCreated: 1481807585 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Particles/Smoke.mat b/Assets/Explosion System/Particles/Smoke.mat new file mode 100644 index 0000000..02cfafe Binary files /dev/null and b/Assets/Explosion System/Particles/Smoke.mat differ diff --git a/Assets/Explosion System/Particles/Smoke.mat.meta b/Assets/Explosion System/Particles/Smoke.mat.meta new file mode 100644 index 0000000..054d4e1 --- /dev/null +++ b/Assets/Explosion System/Particles/Smoke.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 96558d9af5ccba84da0a06dc9afa072d +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Particles/Spark.mat b/Assets/Explosion System/Particles/Spark.mat new file mode 100644 index 0000000..f484403 Binary files /dev/null and b/Assets/Explosion System/Particles/Spark.mat differ diff --git a/Assets/Explosion System/Particles/Spark.mat.meta b/Assets/Explosion System/Particles/Spark.mat.meta new file mode 100644 index 0000000..4ea3c14 --- /dev/null +++ b/Assets/Explosion System/Particles/Spark.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e097e0ca551c28647a5a126e44c35bbc +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Particles/smoke.tif b/Assets/Explosion System/Particles/smoke.tif new file mode 100644 index 0000000..527bfc6 Binary files /dev/null and b/Assets/Explosion System/Particles/smoke.tif differ diff --git a/Assets/Explosion System/Particles/smoke.tif.meta b/Assets/Explosion System/Particles/smoke.tif.meta new file mode 100644 index 0000000..2502c46 --- /dev/null +++ b/Assets/Explosion System/Particles/smoke.tif.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: 08f28e42a647e2a4cbd32e793359aa3c +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Particles/spark.tif b/Assets/Explosion System/Particles/spark.tif new file mode 100644 index 0000000..dfe8c94 Binary files /dev/null and b/Assets/Explosion System/Particles/spark.tif differ diff --git a/Assets/Explosion System/Particles/spark.tif.meta b/Assets/Explosion System/Particles/spark.tif.meta new file mode 100644 index 0000000..45abbeb --- /dev/null +++ b/Assets/Explosion System/Particles/spark.tif.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: e79b4ee3b7b31ee499b1532270c7730d +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: 0 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Prefabs.meta b/Assets/Explosion System/Prefabs.meta new file mode 100644 index 0000000..f23c164 --- /dev/null +++ b/Assets/Explosion System/Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6afcd4124ad274089929e822bc9e6fc7 +folderAsset: yes +timeCreated: 1479657984 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Prefabs/Explosion.prefab b/Assets/Explosion System/Prefabs/Explosion.prefab new file mode 100644 index 0000000..24ded96 --- /dev/null +++ b/Assets/Explosion System/Prefabs/Explosion.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fbf62ec1d5157bafc4c8641a01c715d548e0fd6f1b341fee9f73ecbec21703f +size 21292 diff --git a/Assets/Explosion System/Prefabs/Explosion.prefab.meta b/Assets/Explosion System/Prefabs/Explosion.prefab.meta new file mode 100644 index 0000000..a1c00a6 --- /dev/null +++ b/Assets/Explosion System/Prefabs/Explosion.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6747b1742d70743a8aff8594e708b2f7 +timeCreated: 1479657845 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Prefabs/Graphic explosion.prefab b/Assets/Explosion System/Prefabs/Graphic explosion.prefab new file mode 100644 index 0000000..45893f4 --- /dev/null +++ b/Assets/Explosion System/Prefabs/Graphic explosion.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f76ecbe3b2b2f14770fdf52f3edcadf9ac17c7bed401bc3035bea9c96d83d80 +size 20124 diff --git a/Assets/Explosion System/Prefabs/Graphic explosion.prefab.meta b/Assets/Explosion System/Prefabs/Graphic explosion.prefab.meta new file mode 100644 index 0000000..1b04248 --- /dev/null +++ b/Assets/Explosion System/Prefabs/Graphic explosion.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e0dc4d47bced6d54ab1461804114b5d0 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Prefabs/Physical explosion.prefab b/Assets/Explosion System/Prefabs/Physical explosion.prefab new file mode 100644 index 0000000..2bbb78f --- /dev/null +++ b/Assets/Explosion System/Prefabs/Physical explosion.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af07aa187a71674a428a90c183fe3003f8be58082895337c6af7d9edc5c6cc97 +size 4468 diff --git a/Assets/Explosion System/Prefabs/Physical explosion.prefab.meta b/Assets/Explosion System/Prefabs/Physical explosion.prefab.meta new file mode 100644 index 0000000..dcbaf39 --- /dev/null +++ b/Assets/Explosion System/Prefabs/Physical explosion.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 33e699e7f450bcd4b93af87907df6869 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/ReadMe.pdf b/Assets/Explosion System/ReadMe.pdf new file mode 100644 index 0000000..0048dbc Binary files /dev/null and b/Assets/Explosion System/ReadMe.pdf differ diff --git a/Assets/Explosion System/ReadMe.pdf.meta b/Assets/Explosion System/ReadMe.pdf.meta new file mode 100644 index 0000000..c53e7bf --- /dev/null +++ b/Assets/Explosion System/ReadMe.pdf.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 084c23f720d3b4c39bd7cfa18a33d3d0 +timeCreated: 1480413068 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Scripts.meta b/Assets/Explosion System/Scripts.meta new file mode 100644 index 0000000..3b0867c --- /dev/null +++ b/Assets/Explosion System/Scripts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7ab3c25acfb026c4881ad32984cccca2 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Scripts/GraphicExplosion.cs b/Assets/Explosion System/Scripts/GraphicExplosion.cs new file mode 100644 index 0000000..cec1061 --- /dev/null +++ b/Assets/Explosion System/Scripts/GraphicExplosion.cs @@ -0,0 +1,26 @@ +// script to render explosion +using UnityEngine; +using System.Collections; + +public class GraphicExplosion : MonoBehaviour { +public float loopduration; +private float ramptime=0; +private float alphatime=1; + void Update () { + Destroy(gameObject, 7); +ramptime+=Time.deltaTime*2; +alphatime-=Time.deltaTime; +float r = Mathf.Sin((Time.time / loopduration) * (2 * Mathf.PI)) * 0.5f + 0.25f; +float g = Mathf.Sin((Time.time / loopduration + 0.33333333f) * 2 * Mathf.PI) * 0.5f + 0.25f; +float b = Mathf.Sin((Time.time / loopduration + 0.66666667f) * 2 * Mathf.PI) * 0.5f + 0.25f; +float correction = 1 / (r + g + b); +r *= correction; +g *= correction; +b *= correction; +GetComponent().material.SetVector("_ChannelFactor", new Vector4(r,g,b,0)); +GetComponent().material.SetVector("_Range", new Vector4(ramptime,0,0,0)); +GetComponent().material.SetFloat("_ClipRange", alphatime); + + + } +} diff --git a/Assets/Explosion System/Scripts/GraphicExplosion.cs.meta b/Assets/Explosion System/Scripts/GraphicExplosion.cs.meta new file mode 100644 index 0000000..f2198ce --- /dev/null +++ b/Assets/Explosion System/Scripts/GraphicExplosion.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 68ef2ef05dc70784aae5ae2f583e4356 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Explosion System/Scripts/PhysicalExplosion.cs b/Assets/Explosion System/Scripts/PhysicalExplosion.cs new file mode 100644 index 0000000..07a2304 --- /dev/null +++ b/Assets/Explosion System/Scripts/PhysicalExplosion.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using System.Collections; + +public class PhysicalExplosion : MonoBehaviour +{ + public float Radius;// explosion radius + public float Force;// explosion forse + void Update () + { + Collider[] hitColliders = Physics.OverlapSphere(transform.position, Radius);// create explosion + for(int i=0; i()) + { + hitColliders[i].gameObject.AddComponent(); + } + hitColliders[i].GetComponent().AddExplosionForce(Force, transform.position, Radius, 0.0F); // push game object + } + + } + Destroy(gameObject,0.2f);// destroy explosion + } + void OnDrawGizmos() + { + Gizmos.color = Color.red; + Gizmos.DrawWireSphere(transform.position,Radius); + } +} \ No newline at end of file diff --git a/Assets/Explosion System/Scripts/PhysicalExplosion.cs.meta b/Assets/Explosion System/Scripts/PhysicalExplosion.cs.meta new file mode 100644 index 0000000..73361c3 --- /dev/null +++ b/Assets/Explosion System/Scripts/PhysicalExplosion.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 774c6fe16d827fe4685d1a5d46eb00cd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Explosion System/Scripts/light_control.cs b/Assets/Explosion System/Scripts/light_control.cs new file mode 100644 index 0000000..c636934 --- /dev/null +++ b/Assets/Explosion System/Scripts/light_control.cs @@ -0,0 +1,25 @@ +// script to delete light after explosition +using UnityEngine; +using System.Collections; + +public class light_control : MonoBehaviour { + private float timeout = 0.5f; + public Light Light; + + void Start () { + + } + + void Update () { + if(timeout>0.1f) + { + timeout-=Time.deltaTime; + Light.range=15; + } + else + { + Light.range=0; + } + + } +} diff --git a/Assets/Explosion System/Scripts/light_control.cs.meta b/Assets/Explosion System/Scripts/light_control.cs.meta new file mode 100644 index 0000000..41872a5 --- /dev/null +++ b/Assets/Explosion System/Scripts/light_control.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7d9aa3bcb24514d56ba9c4632ed8fd98 +timeCreated: 1481899373 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Shader.meta b/Assets/Explosion System/Shader.meta new file mode 100644 index 0000000..5de07ea --- /dev/null +++ b/Assets/Explosion System/Shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b70c8915c1307460ba487b5e89db8ac4 +folderAsset: yes +timeCreated: 1479658034 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Explosion System/Shader/Exposion.shader b/Assets/Explosion System/Shader/Exposion.shader new file mode 100644 index 0000000..b1efcdf --- /dev/null +++ b/Assets/Explosion System/Shader/Exposion.shader @@ -0,0 +1,56 @@ +Shader "Custom/Explosion" +{ + Properties + { + _RampTex ("Color Ramp", 2D) = "white" {} + _DispTex ("Displacement Texture", 2D) = "gray" {} + _Displacement ("Displacement", Range(0, 1.0)) = 0.1 + _ChannelFactor ("ChannelFactor (r,g,b)", Vector) = (1,0,0) + _Range ("Range (min,max)", Vector) = (0,0.5,0) + _ClipRange ("ClipRange [0,1]", float) = 0.8 + } + + SubShader + { + Tags { "RenderType"="Opaque" } + Cull Off + LOD 300 + + CGPROGRAM + #pragma surface surf Lambert vertex:disp nolightmap + #pragma target 3.0 + #pragma glsl + + sampler2D _DispTex; + float _Displacement; + float3 _ChannelFactor; + float2 _Range; + float _ClipRange; + + struct Input + { + float2 uv_DispTex; + }; + + void disp (inout appdata_full v) + { + float3 dcolor = tex2Dlod (_DispTex, float4(v.texcoord.xy,0,0)); + float d = (dcolor.r*_ChannelFactor.r + dcolor.g*_ChannelFactor.g + dcolor.b*_ChannelFactor.b); + v.vertex.xyz += v.normal * d * _Displacement; + } + + sampler2D _RampTex; + + void surf (Input IN, inout SurfaceOutput o) + { + float3 dcolor = tex2D (_DispTex, IN.uv_DispTex); + float d = (dcolor.r*_ChannelFactor.r + dcolor.g*_ChannelFactor.g + dcolor.b*_ChannelFactor.b) * (_Range.y-_Range.x) + _Range.x; + clip (_ClipRange-d); + half4 c = tex2D (_RampTex, float2(d,0.5)); + o.Albedo = c.rgb; + o.Emission = c.rgb*c.a; + } + ENDCG + } + FallBack "Diffuse" +} \ No newline at end of file diff --git a/Assets/Explosion System/Shader/Exposion.shader.meta b/Assets/Explosion System/Shader/Exposion.shader.meta new file mode 100644 index 0000000..843f3df --- /dev/null +++ b/Assets/Explosion System/Shader/Exposion.shader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 847ee9d37d5feb549915cd8375dbc58f +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/Explosion System/Textures.meta b/Assets/Explosion System/Textures.meta new file mode 100644 index 0000000..c89da1c --- /dev/null +++ b/Assets/Explosion System/Textures.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 371a0a971406aca43b9fdeb0deed8a51 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Explosion System/Textures/Explosion.mat b/Assets/Explosion System/Textures/Explosion.mat new file mode 100644 index 0000000..13ed1ae Binary files /dev/null and b/Assets/Explosion System/Textures/Explosion.mat differ diff --git a/Assets/Explosion System/Textures/Explosion.mat.meta b/Assets/Explosion System/Textures/Explosion.mat.meta new file mode 100644 index 0000000..c0d3e92 --- /dev/null +++ b/Assets/Explosion System/Textures/Explosion.mat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a59dd84b427e21840883fde2372e7522 +NativeFormatImporter: + userData: diff --git a/Assets/Explosion System/Textures/explosion_displ.png b/Assets/Explosion System/Textures/explosion_displ.png new file mode 100644 index 0000000..c958ee7 --- /dev/null +++ b/Assets/Explosion System/Textures/explosion_displ.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e3de376e5fec00738f475172e9e429784fc4aaf98a7abba3a39e93ac195e63e +size 418211 diff --git a/Assets/Explosion System/Textures/explosion_displ.png.meta b/Assets/Explosion System/Textures/explosion_displ.png.meta new file mode 100644 index 0000000..0c97e37 --- /dev/null +++ b/Assets/Explosion System/Textures/explosion_displ.png.meta @@ -0,0 +1,51 @@ +fileFormatVersion: 2 +guid: c7638ba177e965543b5aa7942b9b3985 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/Explosion System/Textures/explosionramp 1.png b/Assets/Explosion System/Textures/explosionramp 1.png new file mode 100644 index 0000000..be0c8af --- /dev/null +++ b/Assets/Explosion System/Textures/explosionramp 1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:676ef2785f45765edd9c7b76059f60381d7dabd0faf3d66c75e95e59a4080f1f +size 2976 diff --git a/Assets/Explosion System/Textures/explosionramp 1.png.meta b/Assets/Explosion System/Textures/explosionramp 1.png.meta new file mode 100644 index 0000000..8a63e16 --- /dev/null +++ b/Assets/Explosion System/Textures/explosionramp 1.png.meta @@ -0,0 +1,51 @@ +fileFormatVersion: 2 +guid: 5a47746b192eb5d4b8ef32847507b8c0 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: + - buildTarget: Android + maxTextureSize: 1024 + textureFormat: -3 + compressionQuality: 50 + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/SteamVR.meta b/Assets/SteamVR.meta new file mode 100644 index 0000000..e1deb84 --- /dev/null +++ b/Assets/SteamVR.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c972d53f79e5e6b4695b0c61a4d3a52e +folderAsset: yes +timeCreated: 1499082002 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Editor.meta b/Assets/SteamVR/Editor.meta new file mode 100644 index 0000000..90b104c --- /dev/null +++ b/Assets/SteamVR/Editor.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: c33af0785775d7548b22541da37936fe +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: diff --git a/Assets/SteamVR/Editor/SteamVR_Editor.cs b/Assets/SteamVR/Editor/SteamVR_Editor.cs new file mode 100644 index 0000000..8889e49 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Editor.cs @@ -0,0 +1,127 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Custom inspector display for SteamVR_Camera +// +//============================================================================= + +using UnityEngine; +using UnityEditor; +using System.IO; + +[CustomEditor(typeof(SteamVR_Camera)), CanEditMultipleObjects] +public class SteamVR_Editor : Editor +{ + int bannerHeight = 150; + Texture logo; + + SerializedProperty script, wireframe; + + string GetResourcePath() + { + var ms = MonoScript.FromScriptableObject(this); + var path = AssetDatabase.GetAssetPath(ms); + path = Path.GetDirectoryName(path); + return path.Substring(0, path.Length - "Editor".Length) + "Textures/"; + } + + void OnEnable() + { + var resourcePath = GetResourcePath(); + + logo = AssetDatabase.LoadAssetAtPath(resourcePath + "logo.png"); + + script = serializedObject.FindProperty("m_Script"); + + wireframe = serializedObject.FindProperty("wireframe"); + + foreach (SteamVR_Camera target in targets) + target.ForceLast(); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + var rect = GUILayoutUtility.GetRect(Screen.width - 38, bannerHeight, GUI.skin.box); + if (logo) + GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); + + if (!Application.isPlaying) + { + var expand = false; + var collapse = false; + foreach (SteamVR_Camera target in targets) + { + if (AssetDatabase.Contains(target)) + continue; + if (target.isExpanded) + collapse = true; + else + expand = true; + } + + if (expand) + { + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Expand")) + { + foreach (SteamVR_Camera target in targets) + { + if (AssetDatabase.Contains(target)) + continue; + if (!target.isExpanded) + { + target.Expand(); + EditorUtility.SetDirty(target); + } + } + } + GUILayout.Space(18); + GUILayout.EndHorizontal(); + } + + if (collapse) + { + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Collapse")) + { + foreach (SteamVR_Camera target in targets) + { + if (AssetDatabase.Contains(target)) + continue; + if (target.isExpanded) + { + target.Collapse(); + EditorUtility.SetDirty(target); + } + } + } + GUILayout.Space(18); + GUILayout.EndHorizontal(); + } + } + + EditorGUILayout.PropertyField(script); + EditorGUILayout.PropertyField(wireframe); + + serializedObject.ApplyModifiedProperties(); + } + + public static void ExportPackage() + { + AssetDatabase.ExportPackage(new string[] { + "Assets/SteamVR", + "Assets/Plugins/openvr_api.cs", + "Assets/Plugins/openvr_api.bundle", + "Assets/Plugins/x86/openvr_api.dll", + "Assets/Plugins/x86/steam_api.dll", + "Assets/Plugins/x86/libsteam_api.so", + "Assets/Plugins/x86_64/openvr_api.dll", + "Assets/Plugins/x86_64/steam_api.dll", + "Assets/Plugins/x86_64/libsteam_api.so", + "Assets/Plugins/x86_64/libopenvr_api.so", + }, "steamvr.unitypackage", ExportPackageOptions.Recurse); + EditorApplication.Exit(0); + } +} + diff --git a/Assets/SteamVR/Editor/SteamVR_Editor.cs.meta b/Assets/SteamVR/Editor/SteamVR_Editor.cs.meta new file mode 100644 index 0000000..1b344ed --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Editor.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5ba22c80948c94e44a82b9fd1b3abd0d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: diff --git a/Assets/SteamVR/Editor/SteamVR_Preferences.cs b/Assets/SteamVR/Editor/SteamVR_Preferences.cs new file mode 100644 index 0000000..ad3e000 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Preferences.cs @@ -0,0 +1,48 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Preferences pane for how SteamVR plugin behaves. +// +//============================================================================= + +using UnityEngine; +using UnityEditor; + +public class SteamVR_Preferences +{ + /// + /// Should SteamVR automatically enable VR when opening Unity or pressing play. + /// + public static bool AutoEnableVR + { + get + { + return EditorPrefs.GetBool("SteamVR_AutoEnableVR", true); + } + set + { + EditorPrefs.SetBool("SteamVR_AutoEnableVR", value); + } + } + + [PreferenceItem("SteamVR")] + static void PreferencesGUI() + { + EditorGUILayout.BeginVertical(); + EditorGUILayout.Space(); + + // Automatically Enable VR + { + string title = "Automatically Enable VR"; + string tooltip = "Should SteamVR automatically enable VR on launch and play?"; + AutoEnableVR = EditorGUILayout.Toggle(new GUIContent(title, tooltip), AutoEnableVR); + string helpMessage = "To enable VR manually:\n"; + helpMessage += "- go to Edit -> Project Settings -> Player,\n"; + helpMessage += "- tick 'Virtual Reality Supported',\n"; + helpMessage += "- make sure OpenVR is in the 'Virtual Reality SDKs' list."; + EditorGUILayout.HelpBox(helpMessage, MessageType.Info); + } + + EditorGUILayout.EndVertical(); + } +} + diff --git a/Assets/SteamVR/Editor/SteamVR_Preferences.cs.meta b/Assets/SteamVR/Editor/SteamVR_Preferences.cs.meta new file mode 100644 index 0000000..3ecb77a --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Preferences.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 29abf75f7265ccb45b799eac4ab0ca94 +timeCreated: 1487968203 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs b/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs new file mode 100644 index 0000000..75611f6 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs @@ -0,0 +1,104 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Custom inspector display for SteamVR_RenderModel +// +//============================================================================= + +using UnityEngine; +using UnityEditor; +using System.Text; +using System.Collections.Generic; + +[CustomEditor(typeof(SteamVR_RenderModel)), CanEditMultipleObjects] +public class SteamVR_RenderModelEditor : Editor +{ + SerializedProperty script, index, modelOverride, shader, verbose, createComponents, updateDynamically; + + static string[] renderModelNames; + int renderModelIndex; + + void OnEnable() + { + script = serializedObject.FindProperty("m_Script"); + index = serializedObject.FindProperty("index"); + modelOverride = serializedObject.FindProperty("modelOverride"); + shader = serializedObject.FindProperty("shader"); + verbose = serializedObject.FindProperty("verbose"); + createComponents = serializedObject.FindProperty("createComponents"); + updateDynamically = serializedObject.FindProperty("updateDynamically"); + + // Load render model names if necessary. + if (renderModelNames == null) + { + renderModelNames = LoadRenderModelNames(); + } + + // Update renderModelIndex based on current modelOverride value. + if (modelOverride.stringValue != "") + { + for (int i = 0; i < renderModelNames.Length; i++) + { + if (modelOverride.stringValue == renderModelNames[i]) + { + renderModelIndex = i; + break; + } + } + } + } + + static string[] LoadRenderModelNames() + { + var results = new List(); + results.Add("None"); + + using (var holder = new SteamVR_RenderModel.RenderModelInterfaceHolder()) + { + var renderModels = holder.instance; + if (renderModels != null) + { + uint count = renderModels.GetRenderModelCount(); + for (uint i = 0; i < count; i++) + { + var buffer = new StringBuilder(); + var requiredSize = renderModels.GetRenderModelName(i, buffer, 0); + if (requiredSize == 0) + continue; + + buffer.EnsureCapacity((int)requiredSize); + renderModels.GetRenderModelName(i, buffer, requiredSize); + results.Add(buffer.ToString()); + } + } + } + + return results.ToArray(); + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUILayout.PropertyField(script); + EditorGUILayout.PropertyField(index); + //EditorGUILayout.PropertyField(modelOverride); + + GUILayout.BeginHorizontal(); + GUILayout.Label(new GUIContent("Model Override", SteamVR_RenderModel.modelOverrideWarning)); + var selected = EditorGUILayout.Popup(renderModelIndex, renderModelNames); + if (selected != renderModelIndex) + { + renderModelIndex = selected; + modelOverride.stringValue = (selected > 0) ? renderModelNames[selected] : ""; + } + GUILayout.EndHorizontal(); + + EditorGUILayout.PropertyField(shader); + EditorGUILayout.PropertyField(verbose); + EditorGUILayout.PropertyField(createComponents); + EditorGUILayout.PropertyField(updateDynamically); + + serializedObject.ApplyModifiedProperties(); + } +} + diff --git a/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs.meta b/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs.meta new file mode 100644 index 0000000..222f523 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 67867a20919f7db45a2e7034fda1c28e +timeCreated: 1433373945 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Editor/SteamVR_Settings.cs b/Assets/SteamVR/Editor/SteamVR_Settings.cs new file mode 100644 index 0000000..f6e8145 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Settings.cs @@ -0,0 +1,688 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Prompt developers to use settings most compatible with SteamVR. +// +//============================================================================= + +using UnityEngine; +using UnityEditor; +using System.IO; + +[InitializeOnLoad] +public class SteamVR_Settings : EditorWindow +{ + const bool forceShow = false; // Set to true to get the dialog to show back up in the case you clicked Ignore All. + + const string ignore = "ignore."; + const string useRecommended = "Use recommended ({0})"; + const string currentValue = " (current = {0})"; + + const string buildTarget = "Build Target"; + const string showUnitySplashScreen = "Show Unity Splashscreen"; + const string defaultIsFullScreen = "Default is Fullscreen"; + const string defaultScreenSize = "Default Screen Size"; + const string runInBackground = "Run In Background"; + const string displayResolutionDialog = "Display Resolution Dialog"; + const string resizableWindow = "Resizable Window"; + const string fullscreenMode = "D3D11 Fullscreen Mode"; + const string visibleInBackground = "Visible In Background"; +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + const string renderingPath = "Rendering Path"; +#endif + const string colorSpace = "Color Space"; + const string gpuSkinning = "GPU Skinning"; +#if false // skyboxes are currently broken + const string singlePassStereoRendering = "Single-Pass Stereo Rendering"; +#endif + + const BuildTarget recommended_BuildTarget = BuildTarget.StandaloneWindows64; + const bool recommended_ShowUnitySplashScreen = false; + const bool recommended_DefaultIsFullScreen = false; + const int recommended_DefaultScreenWidth = 1024; + const int recommended_DefaultScreenHeight = 768; + const bool recommended_RunInBackground = true; + const ResolutionDialogSetting recommended_DisplayResolutionDialog = ResolutionDialogSetting.HiddenByDefault; + const bool recommended_ResizableWindow = true; + const D3D11FullscreenMode recommended_FullscreenMode = D3D11FullscreenMode.FullscreenWindow; + const bool recommended_VisibleInBackground = true; +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + const RenderingPath recommended_RenderPath = RenderingPath.Forward; +#endif + const ColorSpace recommended_ColorSpace = ColorSpace.Linear; + const bool recommended_GpuSkinning = true; +#if false + const bool recommended_SinglePassStereoRendering = true; +#endif + + static SteamVR_Settings window; + + static SteamVR_Settings() + { + EditorApplication.update += Update; + } + + static void Update() + { + bool show = + (!EditorPrefs.HasKey(ignore + buildTarget) && + EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) || + (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) || +#else + PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) || +#endif + (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && + PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) || + (!EditorPrefs.HasKey(ignore + defaultScreenSize) && + (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || + PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) || + (!EditorPrefs.HasKey(ignore + runInBackground) && + PlayerSettings.runInBackground != recommended_RunInBackground) || + (!EditorPrefs.HasKey(ignore + displayResolutionDialog) && + PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) || + (!EditorPrefs.HasKey(ignore + resizableWindow) && + PlayerSettings.resizableWindow != recommended_ResizableWindow) || + (!EditorPrefs.HasKey(ignore + fullscreenMode) && + PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) || + (!EditorPrefs.HasKey(ignore + visibleInBackground) && + PlayerSettings.visibleInBackground != recommended_VisibleInBackground) || +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + (!EditorPrefs.HasKey(ignore + renderingPath) && + PlayerSettings.renderingPath != recommended_RenderPath) || +#endif + (!EditorPrefs.HasKey(ignore + colorSpace) && + PlayerSettings.colorSpace != recommended_ColorSpace) || + (!EditorPrefs.HasKey(ignore + gpuSkinning) && + PlayerSettings.gpuSkinning != recommended_GpuSkinning) || +#if false + (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && + PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) || +#endif + forceShow; + + if (show) + { + window = GetWindow(true); + window.minSize = new Vector2(320, 440); + //window.title = "SteamVR"; + } + + if (SteamVR_Preferences.AutoEnableVR) + { + // Switch to native OpenVR support. + var updated = false; + + if (!PlayerSettings.virtualRealitySupported) + { + PlayerSettings.virtualRealitySupported = true; + updated = true; + } + +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone); +#else + var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone); +#endif + var hasOpenVR = false; + foreach (var device in devices) + if (device.ToLower() == "openvr") + hasOpenVR = true; + + + if (!hasOpenVR) + { + string[] newDevices; + if (updated) + { + newDevices = new string[] { "OpenVR" }; + } + else + { + newDevices = new string[devices.Length + 1]; + for (int i = 0; i < devices.Length; i++) + newDevices[i] = devices[i]; + newDevices[devices.Length] = "OpenVR"; + updated = true; + } +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices); +#else + UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone, newDevices); +#endif + } + + if (updated) + Debug.Log("Switching to native OpenVR support."); + } + + var dlls = new string[] + { + "Plugins/x86/openvr_api.dll", + "Plugins/x86_64/openvr_api.dll" + }; + + foreach (var path in dlls) + { + if (!File.Exists(Application.dataPath + "/" + path)) + continue; + + if (AssetDatabase.DeleteAsset("Assets/" + path)) + Debug.Log("Deleting " + path); + else + { + Debug.Log(path + " in use; cannot delete. Please restart Unity to complete upgrade."); + } + } + + EditorApplication.update -= Update; + } + + Vector2 scrollPosition; + + string GetResourcePath() + { + var ms = MonoScript.FromScriptableObject(this); + var path = AssetDatabase.GetAssetPath(ms); + path = Path.GetDirectoryName(path); + return path.Substring(0, path.Length - "Editor".Length) + "Textures/"; + } + + public void OnGUI() + { + var resourcePath = GetResourcePath(); + var logo = AssetDatabase.LoadAssetAtPath(resourcePath + "logo.png"); + var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box); + if (logo) + GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); + + EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning); + + scrollPosition = GUILayout.BeginScrollView(scrollPosition); + + int numItems = 0; + + if (!EditorPrefs.HasKey(ignore + buildTarget) && + EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) + { + ++numItems; + + GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget))) + { +#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget); +#else + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget); +#endif + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + buildTarget, true); + } + + GUILayout.EndHorizontal(); + } + +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && + PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) + { + ++numItems; + + GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen))) + { + PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); + } + + GUILayout.EndHorizontal(); + } +#else + if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && + PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) + { + ++numItems; + + GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen))) + { + PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); + } + + GUILayout.EndHorizontal(); + } +#endif + if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && + PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) + { + ++numItems; + + GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen))) + { + PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + defaultScreenSize) && + (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || + PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) + { + ++numItems; + + GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight))) + { + PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth; + PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + defaultScreenSize, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + runInBackground) && + PlayerSettings.runInBackground != recommended_RunInBackground) + { + ++numItems; + + GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground))) + { + PlayerSettings.runInBackground = recommended_RunInBackground; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + runInBackground, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) && + PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) + { + ++numItems; + + GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog))) + { + PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + displayResolutionDialog, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + resizableWindow) && + PlayerSettings.resizableWindow != recommended_ResizableWindow) + { + ++numItems; + + GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow))) + { + PlayerSettings.resizableWindow = recommended_ResizableWindow; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + resizableWindow, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + fullscreenMode) && + PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) + { + ++numItems; + + GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode))) + { + PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + fullscreenMode, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + visibleInBackground) && + PlayerSettings.visibleInBackground != recommended_VisibleInBackground) + { + ++numItems; + + GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground))) + { + PlayerSettings.visibleInBackground = recommended_VisibleInBackground; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + visibleInBackground, true); + } + + GUILayout.EndHorizontal(); + } +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + if (!EditorPrefs.HasKey(ignore + renderingPath) && + PlayerSettings.renderingPath != recommended_RenderPath) + { + ++numItems; + + GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA")) + { + PlayerSettings.renderingPath = recommended_RenderPath; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + renderingPath, true); + } + + GUILayout.EndHorizontal(); + } +#endif + if (!EditorPrefs.HasKey(ignore + colorSpace) && + PlayerSettings.colorSpace != recommended_ColorSpace) + { + ++numItems; + + GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene")) + { + PlayerSettings.colorSpace = recommended_ColorSpace; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + colorSpace, true); + } + + GUILayout.EndHorizontal(); + } + + if (!EditorPrefs.HasKey(ignore + gpuSkinning) && + PlayerSettings.gpuSkinning != recommended_GpuSkinning) + { + ++numItems; + + GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning))) + { + PlayerSettings.gpuSkinning = recommended_GpuSkinning; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + gpuSkinning, true); + } + + GUILayout.EndHorizontal(); + } + +#if false + if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && + PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) + { + ++numItems; + + GUILayout.Label(singlePassStereoRendering + string.Format(currentValue, PlayerSettings.singlePassStereoRendering)); + + GUILayout.BeginHorizontal(); + + if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePassStereoRendering))) + { + PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering; + } + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Ignore")) + { + EditorPrefs.SetBool(ignore + singlePassStereoRendering, true); + } + + GUILayout.EndHorizontal(); + } +#endif + + GUILayout.BeginHorizontal(); + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Clear All Ignores")) + { + EditorPrefs.DeleteKey(ignore + buildTarget); + EditorPrefs.DeleteKey(ignore + showUnitySplashScreen); + EditorPrefs.DeleteKey(ignore + defaultIsFullScreen); + EditorPrefs.DeleteKey(ignore + defaultScreenSize); + EditorPrefs.DeleteKey(ignore + runInBackground); + EditorPrefs.DeleteKey(ignore + displayResolutionDialog); + EditorPrefs.DeleteKey(ignore + resizableWindow); + EditorPrefs.DeleteKey(ignore + fullscreenMode); + EditorPrefs.DeleteKey(ignore + visibleInBackground); +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + EditorPrefs.DeleteKey(ignore + renderingPath); +#endif + EditorPrefs.DeleteKey(ignore + colorSpace); + EditorPrefs.DeleteKey(ignore + gpuSkinning); +#if false + EditorPrefs.DeleteKey(ignore + singlePassStereoRendering); +#endif + } + + GUILayout.EndHorizontal(); + + GUILayout.EndScrollView(); + + GUILayout.FlexibleSpace(); + + GUILayout.BeginHorizontal(); + + if (numItems > 0) + { + if (GUILayout.Button("Accept All")) + { + // Only set those that have not been explicitly ignored. + if (!EditorPrefs.HasKey(ignore + buildTarget)) +#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget); +#else + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget); +#endif + if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen)) +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen; +#else + PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen; +#endif + if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen)) + PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; + if (!EditorPrefs.HasKey(ignore + defaultScreenSize)) + { + PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth; + PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight; + } + if (!EditorPrefs.HasKey(ignore + runInBackground)) + PlayerSettings.runInBackground = recommended_RunInBackground; + if (!EditorPrefs.HasKey(ignore + displayResolutionDialog)) + PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog; + if (!EditorPrefs.HasKey(ignore + resizableWindow)) + PlayerSettings.resizableWindow = recommended_ResizableWindow; + if (!EditorPrefs.HasKey(ignore + fullscreenMode)) + PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; + if (!EditorPrefs.HasKey(ignore + visibleInBackground)) + PlayerSettings.visibleInBackground = recommended_VisibleInBackground; +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + if (!EditorPrefs.HasKey(ignore + renderingPath)) + PlayerSettings.renderingPath = recommended_RenderPath; +#endif + if (!EditorPrefs.HasKey(ignore + colorSpace)) + PlayerSettings.colorSpace = recommended_ColorSpace; + if (!EditorPrefs.HasKey(ignore + gpuSkinning)) + PlayerSettings.gpuSkinning = recommended_GpuSkinning; +#if false + if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering)) + PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering; +#endif + + EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok"); + + Close(); + } + + if (GUILayout.Button("Ignore All")) + { + if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel")) + { + // Only ignore those that do not currently match our recommended settings. + if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) + EditorPrefs.SetBool(ignore + buildTarget, true); +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) +#else + if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) +#endif + EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); + if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) + EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); + if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || + PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight) + EditorPrefs.SetBool(ignore + defaultScreenSize, true); + if (PlayerSettings.runInBackground != recommended_RunInBackground) + EditorPrefs.SetBool(ignore + runInBackground, true); + if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) + EditorPrefs.SetBool(ignore + displayResolutionDialog, true); + if (PlayerSettings.resizableWindow != recommended_ResizableWindow) + EditorPrefs.SetBool(ignore + resizableWindow, true); + if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) + EditorPrefs.SetBool(ignore + fullscreenMode, true); + if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground) + EditorPrefs.SetBool(ignore + visibleInBackground, true); +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + if (PlayerSettings.renderingPath != recommended_RenderPath) + EditorPrefs.SetBool(ignore + renderingPath, true); +#endif + if (PlayerSettings.colorSpace != recommended_ColorSpace) + EditorPrefs.SetBool(ignore + colorSpace, true); + if (PlayerSettings.gpuSkinning != recommended_GpuSkinning) + EditorPrefs.SetBool(ignore + gpuSkinning, true); +#if false + if (PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) + EditorPrefs.SetBool(ignore + singlePassStereoRendering, true); +#endif + + Close(); + } + } + } + else if (GUILayout.Button("Close")) + { + Close(); + } + + GUILayout.EndHorizontal(); + } +} + diff --git a/Assets/SteamVR/Editor/SteamVR_Settings.cs.meta b/Assets/SteamVR/Editor/SteamVR_Settings.cs.meta new file mode 100644 index 0000000..8887628 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Settings.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d2244eee8a3a4784fb40d1123ff69301 +timeCreated: 1438809573 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs b/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs new file mode 100644 index 0000000..9fea2f7 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs @@ -0,0 +1,381 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Custom inspector display for SteamVR_Skybox +// +//============================================================================= + +using UnityEngine; +using UnityEditor; +using System.Text; +using System.Collections.Generic; +using Valve.VR; +using System.IO; + +[CustomEditor(typeof(SteamVR_Skybox)), CanEditMultipleObjects] +public class SteamVR_SkyboxEditor : Editor +{ + private const string nameFormat = "{0}/{1}-{2}.png"; + private const string helpText = "Take snapshot will use the current " + + "position and rotation to capture six directional screenshots to use as this " + + "skybox's textures. Note: This skybox is only used to override what shows up " + + "in the compositor (e.g. when loading levels). Add a Camera component to this " + + "object to override default settings like which layers to render. Additionally, " + + "by specifying your own targetTexture, you can control the size of the textures " + + "and other properties like antialiasing. Don't forget to disable the camera.\n\n" + + "For stereo screenshots, a panorama is render for each eye using the specified " + + "ipd (in millimeters) broken up into segments cellSize pixels square to optimize " + + "generation.\n(32x32 takes about 10 seconds depending on scene complexity, 16x16 " + + "takes around a minute, while will 8x8 take several minutes.)\n\nTo test, hit " + + "play then pause - this will activate the skybox settings, and then drop you to " + + "the compositor where the skybox is rendered."; + + public override void OnInspectorGUI() + { + DrawDefaultInspector(); + + EditorGUILayout.HelpBox(helpText, MessageType.Info); + + if (GUILayout.Button("Take snapshot")) + { + var directions = new Quaternion[] { + Quaternion.LookRotation(Vector3.forward), + Quaternion.LookRotation(Vector3.back), + Quaternion.LookRotation(Vector3.left), + Quaternion.LookRotation(Vector3.right), + Quaternion.LookRotation(Vector3.up, Vector3.back), + Quaternion.LookRotation(Vector3.down, Vector3.forward) + }; + + Camera tempCamera = null; + foreach (SteamVR_Skybox target in targets) + { + var targetScene = target.gameObject.scene; + var sceneName = Path.GetFileNameWithoutExtension(targetScene.path); + var scenePath = Path.GetDirectoryName(targetScene.path); + var assetPath = scenePath + "/" + sceneName; + if (!AssetDatabase.IsValidFolder(assetPath)) + { + var guid = AssetDatabase.CreateFolder(scenePath, sceneName); + assetPath = AssetDatabase.GUIDToAssetPath(guid); + } + + var camera = target.GetComponent(); + if (camera == null) + { + if (tempCamera == null) + tempCamera = new GameObject().AddComponent(); + camera = tempCamera; + } + + var targetTexture = camera.targetTexture; + if (camera.targetTexture == null) + { + targetTexture = new RenderTexture(1024, 1024, 24); + targetTexture.antiAliasing = 8; + camera.targetTexture = targetTexture; + } + + var oldPosition = target.transform.localPosition; + var oldRotation = target.transform.localRotation; + var baseRotation = target.transform.rotation; + + var t = camera.transform; + t.position = target.transform.position; + camera.orthographic = false; + camera.fieldOfView = 90; + + for (int i = 0; i < directions.Length; i++) + { + t.rotation = baseRotation * directions[i]; + camera.Render(); + + // Copy to texture and save to disk. + RenderTexture.active = targetTexture; + var texture = new Texture2D(targetTexture.width, targetTexture.height, TextureFormat.ARGB32, false); + texture.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0); + texture.Apply(); + RenderTexture.active = null; + + var assetName = string.Format(nameFormat, assetPath, target.name, i); + System.IO.File.WriteAllBytes(assetName, texture.EncodeToPNG()); + } + + if (camera != tempCamera) + { + target.transform.localPosition = oldPosition; + target.transform.localRotation = oldRotation; + } + } + + if (tempCamera != null) + { + Object.DestroyImmediate(tempCamera.gameObject); + } + + // Now that everything has be written out, reload the associated assets and assign them. + AssetDatabase.Refresh(); + foreach (SteamVR_Skybox target in targets) + { + var targetScene = target.gameObject.scene; + var sceneName = Path.GetFileNameWithoutExtension(targetScene.path); + var scenePath = Path.GetDirectoryName(targetScene.path); + var assetPath = scenePath + "/" + sceneName; + + for (int i = 0; i < directions.Length; i++) + { + var assetName = string.Format(nameFormat, assetPath, target.name, i); + var importer = AssetImporter.GetAtPath(assetName) as TextureImporter; +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + importer.textureFormat = TextureImporterFormat.RGB24; +#else + importer.textureCompression = TextureImporterCompression.Uncompressed; +#endif + importer.wrapMode = TextureWrapMode.Clamp; + importer.mipmapEnabled = false; + importer.SaveAndReimport(); + + var texture = AssetDatabase.LoadAssetAtPath(assetName); + target.SetTextureByIndex(i, texture); + } + } + } + else if (GUILayout.Button("Take stereo snapshot")) + { + const int width = 4096; + const int height = width / 2; + const int halfHeight = height / 2; + + var textures = new Texture2D[] { + new Texture2D(width, height, TextureFormat.ARGB32, false), + new Texture2D(width, height, TextureFormat.ARGB32, false) }; + + var timer = new System.Diagnostics.Stopwatch(); + + Camera tempCamera = null; + foreach (SteamVR_Skybox target in targets) + { + timer.Start(); + + var targetScene = target.gameObject.scene; + var sceneName = Path.GetFileNameWithoutExtension(targetScene.path); + var scenePath = Path.GetDirectoryName(targetScene.path); + var assetPath = scenePath + "/" + sceneName; + if (!AssetDatabase.IsValidFolder(assetPath)) + { + var guid = AssetDatabase.CreateFolder(scenePath, sceneName); + assetPath = AssetDatabase.GUIDToAssetPath(guid); + } + + var camera = target.GetComponent(); + if (camera == null) + { + if (tempCamera == null) + tempCamera = new GameObject().AddComponent(); + camera = tempCamera; + } + + var fx = camera.gameObject.AddComponent(); + + var oldTargetTexture = camera.targetTexture; + var oldOrthographic = camera.orthographic; + var oldFieldOfView = camera.fieldOfView; + var oldAspect = camera.aspect; + + var oldPosition = target.transform.localPosition; + var oldRotation = target.transform.localRotation; + var basePosition = target.transform.position; + var baseRotation = target.transform.rotation; + + var transform = camera.transform; + + int cellSize = int.Parse(target.StereoCellSize.ToString().Substring(1)); + float ipd = target.StereoIpdMm / 1000.0f; + int vTotal = halfHeight / cellSize; + float dv = 90.0f / vTotal; // vertical degrees per segment + float dvHalf = dv / 2.0f; + + var targetTexture = new RenderTexture(cellSize, cellSize, 24); + targetTexture.wrapMode = TextureWrapMode.Clamp; + targetTexture.antiAliasing = 8; + + camera.fieldOfView = dv; + camera.orthographic = false; + camera.targetTexture = targetTexture; + + // Render sections of a sphere using a rectilinear projection + // and resample using a sphereical projection into a single panorama + // texture per eye. We break into sections in order to keep the eye + // separation similar around the sphere. Rendering alternates between + // top and bottom sections, sweeping horizontally around the sphere, + // alternating left and right eyes. + for (int v = 0; v < vTotal; v++) + { + var pitch = 90.0f - (v * dv) - dvHalf; + var uTotal = width / targetTexture.width; + var du = 360.0f / uTotal; // horizontal degrees per segment + var duHalf = du / 2.0f; + + var vTarget = v * halfHeight / vTotal; + + for (int i = 0; i < 2; i++) // top, bottom + { + if (i == 1) + { + pitch = -pitch; + vTarget = height - vTarget - cellSize; + } + + for (int u = 0; u < uTotal; u++) + { + var yaw = -180.0f + (u * du) + duHalf; + + var uTarget = u * width / uTotal; + + var xOffset = -ipd / 2 * Mathf.Cos(pitch * Mathf.Deg2Rad); + + for (int j = 0; j < 2; j++) // left, right + { + var texture = textures[j]; + + if (j == 1) + { + xOffset = -xOffset; + } + + var offset = baseRotation * Quaternion.Euler(0, yaw, 0) * new Vector3(xOffset, 0, 0); + transform.position = basePosition + offset; + + var direction = Quaternion.Euler(pitch, yaw, 0.0f); + transform.rotation = baseRotation * direction; + + // vector pointing to center of this section + var N = direction * Vector3.forward; + + // horizontal span of this section in degrees + var phi0 = yaw - (du / 2); + var phi1 = phi0 + du; + + // vertical span of this section in degrees + var theta0 = pitch + (dv / 2); + var theta1 = theta0 - dv; + + var midPhi = (phi0 + phi1) / 2; + var baseTheta = Mathf.Abs(theta0) < Mathf.Abs(theta1) ? theta0 : theta1; + + // vectors pointing to corners of image closes to the equator + var V00 = Quaternion.Euler(baseTheta, phi0, 0.0f) * Vector3.forward; + var V01 = Quaternion.Euler(baseTheta, phi1, 0.0f) * Vector3.forward; + + // vectors pointing to top and bottom midsection of image + var V0M = Quaternion.Euler(theta0, midPhi, 0.0f) * Vector3.forward; + var V1M = Quaternion.Euler(theta1, midPhi, 0.0f) * Vector3.forward; + + // intersection points for each of the above + var P00 = V00 / Vector3.Dot(V00, N); + var P01 = V01 / Vector3.Dot(V01, N); + var P0M = V0M / Vector3.Dot(V0M, N); + var P1M = V1M / Vector3.Dot(V1M, N); + + // calculate basis vectors for plane + var P00_P01 = P01 - P00; + var P0M_P1M = P1M - P0M; + + var uMag = P00_P01.magnitude; + var vMag = P0M_P1M.magnitude; + + var uScale = 1.0f / uMag; + var vScale = 1.0f / vMag; + + var uAxis = P00_P01 * uScale; + var vAxis = P0M_P1M * vScale; + + // update material constant buffer + fx.Set(N, phi0, phi1, theta0, theta1, + uAxis, P00, uScale, + vAxis, P0M, vScale); + + camera.aspect = uMag / vMag; + camera.Render(); + + RenderTexture.active = targetTexture; + texture.ReadPixels(new Rect(0, 0, targetTexture.width, targetTexture.height), uTarget, vTarget); + RenderTexture.active = null; + } + } + } + } + + // Save textures to disk. + for (int i = 0; i < 2; i++) + { + var texture = textures[i]; + + texture.Apply(); + var assetName = string.Format(nameFormat, assetPath, target.name, i); + File.WriteAllBytes(assetName, texture.EncodeToPNG()); + } + + // Cleanup. + if (camera != tempCamera) + { + camera.targetTexture = oldTargetTexture; + camera.orthographic = oldOrthographic; + camera.fieldOfView = oldFieldOfView; + camera.aspect = oldAspect; + + target.transform.localPosition = oldPosition; + target.transform.localRotation = oldRotation; + } + else + { + tempCamera.targetTexture = null; + } + + DestroyImmediate(targetTexture); + DestroyImmediate(fx); + + timer.Stop(); + Debug.Log(string.Format("Screenshot took {0} seconds.", timer.Elapsed)); + } + + if (tempCamera != null) + { + DestroyImmediate(tempCamera.gameObject); + } + + DestroyImmediate(textures[0]); + DestroyImmediate(textures[1]); + + // Now that everything has be written out, reload the associated assets and assign them. + AssetDatabase.Refresh(); + foreach (SteamVR_Skybox target in targets) + { + var targetScene = target.gameObject.scene; + var sceneName = Path.GetFileNameWithoutExtension(targetScene.path); + var scenePath = Path.GetDirectoryName(targetScene.path); + var assetPath = scenePath + "/" + sceneName; + + for (int i = 0; i < 2; i++) + { + var assetName = string.Format(nameFormat, assetPath, target.name, i); + var importer = AssetImporter.GetAtPath(assetName) as TextureImporter; + importer.mipmapEnabled = false; + importer.wrapMode = TextureWrapMode.Repeat; +#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) + importer.SetPlatformTextureSettings("Standalone", width, TextureImporterFormat.RGB24); +#else + var settings = importer.GetPlatformTextureSettings("Standalone"); + settings.textureCompression = TextureImporterCompression.Uncompressed; + settings.maxTextureSize = width; + importer.SetPlatformTextureSettings(settings); +#endif + importer.SaveAndReimport(); + + var texture = AssetDatabase.LoadAssetAtPath(assetName); + target.SetTextureByIndex(i, texture); + } + } + } + } +} + diff --git a/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs.meta b/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs.meta new file mode 100644 index 0000000..95230d0 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 80087fbbf7bf93a46bb4aea276b19568 +timeCreated: 1446765449 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Editor/SteamVR_Update.cs b/Assets/SteamVR/Editor/SteamVR_Update.cs new file mode 100644 index 0000000..92375df --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Update.cs @@ -0,0 +1,170 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Notify developers when a new version of the plugin is available. +// +//============================================================================= + +using UnityEngine; +using UnityEditor; +using System.IO; +using System.Text.RegularExpressions; + +[InitializeOnLoad] +public class SteamVR_Update : EditorWindow +{ + const string currentVersion = "1.2.2"; + const string versionUrl = "http://media.steampowered.com/apps/steamvr/unitypluginversion.txt"; + const string notesUrl = "http://media.steampowered.com/apps/steamvr/unityplugin-v{0}.txt"; + const string pluginUrl = "http://u3d.as/content/valve-corporation/steam-vr-plugin"; + const string doNotShowKey = "SteamVR.DoNotShow.v{0}"; + + static bool gotVersion = false; + static WWW wwwVersion, wwwNotes; + static string version, notes; + static SteamVR_Update window; + + static SteamVR_Update() + { + EditorApplication.update += Update; + } + + static void Update() + { + if (!gotVersion) + { + if (wwwVersion == null) + wwwVersion = new WWW(versionUrl); + + if (!wwwVersion.isDone) + return; + + if (UrlSuccess(wwwVersion)) + version = wwwVersion.text; + + wwwVersion = null; + gotVersion = true; + + if (ShouldDisplay()) + { + var url = string.Format(notesUrl, version); + wwwNotes = new WWW(url); + + window = GetWindow(true); + window.minSize = new Vector2(320, 440); + //window.title = "SteamVR"; + } + } + + if (wwwNotes != null) + { + if (!wwwNotes.isDone) + return; + + if (UrlSuccess(wwwNotes)) + notes = wwwNotes.text; + + wwwNotes = null; + + if (notes != "") + window.Repaint(); + } + + EditorApplication.update -= Update; + } + + static bool UrlSuccess(WWW www) + { + if (!string.IsNullOrEmpty(www.error)) + return false; + if (Regex.IsMatch(www.text, "404 not found", RegexOptions.IgnoreCase)) + return false; + return true; + } + + static bool ShouldDisplay() + { + if (string.IsNullOrEmpty(version)) + return false; + if (version == currentVersion) + return false; + if (EditorPrefs.HasKey(string.Format(doNotShowKey, version))) + return false; + + // parse to see if newer (e.g. 1.0.4 vs 1.0.3) + var versionSplit = version.Split('.'); + var currentVersionSplit = currentVersion.Split('.'); + for (int i = 0; i < versionSplit.Length && i < currentVersionSplit.Length; i++) + { + int versionValue, currentVersionValue; + if (int.TryParse(versionSplit[i], out versionValue) && + int.TryParse(currentVersionSplit[i], out currentVersionValue)) + { + if (versionValue > currentVersionValue) + return true; + if (versionValue < currentVersionValue) + return false; + } + } + + // same up to this point, now differentiate based on number of sub values (e.g. 1.0.4.1 vs 1.0.4) + if (versionSplit.Length <= currentVersionSplit.Length) + return false; + + return true; + } + + Vector2 scrollPosition; + bool toggleState; + + string GetResourcePath() + { + var ms = MonoScript.FromScriptableObject(this); + var path = AssetDatabase.GetAssetPath(ms); + path = Path.GetDirectoryName(path); + return path.Substring(0, path.Length - "Editor".Length) + "Textures/"; + } + + public void OnGUI() + { + EditorGUILayout.HelpBox("A new version of the SteamVR plugin is available!", MessageType.Warning); + + var resourcePath = GetResourcePath(); + var logo = AssetDatabase.LoadAssetAtPath(resourcePath + "logo.png"); + var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box); + if (logo) + GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); + + scrollPosition = GUILayout.BeginScrollView(scrollPosition); + + GUILayout.Label("Current version: " + currentVersion); + GUILayout.Label("New version: " + version); + + if (notes != "") + { + GUILayout.Label("Release notes:"); + EditorGUILayout.HelpBox(notes, MessageType.Info); + } + + GUILayout.EndScrollView(); + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Get Latest Version")) + { + Application.OpenURL(pluginUrl); + } + + EditorGUI.BeginChangeCheck(); + var doNotShow = GUILayout.Toggle(toggleState, "Do not prompt for this version again."); + if (EditorGUI.EndChangeCheck()) + { + toggleState = doNotShow; + var key = string.Format(doNotShowKey, version); + if (doNotShow) + EditorPrefs.SetBool(key, true); + else + EditorPrefs.DeleteKey(key); + } + } +} + diff --git a/Assets/SteamVR/Editor/SteamVR_Update.cs.meta b/Assets/SteamVR/Editor/SteamVR_Update.cs.meta new file mode 100644 index 0000000..de16a50 --- /dev/null +++ b/Assets/SteamVR/Editor/SteamVR_Update.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73a0556bda803bf4e898751dcfcf21a8 +timeCreated: 1433880062 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras.meta b/Assets/SteamVR/Extras.meta new file mode 100644 index 0000000..5785668 --- /dev/null +++ b/Assets/SteamVR/Extras.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 61f4796ee4f00314e8d8b1ad39a78c28 +folderAsset: yes +timeCreated: 1438797390 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs b/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs new file mode 100644 index 0000000..c35b783 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs @@ -0,0 +1,88 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +using UnityEngine; +using System.Collections; + +public struct GazeEventArgs +{ + public float distance; +} + +public delegate void GazeEventHandler(object sender, GazeEventArgs e); + +public class SteamVR_GazeTracker : MonoBehaviour +{ + public bool isInGaze = false; + public event GazeEventHandler GazeOn; + public event GazeEventHandler GazeOff; + public float gazeInCutoff = 0.15f; + public float gazeOutCutoff = 0.4f; + + // Contains a HMD tracked object that we can use to find the user's gaze + Transform hmdTrackedObject = null; + + // Use this for initialization + void Start () + { + + } + + public virtual void OnGazeOn(GazeEventArgs e) + { + if (GazeOn != null) + GazeOn(this, e); + } + + public virtual void OnGazeOff(GazeEventArgs e) + { + if (GazeOff != null) + GazeOff(this, e); + } + + // Update is called once per frame + void Update () + { + // If we haven't set up hmdTrackedObject find what the user is looking at + if (hmdTrackedObject == null) + { + SteamVR_TrackedObject[] trackedObjects = FindObjectsOfType(); + foreach (SteamVR_TrackedObject tracked in trackedObjects) + { + if (tracked.index == SteamVR_TrackedObject.EIndex.Hmd) + { + hmdTrackedObject = tracked.transform; + break; + } + } + } + + if (hmdTrackedObject) + { + Ray r = new Ray(hmdTrackedObject.position, hmdTrackedObject.forward); + Plane p = new Plane(hmdTrackedObject.forward, transform.position); + + float enter = 0.0f; + if (p.Raycast(r, out enter)) + { + Vector3 intersect = hmdTrackedObject.position + hmdTrackedObject.forward * enter; + float dist = Vector3.Distance(intersect, transform.position); + //Debug.Log("Gaze dist = " + dist); + if (dist < gazeInCutoff && !isInGaze) + { + isInGaze = true; + GazeEventArgs e; + e.distance = dist; + OnGazeOn(e); + } + else if (dist >= gazeOutCutoff && isInGaze) + { + isInGaze = false; + GazeEventArgs e; + e.distance = dist; + OnGazeOff(e); + } + } + + } + + } +} diff --git a/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs.meta b/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs.meta new file mode 100644 index 0000000..9f67d12 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 501eb8b744f73714fbe7dbdd5e3ef66e +timeCreated: 1426193800 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs b/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs new file mode 100644 index 0000000..d35c731 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs @@ -0,0 +1,141 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +using UnityEngine; +using System.Collections; + +public struct PointerEventArgs +{ + public uint controllerIndex; + public uint flags; + public float distance; + public Transform target; +} + +public delegate void PointerEventHandler(object sender, PointerEventArgs e); + + +public class SteamVR_LaserPointer : MonoBehaviour +{ + public bool active = true; + public Color color; + public float thickness = 0.002f; + public GameObject holder; + public GameObject pointer; + bool isActive = false; + public bool addRigidBody = false; + public Transform reference; + public event PointerEventHandler PointerIn; + public event PointerEventHandler PointerOut; + + Transform previousContact = null; + + // Use this for initialization + void Start () + { + holder = new GameObject(); + holder.transform.parent = this.transform; + holder.transform.localPosition = Vector3.zero; + holder.transform.localRotation = Quaternion.identity; + + pointer = GameObject.CreatePrimitive(PrimitiveType.Cube); + pointer.transform.parent = holder.transform; + pointer.transform.localScale = new Vector3(thickness, thickness, 100f); + pointer.transform.localPosition = new Vector3(0f, 0f, 50f); + pointer.transform.localRotation = Quaternion.identity; + BoxCollider collider = pointer.GetComponent(); + if (addRigidBody) + { + if (collider) + { + collider.isTrigger = true; + } + Rigidbody rigidBody = pointer.AddComponent(); + rigidBody.isKinematic = true; + } + else + { + if(collider) + { + Object.Destroy(collider); + } + } + Material newMaterial = new Material(Shader.Find("Unlit/Color")); + newMaterial.SetColor("_Color", color); + pointer.GetComponent().material = newMaterial; + } + + public virtual void OnPointerIn(PointerEventArgs e) + { + if (PointerIn != null) + PointerIn(this, e); + } + + public virtual void OnPointerOut(PointerEventArgs e) + { + if (PointerOut != null) + PointerOut(this, e); + } + + + // Update is called once per frame + void Update () + { + if (!isActive) + { + isActive = true; + this.transform.GetChild(0).gameObject.SetActive(true); + } + + float dist = 100f; + + SteamVR_TrackedController controller = GetComponent(); + + Ray raycast = new Ray(transform.position, transform.forward); + RaycastHit hit; + bool bHit = Physics.Raycast(raycast, out hit); + + if(previousContact && previousContact != hit.transform) + { + PointerEventArgs args = new PointerEventArgs(); + if (controller != null) + { + args.controllerIndex = controller.controllerIndex; + } + args.distance = 0f; + args.flags = 0; + args.target = previousContact; + OnPointerOut(args); + previousContact = null; + } + if(bHit && previousContact != hit.transform) + { + PointerEventArgs argsIn = new PointerEventArgs(); + if (controller != null) + { + argsIn.controllerIndex = controller.controllerIndex; + } + argsIn.distance = hit.distance; + argsIn.flags = 0; + argsIn.target = hit.transform; + OnPointerIn(argsIn); + previousContact = hit.transform; + } + if(!bHit) + { + previousContact = null; + } + if (bHit && hit.distance < 100f) + { + dist = hit.distance; + } + + if (controller != null && controller.triggerPressed) + { + pointer.transform.localScale = new Vector3(thickness * 5f, thickness * 5f, dist); + } + else + { + pointer.transform.localScale = new Vector3(thickness, thickness, dist); + } + pointer.transform.localPosition = new Vector3(0f, 0f, dist/2f); + } +} diff --git a/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs.meta b/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs.meta new file mode 100644 index 0000000..874f4ae --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d4e8a839a7c5b7e4580c59e305fb5f01 +timeCreated: 1430337756 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_Teleporter.cs b/Assets/SteamVR/Extras/SteamVR_Teleporter.cs new file mode 100644 index 0000000..e04df84 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_Teleporter.cs @@ -0,0 +1,98 @@ +using UnityEngine; +using System.Collections; + +public class SteamVR_Teleporter : MonoBehaviour +{ + public enum TeleportType + { + TeleportTypeUseTerrain, + TeleportTypeUseCollider, + TeleportTypeUseZeroY + } + + public bool teleportOnClick = false; + public TeleportType teleportType = TeleportType.TeleportTypeUseZeroY; + + Transform reference + { + get + { + var top = SteamVR_Render.Top(); + return (top != null) ? top.origin : null; + } + } + + void Start() + { + var trackedController = GetComponent(); + if (trackedController == null) + { + trackedController = gameObject.AddComponent(); + } + + trackedController.TriggerClicked += new ClickedEventHandler(DoClick); + + if (teleportType == TeleportType.TeleportTypeUseTerrain) + { + // Start the player at the level of the terrain + var t = reference; + if (t != null) + t.position = new Vector3(t.position.x, Terrain.activeTerrain.SampleHeight(t.position), t.position.z); + } + } + + void DoClick(object sender, ClickedEventArgs e) + { + if (teleportOnClick) + { + // First get the current Transform of the the reference space (i.e. the Play Area, e.g. CameraRig prefab) + var t = reference; + if (t == null) + return; + + // Get the current Y position of the reference space + float refY = t.position.y; + + // Create a plane at the Y position of the Play Area + // Then create a Ray from the origin of the controller in the direction that the controller is pointing + Plane plane = new Plane(Vector3.up, -refY); + Ray ray = new Ray(this.transform.position, transform.forward); + + // Set defaults + bool hasGroundTarget = false; + float dist = 0f; + if (teleportType == TeleportType.TeleportTypeUseTerrain) // If we picked to use the terrain + { + RaycastHit hitInfo; + TerrainCollider tc = Terrain.activeTerrain.GetComponent(); + hasGroundTarget = tc.Raycast(ray, out hitInfo, 1000f); + dist = hitInfo.distance; + } + else if (teleportType == TeleportType.TeleportTypeUseCollider) // If we picked to use the collider + { + RaycastHit hitInfo; + hasGroundTarget = Physics.Raycast(ray, out hitInfo); + dist = hitInfo.distance; + } + else // If we're just staying flat on the current Y axis + { + // Intersect a ray with the plane that was created earlier + // and output the distance along the ray that it intersects + hasGroundTarget = plane.Raycast(ray, out dist); + } + + if (hasGroundTarget) + { + // Get the current Camera (head) position on the ground relative to the world + Vector3 headPosOnGround = new Vector3(SteamVR_Render.Top().head.position.x, refY, SteamVR_Render.Top().head.position.z); + + // We need to translate the reference space along the same vector + // that is between the head's position on the ground and the intersection point on the ground + // i.e. intersectionPoint - headPosOnGround = translateVector + // currentReferencePosition + translateVector = finalPosition + t.position = t.position + (ray.origin + (ray.direction * dist)) - headPosOnGround; + } + } + } +} + diff --git a/Assets/SteamVR/Extras/SteamVR_Teleporter.cs.meta b/Assets/SteamVR/Extras/SteamVR_Teleporter.cs.meta new file mode 100644 index 0000000..8aad8d9 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_Teleporter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 24c7d7d77dd0d2a4b8e1ad129b170ee3 +timeCreated: 1430337756 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TestIK.unity b/Assets/SteamVR/Extras/SteamVR_TestIK.unity new file mode 100644 index 0000000..b67988f --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestIK.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c36101ca099543026ddda58ceca38150ce27b01b0828360eecc69653796f365 +size 52553 diff --git a/Assets/SteamVR/Extras/SteamVR_TestIK.unity.meta b/Assets/SteamVR/Extras/SteamVR_TestIK.unity.meta new file mode 100644 index 0000000..a31ced7 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestIK.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4b6669fb4e4df9c48926f02b694be9d1 +timeCreated: 1437433018 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TestThrow.cs b/Assets/SteamVR/Extras/SteamVR_TestThrow.cs new file mode 100644 index 0000000..0dd7a94 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestThrow.cs @@ -0,0 +1,58 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +using UnityEngine; +using System.Collections; + +[RequireComponent(typeof(SteamVR_TrackedObject))] +public class SteamVR_TestThrow : MonoBehaviour +{ + public GameObject prefab; + public Rigidbody attachPoint; + + SteamVR_TrackedObject trackedObj; + FixedJoint joint; + + void Awake() + { + trackedObj = GetComponent(); + } + + void FixedUpdate() + { + var device = SteamVR_Controller.Input((int)trackedObj.index); + if (joint == null && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) + { + var go = GameObject.Instantiate(prefab); + go.transform.position = attachPoint.transform.position; + + joint = go.AddComponent(); + joint.connectedBody = attachPoint; + } + else if (joint != null && device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) + { + var go = joint.gameObject; + var rigidbody = go.GetComponent(); + Object.DestroyImmediate(joint); + joint = null; + Object.Destroy(go, 15.0f); + + // We should probably apply the offset between trackedObj.transform.position + // and device.transform.pos to insert into the physics sim at the correct + // location, however, we would then want to predict ahead the visual representation + // by the same amount we are predicting our render poses. + + var origin = trackedObj.origin ? trackedObj.origin : trackedObj.transform.parent; + if (origin != null) + { + rigidbody.velocity = origin.TransformVector(device.velocity); + rigidbody.angularVelocity = origin.TransformVector(device.angularVelocity); + } + else + { + rigidbody.velocity = device.velocity; + rigidbody.angularVelocity = device.angularVelocity; + } + + rigidbody.maxAngularVelocity = rigidbody.angularVelocity.magnitude; + } + } +} diff --git a/Assets/SteamVR/Extras/SteamVR_TestThrow.cs.meta b/Assets/SteamVR/Extras/SteamVR_TestThrow.cs.meta new file mode 100644 index 0000000..86dcfb0 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestThrow.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ff4f36585e15b1942827390ff1a92502 +timeCreated: 1437513988 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TestThrow.unity b/Assets/SteamVR/Extras/SteamVR_TestThrow.unity new file mode 100644 index 0000000..44bd19f --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestThrow.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5240c8d162fd86882cc699eb1b45813cae30260c1c08b7fb48343ebae5232b7d +size 73867 diff --git a/Assets/SteamVR/Extras/SteamVR_TestThrow.unity.meta b/Assets/SteamVR/Extras/SteamVR_TestThrow.unity.meta new file mode 100644 index 0000000..3cb5fc8 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestThrow.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d936163b5e9a5047b5e4ba5afaf5126 +timeCreated: 1437513966 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs new file mode 100644 index 0000000..0d24ae5 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs @@ -0,0 +1,84 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +using UnityEngine; + +public class SteamVR_TestTrackedCamera : MonoBehaviour +{ + public Material material; + public Transform target; + public bool undistorted = true; + public bool cropped = true; + + void OnEnable() + { + // The video stream must be symmetrically acquired and released in + // order to properly disable the stream once there are no consumers. + var source = SteamVR_TrackedCamera.Source(undistorted); + source.Acquire(); + + // Auto-disable if no camera is present. + if (!source.hasCamera) + enabled = false; + } + + void OnDisable() + { + // Clear the texture when no longer active. + material.mainTexture = null; + + // The video stream must be symmetrically acquired and released in + // order to properly disable the stream once there are no consumers. + var source = SteamVR_TrackedCamera.Source(undistorted); + source.Release(); + } + + void Update() + { + var source = SteamVR_TrackedCamera.Source(undistorted); + var texture = source.texture; + if (texture == null) + { + return; + } + + // Apply the latest texture to the material. This must be performed + // every frame since the underlying texture is actually part of a ring + // buffer which is updated in lock-step with its associated pose. + // (You actually really only need to call any of the accessors which + // internally call Update on the SteamVR_TrackedCamera.VideoStreamTexture). + material.mainTexture = texture; + + // Adjust the height of the quad based on the aspect to keep the texels square. + var aspect = (float)texture.width / texture.height; + + // The undistorted video feed has 'bad' areas near the edges where the original + // square texture feed is stretched to undo the fisheye from the lens. + // Therefore, you'll want to crop it to the specified frameBounds to remove this. + if (cropped) + { + var bounds = source.frameBounds; + material.mainTextureOffset = new Vector2(bounds.uMin, bounds.vMin); + + var du = bounds.uMax - bounds.uMin; + var dv = bounds.vMax - bounds.vMin; + material.mainTextureScale = new Vector2(du, dv); + + aspect *= Mathf.Abs(du / dv); + } + else + { + material.mainTextureOffset = Vector2.zero; + material.mainTextureScale = new Vector2(1, -1); + } + + target.localScale = new Vector3(1, 1.0f / aspect, 1); + + // Apply the pose that this frame was recorded at. + if (source.hasTracking) + { + var t = source.transform; + target.localPosition = t.pos; + target.localRotation = t.rot; + } + } +} + diff --git a/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs.meta b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs.meta new file mode 100644 index 0000000..062ae1e --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8b18b36a995ecb04599f35c2741be8d5 +timeCreated: 1465946679 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat new file mode 100644 index 0000000..ac7fe86 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat @@ -0,0 +1,127 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: SteamVR_TestTrackedCamera + m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _EMISSION + m_LightmapFlags: 1 + m_CustomRenderQueue: -1 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + - first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 0.5, y: -0.49999994} + m_Offset: {x: 0.25, y: 0.75} + - first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - first: + name: _BumpScale + second: 1 + - first: + name: _Cutoff + second: 0.5 + - first: + name: _DetailNormalMapScale + second: 1 + - first: + name: _DstBlend + second: 0 + - first: + name: _GlossMapScale + second: 1 + - first: + name: _Glossiness + second: 0.5 + - first: + name: _GlossyReflections + second: 1 + - first: + name: _Metallic + second: 0 + - first: + name: _Mode + second: 0 + - first: + name: _OcclusionStrength + second: 1 + - first: + name: _Parallax + second: 0.02 + - first: + name: _SmoothnessTextureChannel + second: 0 + - first: + name: _SpecularHighlights + second: 1 + - first: + name: _SrcBlend + second: 1 + - first: + name: _UVSec + second: 0 + - first: + name: _ZWrite + second: 1 + m_Colors: + - first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + - first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat.meta b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat.meta new file mode 100644 index 0000000..f8611eb --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99ee8d48ccf36264e9d9a72baa681249 +timeCreated: 1465950289 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity new file mode 100644 index 0000000..5667ae0 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af5fd1bc44adb26245c6f31511caee4e9d3edc7415f8d690a901ce441edeef04 +size 23886 diff --git a/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity.meta b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity.meta new file mode 100644 index 0000000..d3eb908 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TestTrackedCamera.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7fb811b0ffe615b4dbf1d5e6ced385fd +timeCreated: 1464227836 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/Extras/SteamVR_TrackedController.cs b/Assets/SteamVR/Extras/SteamVR_TrackedController.cs new file mode 100644 index 0000000..9922d44 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TrackedController.cs @@ -0,0 +1,250 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +using UnityEngine; +using Valve.VR; + +public struct ClickedEventArgs +{ + public uint controllerIndex; + public uint flags; + public float padX, padY; +} + +public delegate void ClickedEventHandler(object sender, ClickedEventArgs e); + +public class SteamVR_TrackedController : MonoBehaviour +{ + public uint controllerIndex; + public VRControllerState_t controllerState; + public bool triggerPressed = false; + public bool steamPressed = false; + public bool menuPressed = false; + public bool padPressed = false; + public bool padTouched = false; + public bool gripped = false; + + public event ClickedEventHandler MenuButtonClicked; + public event ClickedEventHandler MenuButtonUnclicked; + public event ClickedEventHandler TriggerClicked; + public event ClickedEventHandler TriggerUnclicked; + public event ClickedEventHandler SteamClicked; + public event ClickedEventHandler PadClicked; + public event ClickedEventHandler PadUnclicked; + public event ClickedEventHandler PadTouched; + public event ClickedEventHandler PadUntouched; + public event ClickedEventHandler Gripped; + public event ClickedEventHandler Ungripped; + + // Use this for initialization + protected virtual void Start() + { + if (this.GetComponent() == null) + { + gameObject.AddComponent(); + } + + if (controllerIndex != 0) + { + this.GetComponent().index = (SteamVR_TrackedObject.EIndex)controllerIndex; + if (this.GetComponent() != null) + { + this.GetComponent().index = (SteamVR_TrackedObject.EIndex)controllerIndex; + } + } + else + { + controllerIndex = (uint)this.GetComponent().index; + } + } + + public void SetDeviceIndex(int index) + { + this.controllerIndex = (uint)index; + } + + public virtual void OnTriggerClicked(ClickedEventArgs e) + { + if (TriggerClicked != null) + TriggerClicked(this, e); + } + + public virtual void OnTriggerUnclicked(ClickedEventArgs e) + { + if (TriggerUnclicked != null) + TriggerUnclicked(this, e); + } + + public virtual void OnMenuClicked(ClickedEventArgs e) + { + if (MenuButtonClicked != null) + MenuButtonClicked(this, e); + } + + public virtual void OnMenuUnclicked(ClickedEventArgs e) + { + if (MenuButtonUnclicked != null) + MenuButtonUnclicked(this, e); + } + + public virtual void OnSteamClicked(ClickedEventArgs e) + { + if (SteamClicked != null) + SteamClicked(this, e); + } + + public virtual void OnPadClicked(ClickedEventArgs e) + { + if (PadClicked != null) + PadClicked(this, e); + } + + public virtual void OnPadUnclicked(ClickedEventArgs e) + { + if (PadUnclicked != null) + PadUnclicked(this, e); + } + + public virtual void OnPadTouched(ClickedEventArgs e) + { + if (PadTouched != null) + PadTouched(this, e); + } + + public virtual void OnPadUntouched(ClickedEventArgs e) + { + if (PadUntouched != null) + PadUntouched(this, e); + } + + public virtual void OnGripped(ClickedEventArgs e) + { + if (Gripped != null) + Gripped(this, e); + } + + public virtual void OnUngripped(ClickedEventArgs e) + { + if (Ungripped != null) + Ungripped(this, e); + } + + // Update is called once per frame + protected virtual void Update() + { + var system = OpenVR.System; + if (system != null && system.GetControllerState(controllerIndex, ref controllerState, (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t)))) + { + ulong trigger = controllerState.ulButtonPressed & (1UL << ((int)EVRButtonId.k_EButton_SteamVR_Trigger)); + if (trigger > 0L && !triggerPressed) + { + triggerPressed = true; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnTriggerClicked(e); + + } + else if (trigger == 0L && triggerPressed) + { + triggerPressed = false; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnTriggerUnclicked(e); + } + + ulong grip = controllerState.ulButtonPressed & (1UL << ((int)EVRButtonId.k_EButton_Grip)); + if (grip > 0L && !gripped) + { + gripped = true; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnGripped(e); + + } + else if (grip == 0L && gripped) + { + gripped = false; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnUngripped(e); + } + + ulong pad = controllerState.ulButtonPressed & (1UL << ((int)EVRButtonId.k_EButton_SteamVR_Touchpad)); + if (pad > 0L && !padPressed) + { + padPressed = true; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnPadClicked(e); + } + else if (pad == 0L && padPressed) + { + padPressed = false; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnPadUnclicked(e); + } + + ulong menu = controllerState.ulButtonPressed & (1UL << ((int)EVRButtonId.k_EButton_ApplicationMenu)); + if (menu > 0L && !menuPressed) + { + menuPressed = true; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnMenuClicked(e); + } + else if (menu == 0L && menuPressed) + { + menuPressed = false; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnMenuUnclicked(e); + } + + pad = controllerState.ulButtonTouched & (1UL << ((int)EVRButtonId.k_EButton_SteamVR_Touchpad)); + if (pad > 0L && !padTouched) + { + padTouched = true; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnPadTouched(e); + + } + else if (pad == 0L && padTouched) + { + padTouched = false; + ClickedEventArgs e; + e.controllerIndex = controllerIndex; + e.flags = (uint)controllerState.ulButtonPressed; + e.padX = controllerState.rAxis0.x; + e.padY = controllerState.rAxis0.y; + OnPadUntouched(e); + } + } + } +} diff --git a/Assets/SteamVR/Extras/SteamVR_TrackedController.cs.meta b/Assets/SteamVR/Extras/SteamVR_TrackedController.cs.meta new file mode 100644 index 0000000..7cc72d0 --- /dev/null +++ b/Assets/SteamVR/Extras/SteamVR_TrackedController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7346a42905a29b347b1f492e8ad7b49f +timeCreated: 1430337756 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem.meta b/Assets/SteamVR/InteractionSystem.meta new file mode 100644 index 0000000..f510efd --- /dev/null +++ b/Assets/SteamVR/InteractionSystem.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c8941a9f98c35d84cb19a5e044467de9 +folderAsset: yes +timeCreated: 1479762244 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core.meta b/Assets/SteamVR/InteractionSystem/Core.meta new file mode 100644 index 0000000..7cb2055 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1ab2780fe1da2544b86a1020e5f638e2 +folderAsset: yes +timeCreated: 1479762244 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons.meta b/Assets/SteamVR/InteractionSystem/Core/Icons.meta new file mode 100644 index 0000000..5c73e6b --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1fcf8377413b60c44afff7b2e4efd8f7 +folderAsset: yes +timeCreated: 1482867667 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png new file mode 100644 index 0000000..ccdc4d0 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:761f314867d1d49c8f131ca3b1c2f6da61fea23664652b39b6dfd7f8c85e3f34 +size 14839 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png.meta new file mode 100644 index 0000000..b83d41e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system.png.meta @@ -0,0 +1,59 @@ +fileFormatVersion: 2 +guid: b93fe5c516cf6ed4b9153ec790f856e2 +timeCreated: 1484264198 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png new file mode 100644 index 0000000..4891239 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf9e175f5700ffb6bb73cc00ddd1755742568741b9b793dc9e05453b5da6d4b2 +size 11011 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png.meta new file mode 100644 index 0000000..cf03fc9 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_feet.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 032fb1710098a1d47ad34d72e90f714a +timeCreated: 1435940722 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png new file mode 100644 index 0000000..1b4cc02 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea2c290be7aa9df4dd4e3e13f1ec88191e43e0b24faa0a01708ee9ee9c4e8035 +size 10034 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png.meta new file mode 100644 index 0000000..fd76cfa --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 27f3faef5a63db84c9cbac06e94ab7b3 +timeCreated: 1435940722 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png new file mode 100644 index 0000000..07c3a15 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e76a38e8335f84e32fd90a0ecfc5b4e8c9819cfecb455ff92b23b23967160f88 +size 11809 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png.meta new file mode 100644 index 0000000..551713b --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_left_hand_question.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 6789d499b24f8964c8bb06e21008e546 +timeCreated: 1435940722 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png new file mode 100644 index 0000000..63b1a55 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d96acf42841f71b8e63be677becd16558d8543ef8724217e2af1b10915324cf +size 10163 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png.meta new file mode 100644 index 0000000..a193a69 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 1acda2a2584a8fb4683ea56799b27fa0 +timeCreated: 1435940722 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png new file mode 100644 index 0000000..0befe6e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feb7ce26eec9d58b5e5e790b0795def7284a92479aee962260239cccc6f9b0cb +size 11971 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png.meta new file mode 100644 index 0000000..9725e1d --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_right_hand_question.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 90173f9e9e795f74ca97ccc52fe410cd +timeCreated: 1435940723 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png new file mode 100644 index 0000000..3e3f7ec --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb35c9d96deddc945b1f977a0fbf40eb98111c1e0cb6ba1f2d75c2beed27ef0f +size 13315 diff --git a/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png.meta b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png.meta new file mode 100644 index 0000000..1184b07 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Icons/vr_interaction_system_unknown_hand.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 77b322b27d7d39f4d91e479d19065d50 +timeCreated: 1435940723 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials.meta b/Assets/SteamVR/InteractionSystem/Core/Materials.meta new file mode 100644 index 0000000..d03e9b7 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 05a69997deb9f5944a894239434f00a9 +folderAsset: yes +timeCreated: 1479762244 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat b/Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat new file mode 100644 index 0000000..c4efae1 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat @@ -0,0 +1,138 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: FallbackHandIndicator + m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: 2000 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: 0 + data: + first: + name: _Metallic + second: 0 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 1, g: 0, b: 0, a: 1} diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat.meta b/Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat.meta new file mode 100644 index 0000000..82644b5 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/FallbackHandIndicator.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9e995e61de69d8647ae2b2d65eceab3f +timeCreated: 1436394722 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat b/Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat new file mode 100644 index 0000000..7b40684 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat @@ -0,0 +1,182 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: HoverHighlight + m_Shader: {fileID: 4800000, guid: 0c1cf10ea69e60e4f9eb8955749f88ec, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: -1 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Cutoff + second: 0.5 + data: + first: + name: g_flOutlineWidth + second: 0.005 + data: + first: + name: _Parallax + second: 0.02 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: 0.5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + data: + first: + name: _Outline + second: 0.005 + data: + first: + name: _Opacity + second: 0 + data: + first: + name: _node_6969 + second: 0 + data: + first: + name: _OutlineWidth + second: 0.00238 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 0.486632, g: 0.78411454, b: 0.8823653, a: 1} + data: + first: + name: g_vOutlineColor + second: {r: 0.9485294, g: 0.9223629, b: 0, a: 1} + data: + first: + name: _OutlineColor + second: {r: 1, g: 0.9833671, b: 0.39705884, a: 1} + data: + first: + name: _node_2507 + second: {r: 0.6421389, g: 0.7807802, b: 0.78676474, a: 0} + data: + first: + name: _OutlightColor + second: {r: 0.9446255, g: 1, b: 0.42647058, a: 0.347} + data: + first: + name: _node_8174 + second: {r: 0.5, g: 0.5, b: 0.5, a: 1} + data: + first: + name: _node_8282 + second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat.meta b/Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat.meta new file mode 100644 index 0000000..bc49d16 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/HoverHighlight.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7b939e5e799d98a469f594828ebab52e +timeCreated: 1439237525 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat b/Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat new file mode 100644 index 0000000..89e506c --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat @@ -0,0 +1,213 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: SeeThru + m_Shader: {fileID: 4800000, guid: 6337aa7e7823eee43af8ffe676935e74, type: 3} + m_ShaderKeywords: S_SPECULAR_NONE S_UNLIT _ALPHABLEND_ON + m_LightmapFlags: 5 + m_CustomRenderQueue: -1 + stringTagMap: + OriginalShader: Unlit/Texture + RenderType: Transparent + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + - first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _SpecGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: g_tOverrideLightmap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - first: + name: PixelSnap + second: 0 + - first: + name: _BumpScale + second: 1 + - first: + name: _ColorMask + second: 15 + - first: + name: _Cutoff + second: 0.5 + - first: + name: _DetailNormalMapScale + second: 1 + - first: + name: _DstBlend + second: 10 + - first: + name: _Glossiness + second: 0.5 + - first: + name: _InvFade + second: 0.5 + - first: + name: _Metallic + second: 0 + - first: + name: _Mode + second: 2 + - first: + name: _OcclusionStrength + second: 1 + - first: + name: _OcclusionStrengthDirectDiffuse + second: 1 + - first: + name: _OcclusionStrengthDirectSpecular + second: 1 + - first: + name: _OcclusionStrengthIndirectDiffuse + second: 1 + - first: + name: _OcclusionStrengthIndirectSpecular + second: 1 + - first: + name: _Parallax + second: 0.02 + - first: + name: _SpecularMode + second: 1 + - first: + name: _SrcBlend + second: 5 + - first: + name: _Stencil + second: 0 + - first: + name: _StencilComp + second: 8 + - first: + name: _StencilOp + second: 0 + - first: + name: _StencilReadMask + second: 255 + - first: + name: _StencilWriteMask + second: 255 + - first: + name: _UVSec + second: 0 + - first: + name: _ZWrite + second: 0 + - first: + name: g_bReceiveShadows + second: 1 + - first: + name: g_bUnlit + second: 1 + - first: + name: g_bWorldAlignedTexture + second: 0 + - first: + name: g_flCubeMapScalar + second: 1 + - first: + name: g_flReflectanceBias + second: 0 + - first: + name: g_flReflectanceMax + second: 1 + - first: + name: g_flReflectanceMin + second: 0 + - first: + name: g_flReflectanceScale + second: 1 + m_Colors: + - first: + name: _Color + second: {r: 0.24999985, g: 0.24999985, b: 0.24999985, a: 0.1254902} + - first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + - first: + name: _SpecColor + second: {r: 0.2, g: 0.2, b: 0.2, a: 1} + - first: + name: _TintColor + second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} + - first: + name: g_vWorldAlignedNormalTangentU + second: {r: -1, g: 0, b: 0, a: 0} + - first: + name: g_vWorldAlignedNormalTangentV + second: {r: 0, g: 0, b: 1, a: 0} + - first: + name: g_vWorldAlignedTextureNormal + second: {r: 0, g: 1, b: 0, a: 0} + - first: + name: g_vWorldAlignedTexturePosition + second: {r: 0, g: 0, b: 0, a: 0} + - first: + name: g_vWorldAlignedTextureSize + second: {r: 1, g: 1, b: 1, a: 0} diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat.meta b/Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat.meta new file mode 100644 index 0000000..5630e46 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/SeeThru.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3bbb445147c574240a8b87a1193788b5 +timeCreated: 1456708947 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat b/Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat new file mode 100644 index 0000000..c320786 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: SteamVRControllerModel + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: S_RECEIVE_SHADOWS S_SPECULAR_METALLIC _EMISSION + m_LightmapFlags: 1 + m_CustomRenderQueue: -1 + stringTagMap: + OriginalShader: Standard + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + - first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _SpecGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: g_tOverrideLightmap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - first: + name: _BumpScale + second: 1 + - first: + name: _Cutoff + second: 0.5 + - first: + name: _DetailNormalMapScale + second: 1 + - first: + name: _DstBlend + second: 0 + - first: + name: _GlossMapScale + second: 1 + - first: + name: _Glossiness + second: 0.405 + - first: + name: _GlossyReflections + second: 1 + - first: + name: _Metallic + second: 0 + - first: + name: _Mode + second: 0 + - first: + name: _OcclusionStrength + second: 1 + - first: + name: _OcclusionStrengthDirectDiffuse + second: 1 + - first: + name: _OcclusionStrengthDirectSpecular + second: 1 + - first: + name: _OcclusionStrengthIndirectDiffuse + second: 1 + - first: + name: _OcclusionStrengthIndirectSpecular + second: 1 + - first: + name: _Parallax + second: 0.02 + - first: + name: _SmoothnessTextureChannel + second: 0 + - first: + name: _SpecularHighlights + second: 1 + - first: + name: _SpecularMode + second: 2 + - first: + name: _SrcBlend + second: 1 + - first: + name: _UVSec + second: 0 + - first: + name: _ZWrite + second: 1 + - first: + name: g_bReceiveShadows + second: 1 + - first: + name: g_bUnlit + second: 0 + - first: + name: g_bWorldAlignedTexture + second: 0 + - first: + name: g_flCubeMapScalar + second: 1 + - first: + name: g_flReflectanceBias + second: 0 + - first: + name: g_flReflectanceMax + second: 1 + - first: + name: g_flReflectanceMin + second: 0 + - first: + name: g_flReflectanceScale + second: 1 + m_Colors: + - first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + - first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + - first: + name: _SpecColor + second: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + - first: + name: g_vWorldAlignedNormalTangentU + second: {r: -1, g: 0, b: 0, a: 0} + - first: + name: g_vWorldAlignedNormalTangentV + second: {r: 0, g: 0, b: 1, a: 0} + - first: + name: g_vWorldAlignedTextureNormal + second: {r: 0, g: 1, b: 0, a: 0} + - first: + name: g_vWorldAlignedTexturePosition + second: {r: 0, g: 0, b: 0, a: 0} + - first: + name: g_vWorldAlignedTextureSize + second: {r: 1, g: 1, b: 1, a: 0} diff --git a/Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat.meta b/Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat.meta new file mode 100644 index 0000000..4085b7e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Materials/SteamVRControllerModel.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c433e134e4719444b65bf064a77e22e +timeCreated: 1455877211 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Prefabs.meta b/Assets/SteamVR/InteractionSystem/Core/Prefabs.meta new file mode 100644 index 0000000..a505e51 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6d60d25020af6fb4f8d436244db7cc4b +folderAsset: yes +timeCreated: 1479762244 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab b/Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab new file mode 100644 index 0000000..d53f638 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18c76f1d6f18859ddbb21f4e2369e4d3f9d03f7b4f1d72c2abbe1c7891ae5efc +size 3302 diff --git a/Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab.meta b/Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab.meta new file mode 100644 index 0000000..efbd368 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Prefabs/BlankController.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f39fc63a93686e4a8e9168ee73f24d9 +timeCreated: 1439253462 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab b/Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab new file mode 100644 index 0000000..fe5af92 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afdfb3bad2a4ce301dc4f4e7ba677bec6e498b37d1556f0e8e9f569aab4b1f02 +size 40577 diff --git a/Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab.meta b/Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab.meta new file mode 100644 index 0000000..2e49488 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Prefabs/Player.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dc06161b6d97feb419f45f03b62e14b9 +timeCreated: 1430240738 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts.meta new file mode 100644 index 0000000..50c9058 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 77a23888f82e2ab4c8bc825f20235e1e +folderAsset: yes +timeCreated: 1479762244 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs new file mode 100644 index 0000000..e03cf4e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs @@ -0,0 +1,35 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Collider dangling from the player's head +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( CapsuleCollider ) )] + public class BodyCollider : MonoBehaviour + { + public Transform head; + + private CapsuleCollider capsuleCollider; + + //------------------------------------------------- + void Awake() + { + capsuleCollider = GetComponent(); + } + + + //------------------------------------------------- + void FixedUpdate() + { + float distanceFromFloor = Vector3.Dot( head.localPosition, Vector3.up ); + capsuleCollider.height = Mathf.Max( capsuleCollider.radius, distanceFromFloor ); + transform.localPosition = head.localPosition - 0.5f * distanceFromFloor * Vector3.up; + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs.meta new file mode 100644 index 0000000..280704a --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/BodyCollider.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1731d642c0b250b48bb8cdfb153d9792 +timeCreated: 1434649753 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs new file mode 100644 index 0000000..b24d944 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs @@ -0,0 +1,529 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Interactable that can be used to move in a circular motion +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class CircularDrive : MonoBehaviour + { + public enum Axis_t + { + XAxis, + YAxis, + ZAxis + }; + + [Tooltip( "The axis around which the circular drive will rotate in local space" )] + public Axis_t axisOfRotation = Axis_t.XAxis; + + [Tooltip( "Child GameObject which has the Collider component to initiate interaction, only needs to be set if there is more than one Collider child" )] + public Collider childCollider = null; + + [Tooltip( "A LinearMapping component to drive, if not specified one will be dynamically added to this GameObject" )] + public LinearMapping linearMapping; + + [Tooltip( "If true, the drive will stay manipulating as long as the button is held down, if false, it will stop if the controller moves out of the collider" )] + public bool hoverLock = false; + + [HeaderAttribute( "Limited Rotation" )] + [Tooltip( "If true, the rotation will be limited to [minAngle, maxAngle], if false, the rotation is unlimited" )] + public bool limited = false; + public Vector2 frozenDistanceMinMaxThreshold = new Vector2( 0.1f, 0.2f ); + public UnityEvent onFrozenDistanceThreshold; + + [HeaderAttribute( "Limited Rotation Min" )] + [Tooltip( "If limited is true, the specifies the lower limit, otherwise value is unused" )] + public float minAngle = -45.0f; + [Tooltip( "If limited, set whether drive will freeze its angle when the min angle is reached" )] + public bool freezeOnMin = false; + [Tooltip( "If limited, event invoked when minAngle is reached" )] + public UnityEvent onMinAngle; + + [HeaderAttribute( "Limited Rotation Max" )] + [Tooltip( "If limited is true, the specifies the upper limit, otherwise value is unused" )] + public float maxAngle = 45.0f; + [Tooltip( "If limited, set whether drive will freeze its angle when the max angle is reached" )] + public bool freezeOnMax = false; + [Tooltip( "If limited, event invoked when maxAngle is reached" )] + public UnityEvent onMaxAngle; + + [Tooltip( "If limited is true, this forces the starting angle to be startAngle, clamped to [minAngle, maxAngle]" )] + public bool forceStart = false; + [Tooltip( "If limited is true and forceStart is true, the starting angle will be this, clamped to [minAngle, maxAngle]" )] + public float startAngle = 0.0f; + + [Tooltip( "If true, the transform of the GameObject this component is on will be rotated accordingly" )] + public bool rotateGameObject = true; + + [Tooltip( "If true, the path of the Hand (red) and the projected value (green) will be drawn" )] + public bool debugPath = false; + [Tooltip( "If debugPath is true, this is the maximum number of GameObjects to create to draw the path" )] + public int dbgPathLimit = 50; + + [Tooltip( "If not null, the TextMesh will display the linear value and the angular value of this circular drive" )] + public TextMesh debugText = null; + + [Tooltip( "The output angle value of the drive in degrees, unlimited will increase or decrease without bound, take the 360 modulus to find number of rotations" )] + public float outAngle; + + private Quaternion start; + + private Vector3 worldPlaneNormal = new Vector3( 1.0f, 0.0f, 0.0f ); + private Vector3 localPlaneNormal = new Vector3( 1.0f, 0.0f, 0.0f ); + + private Vector3 lastHandProjected; + + private Color red = new Color( 1.0f, 0.0f, 0.0f ); + private Color green = new Color( 0.0f, 1.0f, 0.0f ); + + private GameObject[] dbgHandObjects; + private GameObject[] dbgProjObjects; + private GameObject dbgObjectsParent; + private int dbgObjectCount = 0; + private int dbgObjectIndex = 0; + + private bool driving = false; + + // If the drive is limited as is at min/max, angles greater than this are ignored + private float minMaxAngularThreshold = 1.0f; + + private bool frozen = false; + private float frozenAngle = 0.0f; + private Vector3 frozenHandWorldPos = new Vector3( 0.0f, 0.0f, 0.0f ); + private Vector2 frozenSqDistanceMinMaxThreshold = new Vector2( 0.0f, 0.0f ); + + Hand handHoverLocked = null; + + //------------------------------------------------- + private void Freeze( Hand hand ) + { + frozen = true; + frozenAngle = outAngle; + frozenHandWorldPos = hand.hoverSphereTransform.position; + frozenSqDistanceMinMaxThreshold.x = frozenDistanceMinMaxThreshold.x * frozenDistanceMinMaxThreshold.x; + frozenSqDistanceMinMaxThreshold.y = frozenDistanceMinMaxThreshold.y * frozenDistanceMinMaxThreshold.y; + } + + + //------------------------------------------------- + private void UnFreeze() + { + frozen = false; + frozenHandWorldPos.Set( 0.0f, 0.0f, 0.0f ); + } + + + //------------------------------------------------- + void Start() + { + if ( childCollider == null ) + { + childCollider = GetComponentInChildren(); + } + + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + + if ( linearMapping == null ) + { + linearMapping = gameObject.AddComponent(); + } + + worldPlaneNormal = new Vector3( 0.0f, 0.0f, 0.0f ); + worldPlaneNormal[(int)axisOfRotation] = 1.0f; + + localPlaneNormal = worldPlaneNormal; + + if ( transform.parent ) + { + worldPlaneNormal = transform.parent.localToWorldMatrix.MultiplyVector( worldPlaneNormal ).normalized; + } + + if ( limited ) + { + start = Quaternion.identity; + outAngle = transform.localEulerAngles[(int)axisOfRotation]; + + if ( forceStart ) + { + outAngle = Mathf.Clamp( startAngle, minAngle, maxAngle ); + } + } + else + { + start = Quaternion.AngleAxis( transform.localEulerAngles[(int)axisOfRotation], localPlaneNormal ); + outAngle = 0.0f; + } + + if ( debugText ) + { + debugText.alignment = TextAlignment.Left; + debugText.anchor = TextAnchor.UpperLeft; + } + + UpdateAll(); + } + + + //------------------------------------------------- + void OnDisable() + { + if ( handHoverLocked ) + { + ControllerButtonHints.HideButtonHint( handHoverLocked, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + handHoverLocked.HoverUnlock( GetComponent() ); + handHoverLocked = null; + } + } + + + //------------------------------------------------- + private IEnumerator HapticPulses( SteamVR_Controller.Device controller, float flMagnitude, int nCount ) + { + if ( controller != null ) + { + int nRangeMax = (int)Util.RemapNumberClamped( flMagnitude, 0.0f, 1.0f, 100.0f, 900.0f ); + nCount = Mathf.Clamp( nCount, 1, 10 ); + + for ( ushort i = 0; i < nCount; ++i ) + { + ushort duration = (ushort)Random.Range( 100, nRangeMax ); + controller.TriggerHapticPulse( duration ); + yield return new WaitForSeconds( .01f ); + } + } + } + + + //------------------------------------------------- + private void OnHandHoverBegin( Hand hand ) + { + ControllerButtonHints.ShowButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + + + //------------------------------------------------- + private void OnHandHoverEnd( Hand hand ) + { + ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + + if ( driving && hand.GetStandardInteractionButton() ) + { + StartCoroutine( HapticPulses( hand.controller, 1.0f, 10 ) ); + } + + driving = false; + handHoverLocked = null; + } + + + //------------------------------------------------- + private void HandHoverUpdate( Hand hand ) + { + if ( hand.GetStandardInteractionButtonDown() ) + { + // Trigger was just pressed + lastHandProjected = ComputeToTransformProjected( hand.hoverSphereTransform ); + + if ( hoverLock ) + { + hand.HoverLock( GetComponent() ); + handHoverLocked = hand; + } + + driving = true; + + ComputeAngle( hand ); + UpdateAll(); + + ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + else if ( hand.GetStandardInteractionButtonUp() ) + { + // Trigger was just released + if ( hoverLock ) + { + hand.HoverUnlock( GetComponent() ); + handHoverLocked = null; + } + } + else if ( driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == GetComponent() ) + { + ComputeAngle( hand ); + UpdateAll(); + } + } + + + //------------------------------------------------- + private Vector3 ComputeToTransformProjected( Transform xForm ) + { + Vector3 toTransform = ( xForm.position - transform.position ).normalized; + Vector3 toTransformProjected = new Vector3( 0.0f, 0.0f, 0.0f ); + + // Need a non-zero distance from the hand to the center of the CircularDrive + if ( toTransform.sqrMagnitude > 0.0f ) + { + toTransformProjected = Vector3.ProjectOnPlane( toTransform, worldPlaneNormal ).normalized; + } + else + { + Debug.LogFormat( "The collider needs to be a minimum distance away from the CircularDrive GameObject {0}", gameObject.ToString() ); + Debug.Assert( false, string.Format( "The collider needs to be a minimum distance away from the CircularDrive GameObject {0}", gameObject.ToString() ) ); + } + + if ( debugPath && dbgPathLimit > 0 ) + { + DrawDebugPath( xForm, toTransformProjected ); + } + + return toTransformProjected; + } + + + //------------------------------------------------- + private void DrawDebugPath( Transform xForm, Vector3 toTransformProjected ) + { + if ( dbgObjectCount == 0 ) + { + dbgObjectsParent = new GameObject( "Circular Drive Debug" ); + dbgHandObjects = new GameObject[dbgPathLimit]; + dbgProjObjects = new GameObject[dbgPathLimit]; + dbgObjectCount = dbgPathLimit; + dbgObjectIndex = 0; + } + + //Actual path + GameObject gSphere = null; + + if ( dbgHandObjects[dbgObjectIndex] ) + { + gSphere = dbgHandObjects[dbgObjectIndex]; + } + else + { + gSphere = GameObject.CreatePrimitive( PrimitiveType.Sphere ); + gSphere.transform.SetParent( dbgObjectsParent.transform ); + dbgHandObjects[dbgObjectIndex] = gSphere; + } + + gSphere.name = string.Format( "actual_{0}", (int)( ( 1.0f - red.r ) * 10.0f ) ); + gSphere.transform.position = xForm.position; + gSphere.transform.rotation = Quaternion.Euler( 0.0f, 0.0f, 0.0f ); + gSphere.transform.localScale = new Vector3( 0.004f, 0.004f, 0.004f ); + gSphere.gameObject.GetComponent().material.color = red; + + if ( red.r > 0.1f ) + { + red.r -= 0.1f; + } + else + { + red.r = 1.0f; + } + + //Projected path + gSphere = null; + + if ( dbgProjObjects[dbgObjectIndex] ) + { + gSphere = dbgProjObjects[dbgObjectIndex]; + } + else + { + gSphere = GameObject.CreatePrimitive( PrimitiveType.Sphere ); + gSphere.transform.SetParent( dbgObjectsParent.transform ); + dbgProjObjects[dbgObjectIndex] = gSphere; + } + + gSphere.name = string.Format( "projed_{0}", (int)( ( 1.0f - green.g ) * 10.0f ) ); + gSphere.transform.position = transform.position + toTransformProjected * 0.25f; + gSphere.transform.rotation = Quaternion.Euler( 0.0f, 0.0f, 0.0f ); + gSphere.transform.localScale = new Vector3( 0.004f, 0.004f, 0.004f ); + gSphere.gameObject.GetComponent().material.color = green; + + if ( green.g > 0.1f ) + { + green.g -= 0.1f; + } + else + { + green.g = 1.0f; + } + + dbgObjectIndex = ( dbgObjectIndex + 1 ) % dbgObjectCount; + } + + + //------------------------------------------------- + // Updates the LinearMapping value from the angle + //------------------------------------------------- + private void UpdateLinearMapping() + { + if ( limited ) + { + // Map it to a [0, 1] value + linearMapping.value = ( outAngle - minAngle ) / ( maxAngle - minAngle ); + } + else + { + // Normalize to [0, 1] based on 360 degree windings + float flTmp = outAngle / 360.0f; + linearMapping.value = flTmp - Mathf.Floor( flTmp ); + } + + UpdateDebugText(); + } + + + //------------------------------------------------- + // Updates the LinearMapping value from the angle + //------------------------------------------------- + private void UpdateGameObject() + { + if ( rotateGameObject ) + { + transform.localRotation = start * Quaternion.AngleAxis( outAngle, localPlaneNormal ); + } + } + + + //------------------------------------------------- + // Updates the Debug TextMesh with the linear mapping value and the angle + //------------------------------------------------- + private void UpdateDebugText() + { + if ( debugText ) + { + debugText.text = string.Format( "Linear: {0}\nAngle: {1}\n", linearMapping.value, outAngle ); + } + } + + + //------------------------------------------------- + // Updates the Debug TextMesh with the linear mapping value and the angle + //------------------------------------------------- + private void UpdateAll() + { + UpdateLinearMapping(); + UpdateGameObject(); + UpdateDebugText(); + } + + + //------------------------------------------------- + // Computes the angle to rotate the game object based on the change in the transform + //------------------------------------------------- + private void ComputeAngle( Hand hand ) + { + Vector3 toHandProjected = ComputeToTransformProjected( hand.hoverSphereTransform ); + + if ( !toHandProjected.Equals( lastHandProjected ) ) + { + float absAngleDelta = Vector3.Angle( lastHandProjected, toHandProjected ); + + if ( absAngleDelta > 0.0f ) + { + if ( frozen ) + { + float frozenSqDist = ( hand.hoverSphereTransform.position - frozenHandWorldPos ).sqrMagnitude; + if ( frozenSqDist > frozenSqDistanceMinMaxThreshold.x ) + { + outAngle = frozenAngle + Random.Range( -1.0f, 1.0f ); + + float magnitude = Util.RemapNumberClamped( frozenSqDist, frozenSqDistanceMinMaxThreshold.x, frozenSqDistanceMinMaxThreshold.y, 0.0f, 1.0f ); + if ( magnitude > 0 ) + { + StartCoroutine( HapticPulses( hand.controller, magnitude, 10 ) ); + } + else + { + StartCoroutine( HapticPulses( hand.controller, 0.5f, 10 ) ); + } + + if ( frozenSqDist >= frozenSqDistanceMinMaxThreshold.y ) + { + onFrozenDistanceThreshold.Invoke(); + } + } + } + else + { + Vector3 cross = Vector3.Cross( lastHandProjected, toHandProjected ).normalized; + float dot = Vector3.Dot( worldPlaneNormal, cross ); + + float signedAngleDelta = absAngleDelta; + + if ( dot < 0.0f ) + { + signedAngleDelta = -signedAngleDelta; + } + + if ( limited ) + { + float angleTmp = Mathf.Clamp( outAngle + signedAngleDelta, minAngle, maxAngle ); + + if ( outAngle == minAngle ) + { + if ( angleTmp > minAngle && absAngleDelta < minMaxAngularThreshold ) + { + outAngle = angleTmp; + lastHandProjected = toHandProjected; + } + } + else if ( outAngle == maxAngle ) + { + if ( angleTmp < maxAngle && absAngleDelta < minMaxAngularThreshold ) + { + outAngle = angleTmp; + lastHandProjected = toHandProjected; + } + } + else if ( angleTmp == minAngle ) + { + outAngle = angleTmp; + lastHandProjected = toHandProjected; + onMinAngle.Invoke(); + if ( freezeOnMin ) + { + Freeze( hand ); + } + } + else if ( angleTmp == maxAngle ) + { + outAngle = angleTmp; + lastHandProjected = toHandProjected; + onMaxAngle.Invoke(); + if ( freezeOnMax ) + { + Freeze( hand ); + } + } + else + { + outAngle = angleTmp; + lastHandProjected = toHandProjected; + } + } + else + { + outAngle += signedAngleDelta; + lastHandProjected = toHandProjected; + } + } + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs.meta new file mode 100644 index 0000000..3895f2f --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1f32883eed859804dbb0c5fedac91496 +timeCreated: 1440531244 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs new file mode 100644 index 0000000..4c367fc --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs @@ -0,0 +1,190 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Throwable that uses physics joints to attach instead of just +// parenting +// +//============================================================================= + +using UnityEngine; +using System.Collections.Generic; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class ComplexThrowable : MonoBehaviour + { + public enum AttachMode + { + FixedJoint, + Force, + } + + public float attachForce = 800.0f; + public float attachForceDamper = 25.0f; + + public AttachMode attachMode = AttachMode.FixedJoint; + + [EnumFlags] + public Hand.AttachmentFlags attachmentFlags = 0; + + private List holdingHands = new List(); + private List holdingBodies = new List(); + private List holdingPoints = new List(); + + private List rigidBodies = new List(); + + //------------------------------------------------- + void Awake() + { + GetComponentsInChildren( rigidBodies ); + } + + + //------------------------------------------------- + void Update() + { + for ( int i = 0; i < holdingHands.Count; i++ ) + { + if ( !holdingHands[i].GetStandardInteractionButton() ) + { + PhysicsDetach( holdingHands[i] ); + } + } + } + + + //------------------------------------------------- + private void OnHandHoverBegin( Hand hand ) + { + if ( holdingHands.IndexOf( hand ) == -1 ) + { + if ( hand.controller != null ) + { + hand.controller.TriggerHapticPulse( 800 ); + } + } + } + + + //------------------------------------------------- + private void OnHandHoverEnd( Hand hand ) + { + if ( holdingHands.IndexOf( hand ) == -1 ) + { + if ( hand.controller != null ) + { + hand.controller.TriggerHapticPulse( 500 ); + } + } + } + + + //------------------------------------------------- + private void HandHoverUpdate( Hand hand ) + { + if ( hand.GetStandardInteractionButtonDown() ) + { + PhysicsAttach( hand ); + } + } + + + //------------------------------------------------- + private void PhysicsAttach( Hand hand ) + { + PhysicsDetach( hand ); + + Rigidbody holdingBody = null; + Vector3 holdingPoint = Vector3.zero; + + // The hand should grab onto the nearest rigid body + float closestDistance = float.MaxValue; + for ( int i = 0; i < rigidBodies.Count; i++ ) + { + float distance = Vector3.Distance( rigidBodies[i].worldCenterOfMass, hand.transform.position ); + if ( distance < closestDistance ) + { + holdingBody = rigidBodies[i]; + closestDistance = distance; + } + } + + // Couldn't grab onto a body + if ( holdingBody == null ) + return; + + // Create a fixed joint from the hand to the holding body + if ( attachMode == AttachMode.FixedJoint ) + { + Rigidbody handRigidbody = Util.FindOrAddComponent( hand.gameObject ); + handRigidbody.isKinematic = true; + + FixedJoint handJoint = hand.gameObject.AddComponent(); + handJoint.connectedBody = holdingBody; + } + + // Don't let the hand interact with other things while it's holding us + hand.HoverLock( null ); + + // Affix this point + Vector3 offset = hand.transform.position - holdingBody.worldCenterOfMass; + offset = Mathf.Min( offset.magnitude, 1.0f ) * offset.normalized; + holdingPoint = holdingBody.transform.InverseTransformPoint( holdingBody.worldCenterOfMass + offset ); + + hand.AttachObject( this.gameObject, attachmentFlags ); + + // Update holding list + holdingHands.Add( hand ); + holdingBodies.Add( holdingBody ); + holdingPoints.Add( holdingPoint ); + } + + + //------------------------------------------------- + private bool PhysicsDetach( Hand hand ) + { + int i = holdingHands.IndexOf( hand ); + + if ( i != -1 ) + { + // Detach this object from the hand + holdingHands[i].DetachObject( this.gameObject, false ); + + // Allow the hand to do other things + holdingHands[i].HoverUnlock( null ); + + // Delete any existing joints from the hand + if ( attachMode == AttachMode.FixedJoint ) + { + Destroy( holdingHands[i].GetComponent() ); + } + + Util.FastRemove( holdingHands, i ); + Util.FastRemove( holdingBodies, i ); + Util.FastRemove( holdingPoints, i ); + + return true; + } + + return false; + } + + + //------------------------------------------------- + void FixedUpdate() + { + if ( attachMode == AttachMode.Force ) + { + for ( int i = 0; i < holdingHands.Count; i++ ) + { + Vector3 targetPoint = holdingBodies[i].transform.TransformPoint( holdingPoints[i] ); + Vector3 vdisplacement = holdingHands[i].transform.position - targetPoint; + + holdingBodies[i].AddForceAtPosition( attachForce * vdisplacement, targetPoint, ForceMode.Acceleration ); + holdingBodies[i].AddForceAtPosition( -attachForceDamper * holdingBodies[i].GetPointVelocity( targetPoint ), targetPoint, ForceMode.Acceleration ); + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs.meta new file mode 100644 index 0000000..d9e69cc --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ad77666522338cf49ba83b80b25e6476 +timeCreated: 1440023090 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs new file mode 100644 index 0000000..fc53bfe --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs @@ -0,0 +1,197 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Highlights the controller when hovering over interactables +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class ControllerHoverHighlight : MonoBehaviour + { + public Material highLightMaterial; + public bool fireHapticsOnHightlight = true; + + private Hand hand; + + private MeshRenderer bodyMeshRenderer; + private MeshRenderer trackingHatMeshRenderer; + private SteamVR_RenderModel renderModel; + private bool renderModelLoaded = false; + + SteamVR_Events.Action renderModelLoadedAction; + + //------------------------------------------------- + void Start() + { + hand = GetComponentInParent(); + } + + + //------------------------------------------------- + void Awake() + { + renderModelLoadedAction = SteamVR_Events.RenderModelLoadedAction( OnRenderModelLoaded ); + } + + + //------------------------------------------------- + void OnEnable() + { + renderModelLoadedAction.enabled = true; + } + + + //------------------------------------------------- + void OnDisable() + { + renderModelLoadedAction.enabled = false; + } + + + //------------------------------------------------- + private void OnHandInitialized( int deviceIndex ) + { + renderModel = gameObject.AddComponent(); + renderModel.SetDeviceIndex( deviceIndex ); + renderModel.updateDynamically = false; + } + + + //------------------------------------------------- + private void OnRenderModelLoaded( SteamVR_RenderModel renderModel, bool success ) + { + if ( renderModel != this.renderModel ) + { + return; + } + + Transform bodyTransform = transform.Find( "body" ); + if ( bodyTransform != null ) + { + bodyTransform.gameObject.layer = gameObject.layer; + bodyTransform.gameObject.tag = gameObject.tag; + bodyMeshRenderer = bodyTransform.GetComponent(); + bodyMeshRenderer.material = highLightMaterial; + bodyMeshRenderer.enabled = false; + } + + Transform trackingHatTransform = transform.Find( "trackhat" ); + if ( trackingHatTransform != null ) + { + trackingHatTransform.gameObject.layer = gameObject.layer; + trackingHatTransform.gameObject.tag = gameObject.tag; + trackingHatMeshRenderer = trackingHatTransform.GetComponent(); + trackingHatMeshRenderer.material = highLightMaterial; + trackingHatMeshRenderer.enabled = false; + } + + foreach ( Transform child in transform ) + { + if ( ( child.name != "body" ) && ( child.name != "trackhat" ) ) + { + Destroy( child.gameObject ); + } + } + + renderModelLoaded = true; + } + + + //------------------------------------------------- + private void OnParentHandHoverBegin( Interactable other ) + { + if ( !this.isActiveAndEnabled ) + { + return; + } + + if ( other.transform.parent != transform.parent ) + { + ShowHighlight(); + } + } + + + //------------------------------------------------- + private void OnParentHandHoverEnd( Interactable other ) + { + HideHighlight(); + } + + + //------------------------------------------------- + private void OnParentHandInputFocusAcquired() + { + if ( !this.isActiveAndEnabled ) + { + return; + } + + if ( hand.hoveringInteractable && hand.hoveringInteractable.transform.parent != transform.parent ) + { + ShowHighlight(); + } + } + + + //------------------------------------------------- + private void OnParentHandInputFocusLost() + { + HideHighlight(); + } + + + //------------------------------------------------- + public void ShowHighlight() + { + if ( renderModelLoaded == false ) + { + return; + } + + if ( fireHapticsOnHightlight ) + { + hand.controller.TriggerHapticPulse( 500 ); + } + + if ( bodyMeshRenderer != null ) + { + bodyMeshRenderer.enabled = true; + } + + if ( trackingHatMeshRenderer != null ) + { + trackingHatMeshRenderer.enabled = true; + } + } + + + //------------------------------------------------- + public void HideHighlight() + { + if ( renderModelLoaded == false ) + { + return; + } + + if ( fireHapticsOnHightlight ) + { + hand.controller.TriggerHapticPulse( 300 ); + } + + if ( bodyMeshRenderer != null ) + { + bodyMeshRenderer.enabled = false; + } + + if ( trackingHatMeshRenderer != null ) + { + trackingHatMeshRenderer.enabled = false; + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs.meta new file mode 100644 index 0000000..34e581c --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ControllerHoverHighlight.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8ca2cc563cc33f542a5d9f8f661184ba +timeCreated: 1441139979 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs new file mode 100644 index 0000000..ae37001 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs @@ -0,0 +1,28 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Custom Unity Events that take in additional parameters +// +//============================================================================= + +using UnityEngine.Events; +using System; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public static class CustomEvents + { + //------------------------------------------------- + [System.Serializable] + public class UnityEventSingleFloat : UnityEvent + { + } + + + //------------------------------------------------- + [System.Serializable] + public class UnityEventHand : UnityEvent + { + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs.meta new file mode 100644 index 0000000..aee0603 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/CustomEvents.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5f3294e06115d0047a2ac7659a11b168 +timeCreated: 1437076614 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs new file mode 100644 index 0000000..079b373 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs @@ -0,0 +1,48 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Debug UI shown for the player +// +//============================================================================= + +using UnityEngine; +using UnityEngine.UI; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class DebugUI : MonoBehaviour + { + private Player player; + + //------------------------------------------------- + static private DebugUI _instance; + static public DebugUI instance + { + get + { + if ( _instance == null ) + { + _instance = GameObject.FindObjectOfType(); + } + return _instance; + } + } + + + //------------------------------------------------- + void Start() + { + player = Player.instance; + } + + + //------------------------------------------------- + private void OnGUI() + { +#if !HIDE_DEBUG_UI + player.Draw2DDebug(); +#endif + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs.meta new file mode 100644 index 0000000..a2da5e7 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DebugUI.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6f3bba2c36dd79242b3157dbcd876bf2 +timeCreated: 1458703500 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs new file mode 100644 index 0000000..5cf17d1 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs @@ -0,0 +1,22 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Destroys this object when it is detached from the hand +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class DestroyOnDetachedFromHand : MonoBehaviour + { + //------------------------------------------------- + private void OnDetachedFromHand( Hand hand ) + { + Destroy( gameObject ); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs.meta new file mode 100644 index 0000000..a660260 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnDetachedFromHand.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5240357a2468cdc4291b266bee3cb9b9 +timeCreated: 1442359285 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs new file mode 100644 index 0000000..ac37223 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs @@ -0,0 +1,36 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Destroys this object when its particle system dies +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( ParticleSystem ) )] + public class DestroyOnParticleSystemDeath : MonoBehaviour + { + private ParticleSystem particles; + + //------------------------------------------------- + void Awake() + { + particles = GetComponent(); + + InvokeRepeating( "CheckParticleSystem", 0.1f, 0.1f ); + } + + + //------------------------------------------------- + private void CheckParticleSystem() + { + if ( !particles.IsAlive() ) + { + Destroy( this.gameObject ); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs.meta new file mode 100644 index 0000000..75455d2 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnParticleSystemDeath.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 69cad530c565c714491a326c21accb90 +timeCreated: 1478655595 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs new file mode 100644 index 0000000..2537d9a --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs @@ -0,0 +1,38 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Destroys this object when it enters a trigger +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class DestroyOnTriggerEnter : MonoBehaviour + { + public string tagFilter; + + private bool useTag; + + //------------------------------------------------- + void Start() + { + if ( !string.IsNullOrEmpty( tagFilter ) ) + { + useTag = true; + } + } + + + //------------------------------------------------- + void OnTriggerEnter( Collider collider ) + { + if ( !useTag || ( useTag && collider.gameObject.tag == tagFilter ) ) + { + Destroy( collider.gameObject.transform.root.gameObject ); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs.meta new file mode 100644 index 0000000..f5a3152 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DestroyOnTriggerEnter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7ba84888c9d4c504cb752a3904551a6c +timeCreated: 1438101498 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs new file mode 100644 index 0000000..3225ac4 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs @@ -0,0 +1,42 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Triggers haptic pulses based on distance between 2 positions +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class DistanceHaptics : MonoBehaviour + { + public Transform firstTransform; + public Transform secondTransform; + + public AnimationCurve distanceIntensityCurve = AnimationCurve.Linear( 0.0f, 800.0f, 1.0f, 800.0f ); + public AnimationCurve pulseIntervalCurve = AnimationCurve.Linear( 0.0f, 0.01f, 1.0f, 0.0f ); + + //------------------------------------------------- + IEnumerator Start() + { + while ( true ) + { + float distance = Vector3.Distance( firstTransform.position, secondTransform.position ); + + SteamVR_TrackedObject trackedObject = GetComponentInParent(); + if ( trackedObject ) + { + float pulse = distanceIntensityCurve.Evaluate( distance ); + SteamVR_Controller.Input( (int)trackedObject.index ).TriggerHapticPulse( (ushort)pulse ); + } + + float nextPulse = pulseIntervalCurve.Evaluate( distance ); + + yield return new WaitForSeconds( nextPulse ); + } + + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs.meta new file mode 100644 index 0000000..628f9e9 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DistanceHaptics.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 65ef702aaa09d3f46a75659678b1a711 +timeCreated: 1430871385 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs new file mode 100644 index 0000000..d266111 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs @@ -0,0 +1,21 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: This object won't be destroyed when a new scene is loaded +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class DontDestroyOnLoad : MonoBehaviour + { + //------------------------------------------------- + void Awake() + { + DontDestroyOnLoad( this ); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs.meta new file mode 100644 index 0000000..5a196e5 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/DontDestroyOnLoad.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4d1c07a6449b0ca439ee6fac5f6f7d83 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs new file mode 100644 index 0000000..30464aa --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs @@ -0,0 +1,32 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Allows Enums to be shown in the inspector as flags +// +//============================================================================= + +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class EnumFlags : PropertyAttribute + { + public EnumFlags() { } + } + + +#if UNITY_EDITOR + //------------------------------------------------------------------------- + [CustomPropertyDrawer( typeof( EnumFlags ) )] + public class EnumFlagsPropertyDrawer : PropertyDrawer + { + public override void OnGUI( Rect position, SerializedProperty property, GUIContent label ) + { + property.intValue = EditorGUI.MaskField( position, label, property.intValue, property.enumNames ); + } + } +#endif +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs.meta new file mode 100644 index 0000000..756265d --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/EnumFlags.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 88a2ccbdad9948c45b28f5e63902705b +timeCreated: 1440536338 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs new file mode 100644 index 0000000..73ec74a --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs @@ -0,0 +1,96 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Controls for the non-VR debug camera +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Camera ) )] + public class FallbackCameraController : MonoBehaviour + { + public float speed = 4.0f; + public float shiftSpeed = 16.0f; + public bool showInstructions = true; + + private Vector3 startEulerAngles; + private Vector3 startMousePosition; + private float realTime; + + //------------------------------------------------- + void OnEnable() + { + realTime = Time.realtimeSinceStartup; + } + + + //------------------------------------------------- + void Update() + { + float forward = 0.0f; + if ( Input.GetKey( KeyCode.W ) || Input.GetKey( KeyCode.UpArrow ) ) + { + forward += 1.0f; + } + if ( Input.GetKey( KeyCode.S ) || Input.GetKey( KeyCode.DownArrow ) ) + { + forward -= 1.0f; + } + + float right = 0.0f; + if ( Input.GetKey( KeyCode.D ) || Input.GetKey( KeyCode.RightArrow ) ) + { + right += 1.0f; + } + if ( Input.GetKey( KeyCode.A ) || Input.GetKey( KeyCode.LeftArrow ) ) + { + right -= 1.0f; + } + + float currentSpeed = speed; + if ( Input.GetKey( KeyCode.LeftShift ) || Input.GetKey( KeyCode.RightShift ) ) + { + currentSpeed = shiftSpeed; + } + + float realTimeNow = Time.realtimeSinceStartup; + float deltaRealTime = realTimeNow - realTime; + realTime = realTimeNow; + + Vector3 delta = new Vector3( right, 0.0f, forward ) * currentSpeed * deltaRealTime; + + transform.position += transform.TransformDirection( delta ); + + Vector3 mousePosition = Input.mousePosition; + + if ( Input.GetMouseButtonDown( 1 ) /* right mouse */) + { + startMousePosition = mousePosition; + startEulerAngles = transform.localEulerAngles; + } + + if ( Input.GetMouseButton( 1 ) /* right mouse */) + { + Vector3 offset = mousePosition - startMousePosition; + transform.localEulerAngles = startEulerAngles + new Vector3( -offset.y * 360.0f / Screen.height, offset.x * 360.0f / Screen.width, 0.0f ); + } + } + + + //------------------------------------------------- + void OnGUI() + { + if ( showInstructions ) + { + GUI.Label( new Rect( 10.0f, 10.0f, 600.0f, 400.0f ), + "WASD/Arrow Keys to translate the camera\n" + + "Right mouse click to rotate the camera\n" + + "Left mouse click for standard interactions.\n" ); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs.meta new file mode 100644 index 0000000..2748ff8 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/FallbackCameraController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6043f3be9a21bd74281f9770463bea00 +timeCreated: 1436190027 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs new file mode 100644 index 0000000..024279d --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs @@ -0,0 +1,917 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: The hands used by the player in the vr interaction system +// +//============================================================================= + +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + // Links with an appropriate SteamVR controller and facilitates + // interactions with objects in the virtual world. + //------------------------------------------------------------------------- + public class Hand : MonoBehaviour + { + public enum HandType + { + Left, + Right, + Any + }; + + // The flags used to determine how an object is attached to the hand. + [Flags] + public enum AttachmentFlags + { + SnapOnAttach = 1 << 0, // The object should snap to the position of the specified attachment point on the hand. + DetachOthers = 1 << 1, // Other objects attached to this hand will be detached. + DetachFromOtherHand = 1 << 2, // This object will be detached from the other hand. + ParentToHand = 1 << 3, // The object will be parented to the hand. + }; + + public const AttachmentFlags defaultAttachmentFlags = AttachmentFlags.ParentToHand | + AttachmentFlags.DetachOthers | + AttachmentFlags.DetachFromOtherHand | + AttachmentFlags.SnapOnAttach; + + public Hand otherHand; + public HandType startingHandType; + + public Transform hoverSphereTransform; + public float hoverSphereRadius = 0.05f; + public LayerMask hoverLayerMask = -1; + public float hoverUpdateInterval = 0.1f; + + public Camera noSteamVRFallbackCamera; + public float noSteamVRFallbackMaxDistanceNoItem = 10.0f; + public float noSteamVRFallbackMaxDistanceWithItem = 0.5f; + private float noSteamVRFallbackInteractorDistance = -1.0f; + + public SteamVR_Controller.Device controller; + + public GameObject controllerPrefab; + private GameObject controllerObject = null; + + public bool showDebugText = false; + public bool spewDebugText = false; + + public struct AttachedObject + { + public GameObject attachedObject; + public GameObject originalParent; + public bool isParentedToHand; + } + + private List attachedObjects = new List(); + + public ReadOnlyCollection AttachedObjects + { + get { return attachedObjects.AsReadOnly(); } + } + + public bool hoverLocked { get; private set; } + + private Interactable _hoveringInteractable; + + private TextMesh debugText; + private int prevOverlappingColliders = 0; + + private const int ColliderArraySize = 16; + private Collider[] overlappingColliders; + + private Player playerInstance; + + private GameObject applicationLostFocusObject; + + SteamVR_Events.Action inputFocusAction; + + + //------------------------------------------------- + // The Interactable object this Hand is currently hovering over + //------------------------------------------------- + public Interactable hoveringInteractable + { + get { return _hoveringInteractable; } + set + { + if ( _hoveringInteractable != value ) + { + if ( _hoveringInteractable != null ) + { + HandDebugLog( "HoverEnd " + _hoveringInteractable.gameObject ); + _hoveringInteractable.SendMessage( "OnHandHoverEnd", this, SendMessageOptions.DontRequireReceiver ); + + //Note: The _hoveringInteractable can change after sending the OnHandHoverEnd message so we need to check it again before broadcasting this message + if ( _hoveringInteractable != null ) + { + this.BroadcastMessage( "OnParentHandHoverEnd", _hoveringInteractable, SendMessageOptions.DontRequireReceiver ); // let objects attached to the hand know that a hover has ended + } + } + + _hoveringInteractable = value; + + if ( _hoveringInteractable != null ) + { + HandDebugLog( "HoverBegin " + _hoveringInteractable.gameObject ); + _hoveringInteractable.SendMessage( "OnHandHoverBegin", this, SendMessageOptions.DontRequireReceiver ); + + //Note: The _hoveringInteractable can change after sending the OnHandHoverBegin message so we need to check it again before broadcasting this message + if ( _hoveringInteractable != null ) + { + this.BroadcastMessage( "OnParentHandHoverBegin", _hoveringInteractable, SendMessageOptions.DontRequireReceiver ); // let objects attached to the hand know that a hover has begun + } + } + } + } + } + + + //------------------------------------------------- + // Active GameObject attached to this Hand + //------------------------------------------------- + public GameObject currentAttachedObject + { + get + { + CleanUpAttachedObjectStack(); + + if ( attachedObjects.Count > 0 ) + { + return attachedObjects[attachedObjects.Count - 1].attachedObject; + } + + return null; + } + } + + + //------------------------------------------------- + public Transform GetAttachmentTransform( string attachmentPoint = "" ) + { + Transform attachmentTransform = null; + + if ( !string.IsNullOrEmpty( attachmentPoint ) ) + { + attachmentTransform = transform.Find( attachmentPoint ); + } + + if ( !attachmentTransform ) + { + attachmentTransform = this.transform; + } + + return attachmentTransform; + } + + + //------------------------------------------------- + // Guess the type of this Hand + // + // If startingHandType is Hand.Left or Hand.Right, returns startingHandType. + // If otherHand is non-null and both Hands are linked to controllers, returns + // Hand.Left if this Hand is leftmost relative to the HMD, otherwise Hand.Right. + // Otherwise, returns Hand.Any + //------------------------------------------------- + public HandType GuessCurrentHandType() + { + if ( startingHandType == HandType.Left || startingHandType == HandType.Right ) + { + return startingHandType; + } + + if ( startingHandType == HandType.Any && otherHand != null && otherHand.controller == null ) + { + return HandType.Right; + } + + if ( controller == null || otherHand == null || otherHand.controller == null ) + { + return startingHandType; + } + + if ( controller.index == SteamVR_Controller.GetDeviceIndex( SteamVR_Controller.DeviceRelation.Leftmost ) ) + { + return HandType.Left; + } + + return HandType.Right; + } + + + //------------------------------------------------- + // Attach a GameObject to this GameObject + // + // objectToAttach - The GameObject to attach + // flags - The flags to use for attaching the object + // attachmentPoint - Name of the GameObject in the hierarchy of this Hand which should act as the attachment point for this GameObject + //------------------------------------------------- + public void AttachObject( GameObject objectToAttach, AttachmentFlags flags = defaultAttachmentFlags, string attachmentPoint = "" ) + { + if ( flags == 0 ) + { + flags = defaultAttachmentFlags; + } + + //Make sure top object on stack is non-null + CleanUpAttachedObjectStack(); + + //Detach the object if it is already attached so that it can get re-attached at the top of the stack + DetachObject( objectToAttach ); + + //Detach from the other hand if requested + if ( ( ( flags & AttachmentFlags.DetachFromOtherHand ) == AttachmentFlags.DetachFromOtherHand ) && otherHand ) + { + otherHand.DetachObject( objectToAttach ); + } + + if ( ( flags & AttachmentFlags.DetachOthers ) == AttachmentFlags.DetachOthers ) + { + //Detach all the objects from the stack + while ( attachedObjects.Count > 0 ) + { + DetachObject( attachedObjects[0].attachedObject ); + } + } + + if ( currentAttachedObject ) + { + currentAttachedObject.SendMessage( "OnHandFocusLost", this, SendMessageOptions.DontRequireReceiver ); + } + + AttachedObject attachedObject = new AttachedObject(); + attachedObject.attachedObject = objectToAttach; + attachedObject.originalParent = objectToAttach.transform.parent != null ? objectToAttach.transform.parent.gameObject : null; + if ( ( flags & AttachmentFlags.ParentToHand ) == AttachmentFlags.ParentToHand ) + { + //Parent the object to the hand + objectToAttach.transform.parent = GetAttachmentTransform( attachmentPoint ); + attachedObject.isParentedToHand = true; + } + else + { + attachedObject.isParentedToHand = false; + } + attachedObjects.Add( attachedObject ); + + if ( ( flags & AttachmentFlags.SnapOnAttach ) == AttachmentFlags.SnapOnAttach ) + { + objectToAttach.transform.localPosition = Vector3.zero; + objectToAttach.transform.localRotation = Quaternion.identity; + } + + HandDebugLog( "AttachObject " + objectToAttach ); + objectToAttach.SendMessage( "OnAttachedToHand", this, SendMessageOptions.DontRequireReceiver ); + + UpdateHovering(); + } + + + //------------------------------------------------- + // Detach this GameObject from the attached object stack of this Hand + // + // objectToDetach - The GameObject to detach from this Hand + //------------------------------------------------- + public void DetachObject( GameObject objectToDetach, bool restoreOriginalParent = true ) + { + int index = attachedObjects.FindIndex( l => l.attachedObject == objectToDetach ); + if ( index != -1 ) + { + HandDebugLog( "DetachObject " + objectToDetach ); + + GameObject prevTopObject = currentAttachedObject; + + Transform parentTransform = null; + if ( attachedObjects[index].isParentedToHand ) + { + if ( restoreOriginalParent && ( attachedObjects[index].originalParent != null ) ) + { + parentTransform = attachedObjects[index].originalParent.transform; + } + attachedObjects[index].attachedObject.transform.parent = parentTransform; + } + + attachedObjects[index].attachedObject.SetActive( true ); + attachedObjects[index].attachedObject.SendMessage( "OnDetachedFromHand", this, SendMessageOptions.DontRequireReceiver ); + attachedObjects.RemoveAt( index ); + + GameObject newTopObject = currentAttachedObject; + + //Give focus to the top most object on the stack if it changed + if ( newTopObject != null && newTopObject != prevTopObject ) + { + newTopObject.SetActive( true ); + newTopObject.SendMessage( "OnHandFocusAcquired", this, SendMessageOptions.DontRequireReceiver ); + } + } + + CleanUpAttachedObjectStack(); + } + + + //------------------------------------------------- + // Get the world velocity of the VR Hand. + // Note: controller velocity value only updates on controller events (Button but and down) so good for throwing + //------------------------------------------------- + public Vector3 GetTrackedObjectVelocity() + { + if ( controller != null ) + { + return transform.parent.TransformVector( controller.velocity ); + } + + return Vector3.zero; + } + + + //------------------------------------------------- + // Get the world angular velocity of the VR Hand. + // Note: controller velocity value only updates on controller events (Button but and down) so good for throwing + //------------------------------------------------- + public Vector3 GetTrackedObjectAngularVelocity() + { + if ( controller != null ) + { + return transform.parent.TransformVector( controller.angularVelocity ); + } + + return Vector3.zero; + } + + + //------------------------------------------------- + private void CleanUpAttachedObjectStack() + { + attachedObjects.RemoveAll( l => l.attachedObject == null ); + } + + + //------------------------------------------------- + void Awake() + { + inputFocusAction = SteamVR_Events.InputFocusAction( OnInputFocus ); + + if ( hoverSphereTransform == null ) + { + hoverSphereTransform = this.transform; + } + + applicationLostFocusObject = new GameObject( "_application_lost_focus" ); + applicationLostFocusObject.transform.parent = transform; + applicationLostFocusObject.SetActive( false ); + } + + + //------------------------------------------------- + IEnumerator Start() + { + // save off player instance + playerInstance = Player.instance; + if ( !playerInstance ) + { + Debug.LogError( "No player instance found in Hand Start()" ); + } + + // allocate array for colliders + overlappingColliders = new Collider[ColliderArraySize]; + + // We are a "no SteamVR fallback hand" if we have this camera set + // we'll use the right mouse to look around and left mouse to interact + // - don't need to find the device + if ( noSteamVRFallbackCamera ) + { + yield break; + } + + //Debug.Log( "Hand - initializing connection routine" ); + + // Acquire the correct device index for the hand we want to be + // Also for the other hand if we get there first + while ( true ) + { + // Don't need to run this every frame + yield return new WaitForSeconds( 1.0f ); + + // We have a controller now, break out of the loop! + if ( controller != null ) + break; + + //Debug.Log( "Hand - checking controllers..." ); + + // Initialize both hands simultaneously + if ( startingHandType == HandType.Left || startingHandType == HandType.Right ) + { + // Left/right relationship. + // Wait until we have a clear unique left-right relationship to initialize. + int leftIndex = SteamVR_Controller.GetDeviceIndex( SteamVR_Controller.DeviceRelation.Leftmost ); + int rightIndex = SteamVR_Controller.GetDeviceIndex( SteamVR_Controller.DeviceRelation.Rightmost ); + if ( leftIndex == -1 || rightIndex == -1 || leftIndex == rightIndex ) + { + //Debug.Log( string.Format( "...Left/right hand relationship not yet established: leftIndex={0}, rightIndex={1}", leftIndex, rightIndex ) ); + continue; + } + + int myIndex = ( startingHandType == HandType.Right ) ? rightIndex : leftIndex; + int otherIndex = ( startingHandType == HandType.Right ) ? leftIndex : rightIndex; + + InitController( myIndex ); + if ( otherHand ) + { + otherHand.InitController( otherIndex ); + } + } + else + { + // No left/right relationship. Just wait for a connection + + var vr = SteamVR.instance; + for ( int i = 0; i < Valve.VR.OpenVR.k_unMaxTrackedDeviceCount; i++ ) + { + if ( vr.hmd.GetTrackedDeviceClass( (uint)i ) != Valve.VR.ETrackedDeviceClass.Controller ) + { + //Debug.Log( string.Format( "Hand - device {0} is not a controller", i ) ); + continue; + } + + var device = SteamVR_Controller.Input( i ); + if ( !device.valid ) + { + //Debug.Log( string.Format( "Hand - device {0} is not valid", i ) ); + continue; + } + + if ( ( otherHand != null ) && ( otherHand.controller != null ) ) + { + // Other hand is using this index, so we cannot use it. + if ( i == (int)otherHand.controller.index ) + { + //Debug.Log( string.Format( "Hand - device {0} is owned by the other hand", i ) ); + continue; + } + } + + InitController( i ); + } + } + } + } + + + //------------------------------------------------- + private void UpdateHovering() + { + if ( ( noSteamVRFallbackCamera == null ) && ( controller == null ) ) + { + return; + } + + if ( hoverLocked ) + return; + + if ( applicationLostFocusObject.activeSelf ) + return; + + float closestDistance = float.MaxValue; + Interactable closestInteractable = null; + + // Pick the closest hovering + float flHoverRadiusScale = playerInstance.transform.lossyScale.x; + float flScaledSphereRadius = hoverSphereRadius * flHoverRadiusScale; + + // if we're close to the floor, increase the radius to make things easier to pick up + float handDiff = Mathf.Abs( transform.position.y - playerInstance.trackingOriginTransform.position.y ); + float boxMult = Util.RemapNumberClamped( handDiff, 0.0f, 0.5f * flHoverRadiusScale, 5.0f, 1.0f ) * flHoverRadiusScale; + + // null out old vals + for ( int i = 0; i < overlappingColliders.Length; ++i ) + { + overlappingColliders[i] = null; + } + + Physics.OverlapBoxNonAlloc( + hoverSphereTransform.position - new Vector3( 0, flScaledSphereRadius * boxMult - flScaledSphereRadius, 0 ), + new Vector3( flScaledSphereRadius, flScaledSphereRadius * boxMult * 2.0f, flScaledSphereRadius ), + overlappingColliders, + Quaternion.identity, + hoverLayerMask.value + ); + + // DebugVar + int iActualColliderCount = 0; + + foreach ( Collider collider in overlappingColliders ) + { + if ( collider == null ) + continue; + + Interactable contacting = collider.GetComponentInParent(); + + // Yeah, it's null, skip + if ( contacting == null ) + continue; + + // Ignore this collider for hovering + IgnoreHovering ignore = collider.GetComponent(); + if ( ignore != null ) + { + if ( ignore.onlyIgnoreHand == null || ignore.onlyIgnoreHand == this ) + { + continue; + } + } + + // Can't hover over the object if it's attached + if ( attachedObjects.FindIndex( l => l.attachedObject == contacting.gameObject ) != -1 ) + continue; + + // Occupied by another hand, so we can't touch it + if ( otherHand && otherHand.hoveringInteractable == contacting ) + continue; + + // Best candidate so far... + float distance = Vector3.Distance( contacting.transform.position, hoverSphereTransform.position ); + if ( distance < closestDistance ) + { + closestDistance = distance; + closestInteractable = contacting; + } + iActualColliderCount++; + } + + // Hover on this one + hoveringInteractable = closestInteractable; + + if ( iActualColliderCount > 0 && iActualColliderCount != prevOverlappingColliders ) + { + prevOverlappingColliders = iActualColliderCount; + HandDebugLog( "Found " + iActualColliderCount + " overlapping colliders." ); + } + } + + + //------------------------------------------------- + private void UpdateNoSteamVRFallback() + { + if ( noSteamVRFallbackCamera ) + { + Ray ray = noSteamVRFallbackCamera.ScreenPointToRay( Input.mousePosition ); + + if ( attachedObjects.Count > 0 ) + { + // Holding down the mouse: + // move around a fixed distance from the camera + transform.position = ray.origin + noSteamVRFallbackInteractorDistance * ray.direction; + } + else + { + // Not holding down the mouse: + // cast out a ray to see what we should mouse over + + // Don't want to hit the hand and anything underneath it + // So move it back behind the camera when we do the raycast + Vector3 oldPosition = transform.position; + transform.position = noSteamVRFallbackCamera.transform.forward * ( -1000.0f ); + + RaycastHit raycastHit; + if ( Physics.Raycast( ray, out raycastHit, noSteamVRFallbackMaxDistanceNoItem ) ) + { + transform.position = raycastHit.point; + + // Remember this distance in case we click and drag the mouse + noSteamVRFallbackInteractorDistance = Mathf.Min( noSteamVRFallbackMaxDistanceNoItem, raycastHit.distance ); + } + else if ( noSteamVRFallbackInteractorDistance > 0.0f ) + { + // Move it around at the distance we last had a hit + transform.position = ray.origin + Mathf.Min( noSteamVRFallbackMaxDistanceNoItem, noSteamVRFallbackInteractorDistance ) * ray.direction; + } + else + { + // Didn't hit, just leave it where it was + transform.position = oldPosition; + } + } + } + } + + + //------------------------------------------------- + private void UpdateDebugText() + { + if ( showDebugText ) + { + if ( debugText == null ) + { + debugText = new GameObject( "_debug_text" ).AddComponent(); + debugText.fontSize = 120; + debugText.characterSize = 0.001f; + debugText.transform.parent = transform; + + debugText.transform.localRotation = Quaternion.Euler( 90.0f, 0.0f, 0.0f ); + } + + if ( GuessCurrentHandType() == HandType.Right ) + { + debugText.transform.localPosition = new Vector3( -0.05f, 0.0f, 0.0f ); + debugText.alignment = TextAlignment.Right; + debugText.anchor = TextAnchor.UpperRight; + } + else + { + debugText.transform.localPosition = new Vector3( 0.05f, 0.0f, 0.0f ); + debugText.alignment = TextAlignment.Left; + debugText.anchor = TextAnchor.UpperLeft; + } + + debugText.text = string.Format( + "Hovering: {0}\n" + + "Hover Lock: {1}\n" + + "Attached: {2}\n" + + "Total Attached: {3}\n" + + "Type: {4}\n", + ( hoveringInteractable ? hoveringInteractable.gameObject.name : "null" ), + hoverLocked, + ( currentAttachedObject ? currentAttachedObject.name : "null" ), + attachedObjects.Count, + GuessCurrentHandType().ToString() ); + } + else + { + if ( debugText != null ) + { + Destroy( debugText.gameObject ); + } + } + } + + + //------------------------------------------------- + void OnEnable() + { + inputFocusAction.enabled = true; + + // Stagger updates between hands + float hoverUpdateBegin = ( ( otherHand != null ) && ( otherHand.GetInstanceID() < GetInstanceID() ) ) ? ( 0.5f * hoverUpdateInterval ) : ( 0.0f ); + InvokeRepeating( "UpdateHovering", hoverUpdateBegin, hoverUpdateInterval ); + InvokeRepeating( "UpdateDebugText", hoverUpdateBegin, hoverUpdateInterval ); + } + + + //------------------------------------------------- + void OnDisable() + { + inputFocusAction.enabled = false; + + CancelInvoke(); + } + + + //------------------------------------------------- + void Update() + { + UpdateNoSteamVRFallback(); + + GameObject attached = currentAttachedObject; + if ( attached ) + { + attached.SendMessage( "HandAttachedUpdate", this, SendMessageOptions.DontRequireReceiver ); + } + + if ( hoveringInteractable ) + { + hoveringInteractable.SendMessage( "HandHoverUpdate", this, SendMessageOptions.DontRequireReceiver ); + } + } + + + //------------------------------------------------- + void LateUpdate() + { + //Re-attach the controller if nothing else is attached to the hand + if ( controllerObject != null && attachedObjects.Count == 0 ) + { + AttachObject( controllerObject ); + } + } + + + //------------------------------------------------- + private void OnInputFocus( bool hasFocus ) + { + if ( hasFocus ) + { + DetachObject( applicationLostFocusObject, true ); + applicationLostFocusObject.SetActive( false ); + UpdateHandPoses(); + UpdateHovering(); + BroadcastMessage( "OnParentHandInputFocusAcquired", SendMessageOptions.DontRequireReceiver ); + } + else + { + applicationLostFocusObject.SetActive( true ); + AttachObject( applicationLostFocusObject, AttachmentFlags.ParentToHand ); + BroadcastMessage( "OnParentHandInputFocusLost", SendMessageOptions.DontRequireReceiver ); + } + } + + + //------------------------------------------------- + void FixedUpdate() + { + UpdateHandPoses(); + } + + + //------------------------------------------------- + void OnDrawGizmos() + { + Gizmos.color = new Color( 0.5f, 1.0f, 0.5f, 0.9f ); + Transform sphereTransform = hoverSphereTransform ? hoverSphereTransform : this.transform; + Gizmos.DrawWireSphere( sphereTransform.position, hoverSphereRadius ); + } + + + //------------------------------------------------- + private void HandDebugLog( string msg ) + { + if ( spewDebugText ) + { + Debug.Log( "Hand (" + this.name + "): " + msg ); + } + } + + + //------------------------------------------------- + private void UpdateHandPoses() + { + if ( controller != null ) + { + SteamVR vr = SteamVR.instance; + if ( vr != null ) + { + var pose = new Valve.VR.TrackedDevicePose_t(); + var gamePose = new Valve.VR.TrackedDevicePose_t(); + var err = vr.compositor.GetLastPoseForTrackedDeviceIndex( controller.index, ref pose, ref gamePose ); + if ( err == Valve.VR.EVRCompositorError.None ) + { + var t = new SteamVR_Utils.RigidTransform( gamePose.mDeviceToAbsoluteTracking ); + transform.localPosition = t.pos; + transform.localRotation = t.rot; + } + } + } + } + + + //------------------------------------------------- + // Continue to hover over this object indefinitely, whether or not the Hand moves out of its interaction trigger volume. + // + // interactable - The Interactable to hover over indefinitely. + //------------------------------------------------- + public void HoverLock( Interactable interactable ) + { + HandDebugLog( "HoverLock " + interactable ); + hoverLocked = true; + hoveringInteractable = interactable; + } + + + //------------------------------------------------- + // Stop hovering over this object indefinitely. + // + // interactable - The hover-locked Interactable to stop hovering over indefinitely. + //------------------------------------------------- + public void HoverUnlock( Interactable interactable ) + { + HandDebugLog( "HoverUnlock " + interactable ); + if ( hoveringInteractable == interactable ) + { + hoverLocked = false; + } + } + + //------------------------------------------------- + // Was the standard interaction button just pressed? In VR, this is a trigger press. In 2D fallback, this is a mouse left-click. + //------------------------------------------------- + public bool GetStandardInteractionButtonDown() + { + if ( noSteamVRFallbackCamera ) + { + return Input.GetMouseButtonDown( 0 ); + } + else if ( controller != null ) + { + return controller.GetHairTriggerDown(); + } + + return false; + } + + + //------------------------------------------------- + // Was the standard interaction button just released? In VR, this is a trigger press. In 2D fallback, this is a mouse left-click. + //------------------------------------------------- + public bool GetStandardInteractionButtonUp() + { + if ( noSteamVRFallbackCamera ) + { + return Input.GetMouseButtonUp( 0 ); + } + else if ( controller != null ) + { + return controller.GetHairTriggerUp(); + } + + return false; + } + + + //------------------------------------------------- + // Is the standard interaction button being pressed? In VR, this is a trigger press. In 2D fallback, this is a mouse left-click. + //------------------------------------------------- + public bool GetStandardInteractionButton() + { + if ( noSteamVRFallbackCamera ) + { + return Input.GetMouseButton( 0 ); + } + else if ( controller != null ) + { + return controller.GetHairTrigger(); + } + + return false; + } + + + //------------------------------------------------- + private void InitController( int index ) + { + if ( controller == null ) + { + controller = SteamVR_Controller.Input( index ); + + HandDebugLog( "Hand " + name + " connected with device index " + controller.index ); + + controllerObject = GameObject.Instantiate( controllerPrefab ); + controllerObject.SetActive( true ); + controllerObject.name = controllerPrefab.name + "_" + this.name; + controllerObject.layer = gameObject.layer; + controllerObject.tag = gameObject.tag; + AttachObject( controllerObject ); + controller.TriggerHapticPulse( 800 ); + + // If the player's scale has been changed the object to attach will be the wrong size. + // To fix this we change the object's scale back to its original, pre-attach scale. + controllerObject.transform.localScale = controllerPrefab.transform.localScale; + + this.BroadcastMessage( "OnHandInitialized", index, SendMessageOptions.DontRequireReceiver ); // let child objects know we've initialized + } + } + } + +#if UNITY_EDITOR + //------------------------------------------------------------------------- + [UnityEditor.CustomEditor( typeof( Hand ) )] + public class HandEditor : UnityEditor.Editor + { + //------------------------------------------------- + // Custom Inspector GUI allows us to click from within the UI + //------------------------------------------------- + public override void OnInspectorGUI() + { + DrawDefaultInspector(); + + Hand hand = (Hand)target; + + if ( hand.otherHand ) + { + if ( hand.otherHand.otherHand != hand ) + { + UnityEditor.EditorGUILayout.HelpBox( "The otherHand of this Hand's otherHand is not this Hand.", UnityEditor.MessageType.Warning ); + } + + if ( hand.startingHandType == Hand.HandType.Left && hand.otherHand.startingHandType != Hand.HandType.Right ) + { + UnityEditor.EditorGUILayout.HelpBox( "This is a left Hand but otherHand is not a right Hand.", UnityEditor.MessageType.Warning ); + } + + if ( hand.startingHandType == Hand.HandType.Right && hand.otherHand.startingHandType != Hand.HandType.Left ) + { + UnityEditor.EditorGUILayout.HelpBox( "This is a right Hand but otherHand is not a left Hand.", UnityEditor.MessageType.Warning ); + } + + if ( hand.startingHandType == Hand.HandType.Any && hand.otherHand.startingHandType != Hand.HandType.Any ) + { + UnityEditor.EditorGUILayout.HelpBox( "This is an any-handed Hand but otherHand is not an any-handed Hand.", UnityEditor.MessageType.Warning ); + } + } + } + } +#endif +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs.meta new file mode 100644 index 0000000..ab2575c --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 29e3e4511966ba94d8ba0b98c6c62f82 +timeCreated: 1484266511 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs new file mode 100644 index 0000000..7f32725 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs @@ -0,0 +1,83 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Triggers haptic pulses based on a linear mapping +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class HapticRack : MonoBehaviour + { + [Tooltip( "The linear mapping driving the haptic rack" )] + public LinearMapping linearMapping; + + [Tooltip( "The number of haptic pulses evenly distributed along the mapping" )] + public int teethCount = 128; + + [Tooltip( "Minimum duration of the haptic pulse" )] + public int minimumPulseDuration = 500; + + [Tooltip( "Maximum duration of the haptic pulse" )] + public int maximumPulseDuration = 900; + + [Tooltip( "This event is triggered every time a haptic pulse is made" )] + public UnityEvent onPulse; + + private Hand hand; + private int previousToothIndex = -1; + + //------------------------------------------------- + void Awake() + { + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + } + + + //------------------------------------------------- + private void OnHandHoverBegin( Hand hand ) + { + this.hand = hand; + } + + + //------------------------------------------------- + private void OnHandHoverEnd( Hand hand ) + { + this.hand = null; + } + + + //------------------------------------------------- + void Update() + { + int currentToothIndex = Mathf.RoundToInt( linearMapping.value * teethCount - 0.5f ); + if ( currentToothIndex != previousToothIndex ) + { + Pulse(); + previousToothIndex = currentToothIndex; + } + } + + + //------------------------------------------------- + private void Pulse() + { + if ( hand && ( hand.controller != null ) && ( hand.GetStandardInteractionButton() ) ) + { + ushort duration = (ushort)Random.Range( minimumPulseDuration, maximumPulseDuration + 1 ); + hand.controller.TriggerHapticPulse( duration ); + + onPulse.Invoke(); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs.meta new file mode 100644 index 0000000..a1b9456 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/HapticRack.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 817521c5973e4ee45905ee97df3c38ad +timeCreated: 1433796170 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs new file mode 100644 index 0000000..9d3b138 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs @@ -0,0 +1,21 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Sets this GameObject as inactive when it loses focus from the hand +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class HideOnHandFocusLost : MonoBehaviour + { + //------------------------------------------------- + private void OnHandFocusLost( Hand hand ) + { + gameObject.SetActive( false ); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs.meta new file mode 100644 index 0000000..9987d49 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/HideOnHandFocusLost.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eb6d6653511aff5409d0827d4e3b79ea +timeCreated: 1439254899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs new file mode 100644 index 0000000..7daa798 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs @@ -0,0 +1,17 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Makes this object ignore any hovering by the hands +// +//============================================================================= + +using UnityEngine; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class IgnoreHovering : MonoBehaviour + { + [Tooltip( "If Hand is not null, only ignore the specified hand" )] + public Hand onlyIgnoreHand = null; + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs.meta new file mode 100644 index 0000000..9ce1636 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/IgnoreHovering.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f5a1be5da1c87864582d778e52de4e9b +timeCreated: 1444166650 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs new file mode 100644 index 0000000..ce97a31 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs @@ -0,0 +1,79 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Makes the hand act as an input module for Unity's event system +// +//============================================================================= + +using UnityEngine; +using System.Collections; +using UnityEngine.EventSystems; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class InputModule : BaseInputModule + { + private GameObject submitObject; + + //------------------------------------------------- + private static InputModule _instance; + public static InputModule instance + { + get + { + if ( _instance == null ) + _instance = GameObject.FindObjectOfType(); + + return _instance; + } + } + + + //------------------------------------------------- + public override bool ShouldActivateModule() + { + if ( !base.ShouldActivateModule() ) + return false; + + return submitObject != null; + } + + + //------------------------------------------------- + public void HoverBegin( GameObject gameObject ) + { + PointerEventData pointerEventData = new PointerEventData( eventSystem ); + ExecuteEvents.Execute( gameObject, pointerEventData, ExecuteEvents.pointerEnterHandler ); + } + + + //------------------------------------------------- + public void HoverEnd( GameObject gameObject ) + { + PointerEventData pointerEventData = new PointerEventData( eventSystem ); + pointerEventData.selectedObject = null; + ExecuteEvents.Execute( gameObject, pointerEventData, ExecuteEvents.pointerExitHandler ); + } + + + //------------------------------------------------- + public void Submit( GameObject gameObject ) + { + submitObject = gameObject; + } + + + //------------------------------------------------- + public override void Process() + { + if ( submitObject ) + { + BaseEventData data = GetBaseEventData(); + data.selectedObject = submitObject; + ExecuteEvents.Execute( submitObject, data, ExecuteEvents.submitHandler ); + + submitObject = null; + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs.meta new file mode 100644 index 0000000..b8bc916 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InputModule.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c9e05292e0d62b542ac5bba92674a86d +timeCreated: 1429055028 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs new file mode 100644 index 0000000..b355011 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs @@ -0,0 +1,43 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: This object will get hover events and can be attached to the hands +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class Interactable : MonoBehaviour + { + public delegate void OnAttachedToHandDelegate( Hand hand ); + public delegate void OnDetachedFromHandDelegate( Hand hand ); + + [HideInInspector] + public event OnAttachedToHandDelegate onAttachedToHand; + [HideInInspector] + public event OnDetachedFromHandDelegate onDetachedFromHand; + + //------------------------------------------------- + private void OnAttachedToHand( Hand hand ) + { + if ( onAttachedToHand != null ) + { + onAttachedToHand.Invoke( hand ); + } + } + + + //------------------------------------------------- + private void OnDetachedFromHand( Hand hand ) + { + if ( onDetachedFromHand != null ) + { + onDetachedFromHand.Invoke( hand ); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs.meta new file mode 100644 index 0000000..ea4b7d4 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Interactable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b93b6a877adcbf94c89a9d6e0c0e844d +timeCreated: 1430943024 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableButtonEvents.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableButtonEvents.cs new file mode 100644 index 0000000..67a3719 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableButtonEvents.cs @@ -0,0 +1,78 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Sends simple controller button events to UnityEvents +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class InteractableButtonEvents : MonoBehaviour + { + public UnityEvent onTriggerDown; + public UnityEvent onTriggerUp; + public UnityEvent onGripDown; + public UnityEvent onGripUp; + public UnityEvent onTouchpadDown; + public UnityEvent onTouchpadUp; + public UnityEvent onTouchpadTouch; + public UnityEvent onTouchpadRelease; + + //------------------------------------------------- + void Update() + { + for ( int i = 0; i < Player.instance.handCount; i++ ) + { + Hand hand = Player.instance.GetHand( i ); + + if ( hand.controller != null ) + { + if ( hand.controller.GetPressDown( Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ) ) + { + onTriggerDown.Invoke(); + } + + if ( hand.controller.GetPressUp( Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ) ) + { + onTriggerUp.Invoke(); + } + + if ( hand.controller.GetPressDown( Valve.VR.EVRButtonId.k_EButton_Grip ) ) + { + onGripDown.Invoke(); + } + + if ( hand.controller.GetPressUp( Valve.VR.EVRButtonId.k_EButton_Grip ) ) + { + onGripUp.Invoke(); + } + + if ( hand.controller.GetPressDown( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) ) + { + onTouchpadDown.Invoke(); + } + + if ( hand.controller.GetPressUp( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) ) + { + onTouchpadUp.Invoke(); + } + + if ( hand.controller.GetTouchDown( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) ) + { + onTouchpadTouch.Invoke(); + } + + if ( hand.controller.GetTouchUp( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) ) + { + onTouchpadRelease.Invoke(); + } + } + } + + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableButtonEvents.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableButtonEvents.cs.meta new file mode 100644 index 0000000..2b9c6a0 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableButtonEvents.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6948c755e9613734dbac166d770c8e3e +timeCreated: 1435876320 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableHoverEvents.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableHoverEvents.cs new file mode 100644 index 0000000..4102d07 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableHoverEvents.cs @@ -0,0 +1,49 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Sends UnityEvents for basic hand interactions +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class InteractableHoverEvents : MonoBehaviour + { + public UnityEvent onHandHoverBegin; + public UnityEvent onHandHoverEnd; + public UnityEvent onAttachedToHand; + public UnityEvent onDetachedFromHand; + + //------------------------------------------------- + private void OnHandHoverBegin() + { + onHandHoverBegin.Invoke(); + } + + + //------------------------------------------------- + private void OnHandHoverEnd() + { + onHandHoverEnd.Invoke(); + } + + + //------------------------------------------------- + private void OnAttachedToHand( Hand hand ) + { + onAttachedToHand.Invoke(); + } + + + //------------------------------------------------- + private void OnDetachedFromHand( Hand hand ) + { + onDetachedFromHand.Invoke(); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableHoverEvents.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableHoverEvents.cs.meta new file mode 100644 index 0000000..ee592eb --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableHoverEvents.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c4153b26428ccf041950b92c057812a3 +timeCreated: 1432689386 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackage.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackage.cs new file mode 100644 index 0000000..cbf28fe --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackage.cs @@ -0,0 +1,24 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: A package of items that can interact with the hands and be returned +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class ItemPackage : MonoBehaviour + { + public enum ItemPackageType { Unrestricted, OneHanded, TwoHanded } + + public new string name; + public ItemPackageType packageType = ItemPackageType.Unrestricted; + public GameObject itemPrefab; // object to be spawned on tracked controller + public GameObject otherHandItemPrefab; // object to be spawned in Other Hand + public GameObject previewPrefab; // used to preview inputObject + public GameObject fadedPreviewPrefab; // used to preview insubstantial inputObject + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackage.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackage.cs.meta new file mode 100644 index 0000000..edda282 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackage.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c9f83db71b9a6764abf964ab7679f035 +timeCreated: 1436836633 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageReference.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageReference.cs new file mode 100644 index 0000000..ed4cdd2 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageReference.cs @@ -0,0 +1,17 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Keeps track of the ItemPackage this object is a part of +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class ItemPackageReference : MonoBehaviour + { + public ItemPackage itemPackage; + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageReference.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageReference.cs.meta new file mode 100644 index 0000000..7141b1d --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageReference.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 57468e6cbae21894fa42c90413c294ff +timeCreated: 1436997098 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageSpawner.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageSpawner.cs new file mode 100644 index 0000000..efaf131 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageSpawner.cs @@ -0,0 +1,348 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Handles the spawning and returning of the ItemPackage +// +//============================================================================= + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using UnityEngine.Events; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class ItemPackageSpawner : MonoBehaviour + { + public ItemPackage itemPackage + { + get + { + return _itemPackage; + } + set + { + CreatePreviewObject(); + } + } + + public ItemPackage _itemPackage; + + private bool useItemPackagePreview = true; + private bool useFadedPreview = false; + private GameObject previewObject; + + public bool requireTriggerPressToTake = false; + public bool requireTriggerPressToReturn = false; + public bool showTriggerHint = false; + + [EnumFlags] + public Hand.AttachmentFlags attachmentFlags = Hand.defaultAttachmentFlags; + public string attachmentPoint; + + public bool takeBackItem = false; // if a hand enters this trigger and has the item this spawner dispenses at the top of the stack, remove it from the stack + + public bool acceptDifferentItems = false; + + private GameObject spawnedItem; + private bool itemIsSpawned = false; + + public UnityEvent pickupEvent; + public UnityEvent dropEvent; + + public bool justPickedUpItem = false; + + + //------------------------------------------------- + private void CreatePreviewObject() + { + if ( !useItemPackagePreview ) + { + return; + } + + ClearPreview(); + + if ( useItemPackagePreview ) + { + if ( itemPackage == null ) + { + return; + } + + if ( useFadedPreview == false ) // if we don't have a spawned item out there, use the regular preview + { + if ( itemPackage.previewPrefab != null ) + { + previewObject = Instantiate( itemPackage.previewPrefab, transform.position, Quaternion.identity ) as GameObject; + previewObject.transform.parent = transform; + previewObject.transform.localRotation = Quaternion.identity; + } + } + else // there's a spawned item out there. Use the faded preview + { + if ( itemPackage.fadedPreviewPrefab != null ) + { + previewObject = Instantiate( itemPackage.fadedPreviewPrefab, transform.position, Quaternion.identity ) as GameObject; + previewObject.transform.parent = transform; + previewObject.transform.localRotation = Quaternion.identity; + } + } + } + } + + + //------------------------------------------------- + void Start() + { + VerifyItemPackage(); + } + + + //------------------------------------------------- + private void VerifyItemPackage() + { + if ( itemPackage == null ) + { + ItemPackageNotValid(); + } + + if ( itemPackage.itemPrefab == null ) + { + ItemPackageNotValid(); + } + } + + + //------------------------------------------------- + private void ItemPackageNotValid() + { + Debug.LogError( "ItemPackage assigned to " + gameObject.name + " is not valid. Destroying this game object." ); + Destroy( gameObject ); + } + + + //------------------------------------------------- + private void ClearPreview() + { + foreach ( Transform child in transform ) + { + if ( Time.time > 0 ) + { + GameObject.Destroy( child.gameObject ); + } + else + { + GameObject.DestroyImmediate( child.gameObject ); + } + } + } + + + //------------------------------------------------- + void Update() + { + if ( ( itemIsSpawned == true ) && ( spawnedItem == null ) ) + { + itemIsSpawned = false; + useFadedPreview = false; + dropEvent.Invoke(); + CreatePreviewObject(); + } + } + + + //------------------------------------------------- + private void OnHandHoverBegin( Hand hand ) + { + ItemPackage currentAttachedItemPackage = GetAttachedItemPackage( hand ); + + if ( currentAttachedItemPackage == itemPackage ) // the item at the top of the hand's stack has an associated ItemPackage + { + if ( takeBackItem && !requireTriggerPressToReturn ) // if we want to take back matching items and aren't waiting for a trigger press + { + TakeBackItem( hand ); + } + } + + if ( !requireTriggerPressToTake ) // we don't require trigger press for pickup. Spawn and attach object. + { + SpawnAndAttachObject( hand ); + } + + if ( requireTriggerPressToTake && showTriggerHint ) + { + ControllerButtonHints.ShowTextHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger, "PickUp" ); + } + } + + + //------------------------------------------------- + private void TakeBackItem( Hand hand ) + { + RemoveMatchingItemsFromHandStack( itemPackage, hand ); + + if ( itemPackage.packageType == ItemPackage.ItemPackageType.TwoHanded ) + { + RemoveMatchingItemsFromHandStack( itemPackage, hand.otherHand ); + } + } + + + //------------------------------------------------- + private ItemPackage GetAttachedItemPackage( Hand hand ) + { + GameObject currentAttachedObject = hand.currentAttachedObject; + + if ( currentAttachedObject == null ) // verify the hand is holding something + { + return null; + } + + ItemPackageReference packageReference = hand.currentAttachedObject.GetComponent(); + if ( packageReference == null ) // verify the item in the hand is matchable + { + return null; + } + + ItemPackage attachedItemPackage = packageReference.itemPackage; // return the ItemPackage reference we find. + + return attachedItemPackage; + } + + + //------------------------------------------------- + private void HandHoverUpdate( Hand hand ) + { + if ( requireTriggerPressToTake ) + { + if ( hand.controller != null && hand.controller.GetHairTriggerDown() ) + { + SpawnAndAttachObject( hand ); + } + } + } + + + //------------------------------------------------- + private void OnHandHoverEnd( Hand hand ) + { + if ( !justPickedUpItem && requireTriggerPressToTake && showTriggerHint ) + { + ControllerButtonHints.HideTextHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + + justPickedUpItem = false; + } + + + //------------------------------------------------- + private void RemoveMatchingItemsFromHandStack( ItemPackage package, Hand hand ) + { + for ( int i = 0; i < hand.AttachedObjects.Count; i++ ) + { + ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent(); + if ( packageReference != null ) + { + ItemPackage attachedObjectItemPackage = packageReference.itemPackage; + if ( ( attachedObjectItemPackage != null ) && ( attachedObjectItemPackage == package ) ) + { + GameObject detachedItem = hand.AttachedObjects[i].attachedObject; + hand.DetachObject( detachedItem ); + } + } + } + } + + + //------------------------------------------------- + private void RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType packageType, Hand hand ) + { + for ( int i = 0; i < hand.AttachedObjects.Count; i++ ) + { + ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent(); + if ( packageReference != null ) + { + if ( packageReference.itemPackage.packageType == packageType ) + { + GameObject detachedItem = hand.AttachedObjects[i].attachedObject; + hand.DetachObject( detachedItem ); + } + } + } + } + + + //------------------------------------------------- + private void SpawnAndAttachObject( Hand hand ) + { + if ( hand.otherHand != null ) + { + //If the other hand has this item package, take it back from the other hand + ItemPackage otherHandItemPackage = GetAttachedItemPackage( hand.otherHand ); + if ( otherHandItemPackage == itemPackage ) + { + TakeBackItem( hand.otherHand ); + } + } + + if ( showTriggerHint ) + { + ControllerButtonHints.HideTextHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + + if ( itemPackage.otherHandItemPrefab != null ) + { + if ( hand.otherHand.hoverLocked ) + { + //Debug.Log( "Not attaching objects because other hand is hoverlocked and we can't deliver both items." ); + return; + } + } + + // if we're trying to spawn a one-handed item, remove one and two-handed items from this hand and two-handed items from both hands + if ( itemPackage.packageType == ItemPackage.ItemPackageType.OneHanded ) + { + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.OneHanded, hand ); + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.TwoHanded, hand ); + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.TwoHanded, hand.otherHand ); + } + + // if we're trying to spawn a two-handed item, remove one and two-handed items from both hands + if ( itemPackage.packageType == ItemPackage.ItemPackageType.TwoHanded ) + { + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.OneHanded, hand ); + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.OneHanded, hand.otherHand ); + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.TwoHanded, hand ); + RemoveMatchingItemTypesFromHand( ItemPackage.ItemPackageType.TwoHanded, hand.otherHand ); + } + + spawnedItem = GameObject.Instantiate( itemPackage.itemPrefab ); + spawnedItem.SetActive( true ); + hand.AttachObject( spawnedItem, attachmentFlags, attachmentPoint ); + + if ( ( itemPackage.otherHandItemPrefab != null ) && ( hand.otherHand.controller != null ) ) + { + GameObject otherHandObjectToAttach = GameObject.Instantiate( itemPackage.otherHandItemPrefab ); + otherHandObjectToAttach.SetActive( true ); + hand.otherHand.AttachObject( otherHandObjectToAttach, attachmentFlags ); + } + + itemIsSpawned = true; + + justPickedUpItem = true; + + if ( takeBackItem ) + { + useFadedPreview = true; + pickupEvent.Invoke(); + CreatePreviewObject(); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageSpawner.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageSpawner.cs.meta new file mode 100644 index 0000000..ad61425 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/ItemPackageSpawner.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 43e53a985809f0949b9a42cc2a6888c9 +timeCreated: 1436915041 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimation.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimation.cs new file mode 100644 index 0000000..6c11379 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimation.cs @@ -0,0 +1,64 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Animation that moves based on a linear mapping +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class LinearAnimation : MonoBehaviour + { + public LinearMapping linearMapping; + public new Animation animation; + + private AnimationState animState; + private float animLength; + private float lastValue; + + + //------------------------------------------------- + void Awake() + { + if ( animation == null ) + { + animation = GetComponent(); + } + + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + + //We're assuming the animation has a single clip, and that's the one we're + //going to scrub with the linear mapping. + animation.playAutomatically = true; + animState = animation[animation.clip.name]; + + //If the anim state's (i.e. clip's) wrap mode is Once (the default) or ClampForever, + //Unity will automatically stop playing the anim, regardless of subsequent changes + //to animState.time. Thus, we set the wrap mode to PingPong. + animState.wrapMode = WrapMode.PingPong; + animState.speed = 0; + animLength = animState.length; + } + + + //------------------------------------------------- + void Update() + { + float value = linearMapping.value; + + //No need to set the anim if our value hasn't changed. + if ( value != lastValue ) + { + animState.time = value / animLength; + } + + lastValue = value; + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimation.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimation.cs.meta new file mode 100644 index 0000000..2f6ba37 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 49a60120b932b59409171f5ff611b639 +timeCreated: 1433799038 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimator.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimator.cs new file mode 100644 index 0000000..15b84ae --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimator.cs @@ -0,0 +1,59 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Animator whose speed is set based on a linear mapping +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class LinearAnimator : MonoBehaviour + { + public LinearMapping linearMapping; + public Animator animator; + + private float currentLinearMapping = float.NaN; + private int framesUnchanged = 0; + + + //------------------------------------------------- + void Awake() + { + if ( animator == null ) + { + animator = GetComponent(); + } + + animator.speed = 0.0f; + + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + } + + + //------------------------------------------------- + void Update() + { + if ( currentLinearMapping != linearMapping.value ) + { + currentLinearMapping = linearMapping.value; + animator.enabled = true; + animator.Play( 0, 0, currentLinearMapping ); + framesUnchanged = 0; + } + else + { + framesUnchanged++; + if ( framesUnchanged > 2 ) + { + animator.enabled = false; + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimator.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimator.cs.meta new file mode 100644 index 0000000..36c5620 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAnimator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 634b98c3ef8bc6d4f834f80a4613a4a4 +timeCreated: 1435864149 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAudioPitch.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAudioPitch.cs new file mode 100644 index 0000000..ec17c04 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAudioPitch.cs @@ -0,0 +1,58 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Changes the pitch of this audio source based on a linear mapping +// and a curve +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class LinearAudioPitch : MonoBehaviour + { + public LinearMapping linearMapping; + public AnimationCurve pitchCurve; + public float minPitch; + public float maxPitch; + public bool applyContinuously = true; + + private AudioSource audioSource; + + + //------------------------------------------------- + void Awake() + { + if ( audioSource == null ) + { + audioSource = GetComponent(); + } + + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + } + + + //------------------------------------------------- + void Update() + { + if ( applyContinuously ) + { + Apply(); + } + } + + + //------------------------------------------------- + private void Apply() + { + float y = pitchCurve.Evaluate( linearMapping.value ); + + audioSource.pitch = Mathf.Lerp( minPitch, maxPitch, y ); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAudioPitch.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAudioPitch.cs.meta new file mode 100644 index 0000000..da2964e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearAudioPitch.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb07dbf09f9933e49b22c82d8428c53b +timeCreated: 1436834777 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearBlendshape.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearBlendshape.cs new file mode 100644 index 0000000..af1740b --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearBlendshape.cs @@ -0,0 +1,51 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Set the blend shape weight based on a linear mapping +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class LinearBlendshape : MonoBehaviour + { + public LinearMapping linearMapping; + public SkinnedMeshRenderer skinnedMesh; + + private float lastValue; + + + //------------------------------------------------- + void Awake() + { + if ( skinnedMesh == null ) + { + skinnedMesh = GetComponent(); + } + + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + } + + + //------------------------------------------------- + void Update() + { + float value = linearMapping.value; + + //No need to set the blend if our value hasn't changed. + if ( value != lastValue ) + { + float blendValue = Util.RemapNumberClamped( value, 0f, 1f, 1f, 100f ); + skinnedMesh.SetBlendShapeWeight( 0, blendValue ); + } + + lastValue = value; + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearBlendshape.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearBlendshape.cs.meta new file mode 100644 index 0000000..74cb2ed --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearBlendshape.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5a3622562855c9a40a14846ffdc8bfe4 +timeCreated: 1447859480 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDisplacement.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDisplacement.cs new file mode 100644 index 0000000..a59c9f4 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDisplacement.cs @@ -0,0 +1,41 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Move the position of this object based on a linear mapping +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class LinearDisplacement : MonoBehaviour + { + public Vector3 displacement; + public LinearMapping linearMapping; + + private Vector3 initialPosition; + + //------------------------------------------------- + void Start() + { + initialPosition = transform.localPosition; + + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + } + + + //------------------------------------------------- + void Update() + { + if ( linearMapping ) + { + transform.localPosition = initialPosition + linearMapping.value * displacement; + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDisplacement.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDisplacement.cs.meta new file mode 100644 index 0000000..66a0a13 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDisplacement.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 13d876e5d485004448f3e7b57eece9ab +timeCreated: 1433730007 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDrive.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDrive.cs new file mode 100644 index 0000000..dabd09e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDrive.cs @@ -0,0 +1,148 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Drives a linear mapping based on position between 2 positions +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class LinearDrive : MonoBehaviour + { + public Transform startPosition; + public Transform endPosition; + public LinearMapping linearMapping; + public bool repositionGameObject = true; + public bool maintainMomemntum = true; + public float momemtumDampenRate = 5.0f; + + private float initialMappingOffset; + private int numMappingChangeSamples = 5; + private float[] mappingChangeSamples; + private float prevMapping = 0.0f; + private float mappingChangeRate; + private int sampleCount = 0; + + + //------------------------------------------------- + void Awake() + { + mappingChangeSamples = new float[numMappingChangeSamples]; + } + + + //------------------------------------------------- + void Start() + { + if ( linearMapping == null ) + { + linearMapping = GetComponent(); + } + + if ( linearMapping == null ) + { + linearMapping = gameObject.AddComponent(); + } + + initialMappingOffset = linearMapping.value; + + if ( repositionGameObject ) + { + UpdateLinearMapping( transform ); + } + } + + + //------------------------------------------------- + private void HandHoverUpdate( Hand hand ) + { + if ( hand.GetStandardInteractionButtonDown() ) + { + hand.HoverLock( GetComponent() ); + + initialMappingOffset = linearMapping.value - CalculateLinearMapping( hand.transform ); + sampleCount = 0; + mappingChangeRate = 0.0f; + } + + if ( hand.GetStandardInteractionButtonUp() ) + { + hand.HoverUnlock( GetComponent() ); + + CalculateMappingChangeRate(); + } + + if ( hand.GetStandardInteractionButton() ) + { + UpdateLinearMapping( hand.transform ); + } + } + + + //------------------------------------------------- + private void CalculateMappingChangeRate() + { + //Compute the mapping change rate + mappingChangeRate = 0.0f; + int mappingSamplesCount = Mathf.Min( sampleCount, mappingChangeSamples.Length ); + if ( mappingSamplesCount != 0 ) + { + for ( int i = 0; i < mappingSamplesCount; ++i ) + { + mappingChangeRate += mappingChangeSamples[i]; + } + mappingChangeRate /= mappingSamplesCount; + } + } + + + //------------------------------------------------- + private void UpdateLinearMapping( Transform tr ) + { + prevMapping = linearMapping.value; + linearMapping.value = Mathf.Clamp01( initialMappingOffset + CalculateLinearMapping( tr ) ); + + mappingChangeSamples[sampleCount % mappingChangeSamples.Length] = ( 1.0f / Time.deltaTime ) * ( linearMapping.value - prevMapping ); + sampleCount++; + + if ( repositionGameObject ) + { + transform.position = Vector3.Lerp( startPosition.position, endPosition.position, linearMapping.value ); + } + } + + + //------------------------------------------------- + private float CalculateLinearMapping( Transform tr ) + { + Vector3 direction = endPosition.position - startPosition.position; + float length = direction.magnitude; + direction.Normalize(); + + Vector3 displacement = tr.position - startPosition.position; + + return Vector3.Dot( displacement, direction ) / length; + } + + + //------------------------------------------------- + void Update() + { + if ( maintainMomemntum && mappingChangeRate != 0.0f ) + { + //Dampen the mapping change rate and apply it to the mapping + mappingChangeRate = Mathf.Lerp( mappingChangeRate, 0.0f, momemtumDampenRate * Time.deltaTime ); + linearMapping.value = Mathf.Clamp01( linearMapping.value + ( mappingChangeRate * Time.deltaTime ) ); + + if ( repositionGameObject ) + { + transform.position = Vector3.Lerp( startPosition.position, endPosition.position, linearMapping.value ); + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDrive.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDrive.cs.meta new file mode 100644 index 0000000..bbc2a5b --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearDrive.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8c81a27fd18a29444be92481fe681f4b +timeCreated: 1434650764 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearMapping.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearMapping.cs new file mode 100644 index 0000000..ec7cc43 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearMapping.cs @@ -0,0 +1,17 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: A linear mapping value that is used by other components +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class LinearMapping : MonoBehaviour + { + public float value; + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearMapping.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearMapping.cs.meta new file mode 100644 index 0000000..21c0195 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/LinearMapping.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 46f8e9e70f68ee3418ad85992778c116 +timeCreated: 1433728353 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/PlaySound.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/PlaySound.cs new file mode 100644 index 0000000..6b8771b --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/PlaySound.cs @@ -0,0 +1,216 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Plays one of many audio files with possible randomized parameters +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( AudioSource ) )] + public class PlaySound : MonoBehaviour + { + [Tooltip( "List of audio clips to play." )] + public AudioClip[] waveFile; + [Tooltip( "Stops the currently playing clip in the audioSource. Otherwise clips will overlap/mix." )] + public bool stopOnPlay; + [Tooltip( "After the audio clip finishes playing, disable the game object the sound is on." )] + public bool disableOnEnd; + [Tooltip( "Loop the sound after the wave file variation has been chosen." )] + public bool looping; + [Tooltip( "If the sound is looping and updating it's position every frame, stop the sound at the end of the wav/clip length. " )] + public bool stopOnEnd; + [Tooltip( "Start a wave file playing on awake, but after a delay." )] + public bool playOnAwakeWithDelay; + + [Header ( "Random Volume" )] + public bool useRandomVolume = true; + [Tooltip( "Minimum volume that will be used when randomly set." )] + [Range( 0.0f, 1.0f )] + public float volMin = 1.0f; + [Tooltip( "Maximum volume that will be used when randomly set." )] + [Range( 0.0f, 1.0f )] + public float volMax = 1.0f; + + [Header ( "Random Pitch" )] + [Tooltip( "Use min and max random pitch levels when playing sounds." )] + public bool useRandomPitch = true; + [Tooltip( "Minimum pitch that will be used when randomly set." )] + [Range( -3.0f, 3.0f )] + public float pitchMin = 1.0f; + [Tooltip( "Maximum pitch that will be used when randomly set." )] + [Range( -3.0f, 3.0f )] + public float pitchMax = 1.0f; + + [Header( "Random Time" )] + [Tooltip( "Use Retrigger Time to repeat the sound within a time range" )] + public bool useRetriggerTime = false; + [Tooltip( "Inital time before the first repetion starts" )] + [Range( 0.0f, 360.0f )] + public float timeInitial = 0.0f; + [Tooltip( "Minimum time that will pass before the sound is retriggered" )] + [Range( 0.0f, 360.0f )] + public float timeMin = 0.0f; + [Tooltip( "Maximum pitch that will be used when randomly set." )] + [Range( 0.0f, 360.0f )] + public float timeMax = 0.0f; + + [Header ( "Random Silence" )] + [Tooltip( "Use Retrigger Time to repeat the sound within a time range" )] + public bool useRandomSilence = false; + [Tooltip( "Percent chance that the wave file will not play" )] + [Range( 0.0f, 1.0f )] + public float percentToNotPlay = 0.0f; + + [Header( "Delay Time" )] + [Tooltip( "Time to offset playback of sound" )] + public float delayOffsetTime = 0.0f; + + + private AudioSource audioSource; + private AudioClip clip; + + //------------------------------------------------- + void Awake() + { + audioSource = GetComponent(); + clip = audioSource.clip; + + // audio source play on awake is true, just play the PlaySound immediately + if ( audioSource.playOnAwake ) + { + if ( useRetriggerTime ) + InvokeRepeating( "Play", timeInitial, Random.Range( timeMin, timeMax ) ); + else + Play(); + } + + // if playOnAwake is false, but the playOnAwakeWithDelay on the PlaySound is true, play the sound on away but with a delay + else if ( !audioSource.playOnAwake && playOnAwakeWithDelay ) + { + PlayWithDelay( delayOffsetTime ); + + if ( useRetriggerTime ) + InvokeRepeating( "Play", timeInitial, Random.Range( timeMin, timeMax ) ); + } + + // in the case where both playOnAwake and playOnAwakeWithDelay are both set to true, just to the same as above, play the sound but with a delay + else if ( audioSource.playOnAwake && playOnAwakeWithDelay ) + { + PlayWithDelay( delayOffsetTime ); + + if ( useRetriggerTime ) + InvokeRepeating( "Play", timeInitial, Random.Range( timeMin, timeMax ) ); + } + } + + + //------------------------------------------------- + // Play a random clip from those available + //------------------------------------------------- + public void Play() + { + if ( looping ) + { + PlayLooping(); + + } + + else PlayOneShotSound(); + } + + + //------------------------------------------------- + public void PlayWithDelay( float delayTime ) + { + if ( looping ) + Invoke( "PlayLooping", delayTime ); + else + Invoke( "PlayOneShotSound", delayTime ); + } + + + //------------------------------------------------- + // Play random wave clip on audiosource as a one shot + //------------------------------------------------- + public AudioClip PlayOneShotSound() + { + if ( !this.audioSource.isActiveAndEnabled ) + return null; + + SetAudioSource(); + if ( this.stopOnPlay ) + audioSource.Stop(); + if ( this.disableOnEnd ) + Invoke( "Disable", clip.length ); + this.audioSource.PlayOneShot( this.clip ); + return this.clip; + } + + + //------------------------------------------------- + public AudioClip PlayLooping() + { + // get audio source properties, and do any special randomizations + SetAudioSource(); + + // if the audio source has forgotten to be set to looping, set it to looping + if ( !audioSource.loop ) + audioSource.loop = true; + + // play the clip in the audio source, all the meanwhile updating it's location + this.audioSource.Play(); + + // if disable on end is checked, stop playing the wave file after the first loop has finished. + if ( stopOnEnd ) + Invoke( "Stop", audioSource.clip.length ); + return this.clip; + } + + + //------------------------------------------------- + public void Disable() + { + gameObject.SetActive( false ); + } + + + //------------------------------------------------- + public void Stop() + { + audioSource.Stop(); + } + + + //------------------------------------------------- + private void SetAudioSource() + { + if ( this.useRandomVolume ) + { + //randomly apply a volume between the volume min max + this.audioSource.volume = Random.Range( this.volMin, this.volMax ); + + if ( useRandomSilence && ( Random.Range( 0, 1 ) < percentToNotPlay ) ) + { + this.audioSource.volume = 0; + } + } + + if ( this.useRandomPitch ) + { + //randomly apply a pitch between the pitch min max + this.audioSource.pitch = Random.Range( this.pitchMin, this.pitchMax ); + } + + if ( this.waveFile.Length > 0 ) + { + // randomly assign a wave file from the array into the audioSource clip property + audioSource.clip = this.waveFile[Random.Range( 0, waveFile.Length )]; + clip = audioSource.clip; + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/PlaySound.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/PlaySound.cs.meta new file mode 100644 index 0000000..9c22ff9 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/PlaySound.cs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1a125d9df683e2a49b12babced273360 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Player.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/Player.cs new file mode 100644 index 0000000..3634415 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Player.cs @@ -0,0 +1,406 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Player interface used to query HMD transforms and VR hands +// +//============================================================================= + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + // Singleton representing the local VR player/user, with methods for getting + // the player's hands, head, tracking origin, and guesses for various properties. + //------------------------------------------------------------------------- + public class Player : MonoBehaviour + { + [Tooltip( "Virtual transform corresponding to the meatspace tracking origin. Devices are tracked relative to this." )] + public Transform trackingOriginTransform; + + [Tooltip( "List of possible transforms for the head/HMD, including the no-SteamVR fallback camera." )] + public Transform[] hmdTransforms; + + [Tooltip( "List of possible Hands, including no-SteamVR fallback Hands." )] + public Hand[] hands; + + [Tooltip( "Reference to the physics collider that follows the player's HMD position." )] + public Collider headCollider; + + [Tooltip( "These objects are enabled when SteamVR is available" )] + public GameObject rigSteamVR; + + [Tooltip( "These objects are enabled when SteamVR is not available, or when the user toggles out of VR" )] + public GameObject rig2DFallback; + + [Tooltip( "The audio listener for this player" )] + public Transform audioListener; + + public bool allowToggleTo2D = true; + + + //------------------------------------------------- + // Singleton instance of the Player. Only one can exist at a time. + //------------------------------------------------- + private static Player _instance; + public static Player instance + { + get + { + if ( _instance == null ) + { + _instance = FindObjectOfType(); + } + return _instance; + } + } + + + //------------------------------------------------- + // Get the number of active Hands. + //------------------------------------------------- + public int handCount + { + get + { + int count = 0; + for ( int i = 0; i < hands.Length; i++ ) + { + if ( hands[i].gameObject.activeInHierarchy ) + { + count++; + } + } + return count; + } + } + + + //------------------------------------------------- + // Get the i-th active Hand. + // + // i - Zero-based index of the active Hand to get + //------------------------------------------------- + public Hand GetHand( int i ) + { + for ( int j = 0; j < hands.Length; j++ ) + { + if ( !hands[j].gameObject.activeInHierarchy ) + { + continue; + } + + if ( i > 0 ) + { + i--; + continue; + } + + return hands[j]; + } + + return null; + } + + + //------------------------------------------------- + public Hand leftHand + { + get + { + for ( int j = 0; j < hands.Length; j++ ) + { + if ( !hands[j].gameObject.activeInHierarchy ) + { + continue; + } + + if ( hands[j].GuessCurrentHandType() != Hand.HandType.Left ) + { + continue; + } + + return hands[j]; + } + + return null; + } + } + + + //------------------------------------------------- + public Hand rightHand + { + get + { + for ( int j = 0; j < hands.Length; j++ ) + { + if ( !hands[j].gameObject.activeInHierarchy ) + { + continue; + } + + if ( hands[j].GuessCurrentHandType() != Hand.HandType.Right ) + { + continue; + } + + return hands[j]; + } + + return null; + } + } + + + //------------------------------------------------- + public SteamVR_Controller.Device leftController + { + get + { + Hand h = leftHand; + if ( h ) + { + return h.controller; + } + return null; + } + } + + + //------------------------------------------------- + public SteamVR_Controller.Device rightController + { + get + { + Hand h = rightHand; + if ( h ) + { + return h.controller; + } + return null; + } + } + + + //------------------------------------------------- + // Get the HMD transform. This might return the fallback camera transform if SteamVR is unavailable or disabled. + //------------------------------------------------- + public Transform hmdTransform + { + get + { + for ( int i = 0; i < hmdTransforms.Length; i++ ) + { + if ( hmdTransforms[i].gameObject.activeInHierarchy ) + return hmdTransforms[i]; + } + return null; + } + } + + + //------------------------------------------------- + // Height of the eyes above the ground - useful for estimating player height. + //------------------------------------------------- + public float eyeHeight + { + get + { + Transform hmd = hmdTransform; + if ( hmd ) + { + Vector3 eyeOffset = Vector3.Project( hmd.position - trackingOriginTransform.position, trackingOriginTransform.up ); + return eyeOffset.magnitude / trackingOriginTransform.lossyScale.x; + } + return 0.0f; + } + } + + + //------------------------------------------------- + // Guess for the world-space position of the player's feet, directly beneath the HMD. + //------------------------------------------------- + public Vector3 feetPositionGuess + { + get + { + Transform hmd = hmdTransform; + if ( hmd ) + { + return trackingOriginTransform.position + Vector3.ProjectOnPlane( hmd.position - trackingOriginTransform.position, trackingOriginTransform.up ); + } + return trackingOriginTransform.position; + } + } + + + //------------------------------------------------- + // Guess for the world-space direction of the player's hips/torso. This is effectively just the gaze direction projected onto the floor plane. + //------------------------------------------------- + public Vector3 bodyDirectionGuess + { + get + { + Transform hmd = hmdTransform; + if ( hmd ) + { + Vector3 direction = Vector3.ProjectOnPlane( hmd.forward, trackingOriginTransform.up ); + if ( Vector3.Dot( hmd.up, trackingOriginTransform.up ) < 0.0f ) + { + // The HMD is upside-down. Either + // -The player is bending over backwards + // -The player is bent over looking through their legs + direction = -direction; + } + return direction; + } + return trackingOriginTransform.forward; + } + } + + + //------------------------------------------------- + void Awake() + { + if ( trackingOriginTransform == null ) + { + trackingOriginTransform = this.transform; + } + } + + + //------------------------------------------------- + void OnEnable() + { + _instance = this; + + if ( SteamVR.instance != null ) + { + ActivateRig( rigSteamVR ); + } + else + { +#if !HIDE_DEBUG_UI + ActivateRig( rig2DFallback ); +#endif + } + } + + + //------------------------------------------------- + void OnDrawGizmos() + { + if ( this != instance ) + { + return; + } + + //NOTE: These gizmo icons don't work in the plugin since the icons need to exist in a specific "Gizmos" + // folder in your Asset tree. These icons are included under Core/Icons. Moving them into a + // "Gizmos" folder should make them work again. + + Gizmos.color = Color.white; + Gizmos.DrawIcon( feetPositionGuess, "vr_interaction_system_feet.png" ); + + Gizmos.color = Color.cyan; + Gizmos.DrawLine( feetPositionGuess, feetPositionGuess + trackingOriginTransform.up * eyeHeight ); + + // Body direction arrow + Gizmos.color = Color.blue; + Vector3 bodyDirection = bodyDirectionGuess; + Vector3 bodyDirectionTangent = Vector3.Cross( trackingOriginTransform.up, bodyDirection ); + Vector3 startForward = feetPositionGuess + trackingOriginTransform.up * eyeHeight * 0.75f; + Vector3 endForward = startForward + bodyDirection * 0.33f; + Gizmos.DrawLine( startForward, endForward ); + Gizmos.DrawLine( endForward, endForward - 0.033f * ( bodyDirection + bodyDirectionTangent ) ); + Gizmos.DrawLine( endForward, endForward - 0.033f * ( bodyDirection - bodyDirectionTangent ) ); + + Gizmos.color = Color.red; + int count = handCount; + for ( int i = 0; i < count; i++ ) + { + Hand hand = GetHand( i ); + + if ( hand.startingHandType == Hand.HandType.Left ) + { + Gizmos.DrawIcon( hand.transform.position, "vr_interaction_system_left_hand.png" ); + } + else if ( hand.startingHandType == Hand.HandType.Right ) + { + Gizmos.DrawIcon( hand.transform.position, "vr_interaction_system_right_hand.png" ); + } + else + { + Hand.HandType guessHandType = hand.GuessCurrentHandType(); + + if ( guessHandType == Hand.HandType.Left ) + { + Gizmos.DrawIcon( hand.transform.position, "vr_interaction_system_left_hand_question.png" ); + } + else if ( guessHandType == Hand.HandType.Right ) + { + Gizmos.DrawIcon( hand.transform.position, "vr_interaction_system_right_hand_question.png" ); + } + else + { + Gizmos.DrawIcon( hand.transform.position, "vr_interaction_system_unknown_hand.png" ); + } + } + } + } + + + //------------------------------------------------- + public void Draw2DDebug() + { + if ( !allowToggleTo2D ) + return; + + if ( !SteamVR.active ) + return; + + int width = 100; + int height = 25; + int left = Screen.width / 2 - width / 2; + int top = Screen.height - height - 10; + + string text = ( rigSteamVR.activeSelf ) ? "2D Debug" : "VR"; + + if ( GUI.Button( new Rect( left, top, width, height ), text ) ) + { + if ( rigSteamVR.activeSelf ) + { + ActivateRig( rig2DFallback ); + } + else + { + ActivateRig( rigSteamVR ); + } + } + } + + + //------------------------------------------------- + private void ActivateRig( GameObject rig ) + { + rigSteamVR.SetActive( rig == rigSteamVR ); + rig2DFallback.SetActive( rig == rig2DFallback ); + + if ( audioListener ) + { + audioListener.transform.parent = hmdTransform; + audioListener.transform.localPosition = Vector3.zero; + audioListener.transform.localRotation = Quaternion.identity; + } + } + + + //------------------------------------------------- + public void PlayerShotSelf() + { + //Do something appropriate here + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Player.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/Player.cs.meta new file mode 100644 index 0000000..c024748 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Player.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 202a6e24b48d1684398409c47161adcb +timeCreated: 1435864159 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SeeThru.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SeeThru.cs new file mode 100644 index 0000000..3d18de1 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SeeThru.cs @@ -0,0 +1,151 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Uses the see thru renderer while attached to hand +// +//============================================================================= + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SeeThru : MonoBehaviour + { + public Material seeThruMaterial; + + private GameObject seeThru; + private Interactable interactable; + private Renderer sourceRenderer; + private Renderer destRenderer; + + + //------------------------------------------------- + void Awake() + { + interactable = GetComponentInParent(); + + // + // Create child game object for see thru renderer + // + seeThru = new GameObject( "_see_thru" ); + seeThru.transform.parent = transform; + seeThru.transform.localPosition = Vector3.zero; + seeThru.transform.localRotation = Quaternion.identity; + seeThru.transform.localScale = Vector3.one; + + // + // Copy mesh filter + // + MeshFilter sourceMeshFilter = GetComponent(); + if ( sourceMeshFilter != null ) + { + MeshFilter destMeshFilter = seeThru.AddComponent(); + destMeshFilter.sharedMesh = sourceMeshFilter.sharedMesh; + } + + // + // Copy mesh renderer + // + MeshRenderer sourceMeshRenderer = GetComponent(); + if ( sourceMeshRenderer != null ) + { + sourceRenderer = sourceMeshRenderer; + destRenderer = seeThru.AddComponent(); + } + + // + // Copy skinned mesh renderer + // + SkinnedMeshRenderer sourceSkinnedMeshRenderer = GetComponent(); + if ( sourceSkinnedMeshRenderer != null ) + { + SkinnedMeshRenderer destSkinnedMeshRenderer = seeThru.AddComponent(); + + sourceRenderer = sourceSkinnedMeshRenderer; + destRenderer = destSkinnedMeshRenderer; + + destSkinnedMeshRenderer.sharedMesh = sourceSkinnedMeshRenderer.sharedMesh; + destSkinnedMeshRenderer.rootBone = sourceSkinnedMeshRenderer.rootBone; + destSkinnedMeshRenderer.bones = sourceSkinnedMeshRenderer.bones; + destSkinnedMeshRenderer.quality = sourceSkinnedMeshRenderer.quality; + destSkinnedMeshRenderer.updateWhenOffscreen = sourceSkinnedMeshRenderer.updateWhenOffscreen; + } + + // + // Create see thru materials + // + if ( sourceRenderer != null && destRenderer != null ) + { + int materialCount = sourceRenderer.sharedMaterials.Length; + Material[] destRendererMaterials = new Material[materialCount]; + for ( int i = 0; i < materialCount; i++ ) + { + destRendererMaterials[i] = seeThruMaterial; + } + destRenderer.sharedMaterials = destRendererMaterials; + + for ( int i = 0; i < destRenderer.materials.Length; i++ ) + { + destRenderer.materials[i].renderQueue = 2001; // Rendered after geometry + } + + for ( int i = 0; i < sourceRenderer.materials.Length; i++ ) + { + if ( sourceRenderer.materials[i].renderQueue == 2000 ) + { + sourceRenderer.materials[i].renderQueue = 2002; + } + } + } + + seeThru.gameObject.SetActive( false ); + } + + + //------------------------------------------------- + void OnEnable() + { + interactable.onAttachedToHand += AttachedToHand; + interactable.onDetachedFromHand += DetachedFromHand; + } + + + //------------------------------------------------- + void OnDisable() + { + interactable.onAttachedToHand -= AttachedToHand; + interactable.onDetachedFromHand -= DetachedFromHand; + } + + + //------------------------------------------------- + private void AttachedToHand( Hand hand ) + { + seeThru.SetActive( true ); + } + + + //------------------------------------------------- + private void DetachedFromHand( Hand hand ) + { + seeThru.SetActive( false ); + } + + + //------------------------------------------------- + void Update() + { + if ( seeThru.activeInHierarchy ) + { + int materialCount = Mathf.Min( sourceRenderer.materials.Length, destRenderer.materials.Length ); + for ( int i = 0; i < materialCount; i++ ) + { + destRenderer.materials[i].mainTexture = sourceRenderer.materials[i].mainTexture; + destRenderer.materials[i].color = destRenderer.materials[i].color * sourceRenderer.materials[i].color; + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SeeThru.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SeeThru.cs.meta new file mode 100644 index 0000000..de9c81e --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SeeThru.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7d623a50b67320940b97e93e31d0a21b +timeCreated: 1456716277 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: + - seeThruMaterial: {fileID: 2100000, guid: 3bbb445147c574240a8b87a1193788b5, type: 2} + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SleepOnAwake.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SleepOnAwake.cs new file mode 100644 index 0000000..5948773 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SleepOnAwake.cs @@ -0,0 +1,25 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: This object's rigidbody goes to sleep when created +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SleepOnAwake : MonoBehaviour + { + //------------------------------------------------- + void Awake() + { + Rigidbody rigidbody = GetComponent(); + if ( rigidbody ) + { + rigidbody.Sleep(); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SleepOnAwake.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SleepOnAwake.cs.meta new file mode 100644 index 0000000..5abaee2 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SleepOnAwake.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0584375ad2f33ef4da0b276de8507487 +timeCreated: 1430167006 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundDeparent.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundDeparent.cs new file mode 100644 index 0000000..2dbd184 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundDeparent.cs @@ -0,0 +1,38 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Unparents this object and optionally destroys it after the sound +// has played +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SoundDeparent : MonoBehaviour + { + public bool destroyAfterPlayOnce = true; + private AudioSource thisAudioSource; + + + //------------------------------------------------- + void Awake() + { + thisAudioSource = GetComponent(); + + } + + + //------------------------------------------------- + void Start() + { + // move the sound object out from under the parent + gameObject.transform.parent = null; + + if ( destroyAfterPlayOnce ) + Destroy( gameObject, thisAudioSource.clip.length ); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundDeparent.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundDeparent.cs.meta new file mode 100644 index 0000000..0b628d8 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundDeparent.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f53662f45a4454944a06629fec9c941e +timeCreated: 1457503214 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundPlayOneshot.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundPlayOneshot.cs new file mode 100644 index 0000000..d210460 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundPlayOneshot.cs @@ -0,0 +1,75 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Play one-shot sounds as opposed to continuos/looping ones +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SoundPlayOneshot : MonoBehaviour + { + public AudioClip[] waveFiles; + private AudioSource thisAudioSource; + + public float volMin; + public float volMax; + + public float pitchMin; + public float pitchMax; + + public bool playOnAwake; + + + //------------------------------------------------- + void Awake() + { + thisAudioSource = GetComponent(); + + if ( playOnAwake ) + { + Play(); + } + } + + + //------------------------------------------------- + public void Play() + { + if ( thisAudioSource != null && thisAudioSource.isActiveAndEnabled && !Util.IsNullOrEmpty( waveFiles ) ) + { + //randomly apply a volume between the volume min max + thisAudioSource.volume = Random.Range( volMin, volMax ); + + //randomly apply a pitch between the pitch min max + thisAudioSource.pitch = Random.Range( pitchMin, pitchMax ); + + // play the sound + thisAudioSource.PlayOneShot( waveFiles[Random.Range( 0, waveFiles.Length )] ); + } + } + + + //------------------------------------------------- + public void Pause() + { + if ( thisAudioSource != null ) + { + thisAudioSource.Pause(); + } + } + + + //------------------------------------------------- + public void UnPause() + { + if ( thisAudioSource != null ) + { + thisAudioSource.UnPause(); + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundPlayOneshot.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundPlayOneshot.cs.meta new file mode 100644 index 0000000..6612487 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SoundPlayOneshot.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 32c1c9a5bbab2e54280027c0ecaf42db +timeCreated: 1436566670 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachAfterControllerIsTracking.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachAfterControllerIsTracking.cs new file mode 100644 index 0000000..35cb476 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachAfterControllerIsTracking.cs @@ -0,0 +1,50 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Spawns and attaches an object to the hand after the controller has +// tracking +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SpawnAndAttachAfterControllerIsTracking : MonoBehaviour + { + private Hand hand; + public GameObject itemPrefab; + + + //------------------------------------------------- + void Start() + { + hand = GetComponentInParent(); + } + + + //------------------------------------------------- + void Update() + { + if ( itemPrefab != null ) + { + if ( hand.controller != null ) + { + if ( hand.controller.hasTracking ) + { + GameObject objectToAttach = GameObject.Instantiate( itemPrefab ); + objectToAttach.SetActive( true ); + hand.AttachObject( objectToAttach ); + hand.controller.TriggerHapticPulse( 800 ); + Destroy( gameObject ); + + // If the player's scale has been changed the object to attach will be the wrong size. + // To fix this we change the object's scale back to its original, pre-attach scale. + objectToAttach.transform.localScale = itemPrefab.transform.localScale; + } + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachAfterControllerIsTracking.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachAfterControllerIsTracking.cs.meta new file mode 100644 index 0000000..66ac9c6 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachAfterControllerIsTracking.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6ad167161b0bf8e4d9c038db358e0a28 +timeCreated: 1441826311 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachToHand.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachToHand.cs new file mode 100644 index 0000000..7cac3cc --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachToHand.cs @@ -0,0 +1,37 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Creates an object and attaches it to the hand +// +//============================================================================= + +using UnityEngine; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SpawnAndAttachToHand : MonoBehaviour + { + public Hand hand; + public GameObject prefab; + + + //------------------------------------------------- + public void SpawnAndAttach( Hand passedInhand ) + { + Hand handToUse = passedInhand; + if ( passedInhand == null ) + { + handToUse = hand; + } + + if ( handToUse == null ) + { + return; + } + + GameObject prefabObject = Instantiate( prefab ) as GameObject; + handToUse.AttachObject( prefabObject ); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachToHand.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachToHand.cs.meta new file mode 100644 index 0000000..c3134fd --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnAndAttachToHand.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f4a03a51c550b92478a559cf694ce118 +timeCreated: 1437097962 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnRenderModel.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnRenderModel.cs new file mode 100644 index 0000000..1cdaa2d --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnRenderModel.cs @@ -0,0 +1,168 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Spawns a render model for the controller from SteamVR +// +//============================================================================= + +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + public class SpawnRenderModel : MonoBehaviour + { + public Material[] materials; + + private SteamVR_RenderModel[] renderModels; + private Hand hand; + private List renderers = new List(); + + private static List spawnRenderModels = new List(); + private static int lastFrameUpdated; + private static int spawnRenderModelUpdateIndex; + + SteamVR_Events.Action renderModelLoadedAction; + + + //------------------------------------------------- + void Awake() + { + renderModels = new SteamVR_RenderModel[materials.Length]; + renderModelLoadedAction = SteamVR_Events.RenderModelLoadedAction( OnRenderModelLoaded ); + } + + + //------------------------------------------------- + void OnEnable() + { + ShowController(); + + renderModelLoadedAction.enabled = true; + + spawnRenderModels.Add( this ); + } + + + //------------------------------------------------- + void OnDisable() + { + HideController(); + + renderModelLoadedAction.enabled = false; + + spawnRenderModels.Remove( this ); + } + + + //------------------------------------------------- + private void OnAttachedToHand( Hand hand ) + { + this.hand = hand; + ShowController(); + } + + + //------------------------------------------------- + private void OnDetachedFromHand( Hand hand ) + { + this.hand = null; + HideController(); + } + + + //------------------------------------------------- + void Update() + { + // Only update one per frame + if ( lastFrameUpdated == Time.renderedFrameCount ) + { + return; + } + lastFrameUpdated = Time.renderedFrameCount; + + + // SpawnRenderModel overflow + if ( spawnRenderModelUpdateIndex >= spawnRenderModels.Count ) + { + spawnRenderModelUpdateIndex = 0; + } + + + // Perform update + if ( spawnRenderModelUpdateIndex < spawnRenderModels.Count ) + { + SteamVR_RenderModel renderModel = spawnRenderModels[spawnRenderModelUpdateIndex].renderModels[0]; + if ( renderModel != null ) + { + renderModel.UpdateComponents( OpenVR.RenderModels ); + } + } + + spawnRenderModelUpdateIndex++; + } + + + //------------------------------------------------- + private void ShowController() + { + if ( hand == null || hand.controller == null ) + { + return; + } + + for ( int i = 0; i < renderModels.Length; i++ ) + { + if ( renderModels[i] == null ) + { + renderModels[i] = new GameObject( "SteamVR_RenderModel" ).AddComponent(); + renderModels[i].updateDynamically = false; // Update one per frame (see Update() method) + renderModels[i].transform.parent = transform; + Util.ResetTransform( renderModels[i].transform ); + } + + renderModels[i].gameObject.SetActive( true ); + renderModels[i].SetDeviceIndex( (int)hand.controller.index ); + } + } + + + //------------------------------------------------- + private void HideController() + { + for ( int i = 0; i < renderModels.Length; i++ ) + { + if ( renderModels[i] != null ) + { + renderModels[i].gameObject.SetActive( false ); + } + } + } + + + //------------------------------------------------- + private void OnRenderModelLoaded( SteamVR_RenderModel renderModel, bool success ) + { + for ( int i = 0; i < renderModels.Length; i++ ) + { + if ( renderModel == renderModels[i] ) + { + if ( materials[i] != null ) + { + renderers.Clear(); + renderModels[i].GetComponentsInChildren( renderers ); + for ( int j = 0; j < renderers.Count; j++ ) + { + Texture mainTexture = renderers[j].material.mainTexture; + renderers[j].sharedMaterial = materials[i]; + renderers[j].material.mainTexture = mainTexture; + renderers[j].gameObject.layer = gameObject.layer; + renderers[j].tag = gameObject.tag; + } + } + } + } + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnRenderModel.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnRenderModel.cs.meta new file mode 100644 index 0000000..ea07185 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/SpawnRenderModel.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9fb3fe54664b917489646492ee8c4993 +timeCreated: 1441140218 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs new file mode 100644 index 0000000..0319e5b --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs @@ -0,0 +1,258 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Basic throwable object +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; +using System.Collections; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + [RequireComponent( typeof( Rigidbody ) )] + [RequireComponent( typeof( VelocityEstimator ) )] + public class Throwable : MonoBehaviour + { + [EnumFlags] + [Tooltip( "The flags used to attach this object to the hand." )] + public Hand.AttachmentFlags attachmentFlags = Hand.AttachmentFlags.ParentToHand | Hand.AttachmentFlags.DetachFromOtherHand; + + [Tooltip( "Name of the attachment transform under in the hand's hierarchy which the object should should snap to." )] + public string attachmentPoint; + + [Tooltip( "How fast must this object be moving to attach due to a trigger hold instead of a trigger press?" )] + public float catchSpeedThreshold = 0.0f; + + [Tooltip( "When detaching the object, should it return to its original parent?" )] + public bool restoreOriginalParent = false; + + public bool attachEaseIn = false; + public AnimationCurve snapAttachEaseInCurve = AnimationCurve.EaseInOut( 0.0f, 0.0f, 1.0f, 1.0f ); + public float snapAttachEaseInTime = 0.15f; + public string[] attachEaseInAttachmentNames; + + private VelocityEstimator velocityEstimator; + private bool attached = false; + private float attachTime; + private Vector3 attachPosition; + private Quaternion attachRotation; + private Transform attachEaseInTransform; + + public UnityEvent onPickUp; + public UnityEvent onDetachFromHand; + + public bool snapAttachEaseInCompleted = false; + + + //------------------------------------------------- + void Awake() + { + velocityEstimator = GetComponent(); + + if ( attachEaseIn ) + { + attachmentFlags &= ~Hand.AttachmentFlags.SnapOnAttach; + } + + Rigidbody rb = GetComponent(); + rb.maxAngularVelocity = 50.0f; + } + + + //------------------------------------------------- + private void OnHandHoverBegin( Hand hand ) + { + bool showHint = false; + + // "Catch" the throwable by holding down the interaction button instead of pressing it. + // Only do this if the throwable is moving faster than the prescribed threshold speed, + // and if it isn't attached to another hand + if ( !attached ) + { + if ( hand.GetStandardInteractionButton() ) + { + Rigidbody rb = GetComponent(); + if ( rb.velocity.magnitude >= catchSpeedThreshold ) + { + hand.AttachObject( gameObject, attachmentFlags, attachmentPoint ); + showHint = false; + } + } + } + + if ( showHint ) + { + ControllerButtonHints.ShowButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + } + + + //------------------------------------------------- + private void OnHandHoverEnd( Hand hand ) + { + ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + + + //------------------------------------------------- + private void HandHoverUpdate( Hand hand ) + { + //Trigger got pressed + if ( hand.GetStandardInteractionButtonDown() ) + { + hand.AttachObject( gameObject, attachmentFlags, attachmentPoint ); + ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ); + } + } + + //------------------------------------------------- + private void OnAttachedToHand( Hand hand ) + { + attached = true; + + onPickUp.Invoke(); + + hand.HoverLock( null ); + + Rigidbody rb = GetComponent(); + rb.isKinematic = true; + rb.interpolation = RigidbodyInterpolation.None; + + if ( hand.controller == null ) + { + velocityEstimator.BeginEstimatingVelocity(); + } + + attachTime = Time.time; + attachPosition = transform.position; + attachRotation = transform.rotation; + + if ( attachEaseIn ) + { + attachEaseInTransform = hand.transform; + if ( !Util.IsNullOrEmpty( attachEaseInAttachmentNames ) ) + { + float smallestAngle = float.MaxValue; + for ( int i = 0; i < attachEaseInAttachmentNames.Length; i++ ) + { + Transform t = hand.GetAttachmentTransform( attachEaseInAttachmentNames[i] ); + float angle = Quaternion.Angle( t.rotation, attachRotation ); + if ( angle < smallestAngle ) + { + attachEaseInTransform = t; + smallestAngle = angle; + } + } + } + } + + snapAttachEaseInCompleted = false; + } + + + //------------------------------------------------- + private void OnDetachedFromHand( Hand hand ) + { + attached = false; + + onDetachFromHand.Invoke(); + + hand.HoverUnlock( null ); + + Rigidbody rb = GetComponent(); + rb.isKinematic = false; + rb.interpolation = RigidbodyInterpolation.Interpolate; + + Vector3 position = Vector3.zero; + Vector3 velocity = Vector3.zero; + Vector3 angularVelocity = Vector3.zero; + if ( hand.controller == null ) + { + velocityEstimator.FinishEstimatingVelocity(); + velocity = velocityEstimator.GetVelocityEstimate(); + angularVelocity = velocityEstimator.GetAngularVelocityEstimate(); + position = velocityEstimator.transform.position; + } + else + { + velocity = Player.instance.trackingOriginTransform.TransformVector( hand.controller.velocity ); + angularVelocity = Player.instance.trackingOriginTransform.TransformVector( hand.controller.angularVelocity ); + position = hand.transform.position; + } + + Vector3 r = transform.TransformPoint( rb.centerOfMass ) - position; + rb.velocity = velocity + Vector3.Cross( angularVelocity, r ); + rb.angularVelocity = angularVelocity; + + // Make the object travel at the release velocity for the amount + // of time it will take until the next fixed update, at which + // point Unity physics will take over + float timeUntilFixedUpdate = ( Time.fixedDeltaTime + Time.fixedTime ) - Time.time; + transform.position += timeUntilFixedUpdate * velocity; + float angle = Mathf.Rad2Deg * angularVelocity.magnitude; + Vector3 axis = angularVelocity.normalized; + transform.rotation *= Quaternion.AngleAxis( angle * timeUntilFixedUpdate, axis ); + } + + + //------------------------------------------------- + private void HandAttachedUpdate( Hand hand ) + { + //Trigger got released + if ( !hand.GetStandardInteractionButton() ) + { + // Detach ourselves late in the frame. + // This is so that any vehicles the player is attached to + // have a chance to finish updating themselves. + // If we detach now, our position could be behind what it + // will be at the end of the frame, and the object may appear + // to teleport behind the hand when the player releases it. + StartCoroutine( LateDetach( hand ) ); + } + + if ( attachEaseIn ) + { + float t = Util.RemapNumberClamped( Time.time, attachTime, attachTime + snapAttachEaseInTime, 0.0f, 1.0f ); + if ( t < 1.0f ) + { + t = snapAttachEaseInCurve.Evaluate( t ); + transform.position = Vector3.Lerp( attachPosition, attachEaseInTransform.position, t ); + transform.rotation = Quaternion.Lerp( attachRotation, attachEaseInTransform.rotation, t ); + } + else if ( !snapAttachEaseInCompleted ) + { + gameObject.SendMessage( "OnThrowableAttachEaseInCompleted", hand, SendMessageOptions.DontRequireReceiver ); + snapAttachEaseInCompleted = true; + } + } + } + + + //------------------------------------------------- + private IEnumerator LateDetach( Hand hand ) + { + yield return new WaitForEndOfFrame(); + + hand.DetachObject( gameObject, restoreOriginalParent ); + } + + + //------------------------------------------------- + private void OnHandFocusAcquired( Hand hand ) + { + gameObject.SetActive( true ); + velocityEstimator.BeginEstimatingVelocity(); + } + + + //------------------------------------------------- + private void OnHandFocusLost( Hand hand ) + { + gameObject.SetActive( false ); + velocityEstimator.FinishEstimatingVelocity(); + } + } +} diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs.meta b/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs.meta new file mode 100644 index 0000000..aa95cdf --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ffefbea063cab884ca33e5a449e5c22c +timeCreated: 1432687610 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: b93fe5c516cf6ed4b9153ec790f856e2, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/UIElement.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/UIElement.cs new file mode 100644 index 0000000..f536234 --- /dev/null +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/UIElement.cs @@ -0,0 +1,89 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: UIElement that responds to VR hands and generates UnityEvents +// +//============================================================================= + +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; +using System; + +namespace Valve.VR.InteractionSystem +{ + //------------------------------------------------------------------------- + [RequireComponent( typeof( Interactable ) )] + public class UIElement : MonoBehaviour + { + public CustomEvents.UnityEventHand onHandClick; + + private Hand currentHand; + + //------------------------------------------------- + void Awake() + { + Button button = GetComponent