├── .BlendShapeBuilder ├── Assets │ ├── BlendShapeBuilderPackaging.cs │ ├── BlendShapeBuilderPackaging.cs.meta │ ├── UTJ.meta │ └── UTJ │ │ ├── BlendShapeBuilder │ │ ├── BlendShapeBuilder.meta │ │ ├── VertexTweaker │ │ └── VertexTweaker.meta ├── Packages │ └── manifest.json ├── Plugin │ ├── CMakeLists.txt │ ├── External │ │ ├── 7z │ │ │ └── 7za.exe │ │ └── make_archive.bat │ ├── MeshUtils.vcxproj │ ├── MeshUtils.vcxproj.filters │ ├── MeshUtils │ │ ├── CMakeLists.txt │ │ ├── MeshUtils.cpp │ │ ├── MeshUtils.h │ │ ├── MeshUtilsCore.ispc │ │ ├── MeshUtils_impl.h │ │ ├── ampmath.h │ │ ├── ampmath_impl.h │ │ ├── ispcmath.h │ │ ├── mikktspace.c │ │ ├── mikktspace.h │ │ ├── muAllocator.cpp │ │ ├── muAllocator.h │ │ ├── muConcurrency.h │ │ ├── muConfig.h │ │ ├── muIntrusiveArray.h │ │ ├── muIterator.h │ │ ├── muMath.cpp │ │ ├── muMath.h │ │ ├── muMeshRefiner.cpp │ │ ├── muMeshRefiner.h │ │ ├── muMisc.cpp │ │ ├── muMisc.h │ │ ├── muRawVector.h │ │ ├── muSIMD.cpp │ │ ├── muSIMD.h │ │ ├── muSIMDConfig.h │ │ ├── muTLS.h │ │ ├── muVertex.cpp │ │ ├── muVertex.h │ │ ├── pch.cpp │ │ └── pch.h │ ├── NatvisFile.natvis │ ├── VertexTweaker │ │ ├── CMakeLists.txt │ │ ├── VertexTweaker.cpp │ │ ├── VertexTweaker.h │ │ ├── pch.cpp │ │ └── pch.h │ ├── VertexTweakerCore.sln │ ├── VertexTweakerCore.vcxproj │ ├── VertexTweakerCore.vcxproj.filters │ ├── build.bat │ ├── cmake │ │ ├── AddPlugin.cmake │ │ ├── FindOpenEXR.cmake │ │ ├── FindTBB.cmake │ │ └── ISPC.cmake │ ├── setup.bat │ ├── setup.vcxproj │ └── toolchan.bat └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityConnectSettings.asset │ ├── VFXManager.asset │ └── XRSettings.asset ├── .gitattributes ├── .gitignore ├── Assets ├── BlendShapeBuilder.meta ├── BlendShapeBuilder │ ├── Editor.meta │ ├── Editor │ │ ├── BlendShapeBuilderEditor.cs │ │ ├── BlendShapeBuilderEditor.cs.meta │ │ ├── BlendShapeBuilderWindow.cs │ │ ├── BlendShapeBuilderWindow.cs.meta │ │ ├── BlendShapeInspectorWindow.cs │ │ ├── BlendShapeInspectorWindow.cs.meta │ │ ├── UTJ.BlendShapeBuilderEditor.asmdef │ │ └── UTJ.BlendShapeBuilderEditor.asmdef.meta │ ├── Runtime.meta │ └── Runtime │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── BlendShapeBuilder.cs │ │ ├── BlendShapeBuilder.cs.meta │ │ ├── BlendShapeBuilderData.cs │ │ └── BlendShapeBuilderData.cs.meta │ │ ├── UTJ.BlendShapeBuilder.asmdef │ │ └── UTJ.BlendShapeBuilder.asmdef.meta ├── VertexTweaker.meta └── VertexTweaker │ ├── Editor.meta │ ├── Editor │ ├── ObjExporter.cs │ ├── ObjExporter.cs.meta │ ├── UTJ.VertexTweakerEditor.asmdef │ ├── UTJ.VertexTweakerEditor.asmdef.meta │ ├── VertexTweakerEditor.cs │ ├── VertexTweakerEditor.cs.meta │ ├── VertexTweakerWindow.cs │ └── VertexTweakerWindow.cs.meta │ ├── Runtime.meta │ └── Runtime │ ├── Data.meta │ ├── Data │ ├── DefaultSettings.asset │ └── DefaultSettings.asset.meta │ ├── Plugins.meta │ ├── Plugins │ ├── x86_64.meta │ └── x86_64 │ │ ├── VertexTweakerCore.bundle.meta │ │ ├── VertexTweakerCore.bundle │ │ ├── Contents.meta │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── Info.plist.meta │ │ │ ├── MacOS.meta │ │ │ └── MacOS │ │ │ ├── VertexTweakerCore │ │ │ └── VertexTweakerCore.meta │ │ ├── VertexTweakerCore.dll │ │ ├── VertexTweakerCore.dll.meta │ │ ├── libVertexTweakerCore.so │ │ └── libVertexTweakerCore.so.meta │ ├── Scripts.meta │ ├── Scripts │ ├── PinnedArray.cs │ ├── PinnedArray.cs.meta │ ├── Utils.cs │ ├── Utils.cs.meta │ ├── VertexHandles.cs │ ├── VertexHandles.cs.meta │ ├── VertexTweaker.cs │ ├── VertexTweaker.cs.meta │ ├── VertexTweakerSettings.cs │ ├── VertexTweakerSettings.cs.meta │ ├── VertexTweaker_impl.cs │ └── VertexTweaker_impl.cs.meta │ ├── Shaders.meta │ ├── Shaders │ ├── BrushShape.shader │ ├── BrushShape.shader.meta │ ├── Overlay.shader │ ├── Overlay.shader.meta │ ├── Visualizer.shader │ └── Visualizer.shader.meta │ ├── UTJ.VertexTweaker.asmdef │ └── UTJ.VertexTweaker.asmdef.meta ├── LICENSE.txt ├── LICENSE.txt.meta ├── Readme.md ├── Readme.md.meta ├── Readme_EN.md ├── Readme_EN.md.meta ├── package.json └── package.json.meta /.BlendShapeBuilder/Assets/BlendShapeBuilderPackaging.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEngine; 3 | using UnityEditor; 4 | 5 | 6 | public class BlendShapeBuilderPackaging 7 | { 8 | [MenuItem("Assets/Make BlendShapeBuilder.unitypackage")] 9 | public static void MakePackage() 10 | { 11 | string[] files = new string[] 12 | { 13 | "Assets/UTJ/BlendShapeBuilder", 14 | "Assets/UTJ/VertexTweaker", 15 | }; 16 | AssetDatabase.ExportPackage(files, "BlendShapeBuilder.unitypackage", ExportPackageOptions.Recurse); 17 | } 18 | 19 | } 20 | #endif // UNITY_EDITOR 21 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Assets/BlendShapeBuilderPackaging.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e200a0c64b232b40b5fc2383c2605b6 3 | timeCreated: 1513672709 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Assets/UTJ.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 309764e37b40ce04da4b3229bd8229ee 3 | folderAsset: yes 4 | timeCreated: 1484424680 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Assets/UTJ/BlendShapeBuilder: -------------------------------------------------------------------------------- 1 | ../../../Assets/BlendShapeBuilder -------------------------------------------------------------------------------- /.BlendShapeBuilder/Assets/UTJ/BlendShapeBuilder.meta: -------------------------------------------------------------------------------- 1 | ../../../Assets/BlendShapeBuilder.meta -------------------------------------------------------------------------------- /.BlendShapeBuilder/Assets/UTJ/VertexTweaker: -------------------------------------------------------------------------------- 1 | ../../../Assets/VertexTweaker -------------------------------------------------------------------------------- /.BlendShapeBuilder/Assets/UTJ/VertexTweaker.meta: -------------------------------------------------------------------------------- 1 | ../../../Assets/VertexTweaker.meta -------------------------------------------------------------------------------- /.BlendShapeBuilder/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.3.1", 4 | "com.unity.analytics": "3.3.2", 5 | "com.unity.collab-proxy": "1.2.16", 6 | "com.unity.multiplayer-hlapi": "1.0.2", 7 | "com.unity.package-manager-ui": "2.1.2", 8 | "com.unity.purchasing": "2.0.6", 9 | "com.unity.textmeshpro": "2.0.0", 10 | "com.unity.timeline": "1.0.0", 11 | "com.unity.xr.legacyinputhelpers": "2.0.2", 12 | "com.unity.modules.ai": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(VertexTweakerCore) 3 | 4 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) 5 | include(ISPC) 6 | include(AddPlugin) 7 | 8 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 9 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11") 10 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") 11 | include_directories(${CMAKE_SOURCE_DIR}) 12 | 13 | add_subdirectory(MeshUtils) 14 | add_subdirectory(VertexTweaker) 15 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/External/7z/7za.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity3d-jp/BlendShapeBuilder/bf04aceb946c20ec18fa9aa437b9b35102d92867/.BlendShapeBuilder/Plugin/External/7z/7za.exe -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/External/make_archive.bat: -------------------------------------------------------------------------------- 1 | 7z\7za.exe a -mx=9 External.7z^ 2 | libs^ 3 | ispc.exe -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | NotUsing 48 | 49 | 50 | 51 | Create 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Document 61 | External\ispc %(FullPath) -o $(IntDir)%(Filename).obj -h $(IntDir)%(Filename).h --target=sse4-i32x4,avx1-i32x8,avx512skx-i32x16 --arch=x86-64 --opt=fast-masked-vload --opt=fast-math 62 | External\ispc %(FullPath) -o $(IntDir)%(Filename).obj -h $(IntDir)%(Filename).h --target=sse4-i32x4,avx1-i32x8,avx512skx-i32x16 --arch=x86 --opt=fast-masked-vload --opt=fast-math 63 | $(IntDir)%(Filename).obj;$(IntDir)%(Filename)_sse4.obj;$(IntDir)%(Filename)_avx.obj;$(IntDir)%(Filename)_avx512skx.obj 64 | $(SolutionDir)MeshUtils\ispcmath.h;$(SolutionDir)MeshUtils\muSIMDConfig.h 65 | 66 | 67 | 68 | 69 | {1c5de91b-7ae9-4304-9fa1-0de1aba8c02d} 70 | 71 | 72 | 73 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C} 74 | Win32Proj 75 | 10.0.17763.0 76 | 77 | 78 | 79 | StaticLibrary 80 | v141 81 | Unicode 82 | true 83 | 84 | 85 | StaticLibrary 86 | v141 87 | Unicode 88 | 89 | 90 | 91 | 92 | 93 | 94 | <_ProjectFileVersion>12.0.21005.1 95 | 96 | 97 | $(SolutionDir);$(SolutionDir)External\include;$(IncludePath) 98 | $(SolutionDir)_out\$(Platform)_$(Configuration)\ 99 | $(SolutionDir)_tmp\$(ProjectName)_$(Platform)_$(Configuration)\ 100 | 101 | 102 | 103 | Disabled 104 | %(PreprocessorDefinitions) 105 | EnableFastChecks 106 | MultiThreadedDLL 107 | Use 108 | Level4 109 | ProgramDatabase 110 | true 111 | pch.h 112 | true 113 | $(IntDir) 114 | 115 | 116 | true 117 | Windows 118 | false 119 | true 120 | 121 | 122 | 123 | 124 | Full 125 | true 126 | %(PreprocessorDefinitions) 127 | MultiThreadedDLL 128 | true 129 | Use 130 | Level4 131 | ProgramDatabase 132 | pch.h 133 | AnySuitable 134 | Speed 135 | false 136 | Fast 137 | true 138 | true 139 | false 140 | false 141 | false 142 | $(IntDir) 143 | 144 | 145 | true 146 | Windows 147 | true 148 | true 149 | false 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | MeshUtils 6 | 7 | 8 | MeshUtils 9 | 10 | 11 | MeshUtils 12 | 13 | 14 | MeshUtils 15 | 16 | 17 | MeshUtils 18 | 19 | 20 | MeshUtils 21 | 22 | 23 | MeshUtils 24 | 25 | 26 | MeshUtils 27 | 28 | 29 | MeshUtils 30 | 31 | 32 | MeshUtils 33 | 34 | 35 | MeshUtils 36 | 37 | 38 | MeshUtils 39 | 40 | 41 | MeshUtils 42 | 43 | 44 | MeshUtils 45 | 46 | 47 | MeshUtils 48 | 49 | 50 | MeshUtils 51 | 52 | 53 | MeshUtils 54 | 55 | 56 | MeshUtils 57 | 58 | 59 | MeshUtils 60 | 61 | 62 | MeshUtils 63 | 64 | 65 | 66 | 67 | {7c7e8a56-7f18-4fed-967a-dd734cc4db8a} 68 | 69 | 70 | 71 | 72 | MeshUtils 73 | 74 | 75 | MeshUtils 76 | 77 | 78 | MeshUtils 79 | 80 | 81 | MeshUtils 82 | 83 | 84 | MeshUtils 85 | 86 | 87 | MeshUtils 88 | 89 | 90 | MeshUtils 91 | 92 | 93 | MeshUtils 94 | 95 | 96 | MeshUtils 97 | 98 | 99 | 100 | 101 | MeshUtils 102 | 103 | 104 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(ENABLE_TBB "Use Intel TBB." OFF) 2 | option(ENABLE_HALF "Use half." OFF) 3 | 4 | if(ENABLE_ISPC) 5 | setup_ispc() 6 | 7 | set(MUISPC_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/ISPC) 8 | set(MUISPC_HEADERS 9 | "${CMAKE_CURRENT_SOURCE_DIR}/ispcmath.h" 10 | "${CMAKE_CURRENT_SOURCE_DIR}/muSIMDConfig.h" 11 | ) 12 | file(GLOB MUISPC_SOURCES *.ispc) 13 | add_ispc_targets(SOURCES ${MUISPC_SOURCES} HEADERS ${MUISPC_HEADERS} OUTDIR ${MUISPC_OUTDIR}) 14 | set(MUISPC_OUTPUTS ${_ispc_outputs}) 15 | endif() 16 | 17 | file(GLOB sources *.cpp *.c *.h) 18 | add_library(MeshUtils STATIC ${sources} ${MUISPC_OUTPUTS}) 19 | install(TARGETS MeshUtils DESTINATION .) 20 | 21 | if(ENABLE_ISPC) 22 | add_definitions(-DmuEnableISPC) 23 | target_include_directories(MeshUtils PUBLIC ${MUISPC_OUTDIR}) 24 | endif() 25 | if(ENABLE_TBB) 26 | find_package(TBB QUIET) 27 | add_definitions(-DmuEnableTBB) 28 | include_directories(${TBB_INCLUDE_DIRS}) 29 | list(APPEND EXTERNAL_LIBS ${TBB_LIBRARIES}) 30 | endif() 31 | if(ENABLE_HALF) 32 | find_package(OpenEXR QUIET) 33 | add_definitions(-DmuEnableHalf) 34 | include_directories(${OPENEXR_INCLUDE_DIR}) 35 | list(APPEND EXTERNAL_LIBS ${OPENEXR_Half_LIBRARY}) 36 | endif() 37 | set(EXTERNAL_LIBS ${EXTERNAL_LIBS} PARENT_SCOPE) 38 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/ampmath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | // fast math 9 | namespace apm { 10 | using namespace concurrency; 11 | using namespace concurrency::graphics; 12 | using namespace concurrency::fast_math; 13 | #include "ampmath_impl.h" 14 | } // namespace apm 15 | 16 | 17 | // precise math 18 | namespace afm { 19 | using namespace concurrency; 20 | using namespace concurrency::graphics; 21 | using namespace concurrency::precise_math; 22 | #include "ampmath_impl.h" 23 | } // namespace afm 24 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/ampmath_impl.h: -------------------------------------------------------------------------------- 1 | 2 | inline bool device_available() 3 | { 4 | static bool value = !Concurrency::accelerator().get_is_emulated(); 5 | return value; 6 | } 7 | 8 | 9 | #define Def1A(A,F) \ 10 | template::size == 2>* = nullptr>\ 11 | inline T A(T v) restrict(amp) { \ 12 | return { F(v.x), F(v.y) }; \ 13 | } \ 14 | template::size == 3>* = nullptr>\ 15 | inline T A(T l, T r) restrict(amp) { \ 16 | return { F(v.x), F(v.y), F(v.z) }; \ 17 | } \ 18 | template::size == 4>* = nullptr>\ 19 | inline T A(T l, T r) restrict(amp) { \ 20 | return { F(v.x), F(v.y), F(v.z), F(v.w) }; \ 21 | } 22 | 23 | #define Def2A(A,F) \ 24 | template::size == 2>* = nullptr>\ 25 | inline T A(T a, T b) restrict(amp) { \ 26 | return { F(a.x, b.x), F(a.y, b.y )}; \ 27 | } \ 28 | template::size == 3>* = nullptr>\ 29 | inline T A(T a, T b) restrict(amp) { \ 30 | return { F(a.x, b.x), F(a.y, b.y), F(a.z, b.z) }; \ 31 | } \ 32 | template::size == 4>* = nullptr>\ 33 | inline T A(T a, T b) restrict(amp) { \ 34 | return { F(a.x, b.x), F(a.y, b.y), F(a.z, b.z), F(a.w, b.w) }; \ 35 | } 36 | 37 | #define Def1(F) Def1A(F,F) 38 | #define Def2(F) Def2A(F,F) 39 | 40 | Def1A(abs, fabs) 41 | Def1(round) 42 | Def1(floor) 43 | Def1(ceil) 44 | Def2(min) 45 | Def2(max) 46 | Def1(rcp) 47 | Def1A(sqrt, sqrtf) 48 | Def1A(rsqrt, rsqrtf) 49 | Def1(sin) 50 | Def1(cos) 51 | Def1(tan) 52 | Def1(asin) 53 | Def1(acos) 54 | Def1(atan) 55 | Def2(atan2) 56 | Def1(exp) 57 | Def1(log) 58 | Def2(pow) 59 | Def2(mod) 60 | Def1(frac) 61 | 62 | #undef Def2 63 | #undef Def1 64 | 65 | inline float abs(float v) restrict(amp) { return fabs(v); } 66 | inline float sqrt(float v) restrict(amp) { return sqrtf(v); } 67 | inline float rsqrt(float v) restrict(amp) { return rsqrtf(v); } 68 | 69 | template::size == 2>* = nullptr> 70 | inline typename short_vector_traits::value_type dot(T l, T r) restrict(amp) { 71 | return l.x * r.x + l.y * r.y; 72 | } 73 | template::size == 3>* = nullptr> 74 | inline typename short_vector_traits::value_type dot(T l, T r) restrict(amp) { 75 | return l.x * r.x + l.y * r.y + l.z * r.z; 76 | } 77 | template::size == 4>* = nullptr> 78 | inline typename short_vector_traits::value_type dot(T l, T r) restrict(amp) { 79 | return l.x * r.x + l.y * r.y + l.z * r.z + l.w * r.w; 80 | } 81 | 82 | template::size == 3>* = nullptr> 83 | inline T cross(T l, T r) restrict(amp) { 84 | return { 85 | l.y * r.z - l.z * r.y, 86 | l.z * r.x - l.x * r.z, 87 | l.x * r.y - l.y * r.x }; 88 | } 89 | 90 | template 91 | inline typename short_vector_traits::value_type length_sq(T v) restrict(amp) { 92 | return dot(v, v); 93 | } 94 | 95 | template 96 | inline typename short_vector_traits::value_type length(T v) restrict(amp) { 97 | return sqrt(dot(v, v)); 98 | } 99 | 100 | template 101 | inline T normalize(T v) restrict(amp) { 102 | return v * rsqrt(dot(v, v)); 103 | } 104 | 105 | 106 | inline bool ray_triangle_intersection(float_3 pos, float_3 dir, float_3 p1, float_3 p2, float_3 p3, float& distance) restrict(amp) 107 | { 108 | const float epsdet = 1e-10f; 109 | const float eps = 1e-4f; 110 | 111 | float_3 e1 = p2 - p1; 112 | float_3 e2 = p3 - p1; 113 | float_3 p = cross(dir, e2); 114 | float det = dot(e1, p); 115 | if (abs(det) < epsdet) return false; 116 | float inv_det = 1.0f / det; 117 | float_3 t = pos - p1; 118 | float u = dot(t, p) * inv_det; 119 | if (u < -eps || u > 1+ eps) return false; 120 | float_3 q = cross(t, e1); 121 | float v = dot(dir, q) * inv_det; 122 | if (v < -eps || u + v > 1+ eps) return false; 123 | 124 | distance = dot(e2, q) * inv_det; 125 | return distance >= 0.0f; 126 | } 127 | inline bool ray_triangle_intersection(float_3 pos, float_3 dir, float_4 p1, float_4 p2, float_4 p3, float& distance) restrict(amp) 128 | { 129 | return ray_triangle_intersection(pos, dir, 130 | { p1.x, p1.y, p1.z }, 131 | { p2.x, p2.y, p2.z }, 132 | { p3.x, p3.y, p3.z }, distance); 133 | } 134 | 135 | template 136 | inline T triangle_interpolation(float_3 pos, float_3 p1, float_3 p2, float_3 p3, T x1, T x2, T x3) restrict(amp) 137 | { 138 | float_3 f1 = p1 - pos; 139 | float_3 f2 = p2 - pos; 140 | float_3 f3 = p3 - pos; 141 | float a = 1.0f / length(cross(p1 - p2, p1 - p3)); 142 | float a1 = length(cross(f2, f3)) * a; 143 | float a2 = length(cross(f3, f1)) * a; 144 | float a3 = length(cross(f1, f2)) * a; 145 | return x1 * a1 + x2 * a2 + x3 * a3; 146 | } 147 | template 148 | inline T triangle_interpolation(float_3 pos, float_4 p1, float_4 p2, float_4 p3, T x1, T x2, T x3) restrict(amp) 149 | { 150 | return triangle_interpolation(pos, 151 | { p1.x, p1.y, p1.z }, 152 | { p2.x, p2.y, p2.z }, 153 | { p3.x, p3.y, p3.z }, 154 | x1, x2, x3); 155 | } 156 | 157 | inline float ray_point_distance(float_3 pos, float_3 dir, float_3 p) restrict(amp) 158 | { 159 | return length(cross(dir, p - pos)); 160 | } 161 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/mikktspace.h: -------------------------------------------------------------------------------- 1 | /** \file mikktspace/mikktspace.h 2 | * \ingroup mikktspace 3 | */ 4 | /** 5 | * Copyright (C) 2011 by Morten S. Mikkelsen 6 | * 7 | * This software is provided 'as-is', without any express or implied 8 | * warranty. In no event will the authors be held liable for any damages 9 | * arising from the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | #ifndef __MIKKTSPACE_H__ 25 | #define __MIKKTSPACE_H__ 26 | 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /* Author: Morten S. Mikkelsen 33 | * Version: 1.0 34 | * 35 | * The files mikktspace.h and mikktspace.c are designed to be 36 | * stand-alone files and it is important that they are kept this way. 37 | * Not having dependencies on structures/classes/libraries specific 38 | * to the program, in which they are used, allows them to be copied 39 | * and used as is into any tool, program or plugin. 40 | * The code is designed to consistently generate the same 41 | * tangent spaces, for a given mesh, in any tool in which it is used. 42 | * This is done by performing an internal welding step and subsequently an order-independent evaluation 43 | * of tangent space for meshes consisting of triangles and quads. 44 | * This means faces can be received in any order and the same is true for 45 | * the order of vertices of each face. The generated result will not be affected 46 | * by such reordering. Additionally, whether degenerate (vertices or texture coordinates) 47 | * primitives are present or not will not affect the generated results either. 48 | * Once tangent space calculation is done the vertices of degenerate primitives will simply 49 | * inherit tangent space from neighboring non degenerate primitives. 50 | * The analysis behind this implementation can be found in my master's thesis 51 | * which is available for download --> http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf 52 | * Note that though the tangent spaces at the vertices are generated in an order-independent way, 53 | * by this implementation, the interpolated tangent space is still affected by which diagonal is 54 | * chosen to split each quad. A sensible solution is to have your tools pipeline always 55 | * split quads by the shortest diagonal. This choice is order-independent and works with mirroring. 56 | * If these have the same length then compare the diagonals defined by the texture coordinates. 57 | * XNormal which is a tool for baking normal maps allows you to write your own tangent space plugin 58 | * and also quad triangulator plugin. 59 | */ 60 | 61 | 62 | typedef int tbool; 63 | typedef struct SMikkTSpaceContext SMikkTSpaceContext; 64 | 65 | typedef struct { 66 | // Returns the number of faces (triangles/quads) on the mesh to be processed. 67 | int (*m_getNumFaces)(const SMikkTSpaceContext * pContext); 68 | 69 | // Returns the number of vertices on face number iFace 70 | // iFace is a number in the range {0, 1, ..., getNumFaces()-1} 71 | int (*m_getNumVerticesOfFace)(const SMikkTSpaceContext * pContext, const int iFace); 72 | 73 | // returns the position/normal/texcoord of the referenced face of vertex number iVert. 74 | // iVert is in the range {0,1,2} for triangles and {0,1,2,3} for quads. 75 | void (*m_getPosition)(const SMikkTSpaceContext * pContext, float fvPosOut[], const int iFace, const int iVert); 76 | void (*m_getNormal)(const SMikkTSpaceContext * pContext, float fvNormOut[], const int iFace, const int iVert); 77 | void (*m_getTexCoord)(const SMikkTSpaceContext * pContext, float fvTexcOut[], const int iFace, const int iVert); 78 | 79 | // either (or both) of the two setTSpace callbacks can be set. 80 | // The call-back m_setTSpaceBasic() is sufficient for basic normal mapping. 81 | 82 | // This function is used to return the tangent and fSign to the application. 83 | // fvTangent is a unit length vector. 84 | // For normal maps it is sufficient to use the following simplified version of the bitangent which is generated at pixel/vertex level. 85 | // bitangent = fSign * cross(vN, tangent); 86 | // Note that the results are returned unindexed. It is possible to generate a new index list 87 | // But averaging/overwriting tangent spaces by using an already existing index list WILL produce INCRORRECT results. 88 | // DO NOT! use an already existing index list. 89 | void (*m_setTSpaceBasic)(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert); 90 | 91 | // This function is used to return tangent space results to the application. 92 | // fvTangent and fvBiTangent are unit length vectors and fMagS and fMagT are their 93 | // true magnitudes which can be used for relief mapping effects. 94 | // fvBiTangent is the "real" bitangent and thus may not be perpendicular to fvTangent. 95 | // However, both are perpendicular to the vertex normal. 96 | // For normal maps it is sufficient to use the following simplified version of the bitangent which is generated at pixel/vertex level. 97 | // fSign = bIsOrientationPreserving ? 1.0f : (-1.0f); 98 | // bitangent = fSign * cross(vN, tangent); 99 | // Note that the results are returned unindexed. It is possible to generate a new index list 100 | // But averaging/overwriting tangent spaces by using an already existing index list WILL produce INCRORRECT results. 101 | // DO NOT! use an already existing index list. 102 | void (*m_setTSpace)(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, 103 | const tbool bIsOrientationPreserving, const int iFace, const int iVert); 104 | } SMikkTSpaceInterface; 105 | 106 | struct SMikkTSpaceContext 107 | { 108 | SMikkTSpaceInterface * m_pInterface; // initialized with callback functions 109 | void * m_pUserData; // pointer to client side mesh data etc. (passed as the first parameter with every interface call) 110 | }; 111 | 112 | // these are both thread safe! 113 | tbool genTangSpaceDefault(const SMikkTSpaceContext * pContext); // Default (recommended) fAngularThreshold is 180 degrees (which means threshold disabled) 114 | tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThreshold); 115 | 116 | 117 | // To avoid visual errors (distortions/unwanted hard edges in lighting), when using sampled normal maps, the 118 | // normal map sampler must use the exact inverse of the pixel shader transformation. 119 | // The most efficient transformation we can possibly do in the pixel shader is 120 | // achieved by using, directly, the "unnormalized" interpolated tangent, bitangent and vertex normal: vT, vB and vN. 121 | // pixel shader (fast transform out) 122 | // vNout = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); 123 | // where vNt is the tangent space normal. The normal map sampler must likewise use the 124 | // interpolated and "unnormalized" tangent, bitangent and vertex normal to be compliant with the pixel shader. 125 | // sampler does (exact inverse of pixel shader): 126 | // float3 row0 = cross(vB, vN); 127 | // float3 row1 = cross(vN, vT); 128 | // float3 row2 = cross(vT, vB); 129 | // float fSign = dot(vT, row0)<0 ? -1 : 1; 130 | // vNt = normalize( fSign * float3(dot(vNout,row0), dot(vNout,row1), dot(vNout,row2)) ); 131 | // where vNout is the sampled normal in some chosen 3D space. 132 | // 133 | // Should you choose to reconstruct the bitangent in the pixel shader instead 134 | // of the vertex shader, as explained earlier, then be sure to do this in the normal map sampler also. 135 | // Finally, beware of quad triangulations. If the normal map sampler doesn't use the same triangulation of 136 | // quads as your renderer then problems will occur since the interpolated tangent spaces will differ 137 | // eventhough the vertex level tangent spaces match. This can be solved either by triangulating before 138 | // sampling/exporting or by using the order-independent choice of diagonal for splitting quads suggested earlier. 139 | // However, this must be used both by the sampler and your tools/rendering pipeline. 140 | 141 | #ifdef __cplusplus 142 | } 143 | #endif 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muAllocator.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "muAllocator.h" 3 | 4 | void* AlignedMalloc(size_t size, size_t alignment) 5 | { 6 | size_t mask = alignment - 1; 7 | size = (size + mask) & (~mask); 8 | #ifdef _WIN32 9 | return _mm_malloc(size, alignment); 10 | #else 11 | void *ret = nullptr; 12 | posix_memalign(&ret, alignment, size); 13 | return ret; 14 | #endif 15 | } 16 | 17 | void AlignedFree(void *addr) 18 | { 19 | #ifdef _WIN32 20 | _mm_free(addr); 21 | #else 22 | free(addr); 23 | #endif 24 | } 25 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muAllocator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void* AlignedMalloc(size_t size, size_t alignment); 4 | void AlignedFree(void *addr); 5 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muConcurrency.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "muConfig.h" 4 | #if defined(muEnablePPL) 5 | #include 6 | #elif defined(muEnableTBB) 7 | #include 8 | #endif 9 | 10 | namespace mu { 11 | 12 | template 13 | inline void parallel_for(Index begin, Index end, const Body& body) 14 | { 15 | #if defined(muEnablePPL) 16 | concurrency::parallel_for(begin, end, body); 17 | #elif defined(muEnableTBB) 18 | tbb::parallel_for(begin, end, body); 19 | #else 20 | for (; begin != end; ++begin) { body(begin); } 21 | #endif 22 | } 23 | 24 | #if defined(muEnablePPL) || defined(muEnableTBB) 25 | template 26 | inline void parallel_for_blocked(int begin, int end, int granularity, const Body& body) 27 | { 28 | int num_elements = end - begin; 29 | int num_blocks = ceildiv(num_elements, granularity); 30 | parallel_for(0, num_blocks, [&](int i) { 31 | int begin = granularity * i; 32 | int end = std::min(granularity * (i + 1), num_elements); 33 | body(begin, end); 34 | }); 35 | } 36 | #else 37 | template 38 | inline void parallel_for_blocked(int begin, int end, int /*granularity*/, const Body& body) 39 | { 40 | body(begin, end); 41 | } 42 | #endif 43 | 44 | template 45 | inline void parallel_for_each(Iter begin, Iter end, const Body& body) 46 | { 47 | #if defined(muEnablePPL) 48 | concurrency::parallel_for_each(begin, end, body); 49 | #elif defined(muEnableTBB) 50 | tbb::parallel_for_each(begin, end, body); 51 | #else 52 | for (; begin != end; ++begin) { body(*begin); } 53 | #endif 54 | } 55 | 56 | 57 | #if defined(muEnablePPL) 58 | 59 | template 60 | inline void parallel_invoke(Bodies... bodies) { concurrency::parallel_invoke(bodies...); } 61 | 62 | #elif defined(muEnableTBB) 63 | 64 | template 65 | inline void parallel_invoke(Bodies... bodies) { tbb::parallel_invoke(bodies...); } 66 | 67 | #else 68 | 69 | template 70 | inline void parallel_invoke(const Body& body) { body(); } 71 | 72 | template 73 | void parallel_invoke(const Body& first, Args... args) { 74 | first(); 75 | parallel_invoke(args...); 76 | } 77 | 78 | #endif 79 | 80 | } // namespace ms 81 | 82 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // available options: 4 | // muEnablePPL 5 | // muEnableTBB 6 | // muEnableISPC 7 | // muEnableAMP 8 | // muEnableSymbol 9 | 10 | #ifdef _WIN32 11 | #define muEnablePPL 12 | #define muEnableISPC 13 | #define muEnableAMP 14 | 15 | #define muEnableSymbol 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muIntrusiveArray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "muIterator.h" 4 | 5 | template 6 | class IntrusiveArray 7 | { 8 | public: 9 | using value_type = T; 10 | using reference = T&; 11 | using const_reference = const T&; 12 | using pointer = T*; 13 | using const_pointer = const T*; 14 | using iterator = pointer; 15 | using const_iterator = const_pointer; 16 | 17 | IntrusiveArray() {} 18 | IntrusiveArray(const T *d, size_t s) : m_data(const_cast(d)), m_size(s) {} 19 | IntrusiveArray(const IntrusiveArray& v) : m_data(const_cast(v.m_data)), m_size(v.m_size) {} 20 | template 21 | IntrusiveArray(const T(&v)[N]) : m_data(const_cast(v)), m_size(N) {} 22 | template 23 | IntrusiveArray(const Container& v) : m_data(const_cast(v.data())), m_size(v.size()) {} 24 | IntrusiveArray& operator=(const IntrusiveArray& v) { m_data = const_cast(v.m_data); m_size = v.m_size; return *this; } 25 | 26 | void reset(T *d, size_t s) 27 | { 28 | m_data = d; 29 | m_size = s; 30 | } 31 | 32 | bool empty() const { return m_size == 0; } 33 | size_t size() const { return m_size; } 34 | 35 | T* data() { return m_data; } 36 | const T* data() const { return m_data; } 37 | 38 | T& operator[](size_t i) { return m_data[i]; } 39 | const T& operator[](size_t i) const { return m_data[i]; } 40 | 41 | iterator begin() { return m_data; } 42 | const_iterator begin() const { return m_data; } 43 | iterator end() { return m_data + m_size; } 44 | const_iterator end() const { return m_data + m_size; } 45 | 46 | void zeroclear() 47 | { 48 | memset(m_data, 0, sizeof(T)*m_size); 49 | } 50 | void copy_to(pointer dst) 51 | { 52 | memcpy(dst, m_data, sizeof(value_type) * m_size); 53 | } 54 | void copy_to(pointer dst, size_t num_elements) 55 | { 56 | memcpy(dst, m_data, sizeof(value_type) * num_elements); 57 | } 58 | 59 | private: 60 | T *m_data = nullptr; 61 | size_t m_size = 0; 62 | }; 63 | 64 | 65 | template 66 | class IntrusiveIndexedArray 67 | { 68 | public: 69 | using value_type = T; 70 | using reference = T&; 71 | using const_reference = const T&; 72 | using pointer = T*; 73 | using const_pointer = const T*; 74 | using iterator = indexed_iterator; 75 | using const_iterator = indexed_iterator; 76 | 77 | IntrusiveIndexedArray() {} 78 | IntrusiveIndexedArray(const I *i, const T *d, size_t s) : m_index(const_cast(i)), m_data(const_cast(d)), m_size(s) {} 79 | IntrusiveIndexedArray(const IntrusiveIndexedArray& v) : m_index(const_cast(v.m_index)), m_data(const_cast(v.m_data)), m_size(v.m_size) {} 80 | template 81 | IntrusiveIndexedArray(const IContainer& i, const VContainer& v) : m_index(const_cast(i.data())), m_data(const_cast(v.data())), m_size(i.size()) {} 82 | IntrusiveIndexedArray& operator=(const IntrusiveIndexedArray& v) 83 | { 84 | m_index = const_cast(v.m_index); 85 | m_data = const_cast(v.m_data); 86 | m_size = v.m_size; 87 | return *this; 88 | } 89 | 90 | void reset(I *i, T *d, size_t s) 91 | { 92 | m_index = i; 93 | m_data = d; 94 | m_size = s; 95 | } 96 | 97 | bool empty() const { return m_size == 0; } 98 | size_t size() const { return m_size; } 99 | 100 | I* index() { return m_index; } 101 | const I* index() const { return m_index; } 102 | 103 | T* data() { return m_data; } 104 | const T* data() const { return m_data; } 105 | 106 | T& operator[](size_t i) { return m_data[m_index[i]]; } 107 | const T& operator[](size_t i) const { return m_data[m_index[i]]; } 108 | 109 | iterator begin() { return { m_data, m_index }; } 110 | const_iterator begin() const { return { m_data, m_index }; } 111 | iterator end() { return { m_data, m_index + m_size }; } 112 | const_iterator end() const { return { m_data, m_index + m_size }; } 113 | 114 | private: 115 | I *m_index = nullptr; 116 | T *m_data = nullptr; 117 | size_t m_size = 0; 118 | }; 119 | 120 | template using IArray = IntrusiveArray; 121 | template using IIArray = IntrusiveIndexedArray; 122 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muIterator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define Boilerplate(I, V) \ 4 | using this_t = I; \ 5 | using difference_type = std::ptrdiff_t; \ 6 | using value_type = typename std::iterator_traits::value_type; \ 7 | using reference = typename std::iterator_traits::reference; \ 8 | using pointer = typename std::iterator_traits::pointer; \ 9 | using iterator_category = std::random_access_iterator_tag; \ 10 | 11 | 12 | template 13 | struct strided_iterator 14 | { 15 | Boilerplate(strided_iterator, T); 16 | static const int stride = Stride; 17 | 18 | uint8_t *data; 19 | 20 | reference operator*() { return *(T*)data; } 21 | pointer operator->() { return &(T*)data; } 22 | this_t operator+(size_t v) { return data + stride*v; } 23 | this_t operator-(size_t v) { return data + stride*v; } 24 | this_t& operator+=(size_t v) { data += stride*v; return *this; } 25 | this_t& operator-=(size_t v) { data -= stride*v; return *this; } 26 | this_t& operator++() { data += stride; return *this; } 27 | this_t& operator++(int) { data += stride; return *this; } 28 | this_t& operator--() { data -= stride; return *this; } 29 | this_t& operator--(int) { data -= stride; return *this; } 30 | bool operator==(const this_t& v) const { return data == data; } 31 | bool operator!=(const this_t& v) const { return data != data; } 32 | 33 | }; 34 | 35 | template 36 | struct strided_iterator 37 | { 38 | Boilerplate(strided_iterator, T) 39 | 40 | uint8_t *data; 41 | size_t stride; 42 | 43 | reference operator*() { return *(T*)data; } 44 | pointer operator->() { return &(T*)data; } 45 | this_t operator+(size_t v) { return data + stride*v; } 46 | this_t operator-(size_t v) { return data + stride*v; } 47 | this_t& operator+=(size_t v) { data += stride*v; return *this; } 48 | this_t& operator-=(size_t v) { data -= stride*v; return *this; } 49 | this_t& operator++() { data += stride; return *this; } 50 | this_t& operator++(int) { data += stride; return *this; } 51 | this_t& operator--() { data -= stride; return *this; } 52 | this_t& operator--(int) { data -= stride; return *this; } 53 | bool operator==(const this_t& v) const { return data == data; } 54 | bool operator!=(const this_t& v) const { return data != data; } 55 | }; 56 | 57 | 58 | template 59 | struct indexed_iterator 60 | { 61 | Boilerplate(indexed_iterator, VIter) 62 | 63 | VIter data; 64 | IIter index; 65 | 66 | reference operator*() { return data[*index]; } 67 | pointer operator->() { return &data[*index]; } 68 | this_t operator+(size_t v) { return { data, index + v }; } 69 | this_t operator-(size_t v) { return { data, index - v }; } 70 | this_t& operator+=(size_t v){ index += v; return *this; } 71 | this_t& operator-=(size_t v){ index -= v; return *this; } 72 | this_t& operator++() { ++index; return *this; } 73 | this_t& operator++(int) { ++index; return *this; } 74 | this_t& operator--() { --index; return *this; } 75 | this_t& operator--(int) { --index; return *this; } 76 | bool operator==(const this_t& v) const { return v.data == data && v.index == index; } 77 | bool operator!=(const this_t& v) const { return v.data != data || v.index != index; } 78 | }; 79 | 80 | template 81 | struct indexed_iterator_s 82 | { 83 | Boilerplate(indexed_iterator_s, VIter) 84 | 85 | VIter data; 86 | IIter index; 87 | 88 | reference operator*() { return index ? data[*index] : *data; } 89 | pointer operator->() { return index ? &data[*index] : data; } 90 | this_t operator+(size_t v) { return index ? this_t{ data, index + v } : this_t{ data + v, nullptr }; } 91 | this_t operator-(size_t v) { return index ? this_t{ data, index - v } : this_t{ data - v, nullptr }; } 92 | this_t& operator+=(size_t v){ if (index) index += v; else data += v; return *this; } 93 | this_t& operator-=(size_t v){ if (index) index -= v; else data -= v; return *this; } 94 | this_t& operator++() { if (index) ++index; else ++data; return *this; } 95 | this_t& operator++(int) { if (index) ++index; else ++data; return *this; } 96 | this_t& operator--() { if (index) --index; else --data; return *this; } 97 | this_t& operator--(int) { if (index) --index; else --data; return *this; } 98 | bool operator==(const this_t& v) const { return v.data == data && v.index == index; } 99 | bool operator!=(const this_t& v) const { return v.data != data || v.index != index; } 100 | }; 101 | 102 | #undef Boilerplate 103 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muMeshRefiner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace mu { 4 | 5 | struct MeshRefiner 6 | { 7 | struct Submesh 8 | { 9 | int num_indices_tri = 0; 10 | int materialID = 0; 11 | int* faces_to_write = nullptr; 12 | }; 13 | 14 | struct Split 15 | { 16 | int offset_faces = 0; 17 | int offset_indices = 0; 18 | int offset_vertices = 0; 19 | int num_faces = 0; 20 | int num_vertices = 0; 21 | int num_indices = 0; 22 | int num_indices_triangulated = 0; 23 | int num_submeshes = 0; 24 | }; 25 | 26 | int split_unit = 0; // 0 == no split 27 | bool triangulate = true; 28 | bool swap_faces = false; 29 | 30 | IArray counts; 31 | IArray indices; 32 | IArray points; 33 | IArray normals; 34 | IArray uv; 35 | IArray colors; 36 | RawVector submeshes; 37 | RawVector splits; 38 | 39 | RawVector old2new_indices; // indices to new indices 40 | RawVector new2old_vertices; // indices to old vertices 41 | 42 | private: 43 | RawVector counts_tmp; 44 | RawVector offsets; 45 | ConnectionData connection; 46 | RawVector face_normals; 47 | RawVector normals_tmp; 48 | RawVector tangents_tmp; 49 | 50 | RawVector new_points; 51 | RawVector new_normals; 52 | RawVector new_tangents; 53 | RawVector new_uv; 54 | RawVector new_colors; 55 | RawVector new_indices; 56 | RawVector new_indices_triangulated; 57 | RawVector new_indices_submeshes; 58 | RawVector dummy_materialIDs; 59 | int num_indices_tri = 0; 60 | 61 | public: 62 | void prepare(const IArray& counts, const IArray& indices, const IArray& points); 63 | void genNormals(bool flip); 64 | void genNormalsWithSmoothAngle(float smooth_angle, bool flip); 65 | void genTangents(); 66 | 67 | bool refine(bool optimize); 68 | 69 | // should be called after refine(), and only valid for triangulated meshes 70 | bool genSubmesh(IArray materialIDs); 71 | 72 | void swapNewData( 73 | RawVector& p, 74 | RawVector& n, 75 | RawVector& t, 76 | RawVector& u, 77 | RawVector& c, 78 | RawVector& idx); 79 | 80 | private: 81 | bool refineDumb(); 82 | bool refineWithOptimization(); 83 | void buildConnection(); 84 | 85 | template void doRefine(const Body& body); 86 | int findOrAddVertexPNTUC(int vi, const float3& p, const float3& n, const float4& t, const float2& u, const float4& c); 87 | int findOrAddVertexPNTU(int vi, const float3& p, const float3& n, const float4& t, const float2& u); 88 | int findOrAddVertexPNU(int vi, const float3& p, const float3& n, const float2& u); 89 | int findOrAddVertexPN(int vi, const float3& p, const float3& n); 90 | int findOrAddVertexPU(int vi, const float3& p, const float2& u); 91 | }; 92 | 93 | } // namespace mu 94 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muMisc.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "muMisc.h" 3 | #ifdef _WIN32 4 | #include 5 | #include 6 | #pragma comment(lib, "dbghelp.lib") 7 | #else 8 | #include 9 | #include 10 | #endif 11 | 12 | namespace mu { 13 | 14 | nanosec Now() 15 | { 16 | using namespace std::chrono; 17 | return duration_cast(steady_clock::now().time_since_epoch()).count(); 18 | } 19 | 20 | void Print(const char *fmt, ...) 21 | { 22 | va_list args; 23 | va_start(args, fmt); 24 | #ifdef _WIN32 25 | char buf[1024]; 26 | vsnprintf(buf, sizeof(buf), fmt, args); 27 | ::OutputDebugStringA(buf); 28 | #else 29 | vprintf(fmt, args); 30 | #endif 31 | va_end(args); 32 | } 33 | 34 | void Print(const wchar_t *fmt, ...) 35 | { 36 | va_list args; 37 | va_start(args, fmt); 38 | #ifdef _WIN32 39 | wchar_t buf[1024]; 40 | _vsnwprintf(buf, sizeof(buf), fmt, args); 41 | ::OutputDebugStringW(buf); 42 | #else 43 | vwprintf(fmt, args); 44 | #endif 45 | va_end(args); 46 | } 47 | 48 | #ifdef _WIN32 49 | std::string ToUTF8(const char *src) 50 | { 51 | // to UTF-16 52 | const int wsize = ::MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src, -1, nullptr, 0); 53 | std::wstring ws; 54 | ws.resize(wsize); 55 | ::MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src, -1, (LPWSTR)ws.data(), wsize); 56 | 57 | // to UTF-8 58 | const int u8size = ::WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)ws.data(), -1, nullptr, 0, nullptr, nullptr); 59 | std::string u8s; 60 | u8s.resize(u8size); 61 | ::WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)ws.data(), -1, (LPSTR)u8s.data(), u8size, nullptr, nullptr); 62 | return u8s; 63 | } 64 | std::string ToUTF8(const std::string& src) 65 | { 66 | return ToUTF8(src.c_str()); 67 | } 68 | 69 | std::string ToANSI(const char *src) 70 | { 71 | // to UTF-16 72 | const int wsize = ::MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)src, -1, nullptr, 0); 73 | std::wstring ws; 74 | ws.resize(wsize); 75 | ::MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)src, -1, (LPWSTR)ws.data(), wsize); 76 | 77 | // to ANSI 78 | const int u8size = ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)ws.data(), -1, nullptr, 0, nullptr, nullptr); 79 | std::string u8s; 80 | u8s.resize(u8size); 81 | ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)ws.data(), -1, (LPSTR)u8s.data(), u8size, nullptr, nullptr); 82 | return u8s; 83 | } 84 | std::string ToANSI(const std::string& src) 85 | { 86 | return ToANSI(src.c_str()); 87 | } 88 | #endif 89 | 90 | 91 | 92 | void AddDLLSearchPath(const char *v) 93 | { 94 | #if defined(_WIN32) 95 | #define LIBRARY_PATH "PATH" 96 | #elif defined(__APPLE__) 97 | #define LIBRARY_PATH "DYLD_LIBRARY_PATH" 98 | #else 99 | #define LIBRARY_PATH "LD_LIBRARY_PATH" 100 | #endif 101 | #ifdef _WIN32 102 | std::string path; 103 | { 104 | DWORD size = ::GetEnvironmentVariableA(LIBRARY_PATH, nullptr, 0); 105 | if (size > 0) { 106 | path.resize(size); 107 | ::GetEnvironmentVariableA(LIBRARY_PATH, &path[0], (DWORD)path.size()); 108 | path.pop_back(); // delete last '\0' 109 | } 110 | } 111 | if (path.find(v) == std::string::npos) { 112 | auto pos = path.size(); 113 | path = std::string(v) + ";" + path; 114 | for (size_t i = pos; i < path.size(); ++i) { 115 | char& c = path[i]; 116 | if (c == '/') { c = '\\'; } 117 | } 118 | ::SetEnvironmentVariableA(LIBRARY_PATH, path.c_str()); 119 | } 120 | #else 121 | std::string path; 122 | if (auto path_ = ::getenv(LIBRARY_PATH)) { 123 | path = path_; 124 | } 125 | if (path.find(v) == std::string::npos) { 126 | if (!path.empty()) { path += ":"; } 127 | auto pos = path.size(); 128 | path += v; 129 | for (size_t i = pos; i < path.size(); ++i) { 130 | char& c = path[i]; 131 | if (c == '\\') { c = '/'; } 132 | } 133 | ::setenv(LIBRARY_PATH, path.c_str(), 1); 134 | } 135 | #endif 136 | #undef LIBRARY_PATH 137 | } 138 | 139 | 140 | 141 | bool ResolveImports(void *module) 142 | { 143 | #ifdef _WIN32 144 | bool ret = true; 145 | EnumerateDLLImports((HMODULE)module, [&](const char *dll, const char *funcname, DWORD ordinal, void *&addr) { 146 | auto mod = ::GetModuleHandleA(dll); 147 | if (!mod) { mod = ::LoadLibraryA(dll); } 148 | if (!mod) { 149 | ret = false; return; 150 | } 151 | if (funcname) { 152 | ForceWrite(&addr, ::GetProcAddress(mod, funcname)); 153 | } 154 | else { 155 | ForceWrite(&addr, ::GetProcAddress(mod, MAKEINTRESOURCEA(ordinal))); 156 | } 157 | }); 158 | return ret; 159 | #else // _WIN32 160 | return false; 161 | #endif //_WIN32 162 | } 163 | 164 | void* LoadModule(const char *path) 165 | { 166 | #ifdef _WIN32 167 | return ::LoadLibraryA(path); 168 | #else // _WIN32 169 | return nullptr; 170 | #endif //_WIN32 171 | } 172 | 173 | void* GetModule(const char *module_name) 174 | { 175 | #ifdef _WIN32 176 | return ::GetModuleHandleA(module_name); 177 | #else // _WIN32 178 | return nullptr; 179 | #endif //_WIN32 180 | } 181 | 182 | 183 | void InitializeSymbols(const char *path) 184 | { 185 | #ifdef _WIN32 186 | char tmp[MAX_PATH]; 187 | if (!path) { 188 | auto ret = ::GetModuleFileNameA(::GetModuleHandleA(nullptr), (LPSTR)tmp, sizeof(tmp)); 189 | for (int i = ret - 1; i > 0; --i) { 190 | if (tmp[i] == '\\') { 191 | tmp[i] = '\0'; 192 | break; 193 | } 194 | } 195 | path = tmp; 196 | } 197 | 198 | DWORD opt = ::SymGetOptions(); 199 | opt |= SYMOPT_DEBUG; 200 | opt |= SYMOPT_DEFERRED_LOADS; 201 | opt &= ~SYMOPT_UNDNAME; 202 | ::SymSetOptions(opt); 203 | ::SymInitialize(::GetCurrentProcess(), path, TRUE); 204 | #else // _WIN32 205 | #endif //_WIN32 206 | } 207 | 208 | void* FindSymbolByName(const char *name) 209 | { 210 | #ifdef _WIN32 211 | char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; 212 | PSYMBOL_INFO sinfo = (PSYMBOL_INFO)buf; 213 | sinfo->SizeOfStruct = sizeof(SYMBOL_INFO); 214 | sinfo->MaxNameLen = MAX_SYM_NAME; 215 | if (::SymFromName(::GetCurrentProcess(), name, sinfo) == FALSE) { 216 | return nullptr; 217 | } 218 | return (void*)sinfo->Address; 219 | #else // _WIN32 220 | return nullptr; 221 | #endif //_WIN32 222 | } 223 | 224 | 225 | #ifdef _WIN32 226 | struct cbEnumSymbolsCtx 227 | { 228 | const char *name; 229 | void *ret; 230 | }; 231 | BOOL CALLBACK cbEnumSymbols(PCSTR SymbolName, DWORD64 SymbolAddress, ULONG /*SymbolSize*/, PVOID UserContext) 232 | { 233 | auto ctx = (cbEnumSymbolsCtx*)UserContext; 234 | if (strcmp(SymbolName, ctx->name) == 0) { 235 | ctx->ret = (void*)SymbolAddress; 236 | return FALSE; 237 | } 238 | return TRUE; 239 | 240 | } 241 | 242 | #endif //_WIN32 243 | 244 | void* FindSymbolByName(const char *name, const char *module_name) 245 | { 246 | #ifdef _WIN32 247 | cbEnumSymbolsCtx ctx{ name, nullptr }; 248 | SymEnumerateSymbols64(::GetCurrentProcess(), (ULONG64)GetModuleHandleA(module_name), cbEnumSymbols, &ctx); 249 | return ctx.ret; 250 | #else // _WIN32 251 | return nullptr; 252 | #endif //_WIN32 253 | } 254 | 255 | void SetMemoryProtection(void *addr, size_t size, MemoryFlags flags) 256 | { 257 | #ifdef _WIN32 258 | DWORD flag = 0; 259 | switch (flags) { 260 | case MemoryFlags::ReadWrite: flag = PAGE_READWRITE; break; 261 | case MemoryFlags::ExecuteRead: flag = PAGE_EXECUTE_READ; break; 262 | case MemoryFlags::ExecuteReadWrite: flag = PAGE_EXECUTE_READWRITE; break; 263 | } 264 | DWORD old_flag; 265 | VirtualProtect(addr, size, flag, &old_flag); 266 | #else 267 | int flag = 0; 268 | switch (flags) { 269 | case MemoryFlags::ReadWrite: flag = PROT_READ | PROT_WRITE; break; 270 | case MemoryFlags::ExecuteRead: flag = PROT_EXEC | PROT_READ; break; 271 | case MemoryFlags::ExecuteReadWrite: flag = PROT_EXEC | PROT_READ | PROT_WRITE; break; 272 | } 273 | void *page = (void*)((size_t)addr - ((size_t)addr % getpagesize())); 274 | mprotect(page, size, flag); 275 | #endif 276 | } 277 | 278 | 279 | } // namespace mu 280 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muMisc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace mu { 4 | 5 | template < typename T, size_t N > 6 | size_t countof(T(&arr)[N]) { return std::extent< T[N] >::value; } 7 | 8 | using nanosec = uint64_t; 9 | nanosec Now(); 10 | inline float NS2MS(nanosec ns) { return (float)((double)ns / 1000000.0); } 11 | 12 | void Print(const char *fmt, ...); 13 | void Print(const wchar_t *fmt, ...); 14 | 15 | std::string ToUTF8(const char *src); 16 | std::string ToUTF8(const std::string& src); 17 | std::string ToANSI(const char *src); 18 | std::string ToANSI(const std::string& src); 19 | 20 | 21 | void AddDLLSearchPath(const char *v); 22 | void* LoadModule(const char *path); 23 | void* GetModule(const char *module_name); 24 | bool ResolveImports(void *module); 25 | 26 | void InitializeSymbols(const char *path = nullptr); 27 | void* FindSymbolByName(const char *name); 28 | void* FindSymbolByName(const char *name, const char *module_name); 29 | 30 | 31 | enum class MemoryFlags 32 | { 33 | ExecuteRead, 34 | ReadWrite, 35 | ExecuteReadWrite, 36 | }; 37 | void SetMemoryProtection(void *addr, size_t size, MemoryFlags flags); 38 | 39 | template 40 | inline void ForceWrite(void *dst, const T &src) 41 | { 42 | SetMemoryProtection(dst, sizeof(T), MemoryFlags::ExecuteReadWrite); 43 | memcpy(dst, &src, sizeof(T)); 44 | SetMemoryProtection(dst, sizeof(T), MemoryFlags::ExecuteRead); 45 | } 46 | 47 | 48 | #ifdef _WIN32 49 | // F: [](const char *dllname, const char *funcname, DWORD ordinal, void *import_address) -> void 50 | template 51 | inline void EnumerateDLLImports(HMODULE module, const F &f) 52 | { 53 | if (module == NULL) { return; } 54 | 55 | size_t ImageBase = (size_t)module; 56 | auto pDosHeader = (PIMAGE_DOS_HEADER)ImageBase; 57 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { return; } 58 | 59 | auto pNTHeader = (PIMAGE_NT_HEADERS)(ImageBase + pDosHeader->e_lfanew); 60 | DWORD RVAImports = pNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; 61 | if (RVAImports == 0) { return; } 62 | 63 | auto *pImportDesc = (IMAGE_IMPORT_DESCRIPTOR*)(ImageBase + RVAImports); 64 | while (pImportDesc->Name != 0) { 65 | const char *pDLLName = (const char*)(ImageBase + pImportDesc->Name); 66 | auto* pThunkOrig = (IMAGE_THUNK_DATA*)(ImageBase + pImportDesc->OriginalFirstThunk); 67 | auto* pThunk = (IMAGE_THUNK_DATA*)(ImageBase + pImportDesc->FirstThunk); 68 | while (pThunkOrig->u1.AddressOfData != 0) { 69 | const char *name = nullptr; 70 | DWORD ordinal = 0; 71 | 72 | #ifdef _WIN64 73 | if (pThunkOrig->u1.Ordinal & IMAGE_ORDINAL_FLAG64) { 74 | ordinal = IMAGE_ORDINAL64(pThunkOrig->u1.Ordinal); 75 | } 76 | #else 77 | if (pThunkOrig->u1.Ordinal & IMAGE_ORDINAL_FLAG32) { 78 | ordinal = IMAGE_ORDINAL32(pThunkOrig->u1.Ordinal); 79 | } 80 | #endif 81 | else { 82 | auto* pIBN = (IMAGE_IMPORT_BY_NAME*)(ImageBase + pThunkOrig->u1.AddressOfData); 83 | name = pIBN->Name; 84 | } 85 | f(pDLLName, name, ordinal, *(void**)pThunk); 86 | ++pThunkOrig; 87 | ++pThunk; 88 | } 89 | ++pImportDesc; 90 | } 91 | return; 92 | } 93 | #endif //_WIN32 94 | } // namespace mu 95 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muRawVector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "muAllocator.h" 6 | 7 | template 8 | class RawVector 9 | { 10 | public: 11 | using value_type = T; 12 | using reference = T&; 13 | using const_reference = const T&; 14 | using pointer = T*; 15 | using const_pointer = const T*; 16 | using iterator = pointer; 17 | using const_iterator = const_pointer; 18 | static const int alignment = Align; 19 | 20 | RawVector() {} 21 | RawVector(const RawVector& v) 22 | { 23 | operator=(v); 24 | } 25 | RawVector(RawVector&& v) 26 | { 27 | v.swap(*this); 28 | } 29 | RawVector(std::initializer_list v) 30 | { 31 | operator=(v); 32 | } 33 | explicit RawVector(size_t initial_size) { resize(initial_size); } 34 | RawVector& operator=(const RawVector& v) 35 | { 36 | assign(v.begin(), v.end()); 37 | return *this; 38 | } 39 | RawVector& operator=(RawVector&& v) 40 | { 41 | v.swap(*this); 42 | return *this; 43 | } 44 | RawVector& operator=(std::initializer_list v) 45 | { 46 | assign(v.begin(), v.end()); 47 | return *this; 48 | } 49 | 50 | ~RawVector() 51 | { 52 | clear(); 53 | shrink_to_fit(); 54 | } 55 | 56 | bool empty() const { return m_size == 0; } 57 | size_t size() const { return m_size; } 58 | size_t capacity() const { return m_capacity; } 59 | 60 | T* data() { return m_data; } 61 | const T* data() const { return m_data; } 62 | const T* cdata() const { return m_data; } 63 | 64 | T& at(size_t i) { return m_data[i]; } 65 | const T& at(size_t i) const { return m_data[i]; } 66 | T& operator[](size_t i) { return at(i); } 67 | const T& operator[](size_t i) const { return at(i); } 68 | 69 | T& front() { return m_data[0]; } 70 | const T& front() const { return m_data[0]; } 71 | T& back() { return m_data[m_size - 1]; } 72 | const T& back() const { return m_data[m_size - 1]; } 73 | 74 | iterator begin() { return m_data; } 75 | const_iterator begin() const { return m_data; } 76 | iterator end() { return m_data + m_size; } 77 | const_iterator end() const { return m_data + m_size; } 78 | 79 | static void* allocate(size_t size) { return AlignedMalloc(size, alignment); } 80 | static void deallocate(void *addr, size_t /*size*/) { AlignedFree(addr); } 81 | 82 | void reserve(size_t s) 83 | { 84 | if (s > m_capacity) { 85 | s = std::max(s, m_size * 2); 86 | size_t newsize = sizeof(T) * s; 87 | size_t oldsize = sizeof(T) * m_size; 88 | 89 | T *newdata = (T*)allocate(newsize); 90 | memcpy(newdata, m_data, oldsize); 91 | deallocate(m_data, oldsize); 92 | m_data = newdata; 93 | m_capacity = s; 94 | } 95 | } 96 | 97 | void reserve_discard(size_t s) 98 | { 99 | if (s > m_capacity) { 100 | s = std::max(s, m_size * 2); 101 | size_t newsize = sizeof(T) * s; 102 | size_t oldsize = sizeof(T) * m_size; 103 | 104 | deallocate(m_data, oldsize); 105 | m_data = (T*)allocate(newsize); 106 | m_capacity = s; 107 | } 108 | } 109 | 110 | void shrink_to_fit() 111 | { 112 | if (m_size == 0) { 113 | deallocate(m_data, m_size); 114 | m_size = m_capacity = 0; 115 | } 116 | else if (m_size == m_capacity) { 117 | // nothing to do 118 | return; 119 | } 120 | else { 121 | size_t newsize = sizeof(T) * m_size; 122 | size_t oldsize = sizeof(T) * m_capacity; 123 | T *newdata = (T*)allocate(newsize); 124 | memcpy(newdata, m_data, newsize); 125 | deallocate(m_data, oldsize); 126 | m_data = newdata; 127 | m_capacity = m_size; 128 | } 129 | } 130 | 131 | void resize(size_t s) 132 | { 133 | reserve(s); 134 | m_size = s; 135 | } 136 | 137 | void resize_discard(size_t s) 138 | { 139 | reserve_discard(s); 140 | m_size = s; 141 | } 142 | 143 | void resize_zeroclear(size_t s) 144 | { 145 | resize_discard(s); 146 | zeroclear(); 147 | } 148 | 149 | void resize(size_t s, const T& v) 150 | { 151 | size_t pos = size(); 152 | resize(s); 153 | // std::fill() can be significantly slower than plain copy 154 | for (size_t i = pos; i < s; ++i) { 155 | m_data[i] = v; 156 | } 157 | } 158 | 159 | void clear() 160 | { 161 | m_size = 0; 162 | } 163 | 164 | void swap(RawVector &other) 165 | { 166 | std::swap(m_data, other.m_data); 167 | std::swap(m_size, other.m_size); 168 | std::swap(m_capacity, other.m_capacity); 169 | } 170 | 171 | template 172 | void assign(FwdIter first, FwdIter last) 173 | { 174 | resize(std::distance(first, last)); 175 | std::copy(first, last, begin()); 176 | } 177 | void assign(const_pointer first, const_pointer last) 178 | { 179 | resize(std::distance(first, last)); 180 | // sadly, memcpy() can way faster than std::copy() 181 | memcpy(m_data, first, sizeof(value_type) * m_size); 182 | } 183 | 184 | template 185 | void insert(iterator pos, ForwardIter first, ForwardIter last) 186 | { 187 | size_t d = std::distance(begin(), pos); 188 | size_t s = std::distance(first, last); 189 | resize(d + s); 190 | std::copy(first, last, begin() + pos); 191 | } 192 | void insert(iterator pos, const_pointer first, const_pointer last) 193 | { 194 | size_t d = std::distance(begin(), pos); 195 | size_t s = std::distance(first, last); 196 | resize(d + s); 197 | memcpy(m_data + d, first, sizeof(value_type) * s); 198 | } 199 | 200 | void insert(iterator pos, const_reference v) 201 | { 202 | insert(pos, &v, &v + 1); 203 | } 204 | 205 | void erase(iterator first, iterator last) 206 | { 207 | size_t s = std::distance(first, last); 208 | std::copy(last, end(), first); 209 | m_size -= s; 210 | } 211 | 212 | void erase(iterator pos) 213 | { 214 | erase(pos, pos + 1); 215 | } 216 | 217 | void push_back(const T& v) 218 | { 219 | resize(m_size + 1); 220 | back() = v; 221 | } 222 | void push_back(T&& v) 223 | { 224 | resize(m_size + 1); 225 | back() = v; 226 | } 227 | 228 | 229 | void pop_back() 230 | { 231 | --m_size; 232 | } 233 | 234 | bool operator == (const RawVector& other) const 235 | { 236 | return m_size == other.m_size && memcmp(m_data, other.m_data, sizeof(T)*m_size) == 0; 237 | } 238 | 239 | bool operator != (const RawVector& other) const 240 | { 241 | return !(*this == other); 242 | } 243 | 244 | void zeroclear() 245 | { 246 | memset(m_data, 0, sizeof(T)*m_size); 247 | } 248 | 249 | void copy_to(pointer dst) 250 | { 251 | memcpy(dst, m_data, sizeof(value_type) * m_size); 252 | } 253 | void copy_to(pointer dst, size_t length, size_t offset = 0) 254 | { 255 | memcpy(dst, m_data + offset, sizeof(value_type) * length); 256 | } 257 | 258 | private: 259 | T *m_data = nullptr; 260 | size_t m_size = 0; 261 | size_t m_capacity = 0; 262 | }; 263 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muSIMDConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#define muSIMD_FloatToHalf 4 | //#define muSIMD_HalfToFloat 5 | 6 | //#define muSIMD_InvertX3 7 | //#define muSIMD_InvertX4 8 | //#define muSIMD_Scale 9 | #define muSIMD_Normalize 10 | //#define muSIMD_Lerp 11 | #define muSIMD_NearEqual 12 | 13 | #define muSIMD_MinMax2 14 | //#define muSIMD_MinMax3 15 | 16 | //#define muSIMD_MulVectors3 17 | //#define muSIMD_MulPoints3 18 | 19 | #define muSIMD_RayTrianglesIntersectionIndexed 20 | //#define muSIMD_RayTrianglesIntersectionFlattened 21 | #define muSIMD_RayTrianglesIntersectionSoA 22 | 23 | //#define muSIMD_PolyInside 24 | #define muSIMD_PolyInsideSoA 25 | 26 | #define muSIMD_GenerateNormalsTriangleIndexed 27 | //#define muSIMD_GenerateNormalsTriangleFlattened 28 | //#define muSIMD_GenerateNormalsTriangleSoA 29 | 30 | #define muSIMD_GenerateTangentsTriangleIndexed 31 | //#define muSIMD_GenerateTangentsTriangleFlattened 32 | //#define muSIMD_GenerateTangentsTriangleSoA 33 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muTLS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #if _WIN32 6 | #define NOMINMAX 7 | #include 8 | #else 9 | #include 10 | #endif 11 | 12 | 13 | class tls_base 14 | { 15 | public: 16 | #if _WIN32 17 | using tls_key_t = DWORD; 18 | #if WindowsStoreApp 19 | tls_base() { m_key = ::FlsAlloc(nullptr); } 20 | ~tls_base() { ::FlsFree(m_key); } 21 | void set_value(void *value) { ::FlsSetValue(m_key, value); } 22 | void* get_value() { return (void *)::FlsGetValue(m_key); } 23 | #else 24 | tls_base() { m_key = ::TlsAlloc(); } 25 | ~tls_base() { ::TlsFree(m_key); } 26 | void set_value(void *value) { ::TlsSetValue(m_key, value); } 27 | void* get_value() const { return (void *)::TlsGetValue(m_key); } 28 | #endif 29 | #else 30 | using tls_key_t = pthread_key_t; 31 | tls_base() { pthread_key_create(&m_key, nullptr); } 32 | ~tls_base() { pthread_key_delete(m_key); } 33 | void set_value(void *value) { pthread_setspecific(m_key, value); } 34 | void* get_value() const { return pthread_getspecific(m_key); } 35 | #endif 36 | private: 37 | tls_key_t m_key; 38 | }; 39 | 40 | template 41 | class tls : private tls_base 42 | { 43 | public: 44 | tls() {} 45 | 46 | ~tls() 47 | { 48 | std::unique_lock lock(m_mutex); 49 | for (auto p : m_locals) { delete p; } 50 | m_locals.clear(); 51 | } 52 | 53 | T& local() 54 | { 55 | return local([](T&) {}); 56 | } 57 | 58 | template 59 | T& local(const OnFirst& on_first) 60 | { 61 | void *value = get_value(); 62 | if (value == nullptr) { 63 | T *v = new T(); 64 | set_value(v); 65 | value = v; 66 | 67 | { 68 | std::unique_lock lock(m_mutex); 69 | m_locals.push_back(v); 70 | } 71 | on_first(*v); 72 | } 73 | return *(T*)value; 74 | } 75 | 76 | template 77 | void each(const Body& body) 78 | { 79 | std::unique_lock lock(m_mutex); 80 | for (auto p : m_locals) { body(*p); } 81 | } 82 | 83 | protected: 84 | std::mutex m_mutex; 85 | std::vector m_locals; 86 | }; 87 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muVertex.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "muMath.h" 3 | #include "muVertex.h" 4 | 5 | namespace mu { 6 | 7 | template static inline void InterleaveImpl(VertexT *dst, const typename VertexT::arrays_t& src, size_t i); 8 | 9 | template<> inline void InterleaveImpl(vertex_v3n3 *dst, const vertex_v3n3::arrays_t& src, size_t i) 10 | { 11 | dst[i].p = src.points[i]; 12 | dst[i].n = src.normals[i]; 13 | } 14 | template<> inline void InterleaveImpl(vertex_v3n3c4 *dst, const vertex_v3n3c4::arrays_t& src, size_t i) 15 | { 16 | dst[i].p = src.points[i]; 17 | dst[i].n = src.normals[i]; 18 | dst[i].c = src.colors[i]; 19 | } 20 | template<> inline void InterleaveImpl(vertex_v3n3u2 *dst, const vertex_v3n3u2::arrays_t& src, size_t i) 21 | { 22 | dst[i].p = src.points[i]; 23 | dst[i].n = src.normals[i]; 24 | dst[i].u = src.uvs[i]; 25 | } 26 | template<> inline void InterleaveImpl(vertex_v3n3c4u2 *dst, const vertex_v3n3c4u2::arrays_t& src, size_t i) 27 | { 28 | dst[i].p = src.points[i]; 29 | dst[i].n = src.normals[i]; 30 | dst[i].c = src.colors[i]; 31 | dst[i].u = src.uvs[i]; 32 | } 33 | template<> inline void InterleaveImpl(vertex_v3n3u2t4 *dst, const vertex_v3n3u2t4::arrays_t& src, size_t i) 34 | { 35 | dst[i].p = src.points[i]; 36 | dst[i].n = src.normals[i]; 37 | dst[i].u = src.uvs[i]; 38 | dst[i].t = src.tangents[i]; 39 | } 40 | template<> inline void InterleaveImpl(vertex_v3n3c4u2t4 *dst, const vertex_v3n3c4u2t4::arrays_t& src, size_t i) 41 | { 42 | dst[i].p = src.points[i]; 43 | dst[i].n = src.normals[i]; 44 | dst[i].c = src.colors[i]; 45 | dst[i].u = src.uvs[i]; 46 | dst[i].t = src.tangents[i]; 47 | } 48 | 49 | template 50 | void TInterleave(VertexT *dst, const typename VertexT::arrays_t& src, size_t num) 51 | { 52 | for (size_t i = 0; i < num; ++i) { 53 | InterleaveImpl(dst, src, i); 54 | } 55 | } 56 | 57 | VertexFormat GuessVertexFormat( 58 | const float3 *points, 59 | const float3 *normals, 60 | const float4 *colors, 61 | const float2 *uvs, 62 | const float4 *tangents 63 | ) 64 | { 65 | if (points && normals) { 66 | if (colors && uvs && tangents) { return VertexFormat::V3N3C4U2T4; } 67 | if (colors && uvs) { return VertexFormat::V3N3C4U2; } 68 | if (uvs && tangents) { return VertexFormat::V3N3U2T4; } 69 | if (uvs) { return VertexFormat::V3N3U2; } 70 | if (colors) { return VertexFormat::V3N3C4; } 71 | return VertexFormat::V3N3; 72 | } 73 | return VertexFormat::Unknown; 74 | } 75 | 76 | size_t GetVertexSize(VertexFormat format) 77 | { 78 | switch (format) { 79 | case VertexFormat::V3N3: return sizeof(vertex_v3n3); 80 | case VertexFormat::V3N3C4: return sizeof(vertex_v3n3c4); 81 | case VertexFormat::V3N3U2: return sizeof(vertex_v3n3u2); 82 | case VertexFormat::V3N3C4U2: return sizeof(vertex_v3n3c4u2); 83 | case VertexFormat::V3N3U2T4: return sizeof(vertex_v3n3u2t4); 84 | case VertexFormat::V3N3C4U2T4: return sizeof(vertex_v3n3c4u2t4); 85 | default: return 0; 86 | } 87 | } 88 | 89 | void Interleave(void *dst, VertexFormat format, size_t num, 90 | const float3 *points, 91 | const float3 *normals, 92 | const float4 *colors, 93 | const float2 *uvs, 94 | const float4 *tangents 95 | ) 96 | { 97 | switch (format) { 98 | case VertexFormat::V3N3: TInterleave((vertex_v3n3*)dst, {points, normals}, num); break; 99 | case VertexFormat::V3N3C4: TInterleave((vertex_v3n3c4*)dst, { points, normals, colors }, num); break; 100 | case VertexFormat::V3N3U2: TInterleave((vertex_v3n3u2*)dst, { points, normals, uvs }, num); break; 101 | case VertexFormat::V3N3C4U2: TInterleave((vertex_v3n3c4u2*)dst, { points, normals, colors, uvs }, num); break; 102 | case VertexFormat::V3N3U2T4: TInterleave((vertex_v3n3u2t4*)dst, { points, normals, uvs, tangents }, num); break; 103 | case VertexFormat::V3N3C4U2T4: TInterleave((vertex_v3n3c4u2t4*)dst, { points, normals, colors, uvs, tangents }, num); break; 104 | default: break; 105 | } 106 | } 107 | 108 | } // namespace mu 109 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/muVertex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace mu { 4 | 5 | template 6 | struct Weights 7 | { 8 | float weights[N] = {}; 9 | int indices[N] = {}; 10 | }; 11 | using Weights4 = Weights<4>; 12 | using Weights8 = Weights<8>; 13 | 14 | 15 | // vertex interleave 16 | 17 | enum class VertexFormat 18 | { 19 | Unknown, 20 | V3N3, 21 | V3N3C4, 22 | V3N3U2, 23 | V3N3C4U2, 24 | V3N3U2T4, 25 | V3N3C4U2T4, 26 | }; 27 | 28 | struct vertex_v3n3; 29 | struct vertex_v3n3_arrays; 30 | struct vertex_v3n3c4; 31 | struct vertex_v3n3c4_arrays; 32 | struct vertex_v3n3u2; 33 | struct vertex_v3n3u2_arrays; 34 | struct vertex_v3n3c4u2; 35 | struct vertex_v3n3c4u2_arrays; 36 | struct vertex_v3n3u2t4; 37 | struct vertex_v3n3u2t4_arrays; 38 | struct vertex_v3n3c4u2t4; 39 | struct vertex_v3n3c4u2t4_arrays; 40 | 41 | #define DefTraits(T, ID)\ 42 | static const VertexFormat tid = VertexFormat::ID;\ 43 | using vertex_t = T;\ 44 | using arrays_t = T##_arrays; 45 | 46 | 47 | struct vertex_v3n3_arrays 48 | { 49 | DefTraits(vertex_v3n3, V3N3) 50 | const float3 *points; 51 | const float3 *normals; 52 | }; 53 | struct vertex_v3n3 54 | { 55 | DefTraits(vertex_v3n3, V3N3) 56 | float3 p; 57 | float3 n; 58 | }; 59 | 60 | struct vertex_v3n3c4_arrays 61 | { 62 | DefTraits(vertex_v3n3c4, V3N3C4) 63 | const float3 *points; 64 | const float3 *normals; 65 | const float4 *colors; 66 | }; 67 | struct vertex_v3n3c4 68 | { 69 | DefTraits(vertex_v3n3c4, V3N3C4) 70 | float3 p; 71 | float3 n; 72 | float4 c; 73 | }; 74 | 75 | 76 | struct vertex_v3n3u2_arrays 77 | { 78 | DefTraits(vertex_v3n3u2, V3N3U2) 79 | const float3 *points; 80 | const float3 *normals; 81 | const float2 *uvs; 82 | }; 83 | struct vertex_v3n3u2 84 | { 85 | DefTraits(vertex_v3n3u2, V3N3U2) 86 | float3 p; 87 | float3 n; 88 | float2 u; 89 | }; 90 | 91 | struct vertex_v3n3c4u2_arrays 92 | { 93 | DefTraits(vertex_v3n3c4u2, V3N3C4U2) 94 | const float3 *points; 95 | const float3 *normals; 96 | const float4 *colors; 97 | const float2 *uvs; 98 | }; 99 | struct vertex_v3n3c4u2 100 | { 101 | DefTraits(vertex_v3n3c4u2, V3N3C4U2) 102 | float3 p; 103 | float3 n; 104 | float4 c; 105 | float2 u; 106 | }; 107 | 108 | struct vertex_v3n3u2t4_arrays 109 | { 110 | DefTraits(vertex_v3n3u2t4, V3N3U2T4) 111 | const float3 *points; 112 | const float3 *normals; 113 | const float2 *uvs; 114 | const float4 *tangents; 115 | }; 116 | struct vertex_v3n3u2t4 117 | { 118 | DefTraits(vertex_v3n3u2t4, V3N3U2T4) 119 | float3 p; 120 | float3 n; 121 | float2 u; 122 | float4 t; 123 | }; 124 | 125 | struct vertex_v3n3c4u2t4_arrays 126 | { 127 | DefTraits(vertex_v3n3u2t4, V3N3C4U2T4) 128 | const float3 *points; 129 | const float3 *normals; 130 | const float4 *colors; 131 | const float2 *uvs; 132 | const float4 *tangents; 133 | }; 134 | struct vertex_v3n3c4u2t4 135 | { 136 | DefTraits(vertex_v3n3c4u2t4, V3N3C4U2T4) 137 | float3 p; 138 | float3 n; 139 | float4 c; 140 | float2 u; 141 | float4 t; 142 | }; 143 | #undef DefTraits 144 | 145 | VertexFormat GuessVertexFormat( 146 | const float3 *points, 147 | const float3 *normals, 148 | const float4 *colors, 149 | const float2 *uvs, 150 | const float4 *tangents 151 | ); 152 | 153 | size_t GetVertexSize(VertexFormat format); 154 | 155 | void Interleave(void *dst, VertexFormat format, size_t num, 156 | const float3 *points, 157 | const float3 *normals, 158 | const float4 *colors, 159 | const float2 *uvs, 160 | const float4 *tangents 161 | ); 162 | 163 | template void Interleave_Generic(VertexT *dst, const typename VertexT::source_t& src, size_t num); 164 | 165 | } // namespace mu 166 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/MeshUtils/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN32 4 | #pragma warning(disable:4996) 5 | #define NOMINMAX 6 | #include 7 | #else 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "muConfig.h" 22 | #ifdef muEnableHalf 23 | #include 24 | #endif // muEnableHalf 25 | 26 | #define muImpl 27 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/NatvisFile.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ size={m_size} }} 5 | 6 | m_size 7 | m_capacity 8 | 9 | m_size 10 | m_data 11 | 12 | 13 | 14 | 15 | {{ size={m_size} }} 16 | 17 | m_size 18 | 19 | m_size 20 | m_data 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweaker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources *.cpp *.h) 2 | set(plugins_dir "${CMAKE_SOURCE_DIR}/../Assets/UTJ/VertexTweaker/Runtime/Plugins/x86_64") 3 | add_plugin(VertexTweakerCore SOURCES ${sources} PLUGINS_DIR ${plugins_dir}) 4 | 5 | add_dependencies(VertexTweakerCore MeshUtils) 6 | target_link_libraries(VertexTweakerCore MeshUtils ${EXTERNAL_LIBS}) 7 | install(TARGETS VertexTweakerCore DESTINATION .) 8 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweaker/VertexTweaker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN32 4 | #define npAPI extern "C" __declspec(dllexport) 5 | //#define npEnablePenTablet 6 | #else 7 | #define npAPI extern "C" 8 | #endif 9 | 10 | #include "MeshUtils/MeshUtils.h" 11 | using namespace mu; 12 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweaker/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweaker/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define npImpl 18 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweakerCore.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2010 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MeshUtils", "MeshUtils.vcxproj", "{FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "setup", "setup.vcxproj", "{1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VertexTweakerCore", "VertexTweakerCore.vcxproj", "{98EB8D3A-2692-4854-A236-00E5D97BBB0E}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Debug|x64.ActiveCfg = Debug|x64 21 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Debug|x64.Build.0 = Debug|x64 22 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Debug|x86.ActiveCfg = Debug|Win32 23 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Debug|x86.Build.0 = Debug|Win32 24 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Release|x64.ActiveCfg = Release|x64 25 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Release|x64.Build.0 = Release|x64 26 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Release|x86.ActiveCfg = Release|Win32 27 | {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C}.Release|x86.Build.0 = Release|Win32 28 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Debug|x64.ActiveCfg = Release|x64 29 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Debug|x64.Build.0 = Release|x64 30 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Debug|x86.ActiveCfg = Release|x64 31 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Debug|x86.Build.0 = Release|x64 32 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Release|x64.ActiveCfg = Release|x64 33 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Release|x64.Build.0 = Release|x64 34 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Release|x86.ActiveCfg = Release|x64 35 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D}.Release|x86.Build.0 = Release|x64 36 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E}.Debug|x64.ActiveCfg = Debug|x64 37 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E}.Debug|x64.Build.0 = Debug|x64 38 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E}.Debug|x86.ActiveCfg = Debug|x64 39 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E}.Release|x64.ActiveCfg = Release|x64 40 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E}.Release|x64.Build.0 = Release|x64 41 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E}.Release|x86.ActiveCfg = Release|x64 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {4C3CF43C-CCDF-4E76-BBA8-F9D84A7ED72C} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweakerCore.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 15 | 16 | Create 17 | 18 | 19 | 20 | 21 | {fd3fe1ff-abe5-40db-b867-144e9dd9b23c} 22 | 23 | 24 | {1c5de91b-7ae9-4304-9fa1-0de1aba8c02d} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {98EB8D3A-2692-4854-A236-00E5D97BBB0E} 36 | Win32Proj 37 | 10.0.17763.0 38 | 39 | 40 | 41 | v141 42 | DynamicLibrary 43 | 44 | 45 | v141 46 | DynamicLibrary 47 | true 48 | 49 | 50 | 51 | 52 | 53 | 54 | $(SolutionDir);$(IncludePath) 55 | $(SolutionDir)_out\$(Platform)_$(Configuration)\ 56 | $(SolutionDir)_tmp\$(ProjectName)_$(Platform)_$(Configuration)\ 57 | 58 | 59 | 60 | xcopy /YQ $(TargetPath) $(SolutionDir)..\Assets\UTJ\VertexTweaker\Runtime\Plugins\x86_64\ 61 | 62 | 63 | Use 64 | pch.h 65 | true 66 | %(PreprocessorDefinitions) 67 | Disabled 68 | MultiThreadedDLL 69 | Level3 70 | 71 | 72 | true 73 | true 74 | 75 | 76 | 77 | 78 | xcopy /YQ $(TargetPath) $(SolutionDir)..\Assets\UTJ\VertexTweaker\Runtime\Plugins\x86_64\ 79 | 80 | 81 | Use 82 | pch.h 83 | true 84 | /Zo %(AdditionalOptions) 85 | %(PreprocessorDefinitions) 86 | Full 87 | MultiThreadedDLL 88 | AnySuitable 89 | true 90 | Speed 91 | false 92 | Level3 93 | true 94 | false 95 | Fast 96 | false 97 | true 98 | true 99 | false 100 | 101 | 102 | true 103 | true 104 | true 105 | UseLinkTimeCodeGeneration 106 | true 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/VertexTweakerCore.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | {0ce9faa4-7f38-42e5-a2be-9e6615f8bf8a} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/build.bat: -------------------------------------------------------------------------------- 1 | call toolchain.bat 2 | 3 | msbuild VertexTweakerCore.vcxproj /t:Build /p:Configuration=Release /p:Platform=x64 /m /nologo 4 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/cmake/AddPlugin.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 2 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 3 | 4 | if (NOT CMAKE_BUILD_TYPE) 5 | set(CMAKE_BUILD_TYPE "Release" CACHE PATH "" FORCE) 6 | endif() 7 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 8 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist" CACHE PATH "" FORCE) 9 | endif() 10 | 11 | if(APPLE) 12 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") 13 | option(ENABLE_OSX_BUNDLE "Build bundle." ON) 14 | set(CMAKE_MACOSX_RPATH ON) 15 | 16 | if(ENABLE_OSX_BUNDLE) 17 | set(CMAKE_SKIP_RPATH ON) 18 | else() 19 | set(CMAKE_SKIP_RPATH OFF) 20 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) 21 | endif() 22 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") 23 | option(ENABLE_LINUX_USE_LINK_PATH "" ON) 24 | 25 | if(ENABLE_LINUX_USE_LINK_PATH) 26 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) 27 | endif() 28 | endif() 29 | option(ENABLE_DEPLOY "Copy built binaries to plugins directory." ON) 30 | 31 | 32 | function(add_plugin name) 33 | cmake_parse_arguments(arg "" "PLUGINS_DIR" "SOURCES" ${ARGN}) 34 | 35 | if(ENABLE_OSX_BUNDLE) 36 | add_library(${name} MODULE ${arg_SOURCES}) 37 | set_target_properties(${name} PROPERTIES BUNDLE ON) 38 | else() 39 | add_library(${name} SHARED ${arg_SOURCES}) 40 | endif() 41 | 42 | if(ENABLE_DEPLOY) 43 | if(ENABLE_OSX_BUNDLE) 44 | SET(target_filename "${name}.bundle") 45 | else() 46 | SET(target_filename $) 47 | endif() 48 | add_custom_target("Deploy${name}" ALL 49 | COMMAND rm -rf ${arg_PLUGINS_DIR}/${target_filename} 50 | COMMAND cp -r ${target_filename} ${arg_PLUGINS_DIR} 51 | DEPENDS ${name} 52 | ) 53 | endif() 54 | endfunction() 55 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/cmake/FindOpenEXR.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 Pixar 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "Apache License") 5 | # with the following modification; you may not use this file except in 6 | # compliance with the Apache License and the following modification to it: 7 | # Section 6. Trademarks. is deleted and replaced with: 8 | # 9 | # 6. Trademarks. This License does not grant permission to use the trade 10 | # names, trademarks, service marks, or product names of the Licensor 11 | # and its affiliates, except as required to comply with Section 4(c) of 12 | # the License and to reproduce the content of the NOTICE file. 13 | # 14 | # You may obtain a copy of the Apache License at 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, software 19 | # distributed under the Apache License with the above modification is 20 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 | # KIND, either express or implied. See the Apache License for the specific 22 | # language governing permissions and limitations under the Apache License. 23 | # 24 | 25 | if (APPLE) 26 | find_path(OPENEXR_LIBRARY_DIR 27 | libHalf.dylib 28 | HINTS 29 | "${OPENEXR_LOCATION}" 30 | "$ENV{OPENEXR_LOCATION}" 31 | "${OPENEXR_BASE_DIR}" 32 | PATH_SUFFIXES 33 | lib/ 34 | DOC 35 | "OpenEXR library path" 36 | ) 37 | elseif (UNIX) 38 | find_path(OPENEXR_LIBRARY_DIR 39 | libHalf.so 40 | HINTS 41 | "${OPENEXR_LOCATION}" 42 | "$ENV{OPENEXR_LOCATION}" 43 | "${OPENEXR_BASE_DIR}" 44 | PATH_SUFFIXES 45 | lib/ 46 | DOC 47 | "OpenEXR library path" 48 | ) 49 | elseif (WIN32) 50 | find_path(OPENEXR_LIBRARY_DIR 51 | Half.lib 52 | HINTS 53 | "${OPENEXR_LOCATION}" 54 | "$ENV{OPENEXR_LOCATION}" 55 | "${OPENEXR_BASE_DIR}" 56 | PATH_SUFFIXES 57 | lib/ 58 | DOC 59 | "OpenEXR library path" 60 | ) 61 | endif() 62 | mark_as_advanced(OPENEXR_LIBRARY_DIR) 63 | 64 | find_path(OPENEXR_INCLUDE_DIR 65 | OpenEXR/half.h 66 | HINTS 67 | "${OPENEXR_LOCATION}" 68 | "$ENV{OPENEXR_LOCATION}" 69 | "${OPENEXR_BASE_DIR}" 70 | PATH_SUFFIXES 71 | include/ 72 | DOC 73 | "OpenEXR headers path" 74 | ) 75 | 76 | if(OPENEXR_INCLUDE_DIR AND EXISTS "${OPENEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h") 77 | file(STRINGS 78 | ${OPENEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h 79 | TMP 80 | REGEX "#define OPENEXR_VERSION_STRING.*$") 81 | string(REGEX MATCHALL "[0-9.]+" OPENEXR_VERSION ${TMP}) 82 | mark_as_advanced(OPENEXR_INCLUDE_DIR) 83 | endif() 84 | 85 | 86 | foreach(OPENEXR_LIB 87 | Half 88 | Iex 89 | IexMath 90 | Imath 91 | IlmImf 92 | IlmThread 93 | ) 94 | 95 | find_library(OPENEXR_${OPENEXR_LIB}_LIBRARY 96 | ${OPENEXR_LIB} 97 | HINTS 98 | "${OPENEXR_LOCATION}" 99 | "$ENV{OPENEXR_LOCATION}" 100 | "${OPENEXR_BASE_DIR}" 101 | PATH_SUFFIXES 102 | lib/ 103 | DOC 104 | "OPENEXR's ${OPENEXR_LIB} library path" 105 | ) 106 | mark_as_advanced(OPENEXR_${OPENEXR_LIB}_LIBRARY) 107 | 108 | if(OPENEXR_${OPENEXR_LIB}_LIBRARY) 109 | list(APPEND OPENEXR_LIBRARIES ${OPENEXR_${OPENEXR_LIB}_LIBRARY}) 110 | endif() 111 | endforeach(OPENEXR_LIB) 112 | 113 | # So #include works 114 | list(APPEND OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR}) 115 | list(APPEND OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR}/OpenEXR) 116 | 117 | include(FindPackageHandleStandardArgs) 118 | find_package_handle_standard_args(OpenEXR 119 | REQUIRED_VARS 120 | OPENEXR_INCLUDE_DIRS 121 | OPENEXR_LIBRARY_DIR 122 | VERSION_VAR 123 | OPENEXR_VERSION 124 | ) 125 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/cmake/FindTBB.cmake: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | # 3 | # Copyright (c) 2015 Justus Calvin 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | # 24 | # FindTBB 25 | # ------- 26 | # 27 | # Find TBB include directories and libraries. 28 | # 29 | # Usage: 30 | # 31 | # find_package(TBB [major[.minor]] [EXACT] 32 | # [QUIET] [REQUIRED] 33 | # [[COMPONENTS] [components...]] 34 | # [OPTIONAL_COMPONENTS components...]) 35 | # 36 | # where the allowed components are tbbmalloc and tbb_preview. Users may modify 37 | # the behavior of this module with the following variables: 38 | # 39 | # * TBB_ROOT_DIR - The base directory the of TBB installation. 40 | # * TBB_INCLUDE_DIR - The directory that contains the TBB headers files. 41 | # * TBB_LIBRARY - The directory that contains the TBB library files. 42 | # * TBB__LIBRARY - The path of the TBB the corresponding TBB library. 43 | # These libraries, if specified, override the 44 | # corresponding library search results, where 45 | # may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug, 46 | # tbb_preview, or tbb_preview_debug. 47 | # * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will 48 | # be used instead of the release version. 49 | # 50 | # Users may modify the behavior of this module with the following environment 51 | # variables: 52 | # 53 | # * TBB_INSTALL_DIR 54 | # * TBBROOT 55 | # * LIBRARY_PATH 56 | # 57 | # This module will set the following variables: 58 | # 59 | # * TBB_FOUND - Set to false, or undefined, if we haven’t found, or 60 | # don’t want to use TBB. 61 | # * TBB__FOUND - If False, optional part of TBB sytem is 62 | # not available. 63 | # * TBB_VERSION - The full version string 64 | # * TBB_VERSION_MAJOR - The major version 65 | # * TBB_VERSION_MINOR - The minor version 66 | # * TBB_INTERFACE_VERSION - The interface version number defined in 67 | # tbb/tbb_stddef.h. 68 | # * TBB__LIBRARY_RELEASE - The path of the TBB release version of 69 | # , where may be tbb, tbb_debug, 70 | # tbbmalloc, tbbmalloc_debug, tbb_preview, or 71 | # tbb_preview_debug. 72 | # * TBB__LIBRARY_DEGUG - The path of the TBB release version of 73 | # , where may be tbb, tbb_debug, 74 | # tbbmalloc, tbbmalloc_debug, tbb_preview, or 75 | # tbb_preview_debug. 76 | # 77 | # The following varibles should be used to build and link with TBB: 78 | # 79 | # * TBB_INCLUDE_DIRS - The include directory for TBB. 80 | # * TBB_LIBRARIES - The libraries to link against to use TBB. 81 | # * TBB_DEFINITIONS - Definitions to use when compiling code that uses TBB. 82 | 83 | include(FindPackageHandleStandardArgs) 84 | 85 | if(NOT TBB_FOUND) 86 | 87 | ################################## 88 | # Check the build type 89 | ################################## 90 | 91 | if(NOT DEFINED TBB_USE_DEBUG_BUILD) 92 | if(CMAKE_BUILD_TYPE MATCHES "Debug|DEBUG|debug") 93 | set(TBB_USE_DEBUG_BUILD TRUE) 94 | else() 95 | set(TBB_USE_DEBUG_BUILD FALSE) 96 | endif() 97 | endif() 98 | 99 | ################################## 100 | # Set the TBB search directories 101 | ################################## 102 | 103 | # Define search paths based on user input and environment variables 104 | set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT}) 105 | 106 | # Define the search directories based on the current platform 107 | if(CMAKE_SYSTEM_NAME STREQUAL "Windows") 108 | set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB" 109 | "C:/Program Files (x86)/Intel/TBB") 110 | # TODO: Set the proper suffix paths based on compiler introspection. 111 | 112 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") 113 | # OS X 114 | set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") 115 | 116 | # TODO: Check to see which C++ library is being used by the compiler. 117 | if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0) 118 | # The default C++ library on OS X 10.9 and later is libc++ 119 | set(TBB_LIB_PATH_SUFFIX "lib/libc++") 120 | else() 121 | set(TBB_LIB_PATH_SUFFIX "lib") 122 | endif() 123 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") 124 | # Linux 125 | set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb") 126 | 127 | # TODO: Check compiler version to see the suffix should be /gcc4.1 or 128 | # /gcc4.1. For now, assume that the compiler is more recent than 129 | # gcc 4.4.x or later. 130 | if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") 131 | set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4") 132 | elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") 133 | set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4") 134 | endif() 135 | endif() 136 | 137 | ################################## 138 | # Find the TBB include dir 139 | ################################## 140 | 141 | find_path(TBB_INCLUDE_DIRS tbb/tbb.h 142 | HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR} 143 | PATHS ${TBB_DEFAULT_SEARCH_DIR} 144 | PATH_SUFFIXES include) 145 | 146 | ################################## 147 | # Find TBB components 148 | ################################## 149 | 150 | # Find each component 151 | foreach(_comp tbb_preview tbbmalloc tbb) 152 | # Search for the libraries 153 | find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp} 154 | HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} 155 | PATHS ${TBB_DEFAULT_SEARCH_DIR} 156 | PATH_SUFFIXES "${TBB_LIB_PATH_SUFFIX}") 157 | 158 | find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug 159 | HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR} 160 | PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH 161 | PATH_SUFFIXES "${TBB_LIB_PATH_SUFFIX}") 162 | 163 | 164 | # Set the library to be used for the component 165 | if(NOT TBB_${_comp}_LIBRARY) 166 | if(TBB_USE_DEBUG_BUILD AND TBB_${_comp}_LIBRARY_DEBUG) 167 | set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_DEBUG}") 168 | elseif(TBB_${_comp}_LIBRARY_RELEASE) 169 | set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_RELEASE}") 170 | elseif(TBB_${_comp}_LIBRARY_DEBUG) 171 | set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_DEBUG}") 172 | endif() 173 | endif() 174 | 175 | # Set the TBB library list and component found variables 176 | if(TBB_${_comp}_LIBRARY) 177 | list(APPEND TBB_LIBRARIES "${TBB_${_comp}_LIBRARY}") 178 | set(TBB_${_comp}_FOUND TRUE) 179 | else() 180 | set(TBB_${_comp}_FOUND FALSE) 181 | endif() 182 | 183 | mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE) 184 | mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG) 185 | mark_as_advanced(TBB_${_comp}_LIBRARY) 186 | 187 | endforeach() 188 | 189 | ################################## 190 | # Set compile flags 191 | ################################## 192 | 193 | if(TBB_tbb_LIBRARY MATCHES "debug") 194 | set(TBB_DEFINITIONS "-DTBB_USE_DEBUG=1") 195 | endif() 196 | 197 | ################################## 198 | # Set version strings 199 | ################################## 200 | 201 | if(TBB_INCLUDE_DIRS) 202 | file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file) 203 | string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" 204 | TBB_VERSION_MAJOR "${_tbb_version_file}") 205 | string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" 206 | TBB_VERSION_MINOR "${_tbb_version_file}") 207 | string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" 208 | TBB_INTERFACE_VERSION "${_tbb_version_file}") 209 | set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") 210 | endif() 211 | 212 | find_package_handle_standard_args(TBB 213 | REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES 214 | HANDLE_COMPONENTS 215 | VERSION_VAR TBB_VERSION) 216 | 217 | mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES) 218 | 219 | endif() 220 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/cmake/ISPC.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeParseArguments) 2 | 3 | option(ENABLE_ISPC "Use Intel ISPC to generate SIMDified code. It can significantly boost performance." ON) 4 | set(ISPC "/usr/local/bin/ispc" CACHE PATH "Path to Intel ISPC") 5 | mark_as_advanced(FORCE ISPC) 6 | 7 | function(setup_ispc) 8 | if(EXISTS ${ISPC}) 9 | return() 10 | endif() 11 | 12 | set(ISPC_VERSION 1.11.0) 13 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 14 | set(ISPC_DIR "ispc-v${ISPC_VERSION}-linux") 15 | set(ISPC_ARCHIVE_FILE "ispc-v${ISPC_VERSION}-linux.tar.gz") 16 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") 17 | set(ISPC_DIR "ispc-v${ISPC_VERSION}-macOS") 18 | set(ISPC_ARCHIVE_FILE "ispc-v${ISPC_VERSION}-macOS.tar.gz") 19 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") 20 | set(ISPC_DIR "ispc-${ISPC_VERSION}-windows") 21 | set(ISPC_ARCHIVE_FILE "ispc-v${ISPC_VERSION}-windows.zip") 22 | endif() 23 | set(ISPC "${CMAKE_BINARY_DIR}/${ISPC_DIR}/bin/ispc" CACHE PATH "" FORCE) 24 | 25 | set(ISPC_ARCHIVE_URL "http://downloads.sourceforge.net/project/ispcmirror/v${ISPC_VERSION}/${ISPC_ARCHIVE_FILE}") 26 | set(ISPC_ARCHIVE_PATH "${CMAKE_BINARY_DIR}/${ISPC_ARCHIVE_FILE}") 27 | if(NOT EXISTS ${ISPC_ARCHIVE_PATH}) 28 | file(DOWNLOAD ${ISPC_ARCHIVE_URL} ${ISPC_ARCHIVE_PATH} SHOW_PROGRESS) 29 | endif() 30 | execute_process( 31 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 32 | COMMAND tar -xf ${ISPC_ARCHIVE_PATH} 33 | ) 34 | endfunction() 35 | 36 | # e.g: 37 | #add_ispc_targets( 38 | # SOURCES "src1.ispc" "src2.ispc" 39 | # HEADERS "header1.h" "header2.h" 40 | # OUTDIR "path/to/outputs") 41 | function(add_ispc_targets) 42 | cmake_parse_arguments(arg "" "OUTDIR" "SOURCES;HEADERS" ${ARGN}) 43 | 44 | foreach(source ${arg_SOURCES}) 45 | get_filename_component(name ${source} NAME_WE) 46 | set(header "${arg_OUTDIR}/${name}.h") 47 | set(object "${arg_OUTDIR}/${name}${CMAKE_CXX_OUTPUT_EXTENSION}") 48 | set(objects 49 | ${object} 50 | "${arg_OUTDIR}/${name}_sse4${CMAKE_CXX_OUTPUT_EXTENSION}" 51 | "${arg_OUTDIR}/${name}_avx${CMAKE_CXX_OUTPUT_EXTENSION}" 52 | "${arg_OUTDIR}/${name}_avx512skx${CMAKE_CXX_OUTPUT_EXTENSION}" 53 | ) 54 | set(outputs ${header} ${objects}) 55 | add_custom_command( 56 | OUTPUT ${outputs} 57 | COMMAND ${ISPC} ${source} -o ${object} -h ${header} --pic --target=sse4-i32x4,avx1-i32x8,avx512skx-i32x16 --arch=x86-64 --opt=fast-masked-vload --opt=fast-math --wno-perf 58 | DEPENDS ${source} ${arg_HEADERS} 59 | ) 60 | 61 | list(APPEND _ispc_headers ${header}) 62 | list(APPEND _ispc_objects ${objects}) 63 | list(APPEND _ispc_outputs ${outputs}) 64 | endforeach() 65 | 66 | set(_ispc_headers ${_ispc_headers} PARENT_SCOPE) 67 | set(_ispc_objects ${_ispc_objects} PARENT_SCOPE) 68 | set(_ispc_outputs ${_ispc_outputs} PARENT_SCOPE) 69 | 70 | execute_process(COMMAND mkdir -p ${arg_OUTDIR}) 71 | foreach(f ${_ispc_outputs}) 72 | if(NOT EXISTS ${f}) 73 | execute_process(COMMAND touch -t 200001010000 ${f}) 74 | endif() 75 | endforeach() 76 | endfunction() 77 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo "downloading external libararies..." 4 | powershell.exe -Command "[System.Net.ServicePointManager]::SecurityProtocol=[System.Net.SecurityProtocolType]::Tls12; wget https://github.com/unity3d-jp/BlendShapeBuilder/releases/download/20171228/External.7z -OutFile External/External.7z" 5 | cd External 6 | 7z\7za.exe x -aos External.7z 7 | cd .. 8 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/setup.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Release 6 | Win32 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 15 | Document 16 | %(Identity) 17 | External\External.7z 18 | %(Identity) 19 | false 20 | 21 | 22 | 23 | {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D} 24 | MakeFileProj 25 | 10.0.17763.0 26 | 27 | 28 | 29 | Utility 30 | true 31 | v141 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | $(SolutionDir)_out\setup\ 40 | $(SolutionDir)_tmp\setup\ 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/Plugin/toolchan.bat: -------------------------------------------------------------------------------- 1 | for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" /version 15.0 /property installationPath`) do ( 2 | set VSDIR=%%i 3 | ) 4 | call "%VSDIR%\Common7\Tools\VsDevCmd.bat" 5 | cd %~dp0 6 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.1.0f2 2 | m_EditorVersionWithRevision: 2019.1.0f2 (292b93d75a2c) 3 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 1 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /.BlendShapeBuilder/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.h text 3 | *.c text 4 | *.hpp text 5 | *.cpp text 6 | 7 | *.bat text eol=crlf 8 | *.sln text eol=crlf 9 | *.vcxproj text eol=crlf 10 | *.vcxproj.filters text eol=crlf 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.DS_Store 3 | *.unitypackage 4 | 5 | .vs/ 6 | _out/ 7 | _tmp/ 8 | _build_*/ 9 | external/ 10 | Library/ 11 | obj/ 12 | Temp/ 13 | Build/ 14 | TestLocal/ 15 | TestLocal.meta 16 | 17 | .BlendShapeBuilder/*.csproj 18 | .BlendShapeBuilder/*.sln -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58ba1391e8e6a80469c8f1c2935ac454 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34a7855c0a080cd4b9a240d0fee84363 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor/BlendShapeBuilderEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Collections; 4 | using UTJ.BlendShapeBuilder; 5 | 6 | namespace UTJ.BlendShapeBuilderEditor 7 | { 8 | [CustomEditor(typeof(UTJ.BlendShapeBuilder.BlendShapeBuilder))] 9 | public class BlendShapeBuilderEditor : Editor 10 | { 11 | public override void OnInspectorGUI() 12 | { 13 | if (GUILayout.Button("Open Window")) 14 | BlendShapeBuilderWindow.Open(); 15 | 16 | EditorGUILayout.Space(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor/BlendShapeBuilderEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37f528b317f3d3b46812c3a3420c0dc8 3 | timeCreated: 1515524029 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor/BlendShapeBuilderWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 197140fd03e2bb541bfddfbef4134230 3 | timeCreated: 1513333291 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor/BlendShapeInspectorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 385803b28f2ddc24f897b2555a414737 3 | timeCreated: 1513560357 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor/UTJ.BlendShapeBuilderEditor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTJ.BlendShapeBuilderEditor", 3 | "references": [ 4 | "UTJ.BlendShapeBuilder", 5 | "UTJ.VertexTweaker", 6 | "UTJ.VertexTweakerEditor" 7 | ], 8 | "optionalUnityReferences": [], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": false, 15 | "precompiledReferences": [], 16 | "autoReferenced": true, 17 | "defineConstraints": [] 18 | } -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Editor/UTJ.BlendShapeBuilderEditor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f65517f7e897e31478aef8e2ef876c96 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75fc855d588312e44be59ad7c6771379 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec77776a0dd3d4d439b32878747a87f1 3 | folderAsset: yes 4 | timeCreated: 1513333291 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/Scripts/BlendShapeBuilder.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UTJ.BlendShapeBuilder 4 | { 5 | [ExecuteInEditMode] 6 | public class BlendShapeBuilder : MonoBehaviour 7 | { 8 | #if UNITY_EDITOR 9 | [SerializeField] BlendShapeBuilderData m_data = new BlendShapeBuilderData(); 10 | 11 | 12 | public BlendShapeBuilderData data { get { return m_data; } } 13 | 14 | void Reset() 15 | { 16 | if (m_data == null) 17 | m_data = new BlendShapeBuilderData(); 18 | if (m_data.baseMesh == null) 19 | m_data.baseMesh = gameObject; 20 | if (m_data.blendShapeData.Count == 0) 21 | m_data.blendShapeData.Add(new BlendShapeData { name = "NewBlendShape0" }); 22 | 23 | } 24 | #endif 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/Scripts/BlendShapeBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be42bdfc267c79a4b8955aa201006f81 3 | timeCreated: 1515521784 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/Scripts/BlendShapeBuilderData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | #if UNITY_EDITOR 5 | namespace UTJ.BlendShapeBuilder 6 | { 7 | [Serializable] 8 | public class BlendShapeFrameData 9 | { 10 | public float weight = 100.0f; 11 | public UnityEngine.Object mesh; 12 | public bool vertex = true; 13 | public bool normal = true; 14 | public bool tangent = true; 15 | } 16 | 17 | [Serializable] 18 | public class BlendShapeData 19 | { 20 | public bool fold = true; 21 | public string name = ""; 22 | public List frames = new List(); 23 | 24 | public void ClearInvalidFrames() 25 | { 26 | frames.RemoveAll(item => { return item.mesh == null; }); 27 | } 28 | 29 | public void NormalizeWeights() 30 | { 31 | int n = frames.Count; 32 | float step = 100.0f / n; 33 | for (int i = 0; i < n; ++i) 34 | { 35 | frames[i].weight = step * (i + 1); 36 | } 37 | } 38 | 39 | public void SortByWeights() 40 | { 41 | frames.Sort((x, y) => x.weight.CompareTo(y.weight)); 42 | } 43 | } 44 | 45 | [Serializable] 46 | public class BlendShapeBuilderData 47 | { 48 | public UnityEngine.Object baseMesh; 49 | public bool preserveExistingBlendShapes = false; 50 | public List blendShapeData = new List(); 51 | } 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/Scripts/BlendShapeBuilderData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0973484e77d2fb45b910d8acec902e0 3 | timeCreated: 1513584901 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/UTJ.BlendShapeBuilder.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTJ.BlendShapeBuilder", 3 | "references": [ 4 | "UTJ.VertexTweaker" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /Assets/BlendShapeBuilder/Runtime/UTJ.BlendShapeBuilder.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5173b14e55eba024da4e9b4309739202 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VertexTweaker.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3b78dad07a879149a99ebb1eaa90d6c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 224fa798f01a19b4194a1319866c34f4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/ObjExporter.cs: -------------------------------------------------------------------------------- 1 | // based on http://wiki.unity3d.com/index.php?title=ExportOBJ (thanks!) 2 | 3 | using UnityEngine; 4 | using System.IO; 5 | using System.Text; 6 | 7 | namespace UTJ.VertexTweaker 8 | { 9 | public class ObjExporter 10 | { 11 | public class Settings 12 | { 13 | public bool includeChildren = true; 14 | public bool makeSubmeshes = true; 15 | public bool applyTransform = true; 16 | public bool flipHandedness = true; 17 | public bool flipFaces = false; 18 | 19 | public bool normals = true; 20 | public bool uv = true; 21 | } 22 | 23 | public static bool Export(GameObject go, string path, Settings settings) 24 | { 25 | if (path == null || path.Length == 0 || go == null) 26 | return false; 27 | 28 | var inst = new ObjExporter(); 29 | inst.DoExport(go, path, settings); 30 | return true; 31 | } 32 | 33 | 34 | Settings m_settings; 35 | int m_startIndex; 36 | 37 | void DoExport(GameObject go, string path, Settings settings) 38 | { 39 | m_settings = settings; 40 | 41 | StringBuilder meshString = new StringBuilder(); 42 | meshString.Append("#" + go.name + ".obj" 43 | + "\n#" + System.DateTime.Now.ToLongDateString() 44 | + "\n#" + System.DateTime.Now.ToLongTimeString() 45 | + "\n#-------" 46 | + "\n\n"); 47 | 48 | Transform t = go.transform; 49 | Vector3 originalPosition = t.position; 50 | t.position = Vector3.zero; 51 | 52 | if (!m_settings.makeSubmeshes) 53 | meshString.Append("g ").Append(t.name).Append("\n"); 54 | meshString.Append(ProcessTransform(t, m_settings.makeSubmeshes)); 55 | 56 | WriteToFile(meshString.ToString(), path); 57 | 58 | t.position = originalPosition; 59 | 60 | Debug.Log("Exported Mesh: " + path); 61 | } 62 | 63 | 64 | string ProcessTransform(Transform t, bool makeSubmeshes) 65 | { 66 | StringBuilder meshString = new StringBuilder(); 67 | 68 | meshString.Append("#" + t.name 69 | + "\n#-------" 70 | + "\n"); 71 | 72 | if (makeSubmeshes) 73 | meshString.Append("g ").Append(t.name).Append("\n"); 74 | 75 | Mesh mesh = null; 76 | Material[] materials = null; 77 | { 78 | var mf = t.GetComponent(); 79 | if (mf != null) 80 | mesh = mf.sharedMesh; 81 | else 82 | { 83 | var smi = t.GetComponent(); 84 | if (smi != null) 85 | mesh = smi.sharedMesh; 86 | } 87 | 88 | var renderer = t.GetComponent(); 89 | if (renderer != null) 90 | materials = renderer.sharedMaterials; 91 | } 92 | 93 | if (mesh != null) 94 | meshString.Append(MeshToString(mesh, materials, t)); 95 | 96 | if (m_settings.includeChildren) 97 | { 98 | for (int i = 0; i < t.childCount; i++) 99 | meshString.Append(ProcessTransform(t.GetChild(i), makeSubmeshes)); 100 | } 101 | 102 | return meshString.ToString(); 103 | } 104 | 105 | string MeshToString(Mesh mesh, Material[] mats, Transform t) 106 | { 107 | if (!mesh) 108 | return "####Error####"; 109 | 110 | Vector3[] points = mesh.vertices; 111 | Vector3[] normals = m_settings.normals ? mesh.normals : null; 112 | Vector2[] uv = m_settings.uv ? mesh.uv : null; 113 | 114 | if (m_settings.applyTransform && t != null) 115 | { 116 | if (points != null) 117 | { 118 | for (int i = 0; i < points.Length; ++i) 119 | points[i] = t.TransformPoint(points[i]); 120 | } 121 | if (normals != null) 122 | { 123 | for (int i = 0; i < normals.Length; ++i) 124 | normals[i] = t.TransformVector(normals[i]); 125 | } 126 | 127 | } 128 | if (m_settings.flipHandedness) 129 | { 130 | if (points != null) 131 | { 132 | for (int i = 0; i < points.Length; ++i) 133 | points[i].x *= -1.0f; 134 | } 135 | if (normals != null) 136 | { 137 | for (int i = 0; i < normals.Length; ++i) 138 | normals[i].x *= -1.0f; 139 | } 140 | } 141 | 142 | StringBuilder sb = new StringBuilder(); 143 | 144 | if (points != null) 145 | { 146 | foreach (Vector3 v in points) 147 | sb.Append(string.Format("v {0} {1} {2}\n", v.x, v.y, v.z)); 148 | sb.Append("\n"); 149 | } 150 | if (normals != null) 151 | { 152 | foreach (Vector3 n in normals) 153 | sb.Append(string.Format("vn {0} {1} {2}\n", n.x, n.y, n.z)); 154 | sb.Append("\n"); 155 | } 156 | if (uv != null) 157 | { 158 | foreach (Vector3 u in uv) 159 | sb.Append(string.Format("vt {0} {1}\n", u.x, u.y)); 160 | } 161 | 162 | int i1 = m_settings.flipFaces ? 2 : 1; 163 | int i2 = m_settings.flipFaces ? 1 : 2; 164 | string format = ""; 165 | { 166 | int numComponents = 0; 167 | if (points != null && points.Length > 0) ++numComponents; 168 | if (normals != null && normals.Length > 0) ++numComponents; 169 | if (uv != null && uv.Length > 0) ++numComponents; 170 | 171 | switch (numComponents) 172 | { 173 | case 1: format = "f {0} {1} {2}\n"; break; 174 | case 2: format = "f {0}/{0} {1}/{1} {2}/{2}\n"; break; 175 | case 3: format = "f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n"; break; 176 | } 177 | } 178 | 179 | for (int sm = 0; sm < mesh.subMeshCount; sm++) 180 | { 181 | sb.Append("\n"); 182 | if (mats != null && sm < mats.Length) 183 | { 184 | sb.Append("usemtl ").Append(mats[sm].name).Append("\n"); 185 | sb.Append("usemap ").Append(mats[sm].name).Append("\n"); 186 | } 187 | 188 | int[] triangles = mesh.GetTriangles(sm); 189 | for (int i = 0; i < triangles.Length; i += 3) 190 | { 191 | sb.Append(string.Format(format, 192 | triangles[i] + 1 + m_startIndex, triangles[i + i1] + 1 + m_startIndex, triangles[i + i2] + 1 + m_startIndex)); 193 | } 194 | } 195 | 196 | m_startIndex += points.Length; 197 | return sb.ToString(); 198 | } 199 | 200 | void WriteToFile(string s, string filename) 201 | { 202 | using (StreamWriter sw = new StreamWriter(filename)) 203 | sw.Write(s); 204 | } 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/ObjExporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fd5ce37a913a0f4f98f48d0da66a780 3 | timeCreated: 1515271134 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/UTJ.VertexTweakerEditor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTJ.VertexTweakerEditor", 3 | "references": [ 4 | "UTJ.VertexTweaker" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [] 16 | } -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/UTJ.VertexTweakerEditor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e2f921f1db032445b8ac0533a7a9c45 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/VertexTweakerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Collections; 4 | using UTJ.VertexTweaker; 5 | 6 | namespace UTJ.VertexTweakerEditor 7 | { 8 | [CustomEditor(typeof(UTJ.VertexTweaker.VertexTweaker))] 9 | public class VertexTweakerEditor : Editor 10 | { 11 | public override void OnInspectorGUI() 12 | { 13 | if (GUILayout.Button("Open Window")) 14 | VertexTweakerWindow.Open(); 15 | 16 | EditorGUILayout.Space(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/VertexTweakerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69931c9db654317449e2e0a619cfea1f 3 | timeCreated: 1515269697 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Editor/VertexTweakerWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b9b6fc14ee35ab47adcd57c6a914c9f 3 | timeCreated: 1515226558 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7c3d4312cb06c345be7d22e9ebc78b0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52b43b00a13da2444ac325b46060fa15 3 | folderAsset: yes 4 | timeCreated: 1515638751 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Data/DefaultSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 322113ad21ec853419f1b961f63c1d62, type: 3} 12 | m_Name: DefaultSettings 13 | m_EditorClassIdentifier: 14 | normalMode: 2 15 | tangentsMode: 1 16 | tangentsPrecision: 0 17 | editMode: 0 18 | selectMode: 1 19 | mirrorMode: 0 20 | mirrorEpsilon: 0.0001 21 | selectFrontSideOnly: 1 22 | selectVertex: 1 23 | selectTriangle: 0 24 | brushData: 25 | - maxRadius: 3 26 | radius: 0.4 27 | strength: 1 28 | curve: 29 | serializedVersion: 2 30 | m_Curve: 31 | - serializedVersion: 2 32 | time: 0 33 | value: 0 34 | inSlope: 0 35 | outSlope: 0 36 | tangentMode: 0 37 | - serializedVersion: 2 38 | time: 1 39 | value: 1 40 | inSlope: 0 41 | outSlope: 0 42 | tangentMode: 0 43 | m_PreInfinity: 2 44 | m_PostInfinity: 2 45 | m_RotationOrder: 4 46 | - maxRadius: 3 47 | radius: 0.4 48 | strength: 1 49 | curve: 50 | serializedVersion: 2 51 | m_Curve: 52 | - serializedVersion: 2 53 | time: 0 54 | value: 0 55 | inSlope: 2 56 | outSlope: 2 57 | tangentMode: 0 58 | - serializedVersion: 2 59 | time: 1 60 | value: 1 61 | inSlope: 0 62 | outSlope: 0 63 | tangentMode: 0 64 | m_PreInfinity: 2 65 | m_PostInfinity: 2 66 | m_RotationOrder: 4 67 | - maxRadius: 3 68 | radius: 0.4 69 | strength: 1 70 | curve: 71 | serializedVersion: 2 72 | m_Curve: 73 | - serializedVersion: 2 74 | time: 0 75 | value: 0 76 | inSlope: 0 77 | outSlope: 0 78 | tangentMode: 0 79 | - serializedVersion: 2 80 | time: 1 81 | value: 1 82 | inSlope: 2 83 | outSlope: 2 84 | tangentMode: 0 85 | m_PreInfinity: 2 86 | m_PostInfinity: 2 87 | m_RotationOrder: 4 88 | - maxRadius: 3 89 | radius: 0.4 90 | strength: 1 91 | curve: 92 | serializedVersion: 2 93 | m_Curve: 94 | - serializedVersion: 2 95 | time: 0 96 | value: 0 97 | inSlope: 1 98 | outSlope: 1 99 | tangentMode: 0 100 | - serializedVersion: 2 101 | time: 1 102 | value: 1 103 | inSlope: 1 104 | outSlope: 1 105 | tangentMode: 0 106 | m_PreInfinity: 2 107 | m_PostInfinity: 2 108 | m_RotationOrder: 4 109 | - maxRadius: 3 110 | radius: 0.4 111 | strength: 1 112 | curve: 113 | serializedVersion: 2 114 | m_Curve: 115 | - serializedVersion: 2 116 | time: 0 117 | value: 0 118 | inSlope: 1 119 | outSlope: 1 120 | tangentMode: 0 121 | - serializedVersion: 2 122 | time: 0.5291646 123 | value: 0.91250294 124 | inSlope: 0.27909 125 | outSlope: 0.27909 126 | tangentMode: 0 127 | - serializedVersion: 2 128 | time: 1 129 | value: 0.32500458 130 | inSlope: -0.11999009 131 | outSlope: -0.11999009 132 | tangentMode: 0 133 | m_PreInfinity: 2 134 | m_PostInfinity: 2 135 | m_RotationOrder: 4 136 | showVertices: 1 137 | showNormals: 0 138 | showTangents: 0 139 | showBinormals: 0 140 | visualize: 1 141 | showSelectedOnly: 0 142 | showBrushRange: 1 143 | modelOverlay: 0 144 | vertexSize: 0.0075 145 | normalSize: 0.1 146 | tangentSize: 0.075 147 | binormalSize: 0.06 148 | vertexColor: {r: 0.15, g: 0.15, b: 0.3, a: 0.75} 149 | vertexColor2: {r: 1, g: 0, b: 0, a: 0.75} 150 | vertexColor3: {r: 0, g: 1, b: 1, a: 1} 151 | normalColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} 152 | tangentColor: {r: 0, g: 1, b: 1, a: 1} 153 | binormalColor: {r: 0, g: 1, b: 0, a: 1} 154 | foldEdit: 1 155 | foldSelect: 1 156 | foldMisc: 1 157 | foldExport: 1 158 | foldDisplay: 1 159 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Data/DefaultSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b3ba32ae87b3a94e9cf70157c96f58a 3 | timeCreated: 1515638755 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 11400000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a2b4375d068e5a4094300f8271fd268 3 | folderAsset: yes 4 | timeCreated: 1515714469 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 962bff73c754d034b867131d92508bde 3 | folderAsset: yes 4 | timeCreated: 1515714469 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8da6f5f15c78c1747ad0e84e90056a73 3 | folderAsset: yes 4 | timeCreated: 1515966952 5 | licenseType: Pro 6 | PluginImporter: 7 | externalObjects: {} 8 | serializedVersion: 2 9 | iconMap: {} 10 | executionOrder: {} 11 | isPreloaded: 0 12 | isOverridable: 0 13 | platformData: 14 | - first: 15 | '': OSXIntel 16 | second: 17 | enabled: 0 18 | settings: 19 | CPU: None 20 | - first: 21 | '': OSXIntel64 22 | second: 23 | enabled: 1 24 | settings: 25 | CPU: AnyCPU 26 | - first: 27 | Any: 28 | second: 29 | enabled: 1 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 0 35 | settings: 36 | CPU: x86_64 37 | DefaultValueInitialized: true 38 | - first: 39 | Facebook: Win 40 | second: 41 | enabled: 0 42 | settings: 43 | CPU: None 44 | - first: 45 | Facebook: Win64 46 | second: 47 | enabled: 1 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Standalone: Linux 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: None 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 1 60 | settings: 61 | CPU: x86_64 62 | - first: 63 | Standalone: LinuxUniversal 64 | second: 65 | enabled: 1 66 | settings: 67 | CPU: x86_64 68 | - first: 69 | Standalone: OSXUniversal 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: x86_64 74 | - first: 75 | Standalone: Win 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: None 80 | - first: 81 | Standalone: Win64 82 | second: 83 | enabled: 1 84 | settings: 85 | CPU: AnyCPU 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0f685de3d7b13246a13d85c5bcfd032 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | VertexTweakerCore 9 | CFBundleGetInfoString 10 | 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | 19 | CFBundleName 20 | 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 29 | CSResourcesFileMapped 30 | 31 | NSHumanReadableCopyright 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e821b0278554bda499839c8740e2d303 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b98ba698686cc794fab2cf41b1cd4df3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents/MacOS/VertexTweakerCore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity3d-jp/BlendShapeBuilder/bf04aceb946c20ec18fa9aa437b9b35102d92867/Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents/MacOS/VertexTweakerCore -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.bundle/Contents/MacOS/VertexTweakerCore.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: def90d9aab586c94dbbc7ef22fdf4852 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity3d-jp/BlendShapeBuilder/bf04aceb946c20ec18fa9aa437b9b35102d92867/Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.dll -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/VertexTweakerCore.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a42cde6695acb404ebae968b440e1e36 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': OSXIntel 16 | second: 17 | enabled: 0 18 | settings: 19 | CPU: None 20 | - first: 21 | '': OSXIntel64 22 | second: 23 | enabled: 1 24 | settings: 25 | CPU: AnyCPU 26 | - first: 27 | Any: 28 | second: 29 | enabled: 1 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 0 35 | settings: 36 | CPU: x86_64 37 | DefaultValueInitialized: true 38 | - first: 39 | Facebook: Win 40 | second: 41 | enabled: 0 42 | settings: 43 | CPU: None 44 | - first: 45 | Facebook: Win64 46 | second: 47 | enabled: 1 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Standalone: Linux 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: None 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 1 60 | settings: 61 | CPU: x86_64 62 | - first: 63 | Standalone: LinuxUniversal 64 | second: 65 | enabled: 1 66 | settings: 67 | CPU: x86_64 68 | - first: 69 | Standalone: OSXUniversal 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: x86_64 74 | - first: 75 | Standalone: Win 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: None 80 | - first: 81 | Standalone: Win64 82 | second: 83 | enabled: 1 84 | settings: 85 | CPU: AnyCPU 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/libVertexTweakerCore.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity3d-jp/BlendShapeBuilder/bf04aceb946c20ec18fa9aa437b9b35102d92867/Assets/VertexTweaker/Runtime/Plugins/x86_64/libVertexTweakerCore.so -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Plugins/x86_64/libVertexTweakerCore.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7064653f5dffb1b49a27566e933a3301 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | CPU: x86_64 25 | DefaultValueInitialized: true 26 | - first: 27 | Facebook: Win 28 | second: 29 | enabled: 0 30 | settings: 31 | CPU: None 32 | - first: 33 | Facebook: Win64 34 | second: 35 | enabled: 1 36 | settings: 37 | CPU: AnyCPU 38 | - first: 39 | Standalone: Linux 40 | second: 41 | enabled: 0 42 | settings: 43 | CPU: None 44 | - first: 45 | Standalone: Linux64 46 | second: 47 | enabled: 1 48 | settings: 49 | CPU: x86_64 50 | - first: 51 | Standalone: LinuxUniversal 52 | second: 53 | enabled: 1 54 | settings: 55 | CPU: x86_64 56 | - first: 57 | Standalone: OSXUniversal 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: x86_64 62 | - first: 63 | Standalone: Win 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: None 68 | - first: 69 | Standalone: Win64 70 | second: 71 | enabled: 1 72 | settings: 73 | CPU: AnyCPU 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92ca1885cf50ae141a94dd66003a494b 3 | folderAsset: yes 4 | timeCreated: 1515714469 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/PinnedArray.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68d206a7b310336408d0f91054b6f5cf 3 | timeCreated: 1515111618 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/Utils.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEngine; 3 | using UnityEditor; 4 | using System.Text.RegularExpressions; 5 | using System.Collections.Generic; 6 | 7 | namespace UTJ.VertexTweaker 8 | { 9 | public static class Utils 10 | { 11 | public static GameObject MeshToGameObject(Mesh mesh, Vector3 pos, Material[] materials) 12 | { 13 | if (materials == null) 14 | materials = new Material[1] { AssetDatabase.GetBuiltinExtraResource("Default-Diffuse.mat") }; 15 | 16 | var go = new GameObject(mesh.name); 17 | var smr = go.AddComponent(); 18 | smr.sharedMesh = mesh; 19 | smr.sharedMaterials = materials; 20 | go.GetComponent().position = pos; 21 | return go; 22 | } 23 | 24 | public static GameObject MeshToGameObject(Mesh mesh, GameObject from) 25 | { 26 | var go = MeshToGameObject(mesh, Vector3.zero, GetMaterials(from)); 27 | if (from != null) 28 | { 29 | var srctrans = from.GetComponent(); 30 | var dsttrans = go.GetComponent(); 31 | dsttrans.position = srctrans.position; 32 | dsttrans.rotation = srctrans.rotation; 33 | dsttrans.localScale = srctrans.localScale; 34 | 35 | var srcsmr = from.GetComponent(); 36 | var dstsmr = go.GetComponent(); 37 | if (srcsmr != null && dstsmr != null) 38 | { 39 | dstsmr.rootBone = srcsmr.rootBone; 40 | dstsmr.bones = srcsmr.bones; 41 | } 42 | } 43 | return go; 44 | } 45 | 46 | 47 | public static Mesh GetMesh(UnityEngine.Object obj) 48 | { 49 | Mesh ret = null; 50 | var go = obj as GameObject; 51 | if (go != null) 52 | { 53 | { 54 | var smr = go.GetComponent(); 55 | if (smr != null) 56 | ret = smr.sharedMesh; 57 | } 58 | if (ret == null) 59 | { 60 | var mf = go.GetComponent(); 61 | if (mf != null) 62 | ret = mf.sharedMesh; 63 | } 64 | } 65 | else 66 | { 67 | ret = obj as Mesh; 68 | } 69 | return ret; 70 | } 71 | 72 | public static Material[] GetMaterials(UnityEngine.Object obj) 73 | { 74 | Material[] ret = null; 75 | var go = obj as GameObject; 76 | if (go != null) 77 | { 78 | { 79 | var smr = go.GetComponent(); 80 | if (smr != null) 81 | ret = smr.sharedMaterials; 82 | } 83 | if (ret == null) 84 | { 85 | var mf = go.GetComponent(); 86 | if (mf != null) 87 | ret = mf.sharedMaterials; 88 | } 89 | } 90 | else 91 | { 92 | var mat = obj as Material; 93 | if(mat != null) 94 | ret = new Material[1] { mat }; 95 | } 96 | return ret; 97 | } 98 | 99 | public static bool SetMesh(UnityEngine.Object obj, Mesh mesh) 100 | { 101 | var go = obj as GameObject; 102 | if (go != null) 103 | { 104 | { 105 | var smr = go.GetComponent(); 106 | if (smr != null) 107 | { 108 | smr.sharedMesh = mesh; 109 | return true; 110 | } 111 | } 112 | { 113 | var mf = go.GetComponent(); 114 | if (mf != null) 115 | { 116 | mf.sharedMesh = mesh; 117 | return true; 118 | } 119 | } 120 | } 121 | return false; 122 | } 123 | 124 | public static string SanitizeFileName(string name) 125 | { 126 | var reg = new Regex("[\\/:\\*\\?<>\\|\\\"]"); 127 | return reg.Replace(name, "_"); 128 | } 129 | } 130 | } 131 | #endif 132 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/Utils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6488cfcf5e2c5e4c8dcf18f0e9340d9 3 | timeCreated: 1513560955 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/VertexHandles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5633d02ccbb9f384fb5804e87d868bee 3 | timeCreated: 1515592536 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/VertexTweaker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6a0b9a5487a09646a4a8765a690c886 3 | timeCreated: 1515226558 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/VertexTweakerSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 322113ad21ec853419f1b961f63c1d62 3 | timeCreated: 1515227020 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Scripts/VertexTweaker_impl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d5c32336cd581842aa9e3483126ba88 3 | timeCreated: 1515226558 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5135b0c5d417d9b41b4cb3b9b330527d 3 | folderAsset: yes 4 | timeCreated: 1515227019 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders/BrushShape.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/VertexTweaker/BrushShape" 2 | { 3 | CGINCLUDE 4 | #include "UnityCG.cginc" 5 | 6 | 7 | int _NumBrushSamples; 8 | StructuredBuffer _BrushSamples; 9 | 10 | struct appdata 11 | { 12 | float4 vertex : POSITION; 13 | }; 14 | 15 | struct v2f 16 | { 17 | float4 vertex : SV_POSITION; 18 | float4 uv : TEXCOORD0; 19 | }; 20 | 21 | 22 | v2f vert(appdata v) 23 | { 24 | v2f o; 25 | o.vertex = float4(v.vertex.xy, 0.0, 1.0); 26 | o.uv = float4(abs(v.vertex.x * 0.5 + 0.5), 1.0f - (v.vertex.y * 0.5f + 0.5f), 0, 0); 27 | return o; 28 | } 29 | 30 | float4 frag(v2f i) : SV_Target 31 | { 32 | //StructuredBuffer::GetDimensions() seems not available on non-D3D11.. 33 | int n = _NumBrushSamples; 34 | 35 | float u = 1.0 - abs(i.uv.x * 2.0 - 1.0); 36 | float v = _BrushSamples[(int)(u * (n-1))]; 37 | 38 | float dy = 1.0 / (n-1) * 2.0; 39 | float c = 0.0; 40 | c += i.uv.y + dy * 2.0 < v ? 0.15 : 0.0; // 41 | c += i.uv.y + dy * 1.0 < v ? 0.2 : 0.0; // 42 | c += i.uv.y < v ? 0.3 : 0.0; 43 | c += i.uv.y - dy * 1.0 < v ? 0.2 : 0.0; // 44 | c += i.uv.y - dy * 2.0 < v ? 0.15 : 0.0; // antialiasing 45 | return float4(1,1,1,c); 46 | } 47 | ENDCG 48 | 49 | SubShader 50 | { 51 | Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+1" } 52 | 53 | Pass 54 | { 55 | CGPROGRAM 56 | #pragma vertex vert 57 | #pragma fragment frag 58 | #pragma target 4.5 59 | ENDCG 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders/BrushShape.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61546cd539a41814d8e0869a726a8c00 3 | timeCreated: 1515270082 4 | licenseType: Pro 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders/Overlay.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/VertexTweaker/Overlay" { 2 | 3 | CGINCLUDE 4 | #include "UnityCG.cginc" 5 | 6 | StructuredBuffer _BaseNormals; 7 | StructuredBuffer _BaseTangents; 8 | StructuredBuffer _Points; 9 | StructuredBuffer _Normals; 10 | StructuredBuffer _Tangents; 11 | StructuredBuffer _Selection; 12 | 13 | 14 | 15 | struct ia_out 16 | { 17 | float4 vertex : POSITION; 18 | float4 normal : NORMAL; 19 | float4 uv : TEXCOORD0; 20 | float4 color : COLOR; 21 | uint vertexID : SV_VertexID; 22 | uint instanceID : SV_InstanceID; 23 | }; 24 | 25 | struct vs_out 26 | { 27 | float4 vertex : SV_POSITION; 28 | float4 color : TEXCOORD0; 29 | }; 30 | 31 | 32 | vs_out vert_local_space_normals_overlay(ia_out v) 33 | { 34 | vs_out o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.color.rgb = v.normal.xyz * 0.5 + 0.5; 37 | o.color.a = 1.0; 38 | return o; 39 | } 40 | 41 | float3 ToBaseTangentSpace(uint vid, float3 n) 42 | { 43 | float3 base_normal = _BaseNormals[vid]; 44 | float4 base_tangent = _BaseTangents[vid]; 45 | float3 base_binormal = normalize(cross(base_normal, base_tangent.xyz) * base_tangent.w); 46 | float3x3 tbn = float3x3(base_tangent.xyz, base_binormal, base_normal); 47 | return normalize(mul(n, transpose(tbn))); 48 | } 49 | 50 | vs_out vert_tangent_space_normals_overlay(ia_out v) 51 | { 52 | vs_out o; 53 | o.vertex = UnityObjectToClipPos(v.vertex); 54 | o.color.rgb = ToBaseTangentSpace(v.vertexID, v.normal.xyz) * 0.5 + 0.5; 55 | o.color.a = 1.0; 56 | return o; 57 | } 58 | 59 | vs_out vert_tangents_overlay(ia_out v) 60 | { 61 | vs_out o; 62 | o.vertex = UnityObjectToClipPos(v.vertex); 63 | 64 | float4 tangent = _Tangents[v.vertexID]; 65 | o.color.rgb = (tangent.xyz * tangent.w) * 0.5 + 0.5; 66 | o.color.a = 1.0; 67 | return o; 68 | } 69 | 70 | vs_out vert_binormals_overlay(ia_out v) 71 | { 72 | vs_out o; 73 | o.vertex = UnityObjectToClipPos(v.vertex); 74 | 75 | float4 tangent = _Tangents[v.vertexID]; 76 | float3 binormal = normalize(cross(v.normal.xyz, tangent.xyz * tangent.w)); 77 | o.color.rgb = binormal * 0.5 + 0.5; 78 | o.color.a = 1.0; 79 | return o; 80 | } 81 | 82 | vs_out vert_uv_overlay(ia_out v) 83 | { 84 | vs_out o; 85 | o.vertex = UnityObjectToClipPos(v.vertex); 86 | o.color = float4(v.uv.xy, 0.0, 1.0); 87 | return o; 88 | } 89 | 90 | vs_out vert_color_overlay(ia_out v) 91 | { 92 | vs_out o; 93 | o.vertex = UnityObjectToClipPos(v.vertex); 94 | o.color = v.color; 95 | return o; 96 | } 97 | 98 | 99 | float4 frag(vs_out v) : SV_Target 100 | { 101 | return v.color; 102 | } 103 | 104 | ENDCG 105 | 106 | SubShader 107 | { 108 | Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+99" } 109 | Blend SrcAlpha OneMinusSrcAlpha 110 | ZWrite Off 111 | 112 | // pass 0: local space normals overlay 113 | Pass 114 | { 115 | ZTest LEqual 116 | 117 | CGPROGRAM 118 | #pragma vertex vert_local_space_normals_overlay 119 | #pragma fragment frag 120 | #pragma target 4.5 121 | ENDCG 122 | } 123 | 124 | // pass 1: tangent space normals overlay 125 | Pass 126 | { 127 | ZTest LEqual 128 | 129 | CGPROGRAM 130 | #pragma vertex vert_tangent_space_normals_overlay 131 | #pragma fragment frag 132 | #pragma target 4.5 133 | ENDCG 134 | } 135 | 136 | // pass 2: tangents overlay 137 | Pass 138 | { 139 | ZTest LEqual 140 | 141 | CGPROGRAM 142 | #pragma vertex vert_tangents_overlay 143 | #pragma fragment frag 144 | #pragma target 4.5 145 | ENDCG 146 | } 147 | 148 | // pass 3: binormals overlay 149 | Pass 150 | { 151 | ZTest LEqual 152 | 153 | CGPROGRAM 154 | #pragma vertex vert_binormals_overlay 155 | #pragma fragment frag 156 | #pragma target 4.5 157 | ENDCG 158 | } 159 | 160 | // pass 4: uv overlay 161 | Pass 162 | { 163 | ZTest LEqual 164 | 165 | CGPROGRAM 166 | #pragma vertex vert_uv_overlay 167 | #pragma fragment frag 168 | #pragma target 4.5 169 | ENDCG 170 | } 171 | 172 | // pass 5: vertex color overlay 173 | Pass 174 | { 175 | ZTest LEqual 176 | 177 | CGPROGRAM 178 | #pragma vertex vert_color_overlay 179 | #pragma fragment frag 180 | #pragma target 4.5 181 | ENDCG 182 | } 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders/Overlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dada189530d1c844588658636810ae94 3 | timeCreated: 1515983648 4 | licenseType: Pro 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders/Visualizer.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/VertexTweaker/Visualizer" { 2 | 3 | CGINCLUDE 4 | #include "UnityCG.cginc" 5 | 6 | float _VertexSize; 7 | float _NormalSize; 8 | float _TangentSize; 9 | float _BinormalSize; 10 | 11 | float4 _VertexColor; 12 | float4 _VertexColor2; 13 | float4 _VertexColor3; 14 | float4 _NormalColor; 15 | float4 _TangentColor; 16 | float4 _BinormalColor; 17 | float4 _BrushPos; 18 | float4 _Direction; 19 | int _OnlySelected = 0; 20 | 21 | float4x4 _Transform; 22 | StructuredBuffer _Points; 23 | StructuredBuffer _Normals; 24 | StructuredBuffer _Tangents; 25 | StructuredBuffer _Selection; 26 | sampler2D _BrushSamples; 27 | 28 | 29 | struct ia_out 30 | { 31 | float4 vertex : POSITION; 32 | float4 normal : NORMAL; 33 | float4 uv : TEXCOORD0; 34 | float4 color : COLOR; 35 | uint vertexID : SV_VertexID; 36 | uint instanceID : SV_InstanceID; 37 | }; 38 | 39 | struct vs_out 40 | { 41 | float4 vertex : SV_POSITION; 42 | float4 color : TEXCOORD0; 43 | }; 44 | 45 | 46 | vs_out vert_vertices(ia_out v) 47 | { 48 | float3 pos = (mul(_Transform, float4(_Points[v.instanceID], 1.0))).xyz; 49 | 50 | float s = _Selection[v.instanceID]; 51 | float4 vertex = v.vertex; 52 | vertex.xyz *= _VertexSize; 53 | vertex.xyz *= abs(mul(UNITY_MATRIX_V, float4(pos, 1.0)).z); 54 | vertex.xyz += pos; 55 | vertex = mul(UNITY_MATRIX_VP, vertex); 56 | 57 | vs_out o; 58 | o.vertex = vertex; 59 | o.color = lerp(_VertexColor, _VertexColor2, s); 60 | float d = length(pos - _BrushPos.xyz) / _BrushPos.w; 61 | if (d < 1) { 62 | o.color.rgb += _VertexColor3.rgb * tex2Dlod(_BrushSamples, float4(1 - d, 0, 0, 0)).r; 63 | } 64 | return o; 65 | } 66 | 67 | vs_out vert_normals(ia_out v) 68 | { 69 | float3 pos = (mul(_Transform, float4(_Points[v.instanceID], 1.0))).xyz; 70 | float3 dir = normalize((mul(_Transform, float4(_Normals[v.instanceID], 0.0))).xyz); 71 | 72 | float s = _OnlySelected ? _Selection[v.instanceID] : 1.0f; 73 | s *= abs(mul(UNITY_MATRIX_V, float4(pos, 1.0)).z); 74 | float4 vertex = v.vertex; 75 | vertex.xyz += pos + dir * v.uv.x * _NormalSize * s; 76 | vertex = mul(UNITY_MATRIX_VP, vertex); 77 | 78 | vs_out o; 79 | o.vertex = vertex; 80 | o.color = _NormalColor; 81 | o.color.a = 1.0 - v.uv.x; 82 | return o; 83 | } 84 | 85 | vs_out vert_tangents(ia_out v) 86 | { 87 | float3 pos = (mul(_Transform, float4(_Points[v.instanceID], 1.0))).xyz; 88 | float4 tangent = _Tangents[v.instanceID]; 89 | float3 dir = normalize((mul(_Transform, float4(tangent.xyz * tangent.w, 0.0))).xyz); 90 | 91 | float s = _OnlySelected ? _Selection[v.instanceID] : 1.0f; 92 | s *= abs(mul(UNITY_MATRIX_V, float4(pos, 1.0)).z); 93 | float4 vertex = v.vertex; 94 | vertex.xyz += pos + dir * v.uv.x * _TangentSize * s; 95 | vertex = mul(UNITY_MATRIX_VP, vertex); 96 | 97 | vs_out o; 98 | o.vertex = vertex; 99 | o.color = _TangentColor; 100 | o.color.a = 1.0 - v.uv.x; 101 | return o; 102 | } 103 | 104 | vs_out vert_binormals(ia_out v) 105 | { 106 | float3 pos = (mul(_Transform, float4(_Points[v.instanceID], 1.0))).xyz; 107 | float4 tangent = _Tangents[v.instanceID]; 108 | float3 binormal = normalize(cross(_Normals[v.instanceID], tangent.xyz * tangent.w)); 109 | float3 dir = normalize((mul(_Transform, float4(binormal, 0.0))).xyz); 110 | 111 | float s = _OnlySelected ? _Selection[v.instanceID] : 1.0f; 112 | s *= abs(mul(UNITY_MATRIX_V, float4(pos, 1.0)).z); 113 | float4 vertex = v.vertex; 114 | vertex.xyz += pos + dir * v.uv.x * _BinormalSize * s; 115 | vertex = mul(UNITY_MATRIX_VP, vertex); 116 | 117 | vs_out o; 118 | o.vertex = vertex; 119 | o.color = _BinormalColor; 120 | o.color.a = 1.0 - v.uv.x; 121 | return o; 122 | } 123 | 124 | vs_out vert_lasso(ia_out v) 125 | { 126 | vs_out o; 127 | o.vertex = float4(v.vertex.xy, 0.0, 1.0); 128 | o.vertex.y *= -1; 129 | o.color = float4(1.0, 0.0, 0.0, 1.0); 130 | return o; 131 | } 132 | 133 | vs_out vert_brush_range(ia_out v) 134 | { 135 | vs_out o; 136 | o.vertex = UnityObjectToClipPos(v.vertex); 137 | o.color = mul(UNITY_MATRIX_M, v.vertex); 138 | return o; 139 | } 140 | 141 | vs_out vert_ray_position(ia_out v) 142 | { 143 | float z = abs(mul(UNITY_MATRIX_V, float4(_BrushPos.xyz, 1.0)).z); 144 | float3 pos = v.vertex.xyz * (0.01 * z) + _BrushPos.xyz; 145 | 146 | vs_out o; 147 | o.vertex = UnityObjectToClipPos(pos); 148 | o.color = float4(1, 0, 0, 1); 149 | return o; 150 | } 151 | 152 | vs_out vert_direction(ia_out v) 153 | { 154 | float3 pos = _BrushPos.xyz; 155 | float3 dir = _Direction.xyz; 156 | float z = abs(mul(UNITY_MATRIX_V, float4(_BrushPos.xyz, 1.0)).z); 157 | float4 vertex = float4(pos + dir * (v.uv.x * 0.25 * z), 1.0); 158 | 159 | vs_out o; 160 | o.vertex = mul(UNITY_MATRIX_VP, vertex); 161 | o.color = float4(1, 0, 0, 1-v.uv.x); 162 | return o; 163 | } 164 | 165 | 166 | float4 frag(vs_out v) : SV_Target 167 | { 168 | return v.color; 169 | } 170 | 171 | float4 frag_brush_range(vs_out v) : SV_Target 172 | { 173 | float2 uv = v.color.xy / v.color.w; 174 | 175 | float3 pixel_pos = v.color.xyz; 176 | float3 brush_pos = _BrushPos.xyz; 177 | float distance = length(pixel_pos - brush_pos); 178 | 179 | float range = clamp(1.0f - distance / _BrushPos.w, 0, 1); 180 | float z = abs(mul(UNITY_MATRIX_V, float4(brush_pos, 1.0)).z); 181 | 182 | float border = 0.004 / _BrushPos.w * z; 183 | if (distance > _BrushPos.w || range > border) { discard; } 184 | 185 | float4 color = float4(1, 0, 0, 1); 186 | return color; 187 | } 188 | 189 | ENDCG 190 | 191 | SubShader 192 | { 193 | Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+100" } 194 | Blend SrcAlpha OneMinusSrcAlpha 195 | ZWrite Off 196 | 197 | // pass 0: visualize vertices 198 | Pass 199 | { 200 | ZTest LEqual 201 | 202 | CGPROGRAM 203 | #pragma vertex vert_vertices 204 | #pragma fragment frag 205 | #pragma target 4.5 206 | ENDCG 207 | } 208 | 209 | // pass 1: visualize normals 210 | Pass 211 | { 212 | ZTest LEqual 213 | 214 | CGPROGRAM 215 | #pragma vertex vert_normals 216 | #pragma fragment frag 217 | #pragma target 4.5 218 | ENDCG 219 | } 220 | 221 | // pass 2: visualize tangents 222 | Pass 223 | { 224 | ZTest LEqual 225 | 226 | CGPROGRAM 227 | #pragma vertex vert_tangents 228 | #pragma fragment frag 229 | #pragma target 4.5 230 | ENDCG 231 | } 232 | 233 | // pass 3: visualize binormals 234 | Pass 235 | { 236 | ZTest LEqual 237 | 238 | CGPROGRAM 239 | #pragma vertex vert_binormals 240 | #pragma fragment frag 241 | #pragma target 4.5 242 | ENDCG 243 | } 244 | 245 | // pass 4: lasso 246 | Pass 247 | { 248 | ZTest Always 249 | 250 | CGPROGRAM 251 | #pragma vertex vert_lasso 252 | #pragma fragment frag 253 | #pragma target 4.5 254 | ENDCG 255 | } 256 | 257 | // pass 5: brush range 258 | Pass 259 | { 260 | ZTest LEqual 261 | 262 | CGPROGRAM 263 | #pragma vertex vert_brush_range 264 | #pragma fragment frag_brush_range 265 | #pragma target 4.5 266 | ENDCG 267 | } 268 | 269 | // pass 6: ray position 270 | Pass 271 | { 272 | ZTest LEqual 273 | 274 | CGPROGRAM 275 | #pragma vertex vert_ray_position 276 | #pragma fragment frag 277 | #pragma target 4.5 278 | ENDCG 279 | } 280 | 281 | // pass 7: direction 282 | Pass 283 | { 284 | ZTest LEqual 285 | 286 | CGPROGRAM 287 | #pragma vertex vert_direction 288 | #pragma fragment frag 289 | #pragma target 4.5 290 | ENDCG 291 | } 292 | } 293 | } 294 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/Shaders/Visualizer.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5786f144ee220ce4ea056f3f5ef4af19 3 | timeCreated: 1515270082 4 | licenseType: Pro 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/UTJ.VertexTweaker.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTJ.VertexTweaker" 3 | } 4 | -------------------------------------------------------------------------------- /Assets/VertexTweaker/Runtime/UTJ.VertexTweaker.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 053d58e0dba5d964c9834f8b76a5b44c 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2018 Unity Technologies Japan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61dbf90932c0ed847966effb78e27762 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Blend Shape Builder & Vertex Tweaker 2 | [English](https://translate.google.com/translate?sl=ja&tl=en&u=https://github.com/unity3d-jp/BlendShapeBuilder) (by Google Translate) 3 | ![demo](https://user-images.githubusercontent.com/1488611/34981308-76511248-faea-11e7-8985-b8fe0e957035.gif) 4 | 5 | Unity 上で blend shape を作成するツールです。既存のモデルの合成はもちろん、Unity 上で頂点を編集してそれを blend shape 化することもできます。 6 | また、頂点の位置だけ、法線だけの合成といった特殊な blend shape ターゲットも生成でき、既存の blend shape をターゲットごとに別個の Mesh として書き出す機能なども備えています。 7 | 8 | Unity 2017.1 系以上、Windows (64bit) or Mac、**D3D11 世代以降の Graphics API** の環境で動作します。 9 | (ターゲットプラットフォームが Standalone ではない場合、D3D9 世代に機能が限定されて正常動作しなくなることがあるのでご注意ください) 10 | 11 | 12 | ## 使い方 13 | - [BlendShapeBuilder.unitypackage](https://github.com/unity3d-jp/BlendShapeBuilder/releases/download/20190425/BlendShapeBuilder.unitypackage) をプロジェクトにインポート 14 | - Unity 2018.3 以降の場合、このリポジトリを直接インポートすることもできます。プロジェクト内にある Packages/manifest.json をテキストエディタで開き、"dependencies" に以下の行を加えます。 15 | > "com.utj.blendshapebuilder": "https://github.com/unity3d-jp/BlendShapeBuilder.git", 16 | 17 | - Window メニューに "Blend Shape Builder" と "Blend Shape Inspector" と "Vertex Tweaker" が追加されます。 18 | Blend Shape Builder が blend shape をオーサリングするツール、Vertex Tweaker が頂点の編集を行うツール、Blend Shape Inspector は既存の blend shape を調べたりデータを抽出したりするツールです。 19 | 20 | 21 | 22 | ## Blend Shape Builder 23 | Blend Shape Builder のウィンドウを開いた状態で MeshRenderer もしくは SkinnedMeshRenderer を持つオブジェクトを選択すると "Add BlendShapeBuilder" というボタンが出てくるので、それでコンポーネントを追加します。 24 | ![BlendShapeBuilder](https://user-images.githubusercontent.com/1488611/34981508-05fb5fb6-faeb-11e7-9204-4aabd4c58543.png) 25 | 26 | blend shape のターゲットとなるオブジェクトは、Mesh アセットもしくは MeshRenderer か SkinnedMeshRenderer を持つ GameObject を設定します。(頂点数が同じである必要があります) 27 | - "Find Targets" ボタンを押すと、現在のシーン内にある Base Mesh と同じ頂点数のモデルを探して選択状態にします。 28 | 29 | - "BlendShapes" にモーフターゲットとなるオブジェクトを指定していきます。 30 | - 既存の Mesh をターゲットに登録したい場合、それらを Drag & Drop します。 31 | "▼ BlendShapes" の部分にオブジェクトを Drag & Drop すると、放り込んだオブジェクト毎に BlendShape が生成されます。 32 | 各 BlendShape のフォールド部分 (上図の "▼ NewBlendShape0" など) にオブジェクトを Drag & Drop するとその BlendShape のフレームとして登録されます。 33 | 34 | - "+" ボタンでフレームを追加すると、フレームが追加されると共にそれに対応する Mesh が生成されます。 35 | 36 | - "Edit" を押すと、そのフレームの Mesh の編集に移行します。(後述の Vertex Tweaker が開きます) 37 | 38 | - V,N,T のチェックは Vertex, Normal, Tangent の略で、その要素を含めるかの指定になります。例えば Normal のみをチェックした場合、頂点の移動はせず法線だけが変わる BlendShape になります。 39 | 40 | - "Update Mesh" を押すと現在の Mesh を直接更新します。 41 | "Generate New Asset" は現在の Mesh には手を加えず、新しいアセットとしてエクスポートします。 42 | "Preserve Existing BlendShapes" をチェックしておくと、Mesh が既に blend shape を持っていた場合にそれを持ち越しつつ追加します。(同名の BlendShape があった場合新しい方で上書きします) 43 | 44 | 45 | ## Vertex Tweaker 46 | 頂点を編集するツールです。Skinning された Mesh の編集もサポートしており、blend shape 用に限らずモデルを微調整したい場合全般に使えます。ただし、できるのはあくまで頂点の移動のみであり、頂点の増減など (いわゆるトポロジーが変化する操作) はできません。 47 | 48 | - Edit -> Move, Rotate, Scale はその名の通り頂点の移動、回転、拡縮を行うモードです 49 | 50 | - Edit -> Assign はいわゆる数値入力です。XYZ 軸別にマスクをかけられるので、例えば球体の下半分を選択し Y だけチェックして 0 を入力することで半球にする、といった使い方ができます。 51 | 52 | - Edit -> Projection は他のモデルに対して頂点の投影を行うモードです。各頂点からレイを飛ばし、対象モデルに当たった地点に移動させます。頂点数が全く合わないモデルに対するモーフィングを実現できます。 53 | 54 | - Select は頂点の選択に関するオプションです。矩形選択、投げ縄選択、ブラシ選択といった一般的な選択方法や、選択中の頂点と繋がった頂点郡 (Connected)、ポリゴンの切れ目上にある頂点 (Edge, Hole) の選択なども備えています。 55 | 56 | - Misc -> Mirroring で方向を選択すると、ミラーリングが有効になります。(対称なモデルである必要があります) 57 | - Misc -> Normals および Tangents は法線と接線の再計算のオプションです。手動で編集した法線があってそれを維持したい場合、"Manual" に変えて自動計算は行わないようにする必要があるでしょう。そうでない場合はデフォルトで問題ないはずです。 58 | 59 | - Shift を押しながらの選択は選択の足し算、Ctrl を押しながらだと選択の引き算になります。 60 | 61 | ## 注意点 62 | - インポートした Mesh に対する編集 63 | fbx ファイルなどからインポートした Mesh はプロジェクトを開くたびに再生成が行われます。このため、インポートした Mesh に対する編集は、そのままではプロジェクトを開き直すとリセットされてしまいます。 64 | この対策として、インポートした Mesh を含む GameObject に "Add BlendShapeBuilder" した場合、元の Mesh のコピーを作成して MeshRenderer や SkinnedMeshRenderer の mesh をそれに差し替えます。 65 | また、Blend Shape Builder の "Generate New Asset" や Vertex Tweaker の "Export -> Export .asset" は、編集中のモデルを独立したアセットとしてエクスポートします。元の Mesh を変えたくない場合はこのコマンドで一度別アセットとして保存し、そちらを編集するといいでしょう。 66 | 67 | - DCC ツール上では一致していた頂点数が Unity 上では一致しない場合 68 | Blend Shape のターゲットは頂点の数と順番が元モデルと一致している必要があります。しかし、DCC ツール上では一致していても Unity にインポートする際に変換処理によって変わってしまうことがあります。これは主に以下のような場合に起こりえます: 69 | - 不連続な法線 (=ハードエッジ) がある 70 | - UV がモデル毎に異なり、かつ不連続な UV がある 71 | - 面毎に違うマテリアルを割り当てている 72 | 73 | 例えばメタセコイアの場合、これを回避するには、スムージング の 角度 を 180 にしてハードエッジを回避し、全モデルで同じ UV を使用し (そもそも Unity の Blend Shape は UV の変化はサポートしていません)、マテリアルは 1 オブジェクトにつき 1 種のみにする必要があります。 74 | 75 | ## 関連ツール 76 | - [NormalPainter](https://github.com/unity3d-jp/NormalPainter) - 法線を編集するツールです。 77 | - [FbxExporter](https://github.com/unity3d-jp/FbxExporter) - Mesh を fbx 形式でエクスポートするツールです。skinning や blend shape もサポートしています。 78 | 79 | ## License 80 | [MIT](LICENSE.txt) 81 | -------------------------------------------------------------------------------- /Readme.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb17bb89744c056439b5b9c2b06c9a4e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Readme_EN.md: -------------------------------------------------------------------------------- 1 | # Blend Shape Builder & Vertex Tweaker 2 | 3 | 4 | ![demo](https://user-images.githubusercontent.com/1488611/34981308-76511248-faea-11e7-8985-b8fe0e957035.gif) 5 | 6 | This is a tool for building blend shapes in Unity. In addition to compositing existing models, it's also possible to edit vertices in Unity to create blend shapes. 7 | There are also features for things like creating special blend shape targets made from composites of vertices or vectors, or exporting existing blend shapes as a separate Mesh for each target. 8 | 9 | You will need Unity 2017.1 or later, Windows (64 bit) or Mac (**Graphics API of D3D11 and later**). 10 | (Please note that if your target platform is not standalone, D3D9 will limit functions and may not work properly.) 11 | 12 | 13 | 14 | ## How to Use 15 | 16 | - Import [[BlendShapeBuilder.unitypackage](https://github.com/unity3d-jp/BlendShapeBuilder/releases/download/20190425/BlendShapeBuilder.unitypackage)to your project. 17 | - For Unity 2018.3 and later, you can also import this repository directly. Open Packages/manifest.json of your project in the text editor and add it after "dependencies". 18 | > "com.utj.blendshapebuilder": "https://github.com/unity3d-jp/BlendShapeBuilder.git", 19 | 20 | -"Blend Shape Builder" and "Blend Shape Inspector", "Vertex Tweaker" will be added to the Window menu. 21 | Blend Shape Builder is a tool to author blend shapes. Vertex Tweaker is for editing vertices. Blend Shape Inspector is for looking up or getting data from existing blend shapes. 22 | 23 | 24 | ## Blend Shape Builder 25 | When you select an object with MeshRenderer or SkinnedMeshRenderer with the Blend Shape Builder window open, the "Add BlendShapeBuilder" button will pop up so you can add it as a component. 26 | ![BlendShapeBuilder](https://user-images.githubusercontent.com/1488611/34981508-05fb5fb6-faeb-11e7-9204-4aabd4c58543.png) 27 | 28 | The object targeted by Blend Shape will be set as a GameObject with either MeshRenderer or SkinnedMeshRenderer. (The number of vertices must match) 29 | -When you push the "Find Targets" button, it will find a model with the same number of vertices as the Base Mesh and select it. 30 | 31 | -Select objects that will be the morph target in "BlendShapes". 32 | -If you want to target existing meshes, just drag and drop them. 33 | When you drag obejects to "▼ BlendShapes", a BlendShape will be spawned for each object. 34 | When you drag and drop and object to each BlendShape's fold (as in "▼ NewBlendShape0" shown above) the BlendShape will be registered as frames. 35 | 36 | -By using the "+" button, a mesh will also be created in additon to the frames. 37 | 38 | -If you click "Edit", you can edit the frame's mesh. (It will open the Vertex Tweaker, which we will talk about more below.) 39 | 40 | -V,N,T is short for Vertex, Normal, Tangent and you can set whether to include them. For example, if you only select Normal, the vertices will not move and only the normal vectors will be changed for the BlendShape. 41 | 42 | 43 | -You can update the current Mesh directly by clicking "Update Mesh". 44 | "By clicking "Generate New Asset", you can export the mesh as a new asset without changing the current mesh. 45 | When "Preserve Existing BlendShapes" is selected, it will carry the mesh over while adding blendshapes that were already in the mesh. (If there is already a BlendShape with the same name, it will be replaced with the newer one.) 46 | 47 | 48 | 49 | ## Vertex Tweaker 50 | 51 | This is a tool for editing vertices. It also supports editing meshes that have been skinned, and making minor changes to models in general (not just blend shapes). However, you can only move the vertices and will not be able to add/reduce the number of them. (In other words, you cannot change the topology) 52 | 53 | -Edit-> Move, Rotate, Scale is as implied, a mode that allows you to move, rotate, and scale vertices. 54 | 55 | -Edit-> Assign is for inputting values. You can mask depending on the XYZ axis. For example, you can select the bottom half of a sphere and select only Y and type in 0. This will make it a half sphere. 56 | 57 | -Edit-> Projection is a mode that allows you to project vertices on to other models. Project rays from each vertex and move the models accordingly. You can morph models that do not have the same number of vertices. 58 | 59 | - Select is for selecting vertices. Rectangle, roping, and brush selection are available, as well as Connected, which allows you to select sets of vertices that are connected. Edge and Hole also allow you to select vertices that are on the edges of polygons. 60 | 61 | -When you set the direction in Misc-> Mirroring, mirroring will be enabled. (Your model must be symmetric) 62 | -Misc-> Normals and Tangents are options to re-calculate the normal vectors and tangents. If there is a vector that you edited manually and you would like to preserve it, you will have to change to "Manual" to disable the automatic calculation. If this is not the case, there will be no problem with leaving it with the default settings. 63 | 64 | -Holding the Shift key while selecting is addition and holding the Ctrl key while selecting is subtraction. 65 | 66 | ## Notes 67 | 68 | -Editing imported meshes. 69 | Meshes will be re-spawned each time the project is opened if it is imported from a fbx file. Therefore, edits on the imported meshes will not be saved if you reopen the project. 70 | To solve this issue, enable "Add BlendShapeBuilder" for GameObjects with imported meshes, then create a copy of the original mesh and replace it with the MeshRenderer or SkinnedMeshRenderer mesh. 71 | Blend Shape Builder's "Generate New Asset" and Vertex Tweaker's "Export-> Export .asset" commands will also export the model you are editing as an independent asset. If you do not want to change the original mesh, save it as a different asset with these command and edit that version instead. 72 | 73 | - When the number of vertices on the DCC tool does not match in Unity 74 | The Blend Shape target must have the same number of vertices as the original model. However, due to conversion, sometimes the number of vertices will not match on Unity after importing. When this happens, the following may occur: 75 | -Uneven vectors (= hard edeges) 76 | -The UV will be different for each model and there will be uneven UVs. 77 | -Different sides having different material. 78 | 79 | For example, to avoid this in Metasequioa, set the smoothing angle to 180 to avoid hard edges, and use the same UV for all models (Unity's Blend Shape does not account for UV changes). You must also only set one type of material per object. 80 | 81 | ## Related Tools 82 | - [NormalPainter](https://github.com/unity3d-jp/NormalPainter) - Edit vectors with this tool. 83 | - [FbxExporter](https://github.com/unity3d-jp/FbxExporter) - Export meshes in fbx format. It also supports skinning and blend shapes. 84 | 85 | ## License 86 | [MIT](LICENSE.txt) 87 | -------------------------------------------------------------------------------- /Readme_EN.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb17bb89744c056439b5b9c2b06c9a5e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.utj.blendshapebuilder", 3 | "description": "This plugin allow you to build / edit blendshapes in scene view.", 4 | "version": "1.0.0", 5 | "unity": "2018.3", 6 | "displayName": "BlendShapeBuilder" 7 | } 8 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fcd3c8dc552a7a4e99125659c41dd22 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------