From ee61629c1afa3693b68c67b50e10b6b30723c7c4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 30 Aug 2024 14:45:17 +0900 Subject: [PATCH] =?UTF-8?q?sample=20=E3=81=AE=20URP=20=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VRM10FirstPersonSample.unity | 206 +++++++++--------- .../VRM10VisualPrimitive.cs | 49 +++++ .../VRM10VisualPrimitive.cs.meta | 3 + .../RuntimeExporterSample.unity | 165 ++++++-------- .../VRM10VisualPrimitive.cs | 49 +++++ .../VRM10VisualPrimitive.cs.meta | 3 + .../VRM10Viewer/VRM10VisualPrimitive.cs | 22 ++ 7 files changed, 303 insertions(+), 194 deletions(-) create mode 100644 Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs create mode 100644 Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs.meta create mode 100644 Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs create mode 100644 Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs.meta diff --git a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10FirstPersonSample.unity b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10FirstPersonSample.unity index 861c7794f..e9235ffa6 100644 --- a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10FirstPersonSample.unity +++ b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10FirstPersonSample.unity @@ -38,12 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.18033902, g: 0.22578256, b: 0.3069559, a: 1} + m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 11 + serializedVersion: 12 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 @@ -98,7 +98,8 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_UseShadowmask: 1 + m_LightingSettings: {fileID: 4890085278179872738, guid: ad63aa5100fb56a41b2d999ac88671ce, + type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -118,6 +119,8 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} @@ -149,6 +152,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2108006564} m_RootOrder: 0 @@ -173,6 +177,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -199,6 +204,51 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 147376043} m_CullTransparentMesh: 0 +--- !u!1 &246845414 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 246845416} + - component: {fileID: 246845417} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &246845416 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 246845414} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &246845417 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 246845414} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0762012503bf8e4409f9d0965461369d, type: 3} + m_Name: + m_EditorClassIdentifier: + _primitiveType: 4 --- !u!1 &267321008 GameObject: m_ObjectHideFlags: 0 @@ -228,6 +278,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2036452538} - {fileID: 555566559} @@ -264,6 +315,7 @@ MonoBehaviour: m_ChildControlHeight: 0 m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!114 &267321011 MonoBehaviour: m_ObjectHideFlags: 0 @@ -279,6 +331,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 0.392} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -331,6 +384,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 m_HorizontalAxis: Horizontal m_VerticalAxis: Vertical m_SubmitButton: Submit @@ -363,6 +417,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 5 @@ -396,6 +451,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 605703266} m_Father: {fileID: 267321009} @@ -420,6 +476,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -464,6 +521,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -541,6 +599,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1468129205} - {fileID: 772693254} @@ -576,6 +635,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 555566559} m_RootOrder: 0 @@ -600,6 +660,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -654,6 +715,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 646222219} m_Father: {fileID: 2082684587} @@ -679,6 +741,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -726,6 +789,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 635962096} m_RootOrder: 0 @@ -750,6 +814,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -855,6 +920,7 @@ Transform: m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} m_LocalPosition: {x: 0, y: 1.2, z: 1} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 568975775} m_RootOrder: 1 @@ -887,6 +953,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2036452538} m_RootOrder: 0 @@ -911,6 +978,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -965,6 +1033,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1382317302} m_Father: {fileID: 2082684587} @@ -990,6 +1059,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -1036,6 +1106,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 @@ -1056,7 +1127,6 @@ MonoBehaviour: m_faceCamera: {fileID: 1919635064} m_source: {fileID: 0} m_target: {fileID: 0} - m_firstPerson: {fileID: 0} --- !u!1 &1175289393 GameObject: m_ObjectHideFlags: 0 @@ -1067,6 +1137,7 @@ GameObject: m_Component: - component: {fileID: 1175289395} - component: {fileID: 1175289394} + - component: {fileID: 1175289396} m_Layer: 0 m_Name: Directional light m_TagString: Untagged @@ -1133,6 +1204,7 @@ Light: m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &1175289395 @@ -1145,10 +1217,31 @@ Transform: m_LocalRotation: {x: 0.2571214, y: -0.8612099, z: 0.4380491, w: 0.017861776} m_LocalPosition: {x: 2.84, y: 1.7, z: 2.02} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 130.209, y: -17.533997, z: 138.566} +--- !u!114 &1175289396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1175289393} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 1 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} --- !u!1 &1382317301 GameObject: m_ObjectHideFlags: 0 @@ -1177,6 +1270,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 991744089} m_RootOrder: 0 @@ -1201,6 +1295,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -1227,100 +1322,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1382317301} m_CullTransparentMesh: 0 ---- !u!1 &1396766179 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1396766183} - - component: {fileID: 1396766182} - - component: {fileID: 1396766181} - - component: {fileID: 1396766180} - m_Layer: 0 - m_Name: Plane - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!23 &1396766180 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1396766179} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 ---- !u!64 &1396766181 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1396766179} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 4 - m_Convex: 0 - m_CookingOptions: 30 - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!33 &1396766182 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1396766179} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1396766183 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1396766179} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 1.41} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1468129200 GameObject: m_ObjectHideFlags: 0 @@ -1400,6 +1401,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1.13, z: -1.29} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 568975775} m_RootOrder: 0 @@ -1433,6 +1435,7 @@ Transform: m_LocalRotation: {x: -0, y: 1, z: -0, w: 0} m_LocalPosition: {x: -0.261, y: 1.497, z: 0.048} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 568975775} m_RootOrder: 2 @@ -1551,6 +1554,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 936781946} m_Father: {fileID: 267321009} @@ -1575,6 +1579,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 + m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -1619,6 +1624,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -1700,6 +1706,7 @@ MonoBehaviour: m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 --- !u!223 &2082684586 Canvas: m_ObjectHideFlags: 0 @@ -1731,6 +1738,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2108006564} - {fileID: 635962096} @@ -1786,6 +1794,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 147376044} m_Father: {fileID: 2082684587} @@ -1811,6 +1820,7 @@ MonoBehaviour: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: diff --git a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs new file mode 100644 index 000000000..318b5279b --- /dev/null +++ b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace UniVRM10.FirstPersonSample +{ + /// + /// Built-in RP と URP の差異を楽に吸収してプリミティブを表示するためのクラス + /// + public class VRM10VisualPrimitive : MonoBehaviour + { + [SerializeField] private PrimitiveType _primitiveType; + + public PrimitiveType PrimitiveType + { + get => _primitiveType; + set => _primitiveType = value; + } + + private void Start() + { + var visual = GameObject.CreatePrimitive(_primitiveType); + visual.transform.SetParent(transform); + visual.transform.localPosition = Vector3.zero; + visual.transform.localRotation = Quaternion.identity; + visual.transform.localScale = Vector3.one; + } + + void OnDrawGizmos() + { + if (!Application.isPlaying) + { + Gizmos.matrix = transform.localToWorldMatrix; + switch (_primitiveType) + { + case PrimitiveType.Sphere: + Gizmos.DrawSphere(Vector3.zero, 1.0f); + break; + + case PrimitiveType.Plane: + Gizmos.DrawCube(Vector3.zero, new Vector3(10, 0.001f, 10)); + break; + + default: + // TODO + break; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs.meta b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs.meta new file mode 100644 index 000000000..7b2d7a1cf --- /dev/null +++ b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10VisualPrimitive.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0762012503bf8e4409f9d0965461369d +timeCreated: 1721736320 \ No newline at end of file diff --git a/Assets/VRM10_Samples/VRM10RuntimeExporterSample/RuntimeExporterSample.unity b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/RuntimeExporterSample.unity index 27e125226..cc3430490 100644 --- a/Assets/VRM10_Samples/VRM10RuntimeExporterSample/RuntimeExporterSample.unity +++ b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/RuntimeExporterSample.unity @@ -123,6 +123,51 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &186101306 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 186101308} + - component: {fileID: 186101309} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &186101308 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 186101306} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &186101309 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 186101306} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4c97429997151824fb65648eca3ae87e, type: 3} + m_Name: + m_EditorClassIdentifier: + _primitiveType: 4 --- !u!1 &1186819954 GameObject: m_ObjectHideFlags: 0 @@ -181,106 +226,11 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1538405295 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1538405299} - - component: {fileID: 1538405298} - - component: {fileID: 1538405297} - - component: {fileID: 1538405296} - m_Layer: 0 - m_Name: Plane - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!64 &1538405296 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1538405295} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 4 - m_Convex: 0 - m_CookingOptions: 30 - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &1538405297 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1538405295} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &1538405298 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1538405295} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1538405299 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1538405295} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1760773430 GameObject: m_ObjectHideFlags: 0 @@ -291,6 +241,7 @@ GameObject: m_Component: - component: {fileID: 1760773432} - component: {fileID: 1760773431} + - component: {fileID: 1760773433} m_Layer: 0 m_Name: Directional Light m_TagString: Untagged @@ -370,10 +321,31 @@ Transform: m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &1760773433 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1760773430} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 1 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} --- !u!1 &2092896552 GameObject: m_ObjectHideFlags: 0 @@ -453,6 +425,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 diff --git a/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs new file mode 100644 index 000000000..5b1e5c8a0 --- /dev/null +++ b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace UniVRM10.RuntimeExporterSample +{ + /// + /// Built-in RP と URP の差異を楽に吸収してプリミティブを表示するためのクラス + /// + public class VRM10VisualPrimitive : MonoBehaviour + { + [SerializeField] private PrimitiveType _primitiveType; + + public PrimitiveType PrimitiveType + { + get => _primitiveType; + set => _primitiveType = value; + } + + private void Start() + { + var visual = GameObject.CreatePrimitive(_primitiveType); + visual.transform.SetParent(transform); + visual.transform.localPosition = Vector3.zero; + visual.transform.localRotation = Quaternion.identity; + visual.transform.localScale = Vector3.one; + } + + void OnDrawGizmos() + { + if (!Application.isPlaying) + { + Gizmos.matrix = transform.localToWorldMatrix; + switch (_primitiveType) + { + case PrimitiveType.Sphere: + Gizmos.DrawSphere(Vector3.zero, 1.0f); + break; + + case PrimitiveType.Plane: + Gizmos.DrawCube(Vector3.zero, new Vector3(10, 0.001f, 10)); + break; + + default: + // TODO + break; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs.meta b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs.meta new file mode 100644 index 000000000..813523350 --- /dev/null +++ b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10VisualPrimitive.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4c97429997151824fb65648eca3ae87e +timeCreated: 1721736320 \ No newline at end of file diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs index 05ea35def..bcbb9f5f2 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10VisualPrimitive.cs @@ -23,5 +23,27 @@ namespace UniVRM10.VRM10Viewer visual.transform.localRotation = Quaternion.identity; visual.transform.localScale = Vector3.one; } + + void OnDrawGizmos() + { + if (!Application.isPlaying) + { + Gizmos.matrix = transform.localToWorldMatrix; + switch (_primitiveType) + { + case PrimitiveType.Sphere: + Gizmos.DrawSphere(Vector3.zero, 1.0f); + break; + + case PrimitiveType.Plane: + Gizmos.DrawCube(Vector3.zero, new Vector3(10, 0.001f, 10)); + break; + + default: + // TODO + break; + } + } + } } } \ No newline at end of file