webzepetoku commited on
Commit
b852697
·
verified ·
1 Parent(s): 27a3425

Upload 88 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. UnityProject/Assets/UnityMeshSimplifier/.circleci/ProjectSettings/ProjectSettings.asset +638 -0
  2. UnityProject/Assets/UnityMeshSimplifier/.circleci/config.yml +97 -0
  3. UnityProject/Assets/UnityMeshSimplifier/.circleci/scripts/prepare_unity.sh +31 -0
  4. UnityProject/Assets/UnityMeshSimplifier/.circleci/scripts/run_unity_tests.sh +49 -0
  5. UnityProject/Assets/UnityMeshSimplifier/.editorconfig +16 -0
  6. UnityProject/Assets/UnityMeshSimplifier/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
  7. UnityProject/Assets/UnityMeshSimplifier/.github/ISSUE_TEMPLATE/config.yml +1 -0
  8. UnityProject/Assets/UnityMeshSimplifier/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  9. UnityProject/Assets/UnityMeshSimplifier/.github/PULL_REQUEST_TEMPLATE.md +17 -0
  10. UnityProject/Assets/UnityMeshSimplifier/.github/workflows/commit_message_check.yml +21 -0
  11. UnityProject/Assets/UnityMeshSimplifier/.github/workflows/release.yml +23 -0
  12. UnityProject/Assets/UnityMeshSimplifier/.releaserc.json +17 -0
  13. UnityProject/Assets/UnityMeshSimplifier/CHANGELOG.md +194 -0
  14. UnityProject/Assets/UnityMeshSimplifier/CHANGELOG.md.meta +7 -0
  15. UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTING.md +106 -0
  16. UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTING.md.meta +7 -0
  17. UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTORS.md +13 -0
  18. UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTORS.md.meta +7 -0
  19. UnityProject/Assets/UnityMeshSimplifier/Editor.meta +8 -0
  20. UnityProject/Assets/UnityMeshSimplifier/Editor/LODGeneratorHelperEditor.cs +692 -0
  21. UnityProject/Assets/UnityMeshSimplifier/Editor/LODGeneratorHelperEditor.cs.meta +11 -0
  22. UnityProject/Assets/UnityMeshSimplifier/Editor/SerializedPropertyExtensions.cs +50 -0
  23. UnityProject/Assets/UnityMeshSimplifier/Editor/SerializedPropertyExtensions.cs.meta +11 -0
  24. UnityProject/Assets/UnityMeshSimplifier/Editor/Whinarn.UnityMeshSimplifier.Editor.asmdef +18 -0
  25. UnityProject/Assets/UnityMeshSimplifier/Editor/Whinarn.UnityMeshSimplifier.Editor.asmdef.meta +7 -0
  26. UnityProject/Assets/UnityMeshSimplifier/LICENSE.md +21 -0
  27. UnityProject/Assets/UnityMeshSimplifier/LICENSE.md.meta +9 -0
  28. UnityProject/Assets/UnityMeshSimplifier/README.md +72 -0
  29. UnityProject/Assets/UnityMeshSimplifier/README.md.meta +9 -0
  30. UnityProject/Assets/UnityMeshSimplifier/Runtime.meta +10 -0
  31. UnityProject/Assets/UnityMeshSimplifier/Runtime/AssemblyAttributes.cs +3 -0
  32. UnityProject/Assets/UnityMeshSimplifier/Runtime/AssemblyAttributes.cs.meta +11 -0
  33. UnityProject/Assets/UnityMeshSimplifier/Runtime/BlendShape.cs +100 -0
  34. UnityProject/Assets/UnityMeshSimplifier/Runtime/BlendShape.cs.meta +11 -0
  35. UnityProject/Assets/UnityMeshSimplifier/Runtime/Components.meta +8 -0
  36. UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODBackupComponent.cs +43 -0
  37. UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODBackupComponent.cs.meta +11 -0
  38. UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODGeneratorHelper.cs +172 -0
  39. UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODGeneratorHelper.cs.meta +11 -0
  40. UnityProject/Assets/UnityMeshSimplifier/Runtime/Exceptions.meta +8 -0
  41. UnityProject/Assets/UnityMeshSimplifier/Runtime/Exceptions/ValidateSimplificationOptionsException.cs +51 -0
  42. UnityProject/Assets/UnityMeshSimplifier/Runtime/Exceptions/ValidateSimplificationOptionsException.cs.meta +11 -0
  43. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal.meta +8 -0
  44. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeContainer.cs +83 -0
  45. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeContainer.cs.meta +11 -0
  46. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeFrameContainer.cs +78 -0
  47. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeFrameContainer.cs.meta +11 -0
  48. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BorderVertex.cs +55 -0
  49. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BorderVertex.cs.meta +11 -0
  50. UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/Ref.cs +43 -0
UnityProject/Assets/UnityMeshSimplifier/.circleci/ProjectSettings/ProjectSettings.asset ADDED
@@ -0,0 +1,638 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!129 &1
4
+ PlayerSettings:
5
+ m_ObjectHideFlags: 0
6
+ serializedVersion: 18
7
+ productGUID: 57ccb20c54a965a44a7abac222c2c8fa
8
+ AndroidProfiler: 0
9
+ AndroidFilterTouchesWhenObscured: 0
10
+ AndroidEnableSustainedPerformanceMode: 0
11
+ defaultScreenOrientation: 4
12
+ targetDevice: 2
13
+ useOnDemandResources: 0
14
+ accelerometerFrequency: 60
15
+ companyName: Whinarn
16
+ productName: UnityMeshSimplifier
17
+ defaultCursor: {fileID: 0}
18
+ cursorHotspot: {x: 0, y: 0}
19
+ m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
20
+ m_ShowUnitySplashScreen: 1
21
+ m_ShowUnitySplashLogo: 1
22
+ m_SplashScreenOverlayOpacity: 1
23
+ m_SplashScreenAnimation: 1
24
+ m_SplashScreenLogoStyle: 1
25
+ m_SplashScreenDrawMode: 0
26
+ m_SplashScreenBackgroundAnimationZoom: 1
27
+ m_SplashScreenLogoAnimationZoom: 1
28
+ m_SplashScreenBackgroundLandscapeAspect: 1
29
+ m_SplashScreenBackgroundPortraitAspect: 1
30
+ m_SplashScreenBackgroundLandscapeUvs:
31
+ serializedVersion: 2
32
+ x: 0
33
+ y: 0
34
+ width: 1
35
+ height: 1
36
+ m_SplashScreenBackgroundPortraitUvs:
37
+ serializedVersion: 2
38
+ x: 0
39
+ y: 0
40
+ width: 1
41
+ height: 1
42
+ m_SplashScreenLogos: []
43
+ m_VirtualRealitySplashScreen: {fileID: 0}
44
+ m_HolographicTrackingLossScreen: {fileID: 0}
45
+ defaultScreenWidth: 1024
46
+ defaultScreenHeight: 768
47
+ defaultScreenWidthWeb: 960
48
+ defaultScreenHeightWeb: 600
49
+ m_StereoRenderingPath: 0
50
+ m_ActiveColorSpace: 0
51
+ m_MTRendering: 1
52
+ m_StackTraceTypes: 010000000100000001000000010000000100000001000000
53
+ iosShowActivityIndicatorOnLoading: -1
54
+ androidShowActivityIndicatorOnLoading: -1
55
+ displayResolutionDialog: 1
56
+ iosUseCustomAppBackgroundBehavior: 0
57
+ iosAllowHTTPDownload: 1
58
+ allowedAutorotateToPortrait: 1
59
+ allowedAutorotateToPortraitUpsideDown: 1
60
+ allowedAutorotateToLandscapeRight: 1
61
+ allowedAutorotateToLandscapeLeft: 1
62
+ useOSAutorotation: 1
63
+ use32BitDisplayBuffer: 1
64
+ preserveFramebufferAlpha: 0
65
+ disableDepthAndStencilBuffers: 0
66
+ androidStartInFullscreen: 1
67
+ androidRenderOutsideSafeArea: 0
68
+ androidBlitType: 0
69
+ defaultIsNativeResolution: 1
70
+ macRetinaSupport: 1
71
+ runInBackground: 1
72
+ captureSingleScreen: 0
73
+ muteOtherAudioSources: 0
74
+ Prepare IOS For Recording: 0
75
+ Force IOS Speakers When Recording: 0
76
+ deferSystemGesturesMode: 0
77
+ hideHomeButton: 0
78
+ submitAnalytics: 1
79
+ usePlayerLog: 1
80
+ bakeCollisionMeshes: 0
81
+ forceSingleInstance: 0
82
+ resizableWindow: 0
83
+ useMacAppStoreValidation: 0
84
+ macAppStoreCategory: public.app-category.games
85
+ gpuSkinning: 1
86
+ graphicsJobs: 0
87
+ xboxPIXTextureCapture: 0
88
+ xboxEnableAvatar: 0
89
+ xboxEnableKinect: 0
90
+ xboxEnableKinectAutoTracking: 0
91
+ xboxEnableFitness: 0
92
+ visibleInBackground: 1
93
+ allowFullscreenSwitch: 1
94
+ graphicsJobMode: 0
95
+ fullscreenMode: 1
96
+ xboxSpeechDB: 0
97
+ xboxEnableHeadOrientation: 0
98
+ xboxEnableGuest: 0
99
+ xboxEnablePIXSampling: 0
100
+ metalFramebufferOnly: 0
101
+ xboxOneResolution: 0
102
+ xboxOneSResolution: 0
103
+ xboxOneXResolution: 3
104
+ xboxOneMonoLoggingLevel: 0
105
+ xboxOneLoggingLevel: 1
106
+ xboxOneDisableEsram: 0
107
+ xboxOneEnableTypeOptimization: 0
108
+ xboxOnePresentImmediateThreshold: 0
109
+ switchQueueCommandMemory: 0
110
+ switchQueueControlMemory: 16384
111
+ switchQueueComputeMemory: 262144
112
+ switchNVNShaderPoolsGranularity: 33554432
113
+ switchNVNDefaultPoolsGranularity: 16777216
114
+ switchNVNOtherPoolsGranularity: 16777216
115
+ switchNVNMaxPublicTextureIDCount: 0
116
+ switchNVNMaxPublicSamplerIDCount: 0
117
+ vulkanEnableSetSRGBWrite: 0
118
+ m_SupportedAspectRatios:
119
+ 4:3: 1
120
+ 5:4: 1
121
+ 16:10: 1
122
+ 16:9: 1
123
+ Others: 1
124
+ bundleVersion: 0.1
125
+ preloadedAssets: []
126
+ metroInputSource: 0
127
+ wsaTransparentSwapchain: 0
128
+ m_HolographicPauseOnTrackingLoss: 1
129
+ xboxOneDisableKinectGpuReservation: 1
130
+ xboxOneEnable7thCore: 1
131
+ isWsaHolographicRemotingEnabled: 0
132
+ vrSettings:
133
+ cardboard:
134
+ depthFormat: 0
135
+ enableTransitionView: 0
136
+ daydream:
137
+ depthFormat: 0
138
+ useSustainedPerformanceMode: 0
139
+ enableVideoLayer: 0
140
+ useProtectedVideoMemory: 0
141
+ minimumSupportedHeadTracking: 0
142
+ maximumSupportedHeadTracking: 1
143
+ hololens:
144
+ depthFormat: 1
145
+ depthBufferSharingEnabled: 1
146
+ oculus:
147
+ sharedDepthBuffer: 1
148
+ dashSupport: 1
149
+ lowOverheadMode: 0
150
+ protectedContext: 0
151
+ v2Signing: 0
152
+ enable360StereoCapture: 0
153
+ protectGraphicsMemory: 0
154
+ enableFrameTimingStats: 0
155
+ useHDRDisplay: 0
156
+ m_ColorGamuts: 00000000
157
+ targetPixelDensity: 30
158
+ resolutionScalingMode: 0
159
+ androidSupportedAspectRatio: 1
160
+ androidMaxAspectRatio: 2.1
161
+ applicationIdentifier: {}
162
+ buildNumber: {}
163
+ AndroidBundleVersionCode: 1
164
+ AndroidMinSdkVersion: 16
165
+ AndroidTargetSdkVersion: 0
166
+ AndroidPreferredInstallLocation: 1
167
+ aotOptions:
168
+ stripEngineCode: 1
169
+ iPhoneStrippingLevel: 0
170
+ iPhoneScriptCallOptimization: 0
171
+ ForceInternetPermission: 0
172
+ ForceSDCardPermission: 0
173
+ CreateWallpaper: 0
174
+ APKExpansionFiles: 0
175
+ keepLoadedShadersAlive: 0
176
+ StripUnusedMeshComponents: 1
177
+ VertexChannelCompressionMask: 4054
178
+ iPhoneSdkVersion: 988
179
+ iOSTargetOSVersionString: 9.0
180
+ tvOSSdkVersion: 0
181
+ tvOSRequireExtendedGameController: 0
182
+ tvOSTargetOSVersionString: 9.0
183
+ uIPrerenderedIcon: 0
184
+ uIRequiresPersistentWiFi: 0
185
+ uIRequiresFullScreen: 1
186
+ uIStatusBarHidden: 1
187
+ uIExitOnSuspend: 0
188
+ uIStatusBarStyle: 0
189
+ iPhoneSplashScreen: {fileID: 0}
190
+ iPhoneHighResSplashScreen: {fileID: 0}
191
+ iPhoneTallHighResSplashScreen: {fileID: 0}
192
+ iPhone47inSplashScreen: {fileID: 0}
193
+ iPhone55inPortraitSplashScreen: {fileID: 0}
194
+ iPhone55inLandscapeSplashScreen: {fileID: 0}
195
+ iPhone58inPortraitSplashScreen: {fileID: 0}
196
+ iPhone58inLandscapeSplashScreen: {fileID: 0}
197
+ iPadPortraitSplashScreen: {fileID: 0}
198
+ iPadHighResPortraitSplashScreen: {fileID: 0}
199
+ iPadLandscapeSplashScreen: {fileID: 0}
200
+ iPadHighResLandscapeSplashScreen: {fileID: 0}
201
+ appleTVSplashScreen: {fileID: 0}
202
+ appleTVSplashScreen2x: {fileID: 0}
203
+ tvOSSmallIconLayers: []
204
+ tvOSSmallIconLayers2x: []
205
+ tvOSLargeIconLayers: []
206
+ tvOSLargeIconLayers2x: []
207
+ tvOSTopShelfImageLayers: []
208
+ tvOSTopShelfImageLayers2x: []
209
+ tvOSTopShelfImageWideLayers: []
210
+ tvOSTopShelfImageWideLayers2x: []
211
+ iOSLaunchScreenType: 0
212
+ iOSLaunchScreenPortrait: {fileID: 0}
213
+ iOSLaunchScreenLandscape: {fileID: 0}
214
+ iOSLaunchScreenBackgroundColor:
215
+ serializedVersion: 2
216
+ rgba: 0
217
+ iOSLaunchScreenFillPct: 100
218
+ iOSLaunchScreenSize: 100
219
+ iOSLaunchScreenCustomXibPath:
220
+ iOSLaunchScreeniPadType: 0
221
+ iOSLaunchScreeniPadImage: {fileID: 0}
222
+ iOSLaunchScreeniPadBackgroundColor:
223
+ serializedVersion: 2
224
+ rgba: 0
225
+ iOSLaunchScreeniPadFillPct: 100
226
+ iOSLaunchScreeniPadSize: 100
227
+ iOSLaunchScreeniPadCustomXibPath:
228
+ iOSUseLaunchScreenStoryboard: 0
229
+ iOSLaunchScreenCustomStoryboardPath:
230
+ iOSDeviceRequirements: []
231
+ iOSURLSchemes: []
232
+ iOSBackgroundModes: 0
233
+ iOSMetalForceHardShadows: 0
234
+ metalEditorSupport: 1
235
+ metalAPIValidation: 1
236
+ iOSRenderExtraFrameOnPause: 0
237
+ appleDeveloperTeamID:
238
+ iOSManualSigningProvisioningProfileID:
239
+ tvOSManualSigningProvisioningProfileID:
240
+ iOSManualSigningProvisioningProfileType: 0
241
+ tvOSManualSigningProvisioningProfileType: 0
242
+ appleEnableAutomaticSigning: 0
243
+ iOSRequireARKit: 0
244
+ iOSAutomaticallyDetectAndAddCapabilities: 1
245
+ appleEnableProMotion: 0
246
+ clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
247
+ templatePackageId: com.unity.template.3d@1.3.0
248
+ templateDefaultScene: Assets/Scenes/SampleScene.unity
249
+ AndroidTargetArchitectures: 5
250
+ AndroidSplashScreenScale: 0
251
+ androidSplashScreen: {fileID: 0}
252
+ AndroidKeystoreName:
253
+ AndroidKeyaliasName:
254
+ AndroidBuildApkPerCpuArchitecture: 0
255
+ AndroidTVCompatibility: 1
256
+ AndroidIsGame: 1
257
+ AndroidEnableTango: 0
258
+ androidEnableBanner: 1
259
+ androidUseLowAccuracyLocation: 0
260
+ m_AndroidBanners:
261
+ - width: 320
262
+ height: 180
263
+ banner: {fileID: 0}
264
+ androidGamepadSupportLevel: 0
265
+ resolutionDialogBanner: {fileID: 0}
266
+ m_BuildTargetIcons: []
267
+ m_BuildTargetPlatformIcons: []
268
+ m_BuildTargetBatching:
269
+ - m_BuildTarget: Standalone
270
+ m_StaticBatching: 1
271
+ m_DynamicBatching: 0
272
+ - m_BuildTarget: tvOS
273
+ m_StaticBatching: 1
274
+ m_DynamicBatching: 0
275
+ - m_BuildTarget: Android
276
+ m_StaticBatching: 1
277
+ m_DynamicBatching: 0
278
+ - m_BuildTarget: iPhone
279
+ m_StaticBatching: 1
280
+ m_DynamicBatching: 0
281
+ - m_BuildTarget: WebGL
282
+ m_StaticBatching: 0
283
+ m_DynamicBatching: 0
284
+ m_BuildTargetGraphicsAPIs:
285
+ - m_BuildTarget: AndroidPlayer
286
+ m_APIs: 0b00000008000000
287
+ m_Automatic: 1
288
+ - m_BuildTarget: iOSSupport
289
+ m_APIs: 10000000
290
+ m_Automatic: 1
291
+ - m_BuildTarget: AppleTVSupport
292
+ m_APIs: 10000000
293
+ m_Automatic: 0
294
+ - m_BuildTarget: WebGLSupport
295
+ m_APIs: 0b000000
296
+ m_Automatic: 1
297
+ m_BuildTargetVRSettings:
298
+ - m_BuildTarget: Standalone
299
+ m_Enabled: 0
300
+ m_Devices:
301
+ - Oculus
302
+ - OpenVR
303
+ m_BuildTargetEnableVuforiaSettings: []
304
+ openGLRequireES31: 0
305
+ openGLRequireES31AEP: 0
306
+ m_TemplateCustomTags: {}
307
+ mobileMTRendering:
308
+ Android: 1
309
+ iPhone: 1
310
+ tvOS: 1
311
+ m_BuildTargetGroupLightmapEncodingQuality: []
312
+ m_BuildTargetGroupLightmapSettings: []
313
+ playModeTestRunnerEnabled: 0
314
+ runPlayModeTestAsEditModeTest: 0
315
+ actionOnDotNetUnhandledException: 1
316
+ enableInternalProfiler: 0
317
+ logObjCUncaughtExceptions: 1
318
+ enableCrashReportAPI: 0
319
+ cameraUsageDescription:
320
+ locationUsageDescription:
321
+ microphoneUsageDescription:
322
+ switchNetLibKey:
323
+ switchSocketMemoryPoolSize: 6144
324
+ switchSocketAllocatorPoolSize: 128
325
+ switchSocketConcurrencyLimit: 14
326
+ switchScreenResolutionBehavior: 2
327
+ switchUseCPUProfiler: 0
328
+ switchApplicationID: 0x01004b9000490000
329
+ switchNSODependencies:
330
+ switchTitleNames_0:
331
+ switchTitleNames_1:
332
+ switchTitleNames_2:
333
+ switchTitleNames_3:
334
+ switchTitleNames_4:
335
+ switchTitleNames_5:
336
+ switchTitleNames_6:
337
+ switchTitleNames_7:
338
+ switchTitleNames_8:
339
+ switchTitleNames_9:
340
+ switchTitleNames_10:
341
+ switchTitleNames_11:
342
+ switchTitleNames_12:
343
+ switchTitleNames_13:
344
+ switchTitleNames_14:
345
+ switchPublisherNames_0:
346
+ switchPublisherNames_1:
347
+ switchPublisherNames_2:
348
+ switchPublisherNames_3:
349
+ switchPublisherNames_4:
350
+ switchPublisherNames_5:
351
+ switchPublisherNames_6:
352
+ switchPublisherNames_7:
353
+ switchPublisherNames_8:
354
+ switchPublisherNames_9:
355
+ switchPublisherNames_10:
356
+ switchPublisherNames_11:
357
+ switchPublisherNames_12:
358
+ switchPublisherNames_13:
359
+ switchPublisherNames_14:
360
+ switchIcons_0: {fileID: 0}
361
+ switchIcons_1: {fileID: 0}
362
+ switchIcons_2: {fileID: 0}
363
+ switchIcons_3: {fileID: 0}
364
+ switchIcons_4: {fileID: 0}
365
+ switchIcons_5: {fileID: 0}
366
+ switchIcons_6: {fileID: 0}
367
+ switchIcons_7: {fileID: 0}
368
+ switchIcons_8: {fileID: 0}
369
+ switchIcons_9: {fileID: 0}
370
+ switchIcons_10: {fileID: 0}
371
+ switchIcons_11: {fileID: 0}
372
+ switchIcons_12: {fileID: 0}
373
+ switchIcons_13: {fileID: 0}
374
+ switchIcons_14: {fileID: 0}
375
+ switchSmallIcons_0: {fileID: 0}
376
+ switchSmallIcons_1: {fileID: 0}
377
+ switchSmallIcons_2: {fileID: 0}
378
+ switchSmallIcons_3: {fileID: 0}
379
+ switchSmallIcons_4: {fileID: 0}
380
+ switchSmallIcons_5: {fileID: 0}
381
+ switchSmallIcons_6: {fileID: 0}
382
+ switchSmallIcons_7: {fileID: 0}
383
+ switchSmallIcons_8: {fileID: 0}
384
+ switchSmallIcons_9: {fileID: 0}
385
+ switchSmallIcons_10: {fileID: 0}
386
+ switchSmallIcons_11: {fileID: 0}
387
+ switchSmallIcons_12: {fileID: 0}
388
+ switchSmallIcons_13: {fileID: 0}
389
+ switchSmallIcons_14: {fileID: 0}
390
+ switchManualHTML:
391
+ switchAccessibleURLs:
392
+ switchLegalInformation:
393
+ switchMainThreadStackSize: 1048576
394
+ switchPresenceGroupId:
395
+ switchLogoHandling: 0
396
+ switchReleaseVersion: 0
397
+ switchDisplayVersion: 1.0.0
398
+ switchStartupUserAccount: 0
399
+ switchTouchScreenUsage: 0
400
+ switchSupportedLanguagesMask: 0
401
+ switchLogoType: 0
402
+ switchApplicationErrorCodeCategory:
403
+ switchUserAccountSaveDataSize: 0
404
+ switchUserAccountSaveDataJournalSize: 0
405
+ switchApplicationAttribute: 0
406
+ switchCardSpecSize: -1
407
+ switchCardSpecClock: -1
408
+ switchRatingsMask: 0
409
+ switchRatingsInt_0: 0
410
+ switchRatingsInt_1: 0
411
+ switchRatingsInt_2: 0
412
+ switchRatingsInt_3: 0
413
+ switchRatingsInt_4: 0
414
+ switchRatingsInt_5: 0
415
+ switchRatingsInt_6: 0
416
+ switchRatingsInt_7: 0
417
+ switchRatingsInt_8: 0
418
+ switchRatingsInt_9: 0
419
+ switchRatingsInt_10: 0
420
+ switchRatingsInt_11: 0
421
+ switchRatingsInt_12: 0
422
+ switchLocalCommunicationIds_0:
423
+ switchLocalCommunicationIds_1:
424
+ switchLocalCommunicationIds_2:
425
+ switchLocalCommunicationIds_3:
426
+ switchLocalCommunicationIds_4:
427
+ switchLocalCommunicationIds_5:
428
+ switchLocalCommunicationIds_6:
429
+ switchLocalCommunicationIds_7:
430
+ switchParentalControl: 0
431
+ switchAllowsScreenshot: 1
432
+ switchAllowsVideoCapturing: 1
433
+ switchAllowsRuntimeAddOnContentInstall: 0
434
+ switchDataLossConfirmation: 0
435
+ switchUserAccountLockEnabled: 0
436
+ switchSystemResourceMemory: 16777216
437
+ switchSupportedNpadStyles: 3
438
+ switchNativeFsCacheSize: 32
439
+ switchIsHoldTypeHorizontal: 0
440
+ switchSupportedNpadCount: 8
441
+ switchSocketConfigEnabled: 0
442
+ switchTcpInitialSendBufferSize: 32
443
+ switchTcpInitialReceiveBufferSize: 64
444
+ switchTcpAutoSendBufferSizeMax: 256
445
+ switchTcpAutoReceiveBufferSizeMax: 256
446
+ switchUdpSendBufferSize: 9
447
+ switchUdpReceiveBufferSize: 42
448
+ switchSocketBufferEfficiency: 4
449
+ switchSocketInitializeEnabled: 1
450
+ switchNetworkInterfaceManagerInitializeEnabled: 1
451
+ switchPlayerConnectionEnabled: 1
452
+ ps4NPAgeRating: 12
453
+ ps4NPTitleSecret:
454
+ ps4NPTrophyPackPath:
455
+ ps4ParentalLevel: 11
456
+ ps4ContentID: ED1633-NPXX51362_00-0000000000000000
457
+ ps4Category: 0
458
+ ps4MasterVersion: 01.00
459
+ ps4AppVersion: 01.00
460
+ ps4AppType: 0
461
+ ps4ParamSfxPath:
462
+ ps4VideoOutPixelFormat: 0
463
+ ps4VideoOutInitialWidth: 1920
464
+ ps4VideoOutBaseModeInitialWidth: 1920
465
+ ps4VideoOutReprojectionRate: 60
466
+ ps4PronunciationXMLPath:
467
+ ps4PronunciationSIGPath:
468
+ ps4BackgroundImagePath:
469
+ ps4StartupImagePath:
470
+ ps4StartupImagesFolder:
471
+ ps4IconImagesFolder:
472
+ ps4SaveDataImagePath:
473
+ ps4SdkOverride:
474
+ ps4BGMPath:
475
+ ps4ShareFilePath:
476
+ ps4ShareOverlayImagePath:
477
+ ps4PrivacyGuardImagePath:
478
+ ps4ExtraSceSysFile:
479
+ ps4NPtitleDatPath:
480
+ ps4RemotePlayKeyAssignment: -1
481
+ ps4RemotePlayKeyMappingDir:
482
+ ps4PlayTogetherPlayerCount: 0
483
+ ps4EnterButtonAssignment: 1
484
+ ps4ApplicationParam1: 0
485
+ ps4ApplicationParam2: 0
486
+ ps4ApplicationParam3: 0
487
+ ps4ApplicationParam4: 0
488
+ ps4DownloadDataSize: 0
489
+ ps4GarlicHeapSize: 2048
490
+ ps4ProGarlicHeapSize: 2560
491
+ ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
492
+ ps4pnSessions: 1
493
+ ps4pnPresence: 1
494
+ ps4pnFriends: 1
495
+ ps4pnGameCustomData: 1
496
+ playerPrefsSupport: 0
497
+ enableApplicationExit: 0
498
+ resetTempFolder: 1
499
+ restrictedAudioUsageRights: 0
500
+ ps4UseResolutionFallback: 0
501
+ ps4ReprojectionSupport: 0
502
+ ps4UseAudio3dBackend: 0
503
+ ps4SocialScreenEnabled: 0
504
+ ps4ScriptOptimizationLevel: 0
505
+ ps4Audio3dVirtualSpeakerCount: 14
506
+ ps4attribCpuUsage: 0
507
+ ps4PatchPkgPath:
508
+ ps4PatchLatestPkgPath:
509
+ ps4PatchChangeinfoPath:
510
+ ps4PatchDayOne: 0
511
+ ps4attribUserManagement: 0
512
+ ps4attribMoveSupport: 0
513
+ ps4attrib3DSupport: 0
514
+ ps4attribShareSupport: 0
515
+ ps4attribExclusiveVR: 0
516
+ ps4disableAutoHideSplash: 0
517
+ ps4videoRecordingFeaturesUsed: 0
518
+ ps4contentSearchFeaturesUsed: 0
519
+ ps4CompatibilityPS5: 0
520
+ ps4GPU800MHz: 1
521
+ ps4attribEyeToEyeDistanceSettingVR: 0
522
+ ps4IncludedModules: []
523
+ monoEnv:
524
+ splashScreenBackgroundSourceLandscape: {fileID: 0}
525
+ splashScreenBackgroundSourcePortrait: {fileID: 0}
526
+ spritePackerPolicy:
527
+ webGLMemorySize: 256
528
+ webGLExceptionSupport: 1
529
+ webGLNameFilesAsHashes: 0
530
+ webGLDataCaching: 1
531
+ webGLDebugSymbols: 0
532
+ webGLEmscriptenArgs:
533
+ webGLModulesDirectory:
534
+ webGLTemplate: APPLICATION:Default
535
+ webGLAnalyzeBuildSize: 0
536
+ webGLUseEmbeddedResources: 0
537
+ webGLCompressionFormat: 1
538
+ webGLLinkerTarget: 1
539
+ webGLThreadsSupport: 0
540
+ scriptingDefineSymbols: {}
541
+ platformArchitecture: {}
542
+ scriptingBackend: {}
543
+ il2cppCompilerConfiguration: {}
544
+ managedStrippingLevel: {}
545
+ incrementalIl2cppBuild: {}
546
+ allowUnsafeCode: 0
547
+ additionalIl2CppArgs:
548
+ scriptingRuntimeVersion: 1
549
+ apiCompatibilityLevelPerPlatform: {}
550
+ m_RenderingPath: 1
551
+ m_MobileRenderingPath: 1
552
+ metroPackageName: Template_3D
553
+ metroPackageVersion:
554
+ metroCertificatePath:
555
+ metroCertificatePassword:
556
+ metroCertificateSubject:
557
+ metroCertificateIssuer:
558
+ metroCertificateNotAfter: 0000000000000000
559
+ metroApplicationDescription: Template_3D
560
+ wsaImages: {}
561
+ metroTileShortName:
562
+ metroTileShowName: 0
563
+ metroMediumTileShowName: 0
564
+ metroLargeTileShowName: 0
565
+ metroWideTileShowName: 0
566
+ metroSupportStreamingInstall: 0
567
+ metroLastRequiredScene: 0
568
+ metroDefaultTileSize: 1
569
+ metroTileForegroundText: 2
570
+ metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}
571
+ metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
572
+ a: 1}
573
+ metroSplashScreenUseBackgroundColor: 0
574
+ platformCapabilities: {}
575
+ metroTargetDeviceFamilies: {}
576
+ metroFTAName:
577
+ metroFTAFileTypes: []
578
+ metroProtocolName:
579
+ metroCompilationOverrides: 1
580
+ XboxOneProductId:
581
+ XboxOneUpdateKey:
582
+ XboxOneSandboxId:
583
+ XboxOneContentId:
584
+ XboxOneTitleId:
585
+ XboxOneSCId:
586
+ XboxOneGameOsOverridePath:
587
+ XboxOnePackagingOverridePath:
588
+ XboxOneAppManifestOverridePath:
589
+ XboxOneVersion: 1.0.0.0
590
+ XboxOnePackageEncryption: 0
591
+ XboxOnePackageUpdateGranularity: 2
592
+ XboxOneDescription:
593
+ XboxOneLanguage:
594
+ - enus
595
+ XboxOneCapability: []
596
+ XboxOneGameRating: {}
597
+ XboxOneIsContentPackage: 0
598
+ XboxOneEnableGPUVariability: 1
599
+ XboxOneSockets: {}
600
+ XboxOneSplashScreen: {fileID: 0}
601
+ XboxOneAllowedProductIds: []
602
+ XboxOnePersistentLocalStorageSize: 0
603
+ XboxOneXTitleMemory: 8
604
+ xboxOneScriptCompiler: 1
605
+ XboxOneOverrideIdentityName:
606
+ vrEditorSettings:
607
+ daydream:
608
+ daydreamIconForeground: {fileID: 0}
609
+ daydreamIconBackground: {fileID: 0}
610
+ cloudServicesEnabled:
611
+ UNet: 1
612
+ luminIcon:
613
+ m_Name:
614
+ m_ModelFolderPath:
615
+ m_PortalFolderPath:
616
+ luminCert:
617
+ m_CertPath:
618
+ m_PrivateKeyPath:
619
+ luminIsChannelApp: 0
620
+ luminVersion:
621
+ m_VersionCode: 1
622
+ m_VersionName:
623
+ facebookSdkVersion: 7.9.4
624
+ facebookAppId:
625
+ facebookCookies: 1
626
+ facebookLogging: 1
627
+ facebookStatus: 1
628
+ facebookXfbml: 0
629
+ facebookFrictionlessRequests: 1
630
+ apiCompatibilityLevel: 6
631
+ cloudProjectId:
632
+ framebufferDepthMemorylessMode: 0
633
+ projectName:
634
+ organizationId:
635
+ cloudEnabled: 0
636
+ enableNativePlatformBackendsForNewInputSystem: 0
637
+ disableOldInputManagerSupport: 0
638
+ legacyClampBlendShapeWeights: 0
UnityProject/Assets/UnityMeshSimplifier/.circleci/config.yml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2.1
2
+ executors:
3
+ unity-2018:
4
+ docker:
5
+ - image: gableroux/unity3d:2018.4.26f1
6
+ environment:
7
+ UNITY_LICENSE_CONTENT_VAR: UNITY_LICENCE_CONTENT_2018_4_26
8
+ unity-2019:
9
+ docker:
10
+ - image: gableroux/unity3d:2019.4.8f1
11
+ environment:
12
+ UNITY_LICENSE_CONTENT_VAR: UNITY_LICENSE_CONTENT_2019_4_8
13
+ unity-2020:
14
+ docker:
15
+ - image: gableroux/unity3d:2020.1.2f1
16
+ environment:
17
+ UNITY_LICENSE_CONTENT_VAR: UNITY_LICENCE_CONTENT_2020_1_2
18
+ RUN_UNITY_WITH_NOGRAPHICS: "true"
19
+
20
+ .test-2018: &test-2018
21
+ executor: unity-2018
22
+ steps:
23
+ - checkout
24
+ - run:
25
+ name: Preparing Unity
26
+ command: chmod +x ./.circleci/scripts/prepare_unity.sh && ./.circleci/scripts/prepare_unity.sh
27
+ - run:
28
+ name: Running tests
29
+ command: chmod +x ./.circleci/scripts/run_unity_tests.sh && ./.circleci/scripts/run_unity_tests.sh
30
+ - store_artifacts:
31
+ path: test-results
32
+ destination: test-results
33
+ - store_test_results:
34
+ path: test-results
35
+
36
+ .test-2019: &test-2019
37
+ executor: unity-2019
38
+ steps:
39
+ - checkout
40
+ - run:
41
+ name: Preparing Unity
42
+ command: chmod +x ./.circleci/scripts/prepare_unity.sh && ./.circleci/scripts/prepare_unity.sh
43
+ - run:
44
+ name: Running tests
45
+ command: chmod +x ./.circleci/scripts/run_unity_tests.sh && ./.circleci/scripts/run_unity_tests.sh
46
+ - store_artifacts:
47
+ path: test-results
48
+ destination: test-results
49
+ - store_test_results:
50
+ path: test-results
51
+
52
+ .test-2020: &test-2020
53
+ executor: unity-2020
54
+ steps:
55
+ - checkout
56
+ - run:
57
+ name: Preparing Unity
58
+ command: chmod +x ./.circleci/scripts/prepare_unity.sh && ./.circleci/scripts/prepare_unity.sh
59
+ - run:
60
+ name: Running tests
61
+ command: chmod +x ./.circleci/scripts/run_unity_tests.sh && ./.circleci/scripts/run_unity_tests.sh
62
+ - store_artifacts:
63
+ path: test-results
64
+ destination: test-results
65
+ - store_test_results:
66
+ path: test-results
67
+
68
+ jobs:
69
+ test-editmode-2018:
70
+ <<: *test-2018
71
+ environment:
72
+ TEST_PLATFORM: editmode
73
+ test-editmode-2019:
74
+ <<: *test-2019
75
+ environment:
76
+ TEST_PLATFORM: editmode
77
+ test-editmode-2020:
78
+ <<: *test-2020
79
+ environment:
80
+ TEST_PLATFORM: editmode
81
+ # test-playmode-2019:
82
+ # <<: *test-2019
83
+ # environment:
84
+ # TEST_PLATFORM: playmode
85
+
86
+ workflows:
87
+ version: 2
88
+ test:
89
+ jobs:
90
+ - test-editmode-2018:
91
+ context: Unity
92
+ - test-editmode-2019:
93
+ context: Unity
94
+ - test-editmode-2020:
95
+ context: Unity
96
+ # - test-playmode-2019:
97
+ # context: Unity
UnityProject/Assets/UnityMeshSimplifier/.circleci/scripts/prepare_unity.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+ set -x
5
+
6
+ mkdir -p /root/.cache/unity3d
7
+ mkdir -p /root/.local/share/unity3d/Unity/
8
+
9
+ set +x
10
+
11
+ echo "Extracting Unity license file..."
12
+ UNITY_LICENSE_CONTENT="${!UNITY_LICENSE_CONTENT_VAR}"
13
+ if [ -z "$UNITY_LICENSE_CONTENT" ]; then
14
+ echo "The $UNITY_LICENSE_CONTENT_VAR environment variable is not set. Code is not trusted. Aborting."
15
+ exit 1
16
+ fi
17
+ echo "$UNITY_LICENSE_CONTENT" | base64 --decode | tr -d '\r' > /root/.local/share/unity3d/Unity/Unity_lic.ulf
18
+
19
+ echo "Building Unity project..."
20
+ PROJECT_ROOT=$(pwd)
21
+ PACKAGE_DEST="$PROJECT_ROOT/Packages/UnityMeshSimplifier"
22
+ mkdir -p "$PACKAGE_DEST"
23
+ mv Editor "$PACKAGE_DEST/"
24
+ mv Runtime "$PACKAGE_DEST/"
25
+ mv Tests "$PACKAGE_DEST/"
26
+ mv package.json "$PACKAGE_DEST/"
27
+
28
+ mkdir "$PROJECT_ROOT/Assets"
29
+ mkdir "$PROJECT_ROOT/Library"
30
+ mkdir "$PROJECT_ROOT/ProjectSettings"
31
+ cp -Trv "$PROJECT_ROOT/.circleci/ProjectSettings/" "$PROJECT_ROOT/ProjectSettings/"
UnityProject/Assets/UnityMeshSimplifier/.circleci/scripts/run_unity_tests.sh ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ set -x
4
+
5
+ echo "Testing for $TEST_PLATFORM"
6
+
7
+ PROJECT_ROOT="$(pwd)"
8
+ TEST_RESULT_DIR="$PROJECT_ROOT/test-results/nunit"
9
+ TEST_RESULT_FILE_NAME="$TEST_PLATFORM-results.xml"
10
+ TEST_RESULT_FILE_PATH="$TEST_RESULT_DIR/$TEST_RESULT_FILE_NAME"
11
+
12
+ if [ -z "$UNITY_EXECUTABLE" ]; then
13
+ UNITY_EXECUTABLE="/opt/Unity/Editor/Unity"
14
+ fi
15
+
16
+ if [ "$RUN_UNITY_WITH_NOGRAPHICS" == "true" ]; then
17
+ $UNITY_EXECUTABLE \
18
+ -projectPath "$PROJECT_ROOT" \
19
+ -runTests \
20
+ -testPlatform "$TEST_PLATFORM" \
21
+ -testResults "$TEST_RESULT_FILE_PATH" \
22
+ -logFile - \
23
+ -batchmode \
24
+ -nographics
25
+ else
26
+ xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' $UNITY_EXECUTABLE \
27
+ -projectPath "$PROJECT_ROOT" \
28
+ -runTests \
29
+ -testPlatform "$TEST_PLATFORM" \
30
+ -testResults "$TEST_RESULT_FILE_PATH" \
31
+ -logFile - \
32
+ -batchmode
33
+ fi
34
+
35
+ UNITY_EXIT_CODE=$?
36
+
37
+ if [ $UNITY_EXIT_CODE -eq 0 ]; then
38
+ echo "Run succeeded, no failures occurred";
39
+ elif [ $UNITY_EXIT_CODE -eq 2 ]; then
40
+ echo "Run succeeded, some tests failed";
41
+ elif [ $UNITY_EXIT_CODE -eq 3 ]; then
42
+ echo "Run failure (other failure)";
43
+ else
44
+ echo "Unexpected exit code $UNITY_EXIT_CODE";
45
+ exit $UNITY_EXIT_CODE
46
+ fi
47
+
48
+ grep test-run < "$TEST_RESULT_FILE_PATH" | grep Passed
49
+ exit $UNITY_EXIT_CODE
UnityProject/Assets/UnityMeshSimplifier/.editorconfig ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+
10
+ [*.md]
11
+ indent_style = space
12
+ indent_size = 2
13
+
14
+ [*.yml]
15
+ indent_style = space
16
+ indent_size = 2
UnityProject/Assets/UnityMeshSimplifier/.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: bug
6
+ assignees: Whinarn
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Environment (please complete the following information):**
27
+ - OS: [e.g. Mac OS]
28
+ - Unity Version: [e.g. 2019.3.4f1]
29
+
30
+ **Additional context**
31
+ Add any other context about the problem here.
UnityProject/Assets/UnityMeshSimplifier/.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1 @@
 
 
1
+ blank_issues_enabled: true
UnityProject/Assets/UnityMeshSimplifier/.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: Whinarn
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
UnityProject/Assets/UnityMeshSimplifier/.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **Related issues**
2
+ Reference the issues related to your pull request here.
3
+
4
+ **Describe the changes**
5
+ A clear and concise description of what the goal of this pull request is.
6
+
7
+ **How to test**
8
+ A clear and concise description of how to test your changes.
9
+
10
+ **Screenshots**
11
+ If applicable, add screenshots to help explain your changes.
12
+
13
+ **Known issues**
14
+ Specify any known issues with your changes.
15
+
16
+ **Further details**
17
+ Add any further details that might be good to know.
UnityProject/Assets/UnityMeshSimplifier/.github/workflows/commit_message_check.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 'Commit Message Check'
2
+ on:
3
+ push:
4
+ branches:
5
+ - '**'
6
+
7
+ jobs:
8
+ check-commit-message:
9
+ name: Check Commit Message
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Check Commit Type And Scope
13
+ uses: gsactions/commit-message-checker@v1
14
+ with:
15
+ pattern: '^[a-z]+(?:\([a-z\-]+\))?: .+(?:\n(?:\n.+)+)?(?:\n\n.+)?$'
16
+ error: 'Your message must have the correct format "<type>(<scope>): <subject>" with an optional body and footer separated by blank lines.'
17
+ - name: Check Line Length
18
+ uses: gsactions/commit-message-checker@v1
19
+ with:
20
+ pattern: '^.{1,72}(?:\n.{0,100})*$'
21
+ error: 'The maximum line length of 100 characters is exceeded.'
UnityProject/Assets/UnityMeshSimplifier/.github/workflows/release.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ jobs:
7
+ release:
8
+ name: release
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ with:
13
+ fetch-depth: 0
14
+ - name: Release
15
+ uses: cycjimmy/semantic-release-action@v2
16
+ with:
17
+ semantic_version: 19
18
+ extra_plugins: |
19
+ @semantic-release/changelog
20
+ @semantic-release/git
21
+ branch: master
22
+ env:
23
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UnityProject/Assets/UnityMeshSimplifier/.releaserc.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tagFormat": "v${version}",
3
+ "plugins": [
4
+ ["@semantic-release/commit-analyzer", { "preset": "angular" }],
5
+ ["@semantic-release/release-notes-generator", { "preset": "angular" }],
6
+ ["@semantic-release/changelog", { "preset": "angular" }],
7
+ ["@semantic-release/npm", { "npmPublish": false }],
8
+ ["@semantic-release/git", {
9
+ "assets": [
10
+ "package.json",
11
+ "CHANGELOG.md"
12
+ ],
13
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
14
+ }],
15
+ "@semantic-release/github"
16
+ ]
17
+ }
UnityProject/Assets/UnityMeshSimplifier/CHANGELOG.md ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## [3.1.1](https://github.com/Whinarn/UnityMeshSimplifier/compare/v3.1.0...v3.1.1) (2026-01-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **lods:** fix obsolete ShaderUtil usage in LODGenerator for Unity 2021.2+ ([#74](https://github.com/Whinarn/UnityMeshSimplifier/issues/74)) ([314eeb2](https://github.com/Whinarn/UnityMeshSimplifier/commit/314eeb2ce7b44c7e5802e2d85e9196d28852d2ff))
7
+
8
+ # [3.1.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v3.0.1...v3.1.0) (2022-02-25)
9
+
10
+
11
+ ### Features
12
+
13
+ * **simplifier:** added options validation ([55264ce](https://github.com/Whinarn/UnityMeshSimplifier/commit/55264ce8a28f6755a2a920f25aa2312f2d185e72))
14
+
15
+ ## [3.0.1](https://github.com/Whinarn/UnityMeshSimplifier/compare/v3.0.0...v3.0.1) (2021-06-25)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * support Unity 2021 ([2f2eb3b](https://github.com/Whinarn/UnityMeshSimplifier/commit/2f2eb3bee2ac1d1691373200983ac64ae507dfc8))
21
+
22
+ # [3.0.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.6...v3.0.0) (2021-03-27)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **lods:** prevent empty mesh names ([ec6cf87](https://github.com/Whinarn/UnityMeshSimplifier/commit/ec6cf87c4c652aca953cb782d8796749037322a6))
28
+ * **simplifier:** obsolete properties that moved to options struct ([84664d1](https://github.com/Whinarn/UnityMeshSimplifier/commit/84664d1852da93e5206f335d17db7025c7be5281))
29
+ * **simplifier:** options for uv component count ([7f7b773](https://github.com/Whinarn/UnityMeshSimplifier/commit/7f7b77370442f5e49dd74b2e8c39a427b21980ab))
30
+ * **simplifier:** removed obsolete properties ([24ccc56](https://github.com/Whinarn/UnityMeshSimplifier/commit/24ccc5663c1281e2feadf6c03e947481a68844c2))
31
+
32
+
33
+ ### Features
34
+
35
+ * **lods:** save assets path is now less restricted ([380bda9](https://github.com/Whinarn/UnityMeshSimplifier/commit/380bda999c8b95baed6a6533b0b66bfb4eb8d2c9))
36
+ * **package:** bump minimum required version of Unity to 2018.1 ([8f37f81](https://github.com/Whinarn/UnityMeshSimplifier/commit/8f37f81a7688c2ff3a895c9616e4b171cd54a633))
37
+ * **simplifier:** set manual uv component count ([9795860](https://github.com/Whinarn/UnityMeshSimplifier/commit/9795860c6354b87924b97b354688e2b59098eda7))
38
+
39
+
40
+ ### BREAKING CHANGES
41
+
42
+ * **simplifier:** removed obsolete properties
43
+ * **lods:** save assets paths are now related to Assets/ rather
44
+ than Assets/UMS_LODS/
45
+
46
+ ## [2.3.6](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.5...v2.3.6) (2020-11-20)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * **simplifier:** prevent near zero denominator ([469272a](https://github.com/Whinarn/UnityMeshSimplifier/commit/469272ae031774383eb13253e7e2d5abbaafe79c))
52
+
53
+ ## [2.3.5](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.4...v2.3.5) (2020-10-10)
54
+
55
+
56
+ ### Bug Fixes
57
+
58
+ * **lod-generator-helper:** mark scene as dirty ([7554f8e](https://github.com/Whinarn/UnityMeshSimplifier/commit/7554f8ecb7cd105aacdad4a07d32eaf081cf7ae3))
59
+ * **unity:** increase support for unity 2020 ([7a28614](https://github.com/Whinarn/UnityMeshSimplifier/commit/7a286148aecef6f7918abce34f3e7000f2856f4a))
60
+
61
+ ## [2.3.4](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.3...v2.3.4) (2020-08-25)
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * **tests:** compile errors on 2018.4.26f1 ([#38](https://github.com/Whinarn/UnityMeshSimplifier/issues/38)) ([91b5ad7](https://github.com/Whinarn/UnityMeshSimplifier/commit/91b5ad7de7d6f77d29275fc69d3e7506df6a586f))
67
+
68
+ ## [2.3.3](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.2...v2.3.3) (2020-05-01)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * **mesh:** bug related to degenerated triangle when using smart linking ([e9d5def](https://github.com/Whinarn/UnityMeshSimplifier/commit/e9d5def2eb6e18eed7e9f86943e5d32bf0721d60))
74
+
75
+ ## [2.3.2](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.1...v2.3.2) (2020-04-30)
76
+
77
+
78
+ ### Bug Fixes
79
+
80
+ * **meshutils:** GetUsedUVComponents should now be able to return zero ([af60914](https://github.com/Whinarn/UnityMeshSimplifier/commit/af6091481d212f5c98bf1f8f16cf922367f0a08d))
81
+
82
+ ## [2.3.1](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.3.0...v2.3.1) (2020-04-14)
83
+
84
+
85
+ ### Reverts
86
+
87
+ * temporarily allow refactor commits to trigger a release ([fd8d697](https://github.com/Whinarn/UnityMeshSimplifier/commit/fd8d69751038f0d8a6fc9880c3159d3718d6a2ee))
88
+
89
+ ## [2.3.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.2.0...v2.3.0) (2020-04-14)
90
+
91
+ ### Added
92
+
93
+ * mesh simplifier uses the simplification options struct ([87d3fa8](https://github.com/Whinarn/UnityMeshSimplifier/commit/87d3fa81419c4fce2d360572290bfecee7a3fbf9))
94
+
95
+ ## [v2.2.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.1.0...v2.2.0) (2020-03-24)
96
+
97
+
98
+ ### Added
99
+
100
+ * An option for preserving surface curvature.
101
+
102
+ ### Fixed
103
+
104
+ * A bug with calculating vertex positions when combining meshes.
105
+
106
+ ## [v2.1.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.0.1...v2.1.0) (2020-03-16)
107
+
108
+
109
+ ### Added
110
+
111
+ * A button to copy visibility changes from the LOD Group.
112
+
113
+ ### Fixed
114
+
115
+ * Fixed an incorrect tooltip for the MaxIterationCount of the SimplificationOptions struct.
116
+ * Fixed potential problems of destroying LODs after some renderers no longer exists.
117
+ * Meshes are always readable in editor.
118
+ * Fixed a warning that is printed when a folder that doesn't exist is attempted to be removed.
119
+ * Fixed bugs where mismatching bindposes resulted in incorrectly combined meshes.
120
+
121
+ ## [v2.0.1](https://github.com/Whinarn/UnityMeshSimplifier/compare/v2.0.0...v2.0.1) (2019-07-12)
122
+
123
+
124
+ ### Fixed
125
+
126
+ * Fixed compilation errors in Unity 2018
127
+
128
+ ## [v2.0.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v1.0.3-legacy...v2.0.0) (2019-07-07)
129
+
130
+
131
+ ### Added
132
+
133
+ * Unity package manifest file.
134
+ * LOD generator.
135
+ * Component to assist with LOD generation.
136
+ * Added support to interpolate blend shapes.
137
+ * Added support for up to 8 UV channels.
138
+
139
+ ### Removed
140
+
141
+ * Removed the long obsolete KeepBorders property on the MeshSimplifier class.
142
+
143
+ ### Changed
144
+
145
+ * Reorganized the project layout to match the Unity convention.
146
+ * The vertex attributes are now interpolated using barycentric coordinates.
147
+
148
+ ## [v1.0.3](https://github.com/Whinarn/UnityMeshSimplifier/compare/v1.0.2-legacy...v1.0.3-legacy) (2018-10-20)
149
+
150
+
151
+ ### Fixed
152
+
153
+ * The maximum hash distance is now calculated based on the VertexLinkDistanceSqr property value instead of being hardcoded to 1.
154
+ * Fixed an issue with the vertex hashes not using the entire integer range, but instead was using only half of it.
155
+
156
+ ## [v1.0.2](https://github.com/Whinarn/UnityMeshSimplifier/compare/v1.0.1-legacy...v1.0.2-legacy) (2018-07-05)
157
+
158
+
159
+ ### Fixed
160
+
161
+ * Fixed a documentation mistake with the VertexLinkDistanceSqr property on the MeshSimplifier class.
162
+
163
+ ## [v1.0.1](https://github.com/Whinarn/UnityMeshSimplifier/compare/v1.0.0-legacy...v1.0.1-legacy) (2018-06-03)
164
+
165
+
166
+ ### Fixed
167
+
168
+ * Added more exception throwing on invalid parameters that wasn't previously handled.
169
+ * Added assertions when getting the triangle indices for a sub-mesh, to detect a faulty state more easily.
170
+ * Optimized the retrieving of sub-mesh triangles when having a large number of sub-meshes.
171
+ * Heavily optimized the initialization and simplification process.
172
+
173
+ ## [v1.0.0](https://github.com/Whinarn/UnityMeshSimplifier/compare/v0.1.0-legacy...v1.0.0-legacy) (2018-05-12)
174
+
175
+
176
+ ### Added
177
+
178
+ * Unity assembly definition file.
179
+ * Feature to change the maximum iteration count for the mesh simplification.
180
+
181
+ ### Fixed
182
+
183
+ * Better support for skinned meshes.
184
+ * Support for Unity 2017.4 and 2018.X
185
+
186
+ ## [v0.1.0](https://github.com/Whinarn/UnityMeshSimplifier/releases/tag/v0.1.0-legacy) (2018-04-01)
187
+
188
+
189
+ ### Added
190
+
191
+ * A mesh simplification algorithm based on the [Fast Quadric Mesh Simplification](https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification) algorithm.
192
+ * A feature (Smart Linking) that attempts to solve problems where holes could appear in simplified meshes.
193
+ * Support for static and skinned meshes.
194
+ * Support for 2D, 3D and 4D UVs.
UnityProject/Assets/UnityMeshSimplifier/CHANGELOG.md.meta ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 5e029678e8aeb0044b335e85de4f2948
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTING.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to UnityMeshSimplifier
2
+
3
+ Thank you for considering contributing to this project.
4
+
5
+ ## Setup
6
+
7
+ In order to start contributing to this project, you will need to setup a new Unity project.
8
+ Make sure that you are using a compatible version of Unity ([see here](https://github.com/Whinarn/UnityMeshSimplifier/blob/master/README.md#compatibility)).
9
+
10
+ The next step is to fork your own copy of this repository here on Github.
11
+ Once you have your forked copy, you can should now clone it into the *Packages* directory of your Unity project.
12
+
13
+ Your Unity project structure should now look something like this:
14
+
15
+ ```text
16
+ Assets
17
+ Library
18
+ ...
19
+ Packages
20
+ UnityMeshSimplifier
21
+ ...
22
+ ProjectSettings
23
+ ...
24
+ ```
25
+
26
+ When starting up your Unity project, you should see UnityMeshSimplifier appear in the package manager (Window -> Package Manager).
27
+
28
+ ## Commit Guidelines
29
+
30
+ We have strict rules over how our git commit messages can be formatted. This is due to them being used for automated semantic releases, as well as making the messages more readable and standarized.
31
+
32
+ Each commit should only ever do one change, so that it is easy to review.
33
+
34
+ ### Commit Message Format
35
+
36
+ Every commit must specify at least a **type** and a **subject**. While **scope**, **body**, and **footer** remains optional.
37
+
38
+ ```text
39
+ <type>(scope): <subject>
40
+ <BLANK LINE>
41
+ <body>
42
+ <BLANK LINE>
43
+ <footer>
44
+ ```
45
+
46
+ Any line of the commit message cannot be longer than 100 characters (with the header being maximum 72 characters), in order for them to be easy to read in varios git tools.
47
+
48
+ **Examples:**
49
+
50
+ ```text
51
+ fix(editor): lod generator component editor exception when generating lods
52
+
53
+ Fixed a bug with exceptions sometimes being thrown when clicking on the button
54
+ to generate LODs in the LODGeneratorHelper editor.
55
+ ```
56
+
57
+ ```text
58
+ docs(readme): added more detailed examples to the readme
59
+ ```
60
+
61
+ #### Type
62
+
63
+ All supported commit types:
64
+
65
+ * **chore**: Changes that aren't relevant to a release.
66
+ * **ci**: Changes made to the CI configuration files and scripts.
67
+ * **docs**: Changes to documentation.
68
+ * **feat**: A new feature.
69
+ * **fix**: A bug fix.
70
+ * **perf**: Performance optimization.
71
+ * **refactor**: A code change that neither fixes a bug nor adds a feature.
72
+ * **style**: Changes that do not effect the logic of the code.
73
+ * **test**: Added or modified tests
74
+
75
+ #### Scope
76
+
77
+ A few recommended scopes:
78
+
79
+ * **component**
80
+ * **editor**
81
+ * **lod**
82
+ * **math**
83
+ * **mesh**
84
+ * **utility**
85
+
86
+ Please note that you are also free to use additional scopes, but only if necessary.
87
+
88
+ #### Subject
89
+
90
+ The subject of a commit should be short and be effective in explaining it.
91
+
92
+ #### Body
93
+
94
+ A body can be used if the subject cannot accurately explain everything that the commit contains.
95
+
96
+ Have in mind however, that each commit should only contain one change.
97
+
98
+ #### Footer
99
+
100
+ A footer can be used to specify issues that can be resolved/closed.
101
+
102
+ Read more about how that works [here](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue).
103
+
104
+ ## Submitting changes
105
+
106
+ Please send me a [pull request](https://github.com/Whinarn/UnityMeshSimplifier/compare) with a short and clear title and a clear description that effectively conveys what your goal of the changes are. Please also mention any issues that your pull request aims to solve.
UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTING.md.meta ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 512408b54d8be83458a9e567a1dd91e7
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTORS.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UnityMeshSimplifier contributors
2
+
3
+ A special thanks goes out to all contributors of this project.
4
+
5
+ The names are sorted alphabetically.
6
+
7
+ * **[amirebrahimi](https://github.com/amirebrahimi)**
8
+ * **[bawar9](https://github.com/bawar9)**
9
+ * **[is3D-1](https://github.com/is3D-1)**
10
+ * **[sbeca](https://github.com/sbeca)**
11
+ * **[soraryu](https://github.com/soraryu)**
12
+
13
+ See the full list of contributors [here](https://github.com/Whinarn/UnityMeshSimplifier/graphs/contributors).
UnityProject/Assets/UnityMeshSimplifier/CONTRIBUTORS.md.meta ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 41424308a86bb9a4084d131ac5ce95cd
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Editor.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: e9816c7903bd8744b806177ae3266ec9
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Editor/LODGeneratorHelperEditor.cs ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System.Collections.Generic;
28
+ using System.Linq;
29
+ using UnityEngine;
30
+ using UnityEditor;
31
+ using UnityEditor.SceneManagement;
32
+
33
+ namespace UnityMeshSimplifier.Editor
34
+ {
35
+ [CustomEditor(typeof(LODGeneratorHelper))]
36
+ internal sealed class LODGeneratorHelperEditor : UnityEditor.Editor
37
+ {
38
+ private const string FadeModeFieldName = "fadeMode";
39
+ private const string AnimateCrossFadingFieldName = "animateCrossFading";
40
+ private const string AutoCollectRenderersFieldName = "autoCollectRenderers";
41
+ private const string SimplificationOptionsFieldName = "simplificationOptions";
42
+ private const string SaveAssetsPathFieldName = "saveAssetsPath";
43
+ private const string LevelsFieldName = "levels";
44
+ private const string IsGeneratedFieldName = "isGenerated";
45
+ private const string LevelScreenRelativeHeightFieldName = "screenRelativeTransitionHeight";
46
+ private const string LevelFadeTransitionWidthFieldName = "fadeTransitionWidth";
47
+ private const string LevelQualityFieldName = "quality";
48
+ private const string LevelCombineMeshesFieldName = "combineMeshes";
49
+ private const string LevelCombineSubMeshesFieldName = "combineSubMeshes";
50
+ private const string LevelRenderersFieldName = "renderers";
51
+ private const string SimplificationOptionsEnableSmartLinkFieldName = "EnableSmartLink";
52
+ private const string SimplificationOptionsVertexLinkDistanceFieldName = "VertexLinkDistance";
53
+ private const float RemoveLevelButtonSize = 20f;
54
+ private const float RendererButtonWidth = 60f;
55
+ private const float RemoveRendererButtonSize = 20f;
56
+
57
+ private SerializedProperty fadeModeProperty = null;
58
+ private SerializedProperty animateCrossFadingProperty = null;
59
+ private SerializedProperty autoCollectRenderersProperty = null;
60
+ private SerializedProperty simplificationOptionsProperty = null;
61
+ private SerializedProperty saveAssetsPathProperty = null;
62
+ private SerializedProperty levelsProperty = null;
63
+ private SerializedProperty isGeneratedProperty = null;
64
+
65
+ private bool overrideSaveAssetsPath = false;
66
+ private bool[] settingsExpanded = null;
67
+ private LODGeneratorHelper lodGeneratorHelper = null;
68
+
69
+ private static readonly GUIContent createLevelButtonContent = new GUIContent("Create Level", "Creates a new LOD level.");
70
+ private static readonly GUIContent deleteLevelButtonContent = new GUIContent("X", "Deletes this LOD level.");
71
+ private static readonly GUIContent generateLODButtonContent = new GUIContent("Generate LODs", "Generates the LOD levels.");
72
+ private static readonly GUIContent destroyLODButtonContent = new GUIContent("Destroy LODs", "Destroys the LOD levels.");
73
+ private static readonly GUIContent copyVisibilityChangesContent = new GUIContent("Copy Visibility Changes", "Copy changed LODGroup visibility settings to LODGeneratorHelper.");
74
+ private static readonly GUIContent settingsContent = new GUIContent("Settings", "The settings for the LOD level.");
75
+ private static readonly GUIContent renderersHeaderContent = new GUIContent("Renderers:", "The renderers used for this LOD level.");
76
+ private static readonly GUIContent removeRendererButtonContent = new GUIContent("X", "Removes this renderer.");
77
+ private static readonly GUIContent addRendererButtonContent = new GUIContent("Add", "Adds a renderer to this LOD level.");
78
+ private static readonly GUIContent overrideSaveAssetsPathContent = new GUIContent("Override Save Assets Path", "If you want to override the path where the generated assets are saved.");
79
+ private static readonly Color removeColor = new Color(1f, 0.6f, 0.6f, 1f);
80
+
81
+ private static readonly int ObjectPickerControlID = "LODGeneratorSelector".GetHashCode();
82
+
83
+ private void OnEnable()
84
+ {
85
+ fadeModeProperty = serializedObject.FindProperty(FadeModeFieldName);
86
+ animateCrossFadingProperty = serializedObject.FindProperty(AnimateCrossFadingFieldName);
87
+ autoCollectRenderersProperty = serializedObject.FindProperty(AutoCollectRenderersFieldName);
88
+ simplificationOptionsProperty = serializedObject.FindProperty(SimplificationOptionsFieldName);
89
+ saveAssetsPathProperty = serializedObject.FindProperty(SaveAssetsPathFieldName);
90
+ levelsProperty = serializedObject.FindProperty(LevelsFieldName);
91
+ isGeneratedProperty = serializedObject.FindProperty(IsGeneratedFieldName);
92
+
93
+ overrideSaveAssetsPath = (saveAssetsPathProperty.stringValue.Length > 0);
94
+ lodGeneratorHelper = target as LODGeneratorHelper;
95
+ }
96
+
97
+ public override void OnInspectorGUI()
98
+ {
99
+ serializedObject.UpdateIfRequiredOrScript();
100
+
101
+ bool isGenerated = isGeneratedProperty.boolValue;
102
+ if (isGenerated)
103
+ {
104
+ DrawGeneratedView();
105
+ }
106
+ else
107
+ {
108
+ DrawNotGeneratedView();
109
+ }
110
+
111
+ serializedObject.ApplyModifiedProperties();
112
+ }
113
+
114
+ private void DrawGeneratedView()
115
+ {
116
+ if (GUILayout.Button(destroyLODButtonContent))
117
+ {
118
+ DestroyLODs();
119
+ }
120
+
121
+ EditorGUI.BeginDisabledGroup(!VisibilitySettingsHaveChanged());
122
+ if(GUILayout.Button(copyVisibilityChangesContent))
123
+ {
124
+ CopyVisibilityChanges();
125
+ }
126
+ EditorGUI.EndDisabledGroup();
127
+ }
128
+
129
+ private void DrawNotGeneratedView()
130
+ {
131
+ EditorGUILayout.PropertyField(fadeModeProperty);
132
+ var fadeMode = (LODFadeMode)fadeModeProperty.intValue;
133
+
134
+ bool hasCrossFade = (fadeMode == LODFadeMode.CrossFade || fadeMode == LODFadeMode.SpeedTree);
135
+ if (hasCrossFade)
136
+ {
137
+ EditorGUILayout.PropertyField(animateCrossFadingProperty);
138
+ }
139
+
140
+ EditorGUILayout.PropertyField(autoCollectRenderersProperty);
141
+ DrawSimplificationOptions();
142
+
143
+ bool newOverrideSaveAssetsPath = EditorGUILayout.Toggle(overrideSaveAssetsPathContent, overrideSaveAssetsPath);
144
+ if (newOverrideSaveAssetsPath != overrideSaveAssetsPath)
145
+ {
146
+ overrideSaveAssetsPath = newOverrideSaveAssetsPath;
147
+ saveAssetsPathProperty.stringValue = string.Empty;
148
+ serializedObject.ApplyModifiedProperties();
149
+ GUIUtility.ExitGUI();
150
+ }
151
+
152
+ if (overrideSaveAssetsPath)
153
+ {
154
+ EditorGUI.BeginChangeCheck();
155
+ EditorGUILayout.PropertyField(saveAssetsPathProperty);
156
+ if (EditorGUI.EndChangeCheck())
157
+ {
158
+ saveAssetsPathProperty.stringValue = IOUtils.MakeSafeRelativePath(saveAssetsPathProperty.stringValue);
159
+ }
160
+ }
161
+
162
+ if (settingsExpanded == null || settingsExpanded.Length != levelsProperty.arraySize)
163
+ {
164
+ var newSettingsExpanded = new bool[levelsProperty.arraySize];
165
+ if (settingsExpanded != null)
166
+ {
167
+ System.Array.Copy(settingsExpanded, 0, newSettingsExpanded, 0, Mathf.Min(settingsExpanded.Length, newSettingsExpanded.Length));
168
+ }
169
+ settingsExpanded = newSettingsExpanded;
170
+ }
171
+
172
+ for (int levelIndex = 0; levelIndex < levelsProperty.arraySize; levelIndex++)
173
+ {
174
+ var levelProperty = levelsProperty.GetArrayElementAtIndex(levelIndex);
175
+ DrawLevel(levelIndex, levelProperty, hasCrossFade);
176
+ }
177
+
178
+ if (GUILayout.Button(createLevelButtonContent))
179
+ {
180
+ CreateLevel();
181
+ }
182
+
183
+ if (GUILayout.Button(generateLODButtonContent))
184
+ {
185
+ GenerateLODs();
186
+ }
187
+ }
188
+
189
+ private void DrawSimplificationOptions()
190
+ {
191
+ if (EditorGUILayout.PropertyField(simplificationOptionsProperty, false))
192
+ {
193
+ ++EditorGUI.indentLevel;
194
+
195
+ var enableSmartLinkProperty = simplificationOptionsProperty.FindPropertyRelative(SimplificationOptionsEnableSmartLinkFieldName);
196
+
197
+ var childProperties = simplificationOptionsProperty.GetChildProperties();
198
+ foreach (var childProperty in childProperties)
199
+ {
200
+ if (!enableSmartLinkProperty.boolValue && string.Equals(childProperty.name, SimplificationOptionsVertexLinkDistanceFieldName))
201
+ continue;
202
+
203
+ EditorGUILayout.PropertyField(childProperty, true);
204
+ }
205
+
206
+ --EditorGUI.indentLevel;
207
+ }
208
+ }
209
+
210
+ private void DrawLevel(int index, SerializedProperty levelProperty, bool hasCrossFade)
211
+ {
212
+ EditorGUILayout.BeginVertical(EditorStyles.helpBox);
213
+ EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
214
+ GUILayout.Label(string.Format("Level {0}", index + 1), EditorStyles.boldLabel);
215
+
216
+ var previousBackgroundColor = GUI.backgroundColor;
217
+ GUI.backgroundColor = removeColor;
218
+ if (GUILayout.Button(deleteLevelButtonContent, GUILayout.Width(RemoveLevelButtonSize)))
219
+ {
220
+ DeleteLevel(index);
221
+ }
222
+ GUI.backgroundColor = previousBackgroundColor;
223
+ EditorGUILayout.EndHorizontal();
224
+
225
+ ++EditorGUI.indentLevel;
226
+
227
+ var screenRelativeHeightProperty = levelProperty.FindPropertyRelative(LevelScreenRelativeHeightFieldName);
228
+ EditorGUILayout.PropertyField(screenRelativeHeightProperty);
229
+
230
+ var qualityProperty = levelProperty.FindPropertyRelative(LevelQualityFieldName);
231
+ EditorGUILayout.PropertyField(qualityProperty);
232
+
233
+ bool animateCrossFading = (hasCrossFade ? animateCrossFadingProperty.boolValue : false);
234
+ settingsExpanded[index] = EditorGUILayout.Foldout(settingsExpanded[index], settingsContent);
235
+ if (settingsExpanded[index])
236
+ {
237
+ ++EditorGUI.indentLevel;
238
+
239
+ var combineMeshesProperty = levelProperty.FindPropertyRelative(LevelCombineMeshesFieldName);
240
+ EditorGUILayout.PropertyField(combineMeshesProperty);
241
+
242
+ if (combineMeshesProperty.boolValue)
243
+ {
244
+ var combineSubMeshesProperty = levelProperty.FindPropertyRelative(LevelCombineSubMeshesFieldName);
245
+ EditorGUILayout.PropertyField(combineSubMeshesProperty);
246
+ }
247
+
248
+ var childProperties = levelProperty.GetChildProperties();
249
+ foreach (var childProperty in childProperties)
250
+ {
251
+ if (string.Equals(childProperty.name, LevelScreenRelativeHeightFieldName) || string.Equals(childProperty.name, LevelQualityFieldName) ||
252
+ string.Equals(childProperty.name, LevelCombineMeshesFieldName) || string.Equals(childProperty.name, LevelCombineSubMeshesFieldName) ||
253
+ string.Equals(childProperty.name, LevelRenderersFieldName))
254
+ {
255
+ continue;
256
+ }
257
+ else if ((!hasCrossFade || !animateCrossFading) && string.Equals(childProperty.name, LevelFadeTransitionWidthFieldName))
258
+ {
259
+ continue;
260
+ }
261
+
262
+ EditorGUILayout.PropertyField(childProperty, true);
263
+ }
264
+
265
+ --EditorGUI.indentLevel;
266
+ }
267
+
268
+ // Remove any null renderers
269
+ var renderersProperty = levelProperty.FindPropertyRelative(LevelRenderersFieldName);
270
+ for (int rendererIndex = renderersProperty.arraySize - 1; rendererIndex >= 0; rendererIndex--)
271
+ {
272
+ var rendererProperty = renderersProperty.GetArrayElementAtIndex(rendererIndex);
273
+ var renderer = rendererProperty.objectReferenceValue as Renderer;
274
+ if (renderer == null)
275
+ {
276
+ renderersProperty.DeleteArrayElementAtIndex(rendererIndex);
277
+ }
278
+ }
279
+
280
+ bool autoCollectRenderers = autoCollectRenderersProperty.boolValue;
281
+ if (!autoCollectRenderers)
282
+ {
283
+ DrawRendererList(renderersProperty, EditorGUIUtility.currentViewWidth);
284
+ }
285
+
286
+ --EditorGUI.indentLevel;
287
+ EditorGUILayout.EndVertical();
288
+ }
289
+
290
+ private void DrawRendererList(SerializedProperty renderersProperty, float availableWidth)
291
+ {
292
+ GUILayout.Label(renderersHeaderContent, EditorStyles.boldLabel);
293
+
294
+ int rendererCount = renderersProperty.arraySize;
295
+ int renderersPerRow = Mathf.Max(1, Mathf.FloorToInt(availableWidth / RendererButtonWidth));
296
+ int rendererRowCount = Mathf.CeilToInt((float)(rendererCount + 1) / (float)renderersPerRow);
297
+
298
+ var listPosition = GUILayoutUtility.GetRect(0f, rendererRowCount * RendererButtonWidth, GUILayout.ExpandWidth(true));
299
+ GUI.Box(listPosition, GUIContent.none, EditorStyles.helpBox);
300
+
301
+ var listInnerPosition = new Rect(listPosition.x + 3f, listPosition.y, listPosition.width - 6f, listPosition.height);
302
+ float buttonWidth = listInnerPosition.width / (float)renderersPerRow;
303
+ for (int rendererIndex = 0; rendererIndex < renderersProperty.arraySize; rendererIndex++)
304
+ {
305
+ int rowIndex = rendererIndex / renderersPerRow;
306
+ int colIndex = rendererIndex % renderersPerRow;
307
+ var rendererProperty = renderersProperty.GetArrayElementAtIndex(rendererIndex);
308
+ var renderer = rendererProperty.objectReferenceValue as Renderer;
309
+
310
+ var buttonPosition = new Rect(listInnerPosition.x + (colIndex * buttonWidth), listInnerPosition.y + (rowIndex * RendererButtonWidth) + 2f,
311
+ buttonWidth - 4f, RendererButtonWidth - 4f);
312
+ DrawRendererButton(buttonPosition, renderersProperty, rendererIndex, renderer);
313
+ }
314
+
315
+ int addButtonRowIndex = rendererCount / renderersPerRow;
316
+ int addButtonColIndex = rendererCount % renderersPerRow;
317
+ var addButtonPosition = new Rect(listInnerPosition.x + (addButtonColIndex * buttonWidth), listInnerPosition.y + (addButtonRowIndex * RendererButtonWidth) + 2f,
318
+ buttonWidth - 4f, RendererButtonWidth - 4f);
319
+ HandleAddRenderer(addButtonPosition, listPosition, renderersProperty);
320
+ }
321
+
322
+ private void DrawRendererButton(Rect position, SerializedProperty renderersProperty, int rendererIndex, Renderer renderer)
323
+ {
324
+ var current = Event.current;
325
+ var currentEvent = current.type;
326
+ var removeButtonPosition = new Rect(position.xMax - RemoveRendererButtonSize, position.yMax - RemoveRendererButtonSize, RemoveRendererButtonSize, RemoveRendererButtonSize);
327
+
328
+ if (currentEvent != EventType.Repaint)
329
+ {
330
+ if (currentEvent == EventType.MouseDown && current.button == 0)
331
+ {
332
+ if (removeButtonPosition.Contains(current.mousePosition))
333
+ {
334
+ renderersProperty.DeleteArrayElementAtIndex(rendererIndex);
335
+ current.Use();
336
+ serializedObject.ApplyModifiedProperties();
337
+ GUIUtility.ExitGUI();
338
+ }
339
+ else if (position.Contains(current.mousePosition))
340
+ {
341
+ Debug.Log("");
342
+ EditorGUIUtility.PingObject(renderer);
343
+ current.Use();
344
+ }
345
+ }
346
+ }
347
+ else
348
+ {
349
+ if (renderer != null)
350
+ {
351
+ GUIContent content = null;
352
+ var skinnedMeshRenderer = (renderer as SkinnedMeshRenderer);
353
+ if (skinnedMeshRenderer != null)
354
+ {
355
+ var meshPreview = AssetPreview.GetAssetPreview(skinnedMeshRenderer.sharedMesh);
356
+ content = new GUIContent(meshPreview, renderer.gameObject.name);
357
+ }
358
+ else
359
+ {
360
+ var meshFilter = renderer.GetComponent<MeshFilter>();
361
+ if (meshFilter != null && meshFilter.sharedMesh != null)
362
+ {
363
+ var meshPreview = AssetPreview.GetAssetPreview(meshFilter.sharedMesh);
364
+ content = new GUIContent(meshPreview, renderer.gameObject.name);
365
+ }
366
+ else
367
+ {
368
+ string niceRendererTypeName = ObjectNames.NicifyVariableName(renderer.GetType().Name);
369
+ content = new GUIContent(niceRendererTypeName, renderer.gameObject.name);
370
+ }
371
+ }
372
+
373
+ var buttonPosition = new Rect(position.x + 2f, position.y + 2f, position.width - 4f, position.height - 4f);
374
+ GUI.Box(position, GUIContent.none, EditorStyles.helpBox);
375
+ GUI.Box(buttonPosition, content);
376
+ }
377
+ else
378
+ {
379
+ GUI.Box(position, GUIContent.none, EditorStyles.helpBox);
380
+ }
381
+
382
+ var previousBackgroundColor = GUI.backgroundColor;
383
+ GUI.backgroundColor = removeColor;
384
+ GUI.Box(removeButtonPosition, removeRendererButtonContent, EditorStyles.miniButton);
385
+ GUI.backgroundColor = previousBackgroundColor;
386
+ }
387
+ }
388
+
389
+ private void HandleAddRenderer(Rect position, Rect listArea, SerializedProperty renderersProperty)
390
+ {
391
+ if (GUI.Button(position, addRendererButtonContent))
392
+ {
393
+ EditorGUIUtility.ShowObjectPicker<Renderer>(null, true, string.Empty, ObjectPickerControlID);
394
+ GUIUtility.ExitGUI();
395
+ }
396
+
397
+ var current = Event.current;
398
+ var currentEvent = current.type;
399
+ if (currentEvent == EventType.DragUpdated || currentEvent == EventType.DragPerform)
400
+ {
401
+ if (listArea.Contains(current.mousePosition))
402
+ {
403
+ var dragObjects = DragAndDrop.objectReferences;
404
+ if (dragObjects != null && dragObjects.Length > 0)
405
+ {
406
+ DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
407
+ if (currentEvent == EventType.DragPerform)
408
+ {
409
+ var draggedGameObjects = from go in dragObjects
410
+ where go as GameObject != null
411
+ select go as GameObject;
412
+ var draggedRenderers = from renderer in dragObjects
413
+ where renderer as Renderer != null
414
+ select renderer as Renderer;
415
+ var gameObjectRenderers = GetRenderers(draggedGameObjects, true);
416
+ AddRenderers(renderersProperty, draggedRenderers, true);
417
+ AddRenderers(renderersProperty, gameObjectRenderers, true);
418
+ DragAndDrop.AcceptDrag();
419
+ }
420
+ }
421
+
422
+ current.Use();
423
+ }
424
+ }
425
+ else if (currentEvent == EventType.ExecuteCommand)
426
+ {
427
+ string commandName = current.commandName;
428
+ if (string.Equals(commandName, "ObjectSelectorClosed") && EditorGUIUtility.GetObjectPickerControlID() == ObjectPickerControlID)
429
+ {
430
+ var gameObject = EditorGUIUtility.GetObjectPickerObject() as GameObject;
431
+ if (gameObject != null)
432
+ {
433
+ var gameObjectRenderers = GetRenderers(new GameObject[] { gameObject }, true);
434
+ AddRenderers(renderersProperty, gameObjectRenderers, true);
435
+ }
436
+ current.Use();
437
+ GUIUtility.ExitGUI();
438
+ }
439
+ }
440
+ }
441
+
442
+ private void AddRenderers(SerializedProperty renderersProperty, IEnumerable<Renderer> renderers, bool append)
443
+ {
444
+ if (!append)
445
+ {
446
+ renderersProperty.ClearArray();
447
+ }
448
+
449
+ var existingRendererList = new List<Renderer>(renderersProperty.arraySize);
450
+ for (int i = 0; i < renderersProperty.arraySize; i++)
451
+ {
452
+ var rendererProperty = renderersProperty.GetArrayElementAtIndex(i);
453
+ var renderer = rendererProperty.objectReferenceValue as Renderer;
454
+ if (renderer != null)
455
+ {
456
+ existingRendererList.Add(renderer);
457
+ }
458
+ }
459
+
460
+ foreach (var renderer in renderers)
461
+ {
462
+ if (!existingRendererList.Contains(renderer))
463
+ {
464
+ ++renderersProperty.arraySize;
465
+ var rendererProperty = renderersProperty.GetArrayElementAtIndex(renderersProperty.arraySize - 1);
466
+ rendererProperty.objectReferenceValue = renderer;
467
+ existingRendererList.Add(renderer);
468
+ }
469
+ }
470
+
471
+ serializedObject.ApplyModifiedProperties();
472
+ }
473
+
474
+ private void CreateLevel()
475
+ {
476
+ int newIndex = levelsProperty.arraySize;
477
+ levelsProperty.InsertArrayElementAtIndex(newIndex);
478
+ var newLevelProperty = levelsProperty.GetArrayElementAtIndex(newIndex);
479
+ var lastLevelProperty = (newIndex > 0 ? levelsProperty.GetArrayElementAtIndex(newIndex - 1) : null);
480
+ var newScreenRelativeHeightProperty = newLevelProperty.FindPropertyRelative(LevelScreenRelativeHeightFieldName);
481
+ var newQualityProperty = newLevelProperty.FindPropertyRelative(LevelQualityFieldName);
482
+
483
+ if (lastLevelProperty != null)
484
+ {
485
+ var lastScreenRelativeHeightProperty = lastLevelProperty.FindPropertyRelative(LevelScreenRelativeHeightFieldName);
486
+ var lastQualityProperty = lastLevelProperty.FindPropertyRelative(LevelQualityFieldName);
487
+ newScreenRelativeHeightProperty.floatValue = lastScreenRelativeHeightProperty.floatValue * 0.5f;
488
+ newQualityProperty.floatValue = lastQualityProperty.floatValue * 0.65f;
489
+ }
490
+ else
491
+ {
492
+ newScreenRelativeHeightProperty.floatValue = 0.6f;
493
+ newQualityProperty.floatValue = 1f;
494
+ }
495
+
496
+ serializedObject.ApplyModifiedProperties();
497
+ GUIUtility.ExitGUI();
498
+ }
499
+
500
+ private void DeleteLevel(int index)
501
+ {
502
+ levelsProperty.DeleteArrayElementAtIndex(index);
503
+ serializedObject.ApplyModifiedProperties();
504
+ GUIUtility.ExitGUI();
505
+ }
506
+
507
+ private void GenerateLODs()
508
+ {
509
+ try
510
+ {
511
+ EditorUtility.DisplayProgressBar("Generating LODs", "Generating LODs...", 0f);
512
+ var lodGroup = LODGenerator.GenerateLODs(lodGeneratorHelper);
513
+ if (lodGroup != null)
514
+ {
515
+ using (var serializedObject = new SerializedObject(lodGeneratorHelper))
516
+ {
517
+ var isGeneratedProperty = serializedObject.FindProperty(IsGeneratedFieldName);
518
+ serializedObject.UpdateIfRequiredOrScript();
519
+ isGeneratedProperty.boolValue = true;
520
+ serializedObject.ApplyModifiedPropertiesWithoutUndo();
521
+ }
522
+ }
523
+ }
524
+ catch (System.Exception ex)
525
+ {
526
+ Debug.LogException(ex, lodGeneratorHelper);
527
+ DisplayError("Failed to generate LODs!", ex.Message, "OK", lodGeneratorHelper);
528
+ }
529
+ finally
530
+ {
531
+ MarkSceneAsDirty();
532
+ EditorUtility.ClearProgressBar();
533
+ }
534
+ }
535
+
536
+ private void DestroyLODs()
537
+ {
538
+ try
539
+ {
540
+ EditorUtility.DisplayProgressBar("Destroying LODs", "Destroying LODs...", 0f);
541
+ LODGenerator.DestroyLODs(lodGeneratorHelper);
542
+
543
+ using (var serializedObject = new SerializedObject(lodGeneratorHelper))
544
+ {
545
+ var isGeneratedProperty = serializedObject.FindProperty(IsGeneratedFieldName);
546
+ serializedObject.UpdateIfRequiredOrScript();
547
+ isGeneratedProperty.boolValue = false;
548
+ serializedObject.ApplyModifiedPropertiesWithoutUndo();
549
+ }
550
+ }
551
+ catch (System.Exception ex)
552
+ {
553
+ Debug.LogException(ex);
554
+ DisplayError("Failed to destroy LODs!", ex.Message, "OK", lodGeneratorHelper);
555
+ }
556
+ finally
557
+ {
558
+ MarkSceneAsDirty();
559
+ EditorUtility.ClearProgressBar();
560
+ }
561
+ }
562
+
563
+ private bool VisibilitySettingsHaveChanged()
564
+ {
565
+ var lodGroup = lodGeneratorHelper.GetComponent<LODGroup>();
566
+ if (!lodGroup)
567
+ return false;
568
+ else if (lodGroup.lodCount != lodGeneratorHelper.Levels.Length)
569
+ return true;
570
+
571
+ var lods = lodGroup.GetLODs();
572
+ bool settingsHaveChanged = false;
573
+ for (int i = 0; i < lodGroup.lodCount; i++)
574
+ {
575
+ var level = lodGeneratorHelper.Levels[i];
576
+ var lod = lods[i];
577
+
578
+ settingsHaveChanged |= !Mathf.Approximately(level.ScreenRelativeTransitionHeight, lod.screenRelativeTransitionHeight);
579
+ settingsHaveChanged |= !Mathf.Approximately(level.FadeTransitionWidth, lod.fadeTransitionWidth);
580
+
581
+ if (settingsHaveChanged)
582
+ break;
583
+ }
584
+
585
+ return settingsHaveChanged;
586
+ }
587
+
588
+ private void CopyVisibilityChanges()
589
+ {
590
+ var lodGroup = lodGeneratorHelper.GetComponent<LODGroup>();
591
+ if (!lodGroup)
592
+ return;
593
+
594
+ if (lodGeneratorHelper.Levels.Length != lodGroup.lodCount)
595
+ {
596
+ Debug.LogError("Can't copy visibility changes - LODGroup element count does not match LODGeneratorHelper level settings.\nPlease regenerate the LOD levels.", this);
597
+ return;
598
+ }
599
+
600
+ var lods = lodGroup.GetLODs();
601
+ for(int i = 0; i < lodGroup.lodCount; i++)
602
+ {
603
+ var level = lodGeneratorHelper.Levels[i];
604
+ var lod = lods[i];
605
+ level.ScreenRelativeTransitionHeight = lod.screenRelativeTransitionHeight;
606
+ level.FadeTransitionWidth = lod.fadeTransitionWidth;
607
+ lodGeneratorHelper.Levels[i] = level;
608
+ }
609
+ }
610
+
611
+ private Renderer[] GetRenderers(IEnumerable<GameObject> gameObjects, bool searchChildren)
612
+ {
613
+ // Filter out game objects that aren't children of the generator
614
+ var ourTransform = lodGeneratorHelper.transform;
615
+ var childGameObjects = from go in gameObjects
616
+ where go.transform.IsChildOf(ourTransform)
617
+ select go;
618
+
619
+ var notChildGameObjects = from go in gameObjects
620
+ where !go.transform.IsChildOf(ourTransform)
621
+ #if UNITY_2018_3_OR_NEWER
622
+ && !PrefabUtility.IsPartOfAnyPrefab(go)
623
+ #endif
624
+ select go;
625
+
626
+ #if UNITY_2018_3_OR_NEWER
627
+ var prefabGameObjects = from go in gameObjects
628
+ where !go.transform.IsChildOf(ourTransform) &&
629
+ PrefabUtility.IsPartOfAnyPrefab(go)
630
+ select go;
631
+
632
+ if (prefabGameObjects.Any())
633
+ {
634
+ EditorUtility.DisplayDialog("Invalid GameObjects", "Some objects are not children of the LODGenerator GameObject," +
635
+ " as well as being part of a prefab. They will not be added.", "OK");
636
+ }
637
+ #endif
638
+
639
+ if (notChildGameObjects.Any())
640
+ {
641
+ if (EditorUtility.DisplayDialog("Reparent GameObjects", "Some objects are not children of the LODGenerator GameObject." +
642
+ " Do you want to reparent them and add them to the LODGenerator?", "Yes, Reparent", "No, Use Only Existing Children"))
643
+ {
644
+ var relocatedList = new List<GameObject>();
645
+ foreach (var gameObject in notChildGameObjects)
646
+ {
647
+ gameObject.transform.SetParent(ourTransform, true);
648
+ relocatedList.Add(gameObject);
649
+ }
650
+
651
+ childGameObjects = childGameObjects.Union(relocatedList);
652
+ }
653
+ }
654
+
655
+ var rendererList = new List<Renderer>();
656
+ foreach (var gameObject in childGameObjects)
657
+ {
658
+ if (searchChildren)
659
+ {
660
+ var renderers = gameObject.GetComponentsInChildren<Renderer>();
661
+ foreach (var renderer in renderers)
662
+ {
663
+ if (!rendererList.Contains(renderer))
664
+ {
665
+ rendererList.Add(renderer);
666
+ }
667
+ }
668
+ }
669
+ else
670
+ {
671
+ var renderer = gameObject.GetComponent<Renderer>();
672
+ if (renderer != null)
673
+ {
674
+ rendererList.Add(renderer);
675
+ }
676
+ }
677
+ }
678
+
679
+ return rendererList.ToArray();
680
+ }
681
+
682
+ private void MarkSceneAsDirty()
683
+ {
684
+ EditorSceneManager.MarkSceneDirty(lodGeneratorHelper.gameObject.scene);
685
+ }
686
+
687
+ private static void DisplayError(string title, string message, string ok, Object context)
688
+ {
689
+ EditorUtility.DisplayDialog(title, message, ok);
690
+ }
691
+ }
692
+ }
UnityProject/Assets/UnityMeshSimplifier/Editor/LODGeneratorHelperEditor.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: f9ac9095af6a98548ba6dd116c3e5136
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Editor/SerializedPropertyExtensions.cs ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System.Collections.Generic;
28
+ using UnityEditor;
29
+
30
+ namespace UnityMeshSimplifier.Editor
31
+ {
32
+ internal static class SerializedPropertyExtensions
33
+ {
34
+ public static IEnumerable<SerializedProperty> GetChildProperties(this SerializedProperty property)
35
+ {
36
+ int originalDepth = property.depth;
37
+ var childProperty = property.Copy();
38
+ if (!childProperty.NextVisible(true))
39
+ yield break; // There was no more properties
40
+
41
+ while (childProperty.depth > originalDepth)
42
+ {
43
+ yield return childProperty;
44
+
45
+ if (!childProperty.NextVisible(false))
46
+ break;
47
+ }
48
+ }
49
+ }
50
+ }
UnityProject/Assets/UnityMeshSimplifier/Editor/SerializedPropertyExtensions.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 17ae6f438c9465c49b2c66a289fdd1c2
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Editor/Whinarn.UnityMeshSimplifier.Editor.asmdef ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Whinarn.UnityMeshSimplifier.Editor",
3
+ "rootNamespace": "UnityMeshSimplifier.Editor",
4
+ "references": [
5
+ "Whinarn.UnityMeshSimplifier.Runtime"
6
+ ],
7
+ "optionalUnityReferences": [],
8
+ "includePlatforms": [
9
+ "Editor"
10
+ ],
11
+ "excludePlatforms": [],
12
+ "allowUnsafeCode": false,
13
+ "overrideReferences": false,
14
+ "precompiledReferences": [],
15
+ "autoReferenced": true,
16
+ "defineConstraints": [],
17
+ "versionDefines": []
18
+ }
UnityProject/Assets/UnityMeshSimplifier/Editor/Whinarn.UnityMeshSimplifier.Editor.asmdef.meta ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: a09b502a3463f794a83cf80a67a246d2
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/LICENSE.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2017-2021 Mattias Edlund
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.
UnityProject/Assets/UnityMeshSimplifier/LICENSE.md.meta ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 659512c87c614fe498baecbaeea4a9b6
3
+ timeCreated: 1516802301
4
+ licenseType: Free
5
+ DefaultImporter:
6
+ externalObjects: {}
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UnityMeshSimplifier
2
+
3
+ [![openupm](https://img.shields.io/npm/v/com.whinarn.unitymeshsimplifier?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.whinarn.unitymeshsimplifier/)
4
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3c6b55bddfe64912b56e6759c642939d)](https://www.codacy.com/manual/Whinarn/UnityMeshSimplifier?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Whinarn/UnityMeshSimplifier&amp;utm_campaign=Badge_Grade)
5
+ [![CircleCI](https://img.shields.io/circleci/build/gh/Whinarn/UnityMeshSimplifier?label=circle-ci)](https://circleci.com/gh/Whinarn/UnityMeshSimplifier/tree/master)
6
+ [![GitHub Release Status](https://img.shields.io/github/workflow/status/Whinarn/UnityMeshSimplifier/Release?label=release)](https://github.com/Whinarn/UnityMeshSimplifier/actions?query=workflow%3ARelease)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/Whinarn/UnityMeshSimplifier/blob/master/LICENSE.md)
8
+ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
9
+
10
+ Mesh simplification for [Unity](https://unity3d.com/). The project is deeply based on the [Fast Quadric Mesh Simplification](https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification) algorithm, but rewritten entirely in C# and released under the MIT license.
11
+
12
+ Because of the fact that this project is entirely in C# it *should* work on all platforms that Unity officially supports, as well as both in the editor and at runtime in builds.
13
+
14
+ ## Up for adoption
15
+
16
+ Hello there! Are you interested in mesh simplification and would like to take this package further?
17
+
18
+ I'm currently looking for someone to take over this repository since I feel like I'm not the right person to do it, nor do I have enough time to spend on it. Or if you'd just like to be a maintainer. Preferably someone with a better knowledge and interest in mesh simplification.
19
+
20
+ If you think that's you or your organization, please open up an issue to start a discussion.
21
+
22
+ ## Compatibility
23
+
24
+ Because this project is now using Unity packages, you should use a Unity version from 2018.1 and beyond.
25
+ Although some scripts have been tested and confirmed working as far back as Unity 5.6, it will no longer be officially supported.
26
+ Unity introduced the package manager in Unity 2017.2, but at a very early state.
27
+
28
+ The code will only (at the time of writing) compile with the *.NET Standard 2.0* or *.NET 4.X* scripting runtime versions. The legacy scripting runtime is no longer supported.
29
+ Read more about this [here](https://docs.unity3d.com/2019.1/Documentation/Manual/dotnetProfileSupport.html).
30
+
31
+ ## Installation into Unity project
32
+
33
+ You will find different methods of installing this library into your Unity project [here](https://github.com/Whinarn/UnityMeshSimplifier/wiki#installing).
34
+
35
+ ## How to use
36
+
37
+ If you are not a programmer look into the [LOD Generator Helper component](https://github.com/Whinarn/UnityMeshSimplifier/wiki/LOD-Generator-Helper-component).
38
+
39
+ For programmers you will find documentation for the [Mesh Simplifier API](https://github.com/Whinarn/UnityMeshSimplifier/wiki/Mesh-Simplifier-API) and the [LOD Generator API](https://github.com/Whinarn/UnityMeshSimplifier/wiki/LOD-Generator-API) useful.
40
+
41
+ ## The Smart Linking feature
42
+
43
+ In order to solve artifacts in the mesh simplification process where holes or other serious issues could arise, a new feature called smart linking has been introduced. This feature is enabled by default but can be disabled through the `EnableSmartLink` field on the `SimplificationOptions` struct appled to the `MeshSimplifier` class through the `SimplificationOptions` property. Disabling this could give you a minor performance gain in cases where you do not need this.
44
+
45
+ The `VertexLinkDistance` field on the `SimplificationOptions` struct could be also be used to change the maximum distance between two vertices for the linking. The default value is `double.Epsilon`. This value maximum distance is intended to be very small, but you might need to increase it for large scale meshes.
46
+
47
+ ## Potential problems and solutions
48
+
49
+ ### I'm missing XML documentation in my project
50
+
51
+ If you have installed this library through the Git URL in the Unity package manager, then you will likely see this problem.
52
+ The solution is quite simple however. Open up your Unity Editor, go to `Edit` > `Preferences` and then under `External Tools` you will have multiple options under `Generate .csproj files for:`. Now simply make sure that Git packages and whatever other kind of package is selected here. You should now see the XML documentation for the API show up in your code editor after having also clicked `Regenerate project files`.
53
+
54
+ ### My decimated meshes have holes
55
+
56
+ The original algorithm that was ported from C++ did not support situations where multiple vertices shared the same position, instead of being treated as one vertex they were treated individually. This would then end up creating visible holes in the mesh where the vertices were not connected through triangles.
57
+
58
+ There are several ways to solve this problem. The smart linking feature (mentioned above) is enabled by default and should take care of most of these problems for you. But there are also options to preserve borders, seams and UV foldovers. The properties *PreserveBorders*, *PreserveSeams* and *PreserveFoldovers* will preserve some vertices from being decimated, strongly limiting the decimation algorithm, but should prevent holes in most situations.
59
+
60
+ The recommendation is to use the smart linking feature that is enabled by default, but the options for preservation exists in those cases where you may want it.
61
+
62
+ ### Some objects are not animated correctly after I have generated LOD Groups
63
+
64
+ The most probable cause for this is that you have objects that are parented under bones that will move with the animations. Currently there is no code to deal with this, and the best way to do this is to use nested LOD Groups. Any such object that you know is parented under a bone should have its own LOD Group.
65
+
66
+ ### The Unity-generated Visual Studio solution file appears broken
67
+
68
+ This can be a problem because of an assembly definition provided with this repository, if you are using Unity 2017.3 or above. Make sure that you have the latest version of [Visual Studio Tools for Unity](https://www.visualstudio.com/vs/unity-tools/). If you are using Visual Studio 2017, make sure that Visual Studio is up to date and that you have installed the *Game development with Unity* component. For other versions of Visual Studio you would have to download a separate installer. Please go to the [Microsoft Documentation](https://docs.microsoft.com/en-us/visualstudio/cross-platform/getting-started-with-visual-studio-tools-for-unity) for more information.
69
+
70
+ ## How to contribute
71
+
72
+ Please read [CONTRIBUTING](https://github.com/Whinarn/UnityMeshSimplifier/blob/master/CONTRIBUTING.md) regarding how to contribute.
UnityProject/Assets/UnityMeshSimplifier/README.md.meta ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 5db135d38eaea1d47a0d5d68c2910c3d
3
+ timeCreated: 1516802302
4
+ licenseType: Free
5
+ TextScriptImporter:
6
+ externalObjects: {}
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime.meta ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: cb8ba913612099548abbbed9a806334a
3
+ folderAsset: yes
4
+ timeCreated: 1516801823
5
+ licenseType: Free
6
+ DefaultImporter:
7
+ externalObjects: {}
8
+ userData:
9
+ assetBundleName:
10
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/AssemblyAttributes.cs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ using System.Runtime.CompilerServices;
2
+
3
+ [assembly:InternalsVisibleTo("Whinarn.UnityMeshSimplifier.Editor")]
UnityProject/Assets/UnityMeshSimplifier/Runtime/AssemblyAttributes.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 4d1ea4d1aec680349b9da9df1024ecbc
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/BlendShape.cs ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System;
28
+ using System.Runtime.InteropServices;
29
+ using UnityEngine;
30
+
31
+ namespace UnityMeshSimplifier
32
+ {
33
+ /// <summary>
34
+ /// A blend shape.
35
+ /// </summary>
36
+ [Serializable]
37
+ [StructLayout(LayoutKind.Auto)]
38
+ public struct BlendShape
39
+ {
40
+ /// <summary>
41
+ /// The name of the blend shape.
42
+ /// </summary>
43
+ public string ShapeName;
44
+ /// <summary>
45
+ /// The blend shape frames.
46
+ /// </summary>
47
+ public BlendShapeFrame[] Frames;
48
+
49
+ /// <summary>
50
+ /// Creates a new blend shape.
51
+ /// </summary>
52
+ /// <param name="shapeName">The name of the blend shape.</param>
53
+ /// <param name="frames">The blend shape frames.</param>
54
+ public BlendShape(string shapeName, BlendShapeFrame[] frames)
55
+ {
56
+ this.ShapeName = shapeName;
57
+ this.Frames = frames;
58
+ }
59
+ }
60
+
61
+ /// <summary>
62
+ /// A blend shape frame.
63
+ /// </summary>
64
+ [Serializable]
65
+ [StructLayout(LayoutKind.Auto)]
66
+ public struct BlendShapeFrame
67
+ {
68
+ /// <summary>
69
+ /// The weight of the blend shape frame.
70
+ /// </summary>
71
+ public float FrameWeight;
72
+ /// <summary>
73
+ /// The delta vertices of the blend shape frame.
74
+ /// </summary>
75
+ public Vector3[] DeltaVertices;
76
+ /// <summary>
77
+ /// The delta normals of the blend shape frame.
78
+ /// </summary>
79
+ public Vector3[] DeltaNormals;
80
+ /// <summary>
81
+ /// The delta tangents of the blend shape frame.
82
+ /// </summary>
83
+ public Vector3[] DeltaTangents;
84
+
85
+ /// <summary>
86
+ /// Creates a new blend shape frame.
87
+ /// </summary>
88
+ /// <param name="frameWeight">The weight of the blend shape frame.</param>
89
+ /// <param name="deltaVertices">The delta vertices of the blend shape frame.</param>
90
+ /// <param name="deltaNormals">The delta normals of the blend shape frame.</param>
91
+ /// <param name="deltaTangents">The delta tangents of the blend shape frame.</param>
92
+ public BlendShapeFrame(float frameWeight, Vector3[] deltaVertices, Vector3[] deltaNormals, Vector3[] deltaTangents)
93
+ {
94
+ this.FrameWeight = frameWeight;
95
+ this.DeltaVertices = deltaVertices;
96
+ this.DeltaNormals = deltaNormals;
97
+ this.DeltaTangents = deltaTangents;
98
+ }
99
+ }
100
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/BlendShape.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 7f4953476e185d34c97f4c00f8c9c5ec
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Components.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: fd13b03ef549b27499e01e3202d66c51
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODBackupComponent.cs ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using UnityEngine;
28
+
29
+ namespace UnityMeshSimplifier
30
+ {
31
+ [AddComponentMenu("")]
32
+ internal class LODBackupComponent : MonoBehaviour
33
+ {
34
+ [SerializeField]
35
+ private Renderer[] originalRenderers = null;
36
+
37
+ public Renderer[] OriginalRenderers
38
+ {
39
+ get { return originalRenderers; }
40
+ set { originalRenderers = value; }
41
+ }
42
+ }
43
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODBackupComponent.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 4e0eb9661dcb8ea4f8acb45586df32e4
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODGeneratorHelper.cs ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using UnityEngine;
28
+
29
+ namespace UnityMeshSimplifier
30
+ {
31
+ /// <summary>
32
+ /// A LOD (level of detail) generator helper.
33
+ /// </summary>
34
+ [AddComponentMenu("Rendering/LOD Generator Helper")]
35
+ public sealed class LODGeneratorHelper : MonoBehaviour
36
+ {
37
+ #region Fields
38
+ [SerializeField, Tooltip("The fade mode used by the created LOD group.")]
39
+ private LODFadeMode fadeMode = LODFadeMode.None;
40
+ [SerializeField, Tooltip("If the cross-fading should be animated by time.")]
41
+ private bool animateCrossFading = false;
42
+
43
+ [SerializeField, Tooltip("If the renderers under this game object and any children should be automatically collected.")]
44
+ private bool autoCollectRenderers = true;
45
+
46
+ [SerializeField, Tooltip("The simplification options.")]
47
+ private SimplificationOptions simplificationOptions = SimplificationOptions.Default;
48
+
49
+ [SerializeField, Tooltip("The path within the assets directory to save the generated assets. Leave this empty to use the default path.")]
50
+ private string saveAssetsPath = string.Empty;
51
+
52
+ [SerializeField, Tooltip("The LOD levels.")]
53
+ private LODLevel[] levels = null;
54
+
55
+ [SerializeField]
56
+ private bool isGenerated = false;
57
+ #endregion
58
+
59
+ #region Properties
60
+ /// <summary>
61
+ /// Gets or sets the fade mode used by the created LOD group.
62
+ /// </summary>
63
+ public LODFadeMode FadeMode
64
+ {
65
+ get { return fadeMode; }
66
+ set { fadeMode = value; }
67
+ }
68
+
69
+ /// <summary>
70
+ /// Gets or sets if the cross-fading should be animated by time. The animation duration
71
+ /// is specified globally as crossFadeAnimationDuration.
72
+ /// </summary>
73
+ public bool AnimateCrossFading
74
+ {
75
+ get { return animateCrossFading; }
76
+ set { animateCrossFading = value; }
77
+ }
78
+
79
+ /// <summary>
80
+ /// Gets or sets if the renderers under this game object and any children should be automatically collected.
81
+ /// </summary>
82
+ public bool AutoCollectRenderers
83
+ {
84
+ get { return autoCollectRenderers; }
85
+ set { autoCollectRenderers = value; }
86
+ }
87
+
88
+ /// <summary>
89
+ /// Gets or sets the simplification options.
90
+ /// </summary>
91
+ public SimplificationOptions SimplificationOptions
92
+ {
93
+ get { return simplificationOptions; }
94
+ set { simplificationOptions = value; }
95
+ }
96
+
97
+ /// <summary>
98
+ /// Gets or sets the path within the project to save the generated assets.
99
+ /// Leave this empty to use the default path.
100
+ /// </summary>
101
+ public string SaveAssetsPath
102
+ {
103
+ get { return saveAssetsPath; }
104
+ set { saveAssetsPath = value; }
105
+ }
106
+
107
+ /// <summary>
108
+ /// Gets or sets the LOD levels for this generator.
109
+ /// </summary>
110
+ public LODLevel[] Levels
111
+ {
112
+ get { return levels; }
113
+ set { levels = value; }
114
+ }
115
+
116
+ /// <summary>
117
+ /// Gets if the LODs have been generated.
118
+ /// </summary>
119
+ public bool IsGenerated
120
+ {
121
+ get { return isGenerated; }
122
+ }
123
+ #endregion
124
+
125
+ #region Unity Events
126
+ private void Reset()
127
+ {
128
+ fadeMode = LODFadeMode.None;
129
+ animateCrossFading = false;
130
+ autoCollectRenderers = true;
131
+ simplificationOptions = SimplificationOptions.Default;
132
+
133
+ levels = new LODLevel[]
134
+ {
135
+ new LODLevel(0.5f, 1f)
136
+ {
137
+ CombineMeshes = false,
138
+ CombineSubMeshes = false,
139
+ SkinQuality = SkinQuality.Auto,
140
+ ShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
141
+ ReceiveShadows = true,
142
+ SkinnedMotionVectors = true,
143
+ LightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes,
144
+ ReflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.BlendProbes,
145
+ },
146
+ new LODLevel(0.17f, 0.65f)
147
+ {
148
+ CombineMeshes = true,
149
+ CombineSubMeshes = false,
150
+ SkinQuality = SkinQuality.Auto,
151
+ ShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On,
152
+ ReceiveShadows = true,
153
+ SkinnedMotionVectors = true,
154
+ LightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes,
155
+ ReflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Simple
156
+ },
157
+ new LODLevel(0.02f, 0.4225f)
158
+ {
159
+ CombineMeshes = true,
160
+ CombineSubMeshes = true,
161
+ SkinQuality = SkinQuality.Bone2,
162
+ ShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off,
163
+ ReceiveShadows = false,
164
+ SkinnedMotionVectors = false,
165
+ LightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off,
166
+ ReflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off
167
+ }
168
+ };
169
+ }
170
+ #endregion
171
+ }
172
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/Components/LODGeneratorHelper.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 3b6501244c613244685e05adcefbedff
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Exceptions.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 38f976f5c84f9364abaf034a22f2a282
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Exceptions/ValidateSimplificationOptionsException.cs ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using System;
2
+
3
+ namespace UnityMeshSimplifier
4
+ {
5
+ /// <summary>
6
+ /// An exception thrown when validating simplification options.
7
+ /// </summary>
8
+ public sealed class ValidateSimplificationOptionsException : Exception
9
+ {
10
+ private readonly string propertyName;
11
+
12
+ /// <summary>
13
+ /// Creates a new simplification options validation exception.
14
+ /// </summary>
15
+ /// <param name="propertyName">The property name.</param>
16
+ /// <param name="message">The exception message.</param>
17
+ public ValidateSimplificationOptionsException(string propertyName, string message)
18
+ : base(message)
19
+ {
20
+ this.propertyName = propertyName;
21
+ }
22
+
23
+ /// <summary>
24
+ /// Creates a new simplification options validation exception.
25
+ /// </summary>
26
+ /// <param name="propertyName">The property name.</param>
27
+ /// <param name="message">The exception message.</param>
28
+ /// <param name="innerException">The exception that caused the validation error.</param>
29
+ public ValidateSimplificationOptionsException(string propertyName, string message, Exception innerException)
30
+ : base(message, innerException)
31
+ {
32
+ this.propertyName = propertyName;
33
+ }
34
+
35
+ /// <summary>
36
+ /// Gets the property name that caused the validation error.
37
+ /// </summary>
38
+ public string PropertyName
39
+ {
40
+ get { return propertyName; }
41
+ }
42
+
43
+ /// <summary>
44
+ /// Gets the message of the exception.
45
+ /// </summary>
46
+ public override string Message
47
+ {
48
+ get { return base.Message + Environment.NewLine + "Property name: " + propertyName; }
49
+ }
50
+ }
51
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/Exceptions/ValidateSimplificationOptionsException.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 05d2dc61d1c5f1d4fa1bab3598adfd17
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal.meta ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 24b45107e3ccbfb46b74880d32f94c47
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeContainer.cs ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System.Runtime.CompilerServices;
28
+ using UnityEngine;
29
+
30
+ namespace UnityMeshSimplifier.Internal
31
+ {
32
+ internal class BlendShapeContainer
33
+ {
34
+ private readonly string shapeName;
35
+ private readonly BlendShapeFrameContainer[] frames;
36
+
37
+ public BlendShapeContainer(BlendShape blendShape)
38
+ {
39
+ shapeName = blendShape.ShapeName;
40
+ frames = new BlendShapeFrameContainer[blendShape.Frames.Length];
41
+ for (int i = 0; i < frames.Length; i++)
42
+ {
43
+ frames[i] = new BlendShapeFrameContainer(blendShape.Frames[i]);
44
+ }
45
+ }
46
+
47
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
48
+ public void MoveVertexElement(int dst, int src)
49
+ {
50
+ for (int i = 0; i < frames.Length; i++)
51
+ {
52
+ frames[i].MoveVertexElement(dst, src);
53
+ }
54
+ }
55
+
56
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
57
+ public void InterpolateVertexAttributes(int dst, int i0, int i1, int i2, ref Vector3 barycentricCoord)
58
+ {
59
+ for (int i = 0; i < frames.Length; i++)
60
+ {
61
+ frames[i].InterpolateVertexAttributes(dst, i0, i1, i2, ref barycentricCoord);
62
+ }
63
+ }
64
+
65
+ public void Resize(int length, bool trimExess = false)
66
+ {
67
+ for (int i = 0; i < frames.Length; i++)
68
+ {
69
+ frames[i].Resize(length, trimExess);
70
+ }
71
+ }
72
+
73
+ public BlendShape ToBlendShape()
74
+ {
75
+ var shapeFrames = new BlendShapeFrame[frames.Length];
76
+ for (int i = 0; i < shapeFrames.Length; i++)
77
+ {
78
+ shapeFrames[i] = frames[i].ToBlendShapeFrame();
79
+ }
80
+ return new BlendShape(shapeName, shapeFrames);
81
+ }
82
+ }
83
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeContainer.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: f3c9e5cde78dbf6409253a8e635c54cb
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeFrameContainer.cs ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System.Runtime.CompilerServices;
28
+ using UnityEngine;
29
+
30
+ namespace UnityMeshSimplifier.Internal
31
+ {
32
+ internal class BlendShapeFrameContainer
33
+ {
34
+ private readonly float frameWeight;
35
+ private readonly ResizableArray<Vector3> deltaVertices;
36
+ private readonly ResizableArray<Vector3> deltaNormals;
37
+ private readonly ResizableArray<Vector3> deltaTangents;
38
+
39
+ public BlendShapeFrameContainer(BlendShapeFrame frame)
40
+ {
41
+ frameWeight = frame.FrameWeight;
42
+ deltaVertices = new ResizableArray<Vector3>(frame.DeltaVertices);
43
+ deltaNormals = new ResizableArray<Vector3>(frame.DeltaNormals);
44
+ deltaTangents = new ResizableArray<Vector3>(frame.DeltaTangents);
45
+ }
46
+
47
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
48
+ public void MoveVertexElement(int dst, int src)
49
+ {
50
+ deltaVertices[dst] = deltaVertices[src];
51
+ deltaNormals[dst] = deltaNormals[src];
52
+ deltaTangents[dst] = deltaTangents[src];
53
+ }
54
+
55
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
56
+ public void InterpolateVertexAttributes(int dst, int i0, int i1, int i2, ref Vector3 barycentricCoord)
57
+ {
58
+ deltaVertices[dst] = (deltaVertices[i0] * barycentricCoord.x) + (deltaVertices[i1] * barycentricCoord.y) + (deltaVertices[i2] * barycentricCoord.z);
59
+ deltaNormals[dst] = Vector3.Normalize((deltaNormals[i0] * barycentricCoord.x) + (deltaNormals[i1] * barycentricCoord.y) + (deltaNormals[i2] * barycentricCoord.z));
60
+ deltaTangents[dst] = Vector3.Normalize((deltaTangents[i0] * barycentricCoord.x) + (deltaTangents[i1] * barycentricCoord.y) + (deltaTangents[i2] * barycentricCoord.z));
61
+ }
62
+
63
+ public void Resize(int length, bool trimExess = false)
64
+ {
65
+ deltaVertices.Resize(length, trimExess);
66
+ deltaNormals.Resize(length, trimExess);
67
+ deltaTangents.Resize(length, trimExess);
68
+ }
69
+
70
+ public BlendShapeFrame ToBlendShapeFrame()
71
+ {
72
+ var resultVertices = deltaVertices.ToArray();
73
+ var resultNormals = deltaNormals.ToArray();
74
+ var resultTangents = deltaTangents.ToArray();
75
+ return new BlendShapeFrame(frameWeight, resultVertices, resultNormals, resultTangents);
76
+ }
77
+ }
78
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BlendShapeFrameContainer.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: 309b14cf47b13e140b440ddcb9f24dcf
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BorderVertex.cs ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System.Collections.Generic;
28
+ using System.Runtime.CompilerServices;
29
+
30
+ namespace UnityMeshSimplifier.Internal
31
+ {
32
+ internal struct BorderVertex
33
+ {
34
+ public int index;
35
+ public int hash;
36
+
37
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
38
+ public BorderVertex(int index, int hash)
39
+ {
40
+ this.index = index;
41
+ this.hash = hash;
42
+ }
43
+ }
44
+
45
+ internal class BorderVertexComparer : IComparer<BorderVertex>
46
+ {
47
+ public static readonly BorderVertexComparer instance = new BorderVertexComparer();
48
+
49
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
50
+ public int Compare(BorderVertex x, BorderVertex y)
51
+ {
52
+ return x.hash.CompareTo(y.hash);
53
+ }
54
+ }
55
+ }
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/BorderVertex.cs.meta ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fileFormatVersion: 2
2
+ guid: b3aa934004e079b4ebf36dbaade127a8
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
UnityProject/Assets/UnityMeshSimplifier/Runtime/Internal/Ref.cs ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #region License
2
+ /*
3
+ MIT License
4
+
5
+ Copyright(c) 2017-2020 Mattias Edlund
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
25
+ #endregion
26
+
27
+ using System.Runtime.CompilerServices;
28
+
29
+ namespace UnityMeshSimplifier.Internal
30
+ {
31
+ internal struct Ref
32
+ {
33
+ public int tid;
34
+ public int tvertex;
35
+
36
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
37
+ public void Set(int tid, int tvertex)
38
+ {
39
+ this.tid = tid;
40
+ this.tvertex = tvertex;
41
+ }
42
+ }
43
+ }