├── .gitignore ├── .gitmodules ├── CharacterModelReplacement.sln ├── LICENSE ├── ModelReplacementAPI.Networking ├── APIPlugin.cs ├── AssemblyInfo.cs ├── Build │ ├── ModelReplacementAPI.Networking.dll │ ├── README.md │ ├── icon.png │ └── manifest.json └── ModelReplacementAPI.Networking.csproj ├── ModelReplacementAPI ├── APIPlugin.cs ├── AssemblyInfo.cs ├── Build │ ├── MRAPI_2.0.3.zip │ ├── ModelReplacementAPI.dll │ ├── README.md │ ├── icon.png │ └── manifest.json ├── LayerAnalysis │ ├── 0LayerAnalysis.txt │ ├── Company.txt │ ├── Dine.txt │ ├── InShip.txt │ └── Moon.txt ├── Libraries │ └── .dependencies ├── ModelReplacementAPI.csproj ├── ModelUpdateHandler.cs ├── Monobehaviors │ ├── BodyReplacementBase.cs │ ├── Enemies │ │ └── MaskedReplacementBase.cs │ ├── ManagerBase.cs │ ├── MoreCompanyCosmeticManager.cs │ └── ViewStateManager.cs ├── NuGet.Config ├── Patches │ ├── CosmeticPatch.cs │ ├── EnemyPatches.cs │ ├── HeldItemPositionPatch.cs │ ├── MaskedPatch.cs │ ├── PlayerControllerBPatch.cs │ └── StartOfRoundPatch.cs └── Scripts │ ├── Enemies │ └── MaskedAvatarUpdater.cs │ ├── MaterialHelper.cs │ ├── MeshHelper.cs │ ├── Player │ ├── AvatarUpdater.cs │ └── ViewModelUpdater.cs │ ├── SDKClasses.cs │ └── Vector3Helper.cs ├── ModelReplacementAPI_VRMSupport └── ModelReplacementAPI.VRMSupport │ ├── APIPlugin.cs │ ├── AssemblyInfo.cs │ ├── Build │ └── ModelReplacementAPI.VRMSupport.dll │ ├── ModelReplacementAPI.VRMSupport.csproj │ ├── NuGet.Config │ └── VRMScripts │ ├── UniGLTF │ ├── LICENSE.md │ ├── README.md │ ├── Runtime │ │ ├── AssemblyInfo.cs │ │ ├── Extensions │ │ │ ├── ArrayExtensions.cs │ │ │ ├── ColorConversionExtensions.cs │ │ │ ├── IndexExtensions.cs │ │ │ ├── NumericsExtensions.cs │ │ │ ├── StringExtensions.cs │ │ │ ├── UnityExtensions.cs │ │ │ └── glTFExtensions.cs │ │ ├── MeshUtility │ │ │ ├── BindposeGizmo.cs │ │ │ ├── BlendShapeReport.cs │ │ │ ├── BoneMeshEraser.cs │ │ │ ├── BoneNormalizer.cs │ │ │ ├── GltfMeshUtility.cs │ │ │ ├── MeshAttachInfo.cs │ │ │ ├── MeshEnumerateOption.cs │ │ │ ├── MeshExclude.cs │ │ │ ├── MeshExtensions.cs │ │ │ ├── MeshFreezer.cs │ │ │ ├── MeshIntegrationGroup.cs │ │ │ ├── MeshIntegrationResult.cs │ │ │ ├── MeshIntegrator.cs │ │ │ └── TriangleSeparator.cs │ │ ├── Scenes │ │ │ └── LookDev │ │ │ │ ├── RenderingServicePostProcessingProfile.asset │ │ │ │ ├── ballroom_1k.unity │ │ │ │ ├── cubemap │ │ │ │ ├── ballroom_1k.exr │ │ │ │ ├── ballroom_1k.mat │ │ │ │ ├── lilienstein_1k.exr │ │ │ │ ├── lilienstein_1k.mat │ │ │ │ ├── moonless_golf_1k.exr │ │ │ │ ├── moonless_golf_1k.mat │ │ │ │ ├── spruit_sunrise_1k.exr │ │ │ │ └── spruit_sunrise_1k.mat │ │ │ │ ├── floor.mat │ │ │ │ ├── floor.prefab │ │ │ │ ├── lilienstein_1k.unity │ │ │ │ ├── moonless_golf_1k.unity │ │ │ │ └── spruit_sunrise_1k.unity │ │ ├── UniGLTF │ │ │ ├── Format │ │ │ │ ├── ExtensionsAndExtras │ │ │ │ │ ├── EmissiveMultiplier │ │ │ │ │ │ ├── Deserializer.g.cs │ │ │ │ │ │ ├── Format.g.cs │ │ │ │ │ │ └── Serializer.g.cs │ │ │ │ │ ├── KHR_materials_emissive_strength.cs │ │ │ │ │ ├── KHR_materials_unlit.cs │ │ │ │ │ ├── KHR_texture_basisu.cs │ │ │ │ │ ├── KHR_texture_transform.cs │ │ │ │ │ ├── gltfExtension.cs │ │ │ │ │ └── gltf_mesh_extras_targetNames.cs │ │ │ │ ├── GltfDeserializer.g.cs │ │ │ │ ├── GltfSerializer.g.cs │ │ │ │ ├── IStorage.cs │ │ │ │ ├── JsonSchemaAttribute.cs │ │ │ │ ├── glEnum.cs │ │ │ │ ├── glTF.cs │ │ │ │ ├── glTFAnimation.cs │ │ │ │ ├── glTFAssets.cs │ │ │ │ ├── glTFBuffer.cs │ │ │ │ ├── glTFCamera.cs │ │ │ │ ├── glTFMaterial.cs │ │ │ │ ├── glTFMesh.cs │ │ │ │ ├── glTFNode.cs │ │ │ │ ├── glTFSkin.cs │ │ │ │ ├── glTFTexture.cs │ │ │ │ └── glbTypes.cs │ │ │ ├── IO │ │ │ │ ├── AnimationIO │ │ │ │ │ ├── AnimationImporterUtil.cs │ │ │ │ │ └── IAnimationExporter.cs │ │ │ │ ├── ArrayByteBuffer.cs │ │ │ │ ├── ArrayPin.cs │ │ │ │ ├── Axes.cs │ │ │ │ ├── BlendShapeTargetNameLocationFlags.cs │ │ │ │ ├── BufferAccessor.cs │ │ │ │ ├── Byte3.cs │ │ │ │ ├── Byte4.cs │ │ │ │ ├── BytesReader.cs │ │ │ │ ├── ExportingGltfData.cs │ │ │ │ ├── FileSystemStorage.cs │ │ │ │ ├── GltfData.cs │ │ │ │ ├── GltfExportSettings.cs │ │ │ │ ├── GltfJsonUtil.cs │ │ │ │ ├── GltfUtility.cs │ │ │ │ ├── ImporterContext.cs │ │ │ │ ├── ImporterContextExtensions.cs │ │ │ │ ├── ImporterContextSpeedLog.cs │ │ │ │ ├── MaterialIO │ │ │ │ │ ├── BuiltInRP │ │ │ │ │ │ ├── Export │ │ │ │ │ │ │ ├── BuiltInGltfMaterialExporter.cs │ │ │ │ │ │ │ └── Materials │ │ │ │ │ │ │ │ ├── BuiltInFallbackMaterialExporter.cs │ │ │ │ │ │ │ │ ├── BuiltInGenericUnlitMaterialExporter.cs │ │ │ │ │ │ │ │ ├── BuiltInStandardMaterialExporter.cs │ │ │ │ │ │ │ │ └── BuiltInUniUnlitMaterialExporter.cs │ │ │ │ │ │ └── Import │ │ │ │ │ │ │ ├── BuiltInGltfMaterialDescriptorGenerator.cs │ │ │ │ │ │ │ └── Materials │ │ │ │ │ │ │ ├── BuiltInGltfDefaultMaterialImporter.cs │ │ │ │ │ │ │ ├── BuiltInGltfPbrMaterialImporter.cs │ │ │ │ │ │ │ └── BuiltInGltfUnlitMaterialImporter.cs │ │ │ │ │ ├── GltfMaterialExportUtils.cs │ │ │ │ │ ├── GltfMaterialImportUtils.cs │ │ │ │ │ ├── IMaterialDescriptorGenerator.cs │ │ │ │ │ ├── IMaterialExporter.cs │ │ │ │ │ ├── MaterialImporterParamExtensions.cs │ │ │ │ │ ├── RenderPipelineMaterialDescriptorUtility.cs │ │ │ │ │ ├── RenderPipelineTypes.cs │ │ │ │ │ ├── TextureTransform.cs │ │ │ │ │ ├── URP │ │ │ │ │ │ └── Import │ │ │ │ │ │ │ ├── Materials │ │ │ │ │ │ │ ├── UrpGltfDefaultMaterialImporter.cs │ │ │ │ │ │ │ └── UrpGltfPbrMaterialImporter.cs │ │ │ │ │ │ │ └── UrpGltfMaterialDescriptorGenerator.cs │ │ │ │ │ └── glTFBlendMode.cs │ │ │ │ ├── MeshIO │ │ │ │ │ ├── BlendShapeExporter.cs │ │ │ │ │ ├── BlendShapeFilter.cs │ │ │ │ │ ├── JointsAccessor.cs │ │ │ │ │ ├── MeshData.cs │ │ │ │ │ ├── MeshExportInfo.cs │ │ │ │ │ ├── MeshExportUtil.cs │ │ │ │ │ ├── MeshExporter_DividedVertexBuffer.cs │ │ │ │ │ ├── MeshExporter_SharedVertexBuffer.cs │ │ │ │ │ ├── MeshUploader.cs │ │ │ │ │ ├── MeshVertex0.cs │ │ │ │ │ ├── MeshVertex1.cs │ │ │ │ │ ├── MeshVertex2.cs │ │ │ │ │ ├── MeshVertexUtility.cs │ │ │ │ │ ├── MeshWithMaterials.cs │ │ │ │ │ ├── PositionMinMax.cs │ │ │ │ │ ├── PrimitiveExtensions.cs │ │ │ │ │ ├── SkinningInfo.cs │ │ │ │ │ ├── TriangleUtil.cs │ │ │ │ │ ├── VertexColorState.cs │ │ │ │ │ └── WeightsAccessor.cs │ │ │ │ ├── MigrationFlags.cs │ │ │ │ ├── MonoBehaviourComparator.cs │ │ │ │ ├── NativeArrayManager.cs │ │ │ │ ├── NodeImporter.cs │ │ │ │ ├── Parser │ │ │ │ │ ├── AutoGltfFileParser.cs │ │ │ │ │ ├── GlbBinaryParser.cs │ │ │ │ │ ├── GlbFileParser.cs │ │ │ │ │ ├── GlbLowLevelParser.cs │ │ │ │ │ ├── GltfFileWithResourceFilesParser.cs │ │ │ │ │ └── ZipArchivedGltfFileParser.cs │ │ │ │ ├── ProgressInfo.cs │ │ │ │ ├── SByte4.cs │ │ │ │ ├── SafeMarshalCopy.cs │ │ │ │ ├── SkinJoint.cs │ │ │ │ ├── TextureIO │ │ │ │ │ ├── GltfPbrTextureImporter.cs │ │ │ │ │ ├── GltfTextureDescriptorGenerator.cs │ │ │ │ │ ├── GltfTextureExporter.cs │ │ │ │ │ ├── GltfTextureImporter.cs │ │ │ │ │ ├── ITextureDescriptorGenerator.cs │ │ │ │ │ └── TextureSamplerUtil.cs │ │ │ │ ├── UShort2.cs │ │ │ │ ├── UShort3.cs │ │ │ │ ├── UShort4.cs │ │ │ │ ├── UnityPath.cs │ │ │ │ ├── UriByteBuffer.cs │ │ │ │ ├── ZipArchiveStorage.cs │ │ │ │ ├── glbImporter.cs │ │ │ │ └── gltfExporter.cs │ │ │ ├── PackageVersion.cs │ │ │ ├── PackageVersionPartial.cs │ │ │ ├── RuntimeGltfInstance.cs │ │ │ ├── UniGLTFException.cs │ │ │ ├── UniGLTFVersion.cs │ │ │ ├── UniGLTFVersion_partial.cs │ │ │ └── Validation │ │ │ │ └── Validation.cs │ │ ├── UniHumanoid │ │ │ ├── AnimationClipUtility.cs │ │ │ ├── AvatarDescription.cs │ │ │ ├── BoneGizmoDrawer.cs │ │ │ ├── BoneMapping.cs │ │ │ ├── BvhBone.cs │ │ │ ├── Extensions │ │ │ │ └── EnumExtensions.cs │ │ │ ├── ForceUniqueName.cs │ │ │ ├── Format │ │ │ │ ├── Bvh.cs │ │ │ │ ├── BvhChannel.cs │ │ │ │ ├── BvhChannelCurve.cs │ │ │ │ ├── BvhEndSite.cs │ │ │ │ ├── BvhException.cs │ │ │ │ └── BvhNode.cs │ │ │ ├── HumanPoseClip.cs │ │ │ ├── HumanPoseTransfer.cs │ │ │ ├── Humanoid.cs │ │ │ ├── HumanoidLoader.cs │ │ │ ├── IBone.cs │ │ │ ├── IO │ │ │ │ ├── BvhAnimationClip.cs │ │ │ │ ├── BvhImporter.cs │ │ │ │ ├── BvhImporterContext.cs │ │ │ │ └── Extensions │ │ │ │ │ ├── BvhExtensions.cs │ │ │ │ │ └── UnityExtensions.cs │ │ │ ├── MuscleDebug.cs │ │ │ ├── MuscleInspector.cs │ │ │ ├── PoseModifier │ │ │ │ ├── HandPose.cs │ │ │ │ ├── HandRig.cs │ │ │ │ └── IPoseModifier.cs │ │ │ ├── Resources │ │ │ │ └── UniHumanoid │ │ │ │ │ └── T-Pose.pose.asset │ │ │ ├── Skeleton.cs │ │ │ ├── SkeletonEstimator.cs │ │ │ └── SkeletonMeshUtility.cs │ │ ├── UniJSON │ │ │ ├── ByteBuffer.cs │ │ │ ├── ConcreteCast.cs │ │ │ ├── ConcreteCast.g.cs │ │ │ ├── Exceptions.cs │ │ │ ├── Extensions │ │ │ │ ├── ArraySegmentExtensions.cs │ │ │ │ ├── ByteExtensions.cs │ │ │ │ ├── DateTimeOffsetExtensions.cs │ │ │ │ ├── EnumExtensions.cs │ │ │ │ ├── ParserExtensions.cs │ │ │ │ └── TypeExtensions.cs │ │ │ ├── FormatterExtensions.cs │ │ │ ├── IFileSystemAccessor.cs │ │ │ ├── IFormatter.cs │ │ │ ├── IStore │ │ │ │ ├── ByteUnion.cs │ │ │ │ ├── BytesStore.cs │ │ │ │ ├── IStore.cs │ │ │ │ ├── StreamStore.cs │ │ │ │ └── StringBuilderStore.cs │ │ │ ├── Json │ │ │ │ ├── JsonFormatter.cs │ │ │ │ ├── JsonParser.cs │ │ │ │ ├── JsonString.cs │ │ │ │ └── JsonValue.cs │ │ │ ├── ListTreeNode │ │ │ │ ├── ListTreeNode.cs │ │ │ │ ├── ListTreeNodeArrayExtensions.cs │ │ │ │ ├── ListTreeNodeExtensions.cs │ │ │ │ └── ListTreeNodeObjectExtensions.cs │ │ │ ├── Utf8String │ │ │ │ ├── IUtf8String.cs │ │ │ │ ├── Utf8Iterator.cs │ │ │ │ ├── Utf8String.cs │ │ │ │ ├── Utf8StringBuilder.cs │ │ │ │ ├── Utf8StringExtensions.cs │ │ │ │ └── Utf8StringSplitterExtensions.cs │ │ │ └── ValueNodeType.cs │ │ └── Utils │ │ │ ├── CachedEnum │ │ │ ├── CachedEnum.cs │ │ │ └── CachedEnumType.cs │ │ │ ├── EuclideanTransform.cs │ │ │ └── TransformState.cs │ └── package.json │ ├── VRM10 │ ├── Runtime │ │ ├── AssemblyInfo.cs │ │ ├── Components │ │ │ ├── Constraint │ │ │ │ ├── ConstRaintException.cs │ │ │ │ ├── ConstraintAxes.cs │ │ │ │ ├── ConstraintDestination.cs │ │ │ │ ├── ConstraintSource.cs │ │ │ │ ├── IVrm10Constraint.cs │ │ │ │ ├── TR.cs │ │ │ │ ├── TransformExtensions.cs │ │ │ │ ├── Vrm10AimConstraint.cs │ │ │ │ ├── Vrm10ConstraintUtil.cs │ │ │ │ ├── Vrm10RollConstraint.cs │ │ │ │ └── Vrm10RotationConstraint.cs │ │ │ ├── Expression │ │ │ │ ├── DefaultExpressionValidator.cs │ │ │ │ ├── ExpressionKey.cs │ │ │ │ ├── ExpressionMerger.cs │ │ │ │ ├── ExpressionPreset.cs │ │ │ │ ├── IExpressionValidator.cs │ │ │ │ ├── IExpressionValidatorFactory.cs │ │ │ │ ├── ILookAtEyeDirectionApplicable.cs │ │ │ │ ├── MaterialColorBinding.cs │ │ │ │ ├── MaterialUVBinding.cs │ │ │ │ ├── MaterialValueBindingMerger.cs │ │ │ │ ├── MorphTargetBinding.cs │ │ │ │ ├── MorphTargetBindingMerger │ │ │ │ │ ├── MorphTargetBindingMerger.cs │ │ │ │ │ ├── MorphTargetIdentifier.cs │ │ │ │ │ └── RuntimeMorphTargetBinding.cs │ │ │ │ ├── Preview │ │ │ │ │ ├── PreviewMaterialUtil.cs │ │ │ │ │ ├── PreviewMeshItem.cs │ │ │ │ │ └── PreviewSceneManager.cs │ │ │ │ ├── PreviewMaterialItem.cs │ │ │ │ └── VRM10Expression.cs │ │ │ ├── FirstPerson │ │ │ │ ├── RendererFirstPersonFlags.cs │ │ │ │ └── Vrm10FirstPersonLayerSettings.cs │ │ │ ├── LookAt │ │ │ │ ├── CurveMapper.cs │ │ │ │ ├── ILookAtEyeDirectionProvider.cs │ │ │ │ ├── LookAtEyeDirection.cs │ │ │ │ ├── LookAtEyeDirectionApplicableToBone.cs │ │ │ │ ├── LookAtEyeDirectionApplicableToExpression.cs │ │ │ │ ├── LookAtInput.cs │ │ │ │ └── Matrix4x4Extensions.cs │ │ │ ├── PrefabRelatedScriptableObject.cs │ │ │ ├── SpringBone │ │ │ │ ├── VRM10SpringBoneCollider.cs │ │ │ │ ├── VRM10SpringBoneColliderGroup.cs │ │ │ │ ├── VRM10SpringBoneJoint.cs │ │ │ │ └── VRM10SpringUtility.cs │ │ │ ├── VRM10Object │ │ │ │ ├── VRM10Object.cs │ │ │ │ ├── VRM10ObjectExpression.cs │ │ │ │ ├── VRM10ObjectFirstPerson.cs │ │ │ │ ├── VRM10ObjectLookAt.cs │ │ │ │ └── VRM10ObjectMeta.cs │ │ │ ├── Vrm10Instance │ │ │ │ ├── Vrm10Instance.cs │ │ │ │ └── Vrm10InstanceSpringBone.cs │ │ │ ├── Vrm10Runtime │ │ │ │ ├── ControlRig │ │ │ │ │ ├── ControlRigGenerationOption.cs │ │ │ │ │ ├── Vrm10ControlBone.cs │ │ │ │ │ └── Vrm10RuntimeControlRig.cs │ │ │ │ ├── Vrm10Runtime.cs │ │ │ │ ├── Vrm10RuntimeExpression.cs │ │ │ │ └── Vrm10RuntimeLookAt.cs │ │ │ └── VrmAnimationInstance │ │ │ │ ├── IVrm10Animation.cs │ │ │ │ ├── Vrm10AnimationInstance.cs │ │ │ │ ├── Vrm10PoseLoader.cs │ │ │ │ └── Vrm10TPose.cs │ │ ├── ControlRig │ │ │ ├── AnimatorPoseProvider.cs │ │ │ ├── BoneInitialRotation.cs │ │ │ ├── INormalizedPoseApplicable.cs │ │ │ ├── INormalizedPoseProvider.cs │ │ │ ├── ITPoseProvider.cs │ │ │ ├── InitialRotationPoseProvider.cs │ │ │ ├── InitialRotations │ │ │ │ ├── XR_EXT_hand_tracking.cs │ │ │ │ └── XR_FB_body_tracking.cs │ │ │ └── Vrm10Retarget.cs │ │ ├── EnumFlagsAttribute.cs │ │ ├── FastSpringBone │ │ │ ├── Blittables │ │ │ │ ├── BlittableCollider.cs │ │ │ │ ├── BlittableColliderType.cs │ │ │ │ ├── BlittableExternalData.cs │ │ │ │ ├── BlittableJoint.cs │ │ │ │ ├── BlittableLogic.cs │ │ │ │ ├── BlittableSpan.cs │ │ │ │ ├── BlittableSpring.cs │ │ │ │ └── BlittableTransform.cs │ │ │ ├── InputPorts │ │ │ │ ├── FastSpringBoneBuffer.cs │ │ │ │ ├── FastSpringBoneCollider.cs │ │ │ │ ├── FastSpringBoneJoint.cs │ │ │ │ └── FastSpringBoneSpring.cs │ │ │ └── System │ │ │ │ ├── CopyToNativeArrayTransformJob.cs │ │ │ │ ├── FastSpringBoneBufferCombiner.cs │ │ │ │ ├── FastSpringBoneScheduler.cs │ │ │ │ ├── FastSpringBoneService.cs │ │ │ │ ├── PushTransformJob.cs │ │ │ │ └── UpdateFastSpringBoneJob.cs │ │ ├── Format │ │ │ ├── Animation │ │ │ │ ├── Deserializer.g.cs │ │ │ │ ├── Format.g.cs │ │ │ │ └── Serializer.g.cs │ │ │ ├── Constraints │ │ │ │ ├── Deserializer.g.cs │ │ │ │ ├── Format.g.cs │ │ │ │ └── Serializer.g.cs │ │ │ ├── MaterialsMToon │ │ │ │ ├── Deserializer.g.cs │ │ │ │ └── Serializer.g.cs │ │ │ ├── SpringBone │ │ │ │ ├── Deserializer.g.cs │ │ │ │ ├── Format.g.cs │ │ │ │ └── Serializer.g.cs │ │ │ ├── Vrm │ │ │ │ ├── Deserializer.g.cs │ │ │ │ ├── Format.g.cs │ │ │ │ └── Serializer.g.cs │ │ │ └── VrmHumanoidBones │ │ │ │ ├── Vrm10HumanoidBoneAttribute.cs │ │ │ │ ├── Vrm10HumanoidBoneSpecification.cs │ │ │ │ └── Vrm10HumanoidBones.cs │ │ ├── IO │ │ │ ├── ArrayExtensions.cs │ │ │ ├── ExpressionExtensions.cs │ │ │ ├── IndexExtensions.cs │ │ │ ├── Material │ │ │ │ ├── BuiltInRP │ │ │ │ │ ├── Export │ │ │ │ │ │ ├── BuiltInVrm10MaterialExporter.cs │ │ │ │ │ │ └── Materials │ │ │ │ │ │ │ └── BuiltInVrm10MToonMaterialExporter.cs │ │ │ │ │ └── Import │ │ │ │ │ │ ├── BuiltInVrm10MaterialDescriptorGenerator.cs │ │ │ │ │ │ └── Materials │ │ │ │ │ │ └── BuiltInVrm10MToonMaterialImporter.cs │ │ │ │ ├── URP │ │ │ │ │ └── Import │ │ │ │ │ │ ├── Materials │ │ │ │ │ │ └── UrpVrm10MToonMaterialImporter.cs │ │ │ │ │ │ ├── UrpVrm10MaterialDescriptorGenerator.cs │ │ │ │ │ │ └── VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs │ │ │ │ └── Vrm10MaterialExportUtils.cs │ │ │ ├── MigrationData.cs │ │ │ ├── Model │ │ │ │ ├── CopyIndicesJob.cs │ │ │ │ ├── InterleaveMeshVerticesJob.cs │ │ │ │ ├── MeshImporterDivided.cs │ │ │ │ ├── MeshImporterShared.cs │ │ │ │ ├── MeshReader.cs │ │ │ │ ├── MeshVertex0.cs │ │ │ │ ├── MeshVertex1.cs │ │ │ │ ├── MeshVertex2.cs │ │ │ │ ├── MeshVertexUtility.cs │ │ │ │ ├── MeshWriter.cs │ │ │ │ ├── ModelExporter.cs │ │ │ │ └── ModelReader.cs │ │ │ ├── Texture │ │ │ │ ├── Vrm10MToonTextureImporter.cs │ │ │ │ └── Vrm10TextureDescriptorGenerator.cs │ │ │ ├── UnityExtension.cs │ │ │ ├── Vrm10.cs │ │ │ ├── Vrm10Data.cs │ │ │ ├── Vrm10Exception.cs │ │ │ ├── Vrm10Exporter.cs │ │ │ ├── Vrm10ImportData.cs │ │ │ ├── Vrm10Importer.cs │ │ │ ├── VrmAnimationExporter.cs │ │ │ ├── VrmAnimationImporter.cs │ │ │ └── VrmAnimationUtil.cs │ │ ├── MeshUtility │ │ │ └── Vrm10MeshUtility.cs │ │ ├── Migration │ │ │ ├── Materials │ │ │ │ ├── MigrationLegacyUnlitMaterial.cs │ │ │ │ ├── MigrationMToonMaterial.cs │ │ │ │ ├── MigrationMaterialUtil.cs │ │ │ │ ├── MigrationPbrMaterial.cs │ │ │ │ ├── MigrationUnlitTransparentZWriteMaterial.cs │ │ │ │ ├── Vrm0XMToonTextureIndexMap.cs │ │ │ │ └── Vrm0XMToonValue.cs │ │ │ ├── MeshUpdater.cs │ │ │ ├── MigrationCheck.cs │ │ │ ├── MigrationException.cs │ │ │ ├── MigrationMaterials.cs │ │ │ ├── MigrationVector3.cs │ │ │ ├── MigrationVrm.cs │ │ │ ├── MigrationVrmExpression.cs │ │ │ ├── MigrationVrmFirstPersonAndLookAt.cs │ │ │ ├── MigrationVrmHumanoid.cs │ │ │ ├── MigrationVrmMeta.cs │ │ │ ├── MigrationVrmSpringBone.cs │ │ │ ├── Migrator.cs │ │ │ ├── RotateY180.cs │ │ │ ├── Vrm0Meta.cs │ │ │ └── Vrm0XVersion.cs │ │ ├── Scenes │ │ │ ├── Sample.cs │ │ │ └── SampleScene.unity │ │ ├── StringExtensions.cs │ │ ├── UnityExtensions.cs │ │ └── Version │ │ │ ├── VRMSpecVersion.cs │ │ │ └── VRMSpecVersionPartial.cs │ ├── package.json │ └── vrmlib │ │ ├── README.md │ │ └── Runtime │ │ ├── Coordinates.cs │ │ ├── ExportArgs.cs │ │ ├── Extensions │ │ └── ListExtensions.cs │ │ ├── GltfId.cs │ │ ├── Humanoid │ │ ├── Humanoid.cs │ │ ├── HumanoidBones.cs │ │ ├── SkeletonEstimator.cs │ │ └── SkeletonMeshUtility.cs │ │ ├── MathFWrap.cs │ │ ├── Mesh.cs │ │ ├── MeshGroup.cs │ │ ├── Model.cs │ │ ├── MorphTarget.cs │ │ ├── Node.cs │ │ ├── NodeAnimation.cs │ │ ├── Skin.cs │ │ └── VertexBuffer.cs │ └── VRMShaders │ ├── CHANGELOG.md │ ├── Documentation │ └── VRMShaders.md │ ├── GLTF │ ├── IO │ │ ├── Resources │ │ │ └── UniGLTF │ │ │ │ ├── NormalMapExporter.shader │ │ │ │ ├── StandardMapExporter.shader │ │ │ │ └── StandardMapImporter.shader │ │ └── Runtime │ │ │ ├── Animation │ │ │ └── Importer │ │ │ │ └── AnimationClipFactory.cs │ │ │ ├── AwaitCaller │ │ │ ├── IAwaitCaller.cs │ │ │ ├── ImmediateCaller.cs │ │ │ ├── NextFrameTaskScheduler.cs │ │ │ ├── RuntimeOnlyAwaitCaller.cs │ │ │ ├── RuntimeOnlyNoThreadAwaitCaller.cs │ │ │ └── TinyManagedTaskScheduler.cs │ │ │ ├── ColorSpace.cs │ │ │ ├── IResponsibilityForDestroyObjects.cs │ │ │ ├── Material │ │ │ └── Importer │ │ │ │ ├── MaterialDescriptor.cs │ │ │ │ └── MaterialFactory.cs │ │ │ ├── PathObject.cs │ │ │ ├── SubAssetKey.cs │ │ │ ├── Texture │ │ │ ├── Converter │ │ │ │ ├── NormalConverter.cs │ │ │ │ ├── OcclusionMetallicRoughnessConverter.cs │ │ │ │ └── TextureConverter.cs │ │ │ ├── Exporter │ │ │ │ ├── ITextureExporter.cs │ │ │ │ ├── ITextureSerializer.cs │ │ │ │ ├── RuntimeTextureSerializer.cs │ │ │ │ ├── TextureExportParam.cs │ │ │ │ ├── TextureExportTypes.cs │ │ │ │ └── TextureExporter.cs │ │ │ ├── Importer │ │ │ │ ├── DeserializingTextureInfo.cs │ │ │ │ ├── ITextureDeserializer.cs │ │ │ │ ├── SamplerParam.cs │ │ │ │ ├── TextureDescriptor.cs │ │ │ │ ├── TextureDescriptorSet.cs │ │ │ │ ├── TextureFactory.cs │ │ │ │ ├── TextureImportName.cs │ │ │ │ ├── TextureImportTypes.cs │ │ │ │ └── UnityTextureDeserializer.cs │ │ │ └── Util │ │ │ │ └── TextureExtensions.cs │ │ │ └── Util │ │ │ ├── Symbols.cs │ │ │ └── UnityObjectDestroyer.cs │ └── UniUnlit │ │ ├── Resources │ │ └── UniGLTF │ │ │ └── UniUnlit.shader │ │ └── Runtime │ │ └── UniUnlitUtil.cs │ ├── LICENSE.md │ ├── README.md │ ├── VRM │ ├── IO │ │ └── Runtime │ │ │ ├── PreShaderPropExporter.cs │ │ │ └── ShaderProps.cs │ ├── MToon │ │ ├── LICENSE │ │ ├── MToon │ │ │ ├── Resources │ │ │ │ └── Shaders │ │ │ │ │ ├── MToon.shader │ │ │ │ │ ├── MToonCore.cginc │ │ │ │ │ ├── MToonSM3.cginc │ │ │ │ │ └── MToonSM4.cginc │ │ │ ├── Samples │ │ │ │ ├── Materials │ │ │ │ │ ├── Ex_OutlineWidth_Screen.mat │ │ │ │ │ ├── Ex_OutlineWidth_World.mat │ │ │ │ │ ├── Ground.mat │ │ │ │ │ └── Toon.mat │ │ │ │ └── OutlineWidthModes.unity │ │ │ └── Scripts │ │ │ │ ├── Enums.cs │ │ │ │ ├── MToonDefinition.cs │ │ │ │ ├── Utils.cs │ │ │ │ ├── UtilsGetter.cs │ │ │ │ ├── UtilsSetter.cs │ │ │ │ └── UtilsVersion.cs │ │ └── README.md │ └── VRMShaders.shadervariants │ ├── VRM10 │ ├── Format │ │ └── Runtime │ │ │ └── MaterialsMToon │ │ │ └── Format.g.cs │ ├── MToon10 │ │ ├── Resources │ │ │ └── VRM10 │ │ │ │ ├── vrmc_materials_mtoon.shader │ │ │ │ ├── vrmc_materials_mtoon_attribute.hlsl │ │ │ │ ├── vrmc_materials_mtoon_define.hlsl │ │ │ │ ├── vrmc_materials_mtoon_depthnormals_fragment.hlsl │ │ │ │ ├── vrmc_materials_mtoon_depthnormals_vertex.hlsl │ │ │ │ ├── vrmc_materials_mtoon_depthonly_fragment.hlsl │ │ │ │ ├── vrmc_materials_mtoon_depthonly_vertex.hlsl │ │ │ │ ├── vrmc_materials_mtoon_forward_fragment.hlsl │ │ │ │ ├── vrmc_materials_mtoon_forward_vertex.hlsl │ │ │ │ ├── vrmc_materials_mtoon_geometry_alpha.hlsl │ │ │ │ ├── vrmc_materials_mtoon_geometry_normal.hlsl │ │ │ │ ├── vrmc_materials_mtoon_geometry_uv.hlsl │ │ │ │ ├── vrmc_materials_mtoon_geometry_vertex.hlsl │ │ │ │ ├── vrmc_materials_mtoon_input.hlsl │ │ │ │ ├── vrmc_materials_mtoon_lighting_mtoon.hlsl │ │ │ │ ├── vrmc_materials_mtoon_lighting_unity.hlsl │ │ │ │ ├── vrmc_materials_mtoon_render_pipeline.hlsl │ │ │ │ ├── vrmc_materials_mtoon_shadowcaster_fragment.hlsl │ │ │ │ ├── vrmc_materials_mtoon_shadowcaster_vertex.hlsl │ │ │ │ ├── vrmc_materials_mtoon_urp.shader │ │ │ │ └── vrmc_materials_mtoon_utility.hlsl │ │ └── Runtime │ │ │ ├── Extensions │ │ │ └── MaterialExtensions.cs │ │ │ ├── MToon10Context.cs │ │ │ ├── MToon10Migrator.cs │ │ │ ├── MToonOutlineRenderFeature.cs │ │ │ ├── MToonOutlineRenderPass.cs │ │ │ ├── MToonValidator.cs │ │ │ └── UnityShaderLab │ │ │ ├── MToonDefinedValues │ │ │ ├── MToon10AlphaMode.cs │ │ │ ├── MToon10DoubleSidedMode.cs │ │ │ ├── MToon10EmissiveMapKeyword.cs │ │ │ ├── MToon10NormalMapKeyword.cs │ │ │ ├── MToon10OutlineMode.cs │ │ │ ├── MToon10OutlineModeKeyword.cs │ │ │ ├── MToon10ParameterMapKeyword.cs │ │ │ ├── MToon10RimMapKeyword.cs │ │ │ └── MToon10TransparentWithZWriteMode.cs │ │ │ ├── Properties │ │ │ ├── MToon10Meta.cs │ │ │ ├── MToon10Prop.cs │ │ │ └── MToon10Properties.cs │ │ │ └── ShaderLabDefinedValues │ │ │ ├── UnityAlphaModeKeyword.cs │ │ │ ├── UnityAlphaToMaskMode.cs │ │ │ ├── UnityCullMode.cs │ │ │ ├── UnityRenderTag.cs │ │ │ └── UnityZWriteMode.cs │ └── VRM10Shaders.shadervariants │ └── package.json ├── README.md └── Wiki_Img ├── img1.png ├── img10.png ├── img11.png ├── img12.png ├── img13.png ├── img14.png ├── img15.png ├── img16.png ├── img17.png ├── img2.png ├── img201.png ├── img202.png ├── img203.png ├── img204.png ├── img205.png ├── img206.png ├── img207.png ├── img208.png ├── img209.png ├── img210.png ├── img211.png ├── img212.png ├── img213.png ├── img3.png ├── img4.png ├── img5.png ├── img6.png ├── img7.png ├── img8.png └── img9.png /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ModelReplacementAPI/UnityJigglePhysics"] 2 | path = ModelReplacementAPI/UnityJigglePhysics 3 | url = https://github.com/naelstrof/UnityJigglePhysics.git 4 | branch = bcompat 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Bunya Pine Tree 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ModelReplacementAPI.Networking/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using ModelReplacementNetworking; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle(PluginInfo.NAME)] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(PluginInfo.WEBSITE)] 12 | [assembly: AssemblyProduct(PluginInfo.GUID)] 13 | [assembly: AssemblyCopyright("Copyright © meow 2023")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("Neutral")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6390E70C-AB5E-42ED-BA29-F173942DC3A8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion(PluginInfo.VERSION)] 35 | [assembly: AssemblyFileVersion(PluginInfo.VERSION)] 36 | -------------------------------------------------------------------------------- /ModelReplacementAPI.Networking/Build/ModelReplacementAPI.Networking.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI.Networking/Build/ModelReplacementAPI.Networking.dll -------------------------------------------------------------------------------- /ModelReplacementAPI.Networking/Build/README.md: -------------------------------------------------------------------------------- 1 | # ModelReplacementAPI.Networking v2.3.9 2 | ### Server-Side derivative to ModelReplacementAPI to allow networking of enemy models 3 | 4 | ## Instructions 5 | For more info on making model replacements see the wiki at https://github.com/BunyaPineTree/LethalCompany_ModelReplacementAPI 6 | 7 | ## Known Issues 8 | 9 | ## Unknown Issues 10 | - Many 11 | 12 | ## Changelog 13 | - v1.0.0 14 | - Release -------------------------------------------------------------------------------- /ModelReplacementAPI.Networking/Build/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI.Networking/Build/icon.png -------------------------------------------------------------------------------- /ModelReplacementAPI.Networking/Build/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ModelReplacementAPI.Networking", 3 | "version_number": "1.0.0", 4 | "website_url": "https://github.com/BunyaPineTree/LethalCompany_ModelReplacementAPI", 5 | "description": "Server-Side derivative to ModelReplacementAPI to allow networking of enemy models.", 6 | "dependencies": [ 7 | "BepInEx-BepInExPack-5.4.2100", 8 | "BunyaPineTree-ModelReplacementAPI-2.3.1" 9 | ] 10 | } -------------------------------------------------------------------------------- /ModelReplacementAPI/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using ModelReplacement; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle(PluginInfo.NAME)] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(PluginInfo.WEBSITE)] 12 | [assembly: AssemblyProduct(PluginInfo.GUID)] 13 | [assembly: AssemblyCopyright("Copyright © meow 2023")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("Neutral")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6390E70C-AB5E-42ED-BA29-F173942DC3A9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion(PluginInfo.VERSION)] 35 | [assembly: AssemblyFileVersion(PluginInfo.VERSION)] 36 | -------------------------------------------------------------------------------- /ModelReplacementAPI/Build/MRAPI_2.0.3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI/Build/MRAPI_2.0.3.zip -------------------------------------------------------------------------------- /ModelReplacementAPI/Build/ModelReplacementAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI/Build/ModelReplacementAPI.dll -------------------------------------------------------------------------------- /ModelReplacementAPI/Build/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI/Build/icon.png -------------------------------------------------------------------------------- /ModelReplacementAPI/Build/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ModelReplacementAPI", 3 | "version_number": "2.4.18", 4 | "website_url": "https://github.com/BunyaPineTree/LethalCompany_ModelReplacementAPI", 5 | "description": "API to simplify model replacement", 6 | "dependencies": [ 7 | "BepInEx-BepInExPack-5.4.2100" 8 | 9 | ] 10 | } -------------------------------------------------------------------------------- /ModelReplacementAPI/Libraries/.dependencies: -------------------------------------------------------------------------------- 1 | On Thunderstore install 2 | 3 | TooManyEmotes.dll 4 | RecordingCamera.dll 5 | MoreCompany.dll 6 | MirrorDecor.dll 7 | LCThirdPerson.dll 8 | 3rdPerson.dll 9 | 10 | And place it in this folder -------------------------------------------------------------------------------- /ModelReplacementAPI/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ModelReplacementAPI/Patches/EnemyPatches.cs: -------------------------------------------------------------------------------- 1 | using GameNetcodeStuff; 2 | using HarmonyLib; 3 | using ModelReplacement.Monobehaviors; 4 | 5 | namespace ModelReplacement.Patches 6 | { 7 | 8 | [HarmonyPatch(typeof(EnemyAI))] 9 | public class EnemyAIPatch 10 | { 11 | [HarmonyPatch("HitEnemy")] 12 | [HarmonyPrefix] 13 | 14 | [HarmonyAfter()] 15 | public static void HitEnemy(ref EnemyAI __instance, int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) 16 | { 17 | if (playerWhoHit == null) return; 18 | 19 | BodyReplacementBase bodyReplacement = playerWhoHit.gameObject.GetComponent(); 20 | if (bodyReplacement) 21 | { 22 | bodyReplacement.OnHitEnemy(__instance.isEnemyDead); 23 | } 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ModelReplacementAPI/Patches/HeldItemPositionPatch.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using ModelReplacement.Monobehaviors; 3 | using UnityEngine; 4 | 5 | namespace ModelReplacement.Patches 6 | { 7 | [HarmonyPatch(typeof(GrabbableObject))] 8 | public class LocateHeldObjectsOnModelReplacementPatch 9 | { 10 | 11 | [HarmonyPatch("LateUpdate")] 12 | [HarmonyPostfix] 13 | public static void LateUpdatePatch(ref GrabbableObject __instance) 14 | { 15 | if (__instance.parentObject == null || __instance.playerHeldBy == null) return; 16 | if (__instance.playerHeldBy.ItemSlots[__instance.playerHeldBy.currentItemSlot] != __instance) return; 17 | 18 | BodyReplacementBase bodyReplacement = __instance.playerHeldBy.gameObject.GetComponent(); 19 | if (!bodyReplacement) return; 20 | 21 | if (bodyReplacement.heldItem != __instance) 22 | bodyReplacement.heldItem = __instance; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ModelReplacementAPI/Patches/MaskedPatch.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using ModelReplacement.Monobehaviors.Enemies; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using static UnityEngine.UIElements.UIR.Implementation.UIRStylePainter; 7 | 8 | namespace ModelReplacement.Patches 9 | { 10 | [HarmonyPatch(typeof(MaskedPlayerEnemy))] 11 | public class MaskedPlayerEnemyPatch 12 | { 13 | 14 | [HarmonyPatch("Start")] 15 | [HarmonyPostfix] 16 | public static void ManageRegistryBodyReplacements(ref EnemyAI __instance) 17 | { 18 | try 19 | { 20 | __instance.gameObject.AddComponent(); 21 | } 22 | catch (Exception e) 23 | { 24 | ModelReplacementAPI.Instance.Logger.LogError($"Exception in Masked ManageRegistryBodyReplacements: {e}"); 25 | } 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ModelReplacementAPI/Patches/StartOfRoundPatch.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using ModelReplacement; 3 | 4 | [HarmonyPatch(typeof(StartOfRound))] 5 | public class RepairBrokenBodyReplacementsPatch 6 | { 7 | 8 | [HarmonyPatch("ReviveDeadPlayers")] 9 | [HarmonyPostfix] 10 | public static void ReviveDeadPlayersPatch(ref StartOfRound __instance) 11 | { 12 | 13 | foreach (GameNetcodeStuff.PlayerControllerB item in __instance.allPlayerScripts) 14 | { 15 | if (!item.isPlayerDead) continue; 16 | ModelReplacementAPI.ResetPlayerModelReplacement(item); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ModelReplacementAPI/Scripts/SDKClasses.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | // ModelReplacement.AvatarBodyUpdater, for SDK compat 6 | namespace ModelReplacement.AvatarBodyUpdater 7 | { 8 | #region model setup classes 9 | public class RotationOffset : MonoBehaviour 10 | { 11 | public Quaternion offset = Quaternion.identity; 12 | 13 | public bool RenderMCC = true; 14 | public Vector3 MCCPosition = Vector3.zero; 15 | public Quaternion MCCRotation = Quaternion.identity; 16 | public Vector3 MCCScale = Vector3.one; 17 | } 18 | public class OffsetBuilder : MonoBehaviour 19 | { 20 | public Vector3 rootPositionOffset = new Vector3(0, 0, 0); 21 | public Vector3 rootScale = new Vector3(1, 1, 1); 22 | public Vector3 itemPositonOffset = new Vector3(0, 0, 0); 23 | public Quaternion itemRotationOffset = Quaternion.identity; 24 | public GameObject itemHolder = null; 25 | public bool UseNoPostProcessing = false; 26 | public bool GenerateViewModel = false; 27 | public bool RemoveHelmet = false; 28 | public GameObject ViewModel = null; 29 | } 30 | #endregion 31 | } 32 | -------------------------------------------------------------------------------- /ModelReplacementAPI/Scripts/Vector3Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace ModelReplacement.Scripts 7 | { 8 | public static class Vector3Helper 9 | { 10 | public static void MoveSmoothly(this Vector3 from, Vector3 to) 11 | { 12 | from = Vector3.Lerp(from, to, 0.1f); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/APIPlugin.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using BepInEx.Bootstrap; 3 | using BepInEx.Logging; 4 | using GameNetcodeStuff; 5 | using HarmonyLib; 6 | using System; 7 | using System.Collections.Generic; 8 | 9 | namespace ModelReplacementVRM 10 | { 11 | 12 | public static class PluginInfo 13 | { 14 | public const string GUID = "meow.ModelReplacementAPI.VRMSupport"; 15 | public const string NAME = "ModelReplacementAPI.VRMSupport"; 16 | public const string VERSION = "0.0.1"; 17 | public const string WEBSITE = "https://github.com/BunyaPineTree/LethalCompany_ModelReplacementAPI"; 18 | } 19 | 20 | 21 | [BepInPlugin(PluginInfo.GUID, PluginInfo.NAME, PluginInfo.VERSION)] 22 | [BepInDependency("meow.ModelReplacementAPI", BepInDependency.DependencyFlags.HardDependency)] 23 | public class ModelReplacementAPI_VRM : BaseUnityPlugin 24 | { 25 | 26 | private void Awake() 27 | { 28 | Logger = BepInEx.Logging.Logger.CreateLogSource(PluginInfo.GUID); 29 | // Plugin startup logic 30 | bool flag = ModelReplacementAPI_VRM.Instance == null; 31 | if (flag) 32 | { 33 | ModelReplacementAPI_VRM.Instance = this; 34 | } 35 | 36 | Harmony harmony = new Harmony(PluginInfo.GUID); 37 | harmony.PatchAll(); 38 | Logger.LogInfo($"Plugin {PluginInfo.GUID} is loaded!"); 39 | } 40 | 41 | //Other 42 | public static ModelReplacementAPI_VRM Instance = null; 43 | public new ManualLogSource Logger; 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using ModelReplacementVRM; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle(PluginInfo.NAME)] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany(PluginInfo.WEBSITE)] 12 | [assembly: AssemblyProduct(PluginInfo.GUID)] 13 | [assembly: AssemblyCopyright("Copyright © meow 2023")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("Neutral")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6390E70C-AB5E-42ED-BA29-F173942DC3A8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion(PluginInfo.VERSION)] 35 | [assembly: AssemblyFileVersion(PluginInfo.VERSION)] 36 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/Build/ModelReplacementAPI.VRMSupport.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/Build/ModelReplacementAPI.VRMSupport.dll -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 ousttrue 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/README.md: -------------------------------------------------------------------------------- 1 | # UniGLTF-2.0 2 | 3 | * Unity-Supports 2019.4 and later 4 | * You can import and export glTF-2.0 in Unity's editor and runtime. 5 | * implement `KHR_materials_unlit` 6 | * implement `KHR_texture_transform` (partial) 7 | 8 | # Material 9 | 10 | ## PBR 11 | 12 | * Convert as much as possible between glTF pbr and Unity Standard Shader. 13 | * Converts metal roughness and occlusion RGBA channel incompatibility. 14 | 15 | ## Unlit 16 | 17 | * import: UniGLTF's own `UniGLTF/UniUnlit` shader. 18 | * export: You can export `UniGLTF/UniUnlit` and Unity unilt materials. 19 | 20 | * Only `UniGLTF/UniUnlit` supports vertex colors. 21 | 22 | ## URP 23 | 24 | * import only. experimental 25 | 26 | # License 27 | 28 | * [MIT license](LICENSE) 29 | 30 | # Download 31 | 32 | * https://github.com/vrm-c/UniVRM/releases 33 | 34 | # Screenshots 35 | 36 | You can import almost all of [gltf_sample_models](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0) 37 | 38 | ![standard shader](doc/pbr_to_standard.png) 39 | ![duck](doc/duck.png) 40 | ![animation](doc/animation.gif) 41 | ![SciFiHelmet](doc/SciFiHelmet.png) 42 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: InternalsVisibleTo("UniGLTF.Tests")] 5 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Extensions/IndexExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF 2 | { 3 | public static class IndexExtensions 4 | { 5 | public static bool HasValidIndex(this int? self) 6 | { 7 | if (!self.HasValue) 8 | { 9 | return false; 10 | } 11 | if (self.Value < 0) 12 | { 13 | // 古いモデルで index の無効値に -1 を使っている場合がある 14 | return false; 15 | } 16 | return true; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/MeshUtility/MeshEnumerateOption.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF.MeshUtility 2 | { 3 | public enum MeshEnumerateOption 4 | { 5 | OnlyWithBlendShape, 6 | OnlyWithoutBlendShape, 7 | All, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/MeshUtility/MeshIntegrationGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace UniGLTF.MeshUtility 5 | { 6 | public class MeshIntegrationGroup 7 | { 8 | public string Name; 9 | 10 | public enum MeshIntegrationTypes 11 | { 12 | Both, 13 | FirstPersonOnly, 14 | ThirdPersonOnly, 15 | Auto, 16 | } 17 | 18 | public MeshIntegrationTypes IntegrationType = default; 19 | public List Renderers = new List(); 20 | 21 | public MeshIntegrationGroup CopyInstantiate(GameObject go, GameObject instance) 22 | { 23 | var copy = new MeshIntegrationGroup 24 | { 25 | Name = Name 26 | }; 27 | foreach (var r in Renderers) 28 | { 29 | var relative = r.transform.RelativePathFrom(go.transform); 30 | if (r is SkinnedMeshRenderer smr) 31 | { 32 | copy.Renderers.Add(instance.transform.GetFromPath(relative).GetComponent()); 33 | } 34 | else if (r is MeshRenderer mr) 35 | { 36 | copy.Renderers.Add(instance.transform.GetFromPath(relative).GetComponent()); 37 | } 38 | } 39 | return copy; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/MeshUtility/TriangleSeparator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace UniGLTF.MeshUtility 6 | { 7 | class TriangleSeparator 8 | { 9 | bool[] VertexHasBlendShape; 10 | 11 | public bool ShouldSplit 12 | { 13 | get 14 | { 15 | var count = VertexHasBlendShape.Count(x => x); 16 | // すべて true か false の場合は分割しない 17 | return count > 0 && count < VertexHasBlendShape.Length; 18 | } 19 | } 20 | 21 | public bool TriangleHasBlendShape(int i0, int i1, int i2) 22 | { 23 | return VertexHasBlendShape[i0] 24 | || VertexHasBlendShape[i1] 25 | || VertexHasBlendShape[i2]; 26 | } 27 | 28 | public bool TriangleHasNotBlendShape(int i0, int i1, int i2) 29 | { 30 | return !TriangleHasBlendShape(i0, i1, i2); 31 | } 32 | 33 | public TriangleSeparator(int vertexCount) 34 | { 35 | VertexHasBlendShape = new bool[vertexCount]; 36 | } 37 | 38 | public void CheckPositions(IReadOnlyList positions) 39 | { 40 | for (int i = 0; i < positions.Count; ++i) 41 | { 42 | if (positions[i] != Vector3.zero) 43 | { 44 | VertexHasBlendShape[i] = true; 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/ballroom_1k.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/ballroom_1k.exr -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/lilienstein_1k.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/lilienstein_1k.exr -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/moonless_golf_1k.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/moonless_golf_1k.exr -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/spruit_sunrise_1k.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Scenes/LookDev/cubemap/spruit_sunrise_1k.exr -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/Format/ExtensionsAndExtras/EmissiveMultiplier/Format.g.cs: -------------------------------------------------------------------------------- 1 | // This file is generated from JsonSchema. Don't modify this source code. 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | 6 | namespace UniGLTF.Extensions.VRMC_materials_hdr_emissiveMultiplier 7 | { 8 | 9 | public class VRMC_materials_hdr_emissiveMultiplier 10 | { 11 | public const string ExtensionName = "VRMC_materials_hdr_emissiveMultiplier"; 12 | 13 | // Dictionary object with extension-specific objects. 14 | public object Extensions; 15 | 16 | // Application-specific data. 17 | public object Extras; 18 | 19 | // A multiplier for emissiveFactor 20 | public float? EmissiveMultiplier; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/Format/IStorage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// Represents bytes access by URL in gltf 7 | /// 8 | public interface IStorage 9 | { 10 | /// 11 | /// gltf の buffer の バイト列アクセス を実装する。 12 | /// 1. url による相対パス 13 | /// 2. url によるbase64 encoding 14 | /// 3. url がnullのときに bin chunk(buffers[0]) にアクセスする 15 | /// 16 | /// 17 | /// 18 | ArraySegment Get(string url = default); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/Format/glTFAssets.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UniJSON; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable] 7 | public class glTFAssets 8 | { 9 | public string generator; 10 | 11 | [JsonSchema(Required = true, Pattern = "^[0-9]+\\.[0-9]+$")] 12 | public string version; 13 | 14 | public string copyright; 15 | 16 | [JsonSchema(Pattern = "^[0-9]+\\.[0-9]+$")] 17 | public string minVersion; 18 | 19 | // empty schemas 20 | public glTFExtension extensions; 21 | public glTFExtension extras; 22 | 23 | public override string ToString() 24 | { 25 | return string.Format("GLTF-{0} generated by {1}", version, generator); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/Format/glTFSkin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UniJSON; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable] 7 | public class glTFSkin 8 | { 9 | [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)] 10 | public int inverseBindMatrices = -1; 11 | 12 | [JsonSchema(Required = true, MinItems = 1)] 13 | [ItemJsonSchema(Minimum = 0)] 14 | public int[] joints; 15 | 16 | [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)] 17 | public int skeleton = -1; 18 | 19 | // empty schemas 20 | public glTFExtension extensions; 21 | public glTFExtension extras; 22 | public string name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/AnimationIO/IAnimationExporter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace UniGLTF 5 | { 6 | public interface IAnimationExporter 7 | { 8 | void Export(ExportingGltfData _data, GameObject Copy, List Nodes); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/BlendShapeTargetNameLocationFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#meshes 7 | /// 8 | /// See Implementation Note about `mesh.extras.targetNames` 9 | /// 10 | [Flags] 11 | public enum BlendShapeTargetNameLocationFlags 12 | { 13 | None = 0, 14 | Mesh = 1, 15 | Primitives = 2, 16 | 17 | Both = Mesh | Primitives, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/Byte3.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public readonly struct Byte3 : IEquatable 8 | { 9 | public readonly byte x; 10 | public readonly byte y; 11 | public readonly byte z; 12 | public Byte3(byte _x, byte _y, byte _z) 13 | { 14 | x = _x; 15 | y = _y; 16 | z = _z; 17 | } 18 | 19 | public bool Equals(Byte3 other) 20 | { 21 | return x == other.x && y == other.y && z == other.z; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/Byte4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public readonly struct Byte4 : IEquatable 8 | { 9 | public readonly byte x; 10 | public readonly byte y; 11 | public readonly byte z; 12 | public readonly byte w; 13 | public Byte4(byte _x, byte _y, byte _z, byte _w) 14 | { 15 | x = _x; 16 | y = _y; 17 | z = _z; 18 | w = _w; 19 | } 20 | 21 | public bool Equals(Byte4 other) 22 | { 23 | return x == other.x && y == other.y && z == other.z && w == other.w; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/FileSystemStorage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace UniGLTF 5 | { 6 | /// 7 | /// Implement url that represnet relative path 8 | /// 9 | public class FileSystemStorage : IStorage 10 | { 11 | string m_root; 12 | 13 | public FileSystemStorage(string root) 14 | { 15 | m_root = Path.GetFullPath(root); 16 | } 17 | 18 | public ArraySegment Get(string url) 19 | { 20 | var bytes = File.ReadAllBytes(Path.Combine(m_root, url)); 21 | return new ArraySegment(bytes); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/ImporterContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using VRMShaders; 4 | 5 | namespace UniGLTF 6 | { 7 | public static class ImporterContextExtensions 8 | { 9 | /// 10 | /// Build unity objects from parsed gltf 11 | /// 12 | public static RuntimeGltfInstance Load(this ImporterContext self) 13 | { 14 | var meassureTime = new ImporterContextSpeedLog(); 15 | var task = self.LoadAsync(new ImmediateCaller(), meassureTime.MeasureTime); 16 | if (!task.IsCompleted) 17 | { 18 | throw new Exception(); 19 | } 20 | if (task.IsFaulted) 21 | { 22 | throw new AggregateException(task.Exception); 23 | } 24 | 25 | if (Symbols.VRM_DEVELOP) 26 | { 27 | Debug.Log($"{self.Data.TargetPath}: {meassureTime.GetSpeedLog()}"); 28 | } 29 | 30 | return task.Result; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/BuiltInRP/Import/BuiltInGltfMaterialDescriptorGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using VRMShaders; 5 | 6 | 7 | namespace UniGLTF 8 | { 9 | /// 10 | /// GLTF の MaterialImporter 11 | /// 12 | public sealed class BuiltInGltfMaterialDescriptorGenerator : IMaterialDescriptorGenerator 13 | { 14 | public MaterialDescriptor Get(GltfData data, int i) 15 | { 16 | if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param; 17 | if (BuiltInGltfPbrMaterialImporter.TryCreateParam(data, i, out param)) return param; 18 | // fallback 19 | if (Symbols.VRM_DEVELOP) 20 | { 21 | Debug.LogWarning($"material: {i} out of range. fallback"); 22 | } 23 | 24 | return new MaterialDescriptor( 25 | GltfMaterialImportUtils.ImportMaterialName(i, null), 26 | BuiltInGltfPbrMaterialImporter.Shader, 27 | null, 28 | new Dictionary(), 29 | new Dictionary(), 30 | new Dictionary(), 31 | new Dictionary(), 32 | new Action[]{}); 33 | } 34 | 35 | public MaterialDescriptor GetGltfDefault() 36 | { 37 | return BuiltInGltfDefaultMaterialImporter.CreateParam(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/BuiltInRP/Import/Materials/BuiltInGltfDefaultMaterialImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using VRMShaders; 5 | 6 | namespace UniGLTF 7 | { 8 | /// 9 | /// Generate the descriptor of the glTF default material. 10 | /// 11 | public static class BuiltInGltfDefaultMaterialImporter 12 | { 13 | public static MaterialDescriptor CreateParam() 14 | { 15 | // FIXME 16 | return new MaterialDescriptor( 17 | "__default__", 18 | BuiltInGltfPbrMaterialImporter.Shader, 19 | default, 20 | new Dictionary(), 21 | new Dictionary(), 22 | new Dictionary(), 23 | new Dictionary(), 24 | new List>() 25 | ); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/GltfMaterialExportUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniGLTF 5 | { 6 | public static class GltfMaterialExportUtils 7 | { 8 | public static void ExportTextureTransform(Material src, glTFTextureInfo dstTextureInfo, string targetTextureName) 9 | { 10 | if (dstTextureInfo != null && src.HasProperty(targetTextureName)) 11 | { 12 | var offset = src.GetTextureOffset(targetTextureName); 13 | var scale = src.GetTextureScale(targetTextureName); 14 | (scale, offset) = TextureTransform.VerticalFlipScaleOffset(scale, offset); 15 | 16 | glTF_KHR_texture_transform.Serialize(dstTextureInfo, (offset.x, offset.y), (scale.x, scale.y)); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/IMaterialDescriptorGenerator.cs: -------------------------------------------------------------------------------- 1 | using VRMShaders; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// 指定の index の glTFMaterial から Import できる Material の生成情報を生成する。 7 | /// glTFMaterial と Unity Material は 1:1 対応する。 8 | /// 9 | public interface IMaterialDescriptorGenerator 10 | { 11 | /// 12 | /// Generate the MaterialDescriptor generated from the index i. 13 | /// 14 | MaterialDescriptor Get(GltfData data, int i); 15 | 16 | /// 17 | /// Generate the MaterialDescriptor for the non-specified glTF material. 18 | /// 19 | MaterialDescriptor GetGltfDefault(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/IMaterialExporter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using VRMShaders; 3 | 4 | namespace UniGLTF 5 | { 6 | /// 7 | /// 指定の Unity Material から glTFMaterial を生成する。 8 | /// glTFMaterial と Unity Material は 1:1 対応する。 9 | /// 10 | public interface IMaterialExporter 11 | { 12 | glTFMaterial ExportMaterial(Material m, ITextureExporter textureExporter, GltfExportSettings settings); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/MaterialImporterParamExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using VRMShaders; 4 | 5 | namespace UniGLTF 6 | { 7 | public static class MaterialImporterParamExtensions 8 | { 9 | public static IEnumerable<(SubAssetKey, TextureDescriptor)> EnumerateSubAssetKeyValue(this MaterialDescriptor matDesc) 10 | { 11 | foreach (var kv in matDesc.TextureSlots) 12 | { 13 | yield return (kv.Value.SubAssetKey, kv.Value); 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineMaterialDescriptorUtility.cs: -------------------------------------------------------------------------------- 1 | using UniGLTF; 2 | using UnityEngine.Rendering; 3 | 4 | public class RenderPipelineMaterialDescriptorGeneratorUtility 5 | { 6 | protected static RenderPipelineTypes GetRenderPipelineType() 7 | { 8 | RenderPipeline currentPipeline = RenderPipelineManager.currentPipeline; 9 | 10 | if (currentPipeline == null) 11 | { 12 | return RenderPipelineTypes.BuiltinRenderPipeline; 13 | } 14 | if (currentPipeline.GetType().Name.Contains("HDRenderPipeline")) 15 | { 16 | return RenderPipelineTypes.HighDefinitionRenderPipeline; 17 | } 18 | if (currentPipeline.GetType().Name.Contains("UniversalRenderPipeline")) 19 | { 20 | return RenderPipelineTypes.UniversalRenderPipeline; 21 | } 22 | return RenderPipelineTypes.Unknown; 23 | } 24 | 25 | public static IMaterialDescriptorGenerator GetValidGLTFMaterialDescriptorGenerator() 26 | { 27 | switch (GetRenderPipelineType()) 28 | { 29 | case RenderPipelineTypes.UniversalRenderPipeline: 30 | return new UrpGltfMaterialDescriptorGenerator(); 31 | case RenderPipelineTypes.BuiltinRenderPipeline: 32 | return new BuiltInGltfMaterialDescriptorGenerator(); 33 | } 34 | 35 | return null; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineTypes.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF 2 | { 3 | /// 4 | /// TODO: HDRP ? 5 | /// TODO: UserCustom ? 6 | /// 7 | public enum RenderPipelineTypes 8 | { 9 | BuiltinRenderPipeline, 10 | UniversalRenderPipeline, 11 | HighDefinitionRenderPipeline, 12 | Unknown 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/TextureTransform.cs: -------------------------------------------------------------------------------- 1 | 2 | 3 | using UnityEngine; 4 | 5 | namespace UniGLTF 6 | { 7 | public static class TextureTransform 8 | { 9 | /// 10 | // UV Coordinate Conversion: glTF(top-left origin) to Unity(bottom-left origin) 11 | /// https://github.com/vrm-c/UniVRM/issues/930 12 | /// offset.y = 1.0f - offset.y - scale.y; 13 | /// 14 | /// 15 | /// 16 | /// 17 | public static (Vector2 Scale, Vector2 Offset) VerticalFlipScaleOffset(Vector2 s, Vector2 o) 18 | { 19 | return (new Vector2(s.x, s.y), new Vector2(o.x, 1.0f - o.y - s.y)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/Import/Materials/UrpGltfDefaultMaterialImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using VRMShaders; 5 | 6 | namespace UniGLTF 7 | { 8 | /// 9 | /// Generate the descriptor of the glTF default material. 10 | /// 11 | public static class UrpGltfDefaultMaterialImporter 12 | { 13 | public static MaterialDescriptor CreateParam() 14 | { 15 | // FIXME 16 | return new MaterialDescriptor( 17 | "__default__", 18 | UrpGltfPbrMaterialImporter.Shader, 19 | default, 20 | new Dictionary(), 21 | new Dictionary(), 22 | new Dictionary(), 23 | new Dictionary(), 24 | new List>() 25 | ); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/Import/UrpGltfMaterialDescriptorGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using UnityEngine; 5 | using VRMShaders; 6 | 7 | 8 | namespace UniGLTF 9 | { 10 | /// 11 | /// GLTF の MaterialImporter 12 | /// 13 | public sealed class UrpGltfMaterialDescriptorGenerator : IMaterialDescriptorGenerator 14 | { 15 | public MaterialDescriptor Get(GltfData data, int i) 16 | { 17 | if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param; 18 | if (UrpGltfPbrMaterialImporter.TryCreateParam(data, i, out param)) return param; 19 | // fallback 20 | if (Symbols.VRM_DEVELOP) 21 | { 22 | Debug.LogWarning($"material: {i} out of range. fallback"); 23 | } 24 | 25 | return new MaterialDescriptor( 26 | GltfMaterialImportUtils.ImportMaterialName(i, null), 27 | UrpGltfPbrMaterialImporter.Shader, 28 | null, 29 | new Dictionary(), 30 | new Dictionary(), 31 | new Dictionary(), 32 | new Dictionary(), 33 | new Collection>()); 34 | } 35 | 36 | public MaterialDescriptor GetGltfDefault() 37 | { 38 | return UrpGltfDefaultMaterialImporter.CreateParam(); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/glTFBlendMode.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF 2 | { 3 | public enum glTFBlendMode 4 | { 5 | OPAQUE, 6 | MASK, 7 | BLEND 8 | } 9 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/BlendShapeFilter.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF 2 | { 3 | public interface IBlendShapeExportFilter 4 | { 5 | bool UseBlendShape(int blendShapeIndex, string relativePath); 6 | } 7 | 8 | public class DefualtBlendShapeExportFilter : IBlendShapeExportFilter 9 | { 10 | /// 11 | /// Export all blendshape 12 | /// 13 | /// 14 | /// 15 | /// 16 | public bool UseBlendShape(int blendShapeIndex, string relativePath) => true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshVertex0.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using UnityEngine; 4 | 5 | namespace UniGLTF 6 | { 7 | /// 8 | /// Stream0用のインターリーブされたメッシュの頂点情報 9 | /// そのままGPUにアップロードされる 10 | /// 11 | [Serializable, StructLayout(LayoutKind.Sequential)] 12 | internal readonly struct MeshVertex0 13 | { 14 | private readonly Vector3 _position; 15 | private readonly Vector3 _normal; 16 | 17 | public MeshVertex0( 18 | Vector3 position, 19 | Vector3 normal) 20 | { 21 | _position = position; 22 | _normal = normal; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshVertex1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using UnityEngine; 4 | 5 | namespace UniGLTF 6 | { 7 | /// 8 | /// Stream1用のインターリーブされたメッシュの頂点情報 9 | /// そのままGPUにアップロードされる 10 | /// 11 | [Serializable, StructLayout(LayoutKind.Sequential)] 12 | internal readonly struct MeshVertex1 13 | { 14 | private readonly Color _color; 15 | private readonly Vector2 _texCoord0; 16 | private readonly Vector2 _texCoord1; 17 | 18 | public MeshVertex1( 19 | Vector2 texCoord0, 20 | Vector2 texCoord1, 21 | Color color) 22 | { 23 | _texCoord0 = texCoord0; 24 | _texCoord1 = texCoord1; 25 | _color = color; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshVertex2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | /// 7 | /// Stream2用のインターリーブされたメッシュの頂点情報 8 | /// そのままGPUにアップロードされる 9 | /// 10 | [Serializable, StructLayout(LayoutKind.Sequential)] 11 | internal readonly struct MeshVertex2 12 | { 13 | private readonly float _boneWeight0; 14 | private readonly float _boneWeight1; 15 | private readonly float _boneWeight2; 16 | private readonly float _boneWeight3; 17 | private readonly ushort _boneIndex0; 18 | private readonly ushort _boneIndex1; 19 | private readonly ushort _boneIndex2; 20 | private readonly ushort _boneIndex3; 21 | 22 | public MeshVertex2( 23 | ushort boneIndex0, 24 | ushort boneIndex1, 25 | ushort boneIndex2, 26 | ushort boneIndex3, 27 | float boneWeight0, 28 | float boneWeight1, 29 | float boneWeight2, 30 | float boneWeight3) 31 | { 32 | _boneIndex0 = boneIndex0; 33 | _boneIndex1 = boneIndex1; 34 | _boneIndex2 = boneIndex2; 35 | _boneIndex3 = boneIndex3; 36 | _boneWeight0 = boneWeight0; 37 | _boneWeight1 = boneWeight1; 38 | _boneWeight2 = boneWeight2; 39 | _boneWeight3 = boneWeight3; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshWithMaterials.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | 5 | namespace UniGLTF 6 | { 7 | public class MeshWithMaterials 8 | { 9 | public Mesh Mesh; 10 | public Material[] Materials; 11 | 12 | /// 13 | /// SkinningInfo.ShouldSetRendererNodeAsBone を伝播させる。 14 | /// 15 | public bool ShouldSetRendererNodeAsBone = false; 16 | 17 | // 複数のノードから参照されうる 18 | public List Renderers = new List(); // SkinnedMeshRenderer or MeshRenderer 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/PositionMinMax.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#accessors-bounds 7 | /// 8 | /// Animation input and vertex position attribute accessors MUST have accessor.min and accessor.max defined. For all other accessors, these properties are optional. 9 | /// 10 | public static class AccessorsBounds 11 | { 12 | public static void UpdatePositionAccessorsBounds(glTFAccessor accessor, Vector3[] positions) 13 | { 14 | if (positions.Length == 0) 15 | { 16 | return; 17 | } 18 | var minX = positions[0].x; 19 | var minY = positions[0].y; 20 | var minZ = positions[0].z; 21 | var maxX = positions[0].x; 22 | var maxY = positions[0].y; 23 | var maxZ = positions[0].z; 24 | foreach (var position in positions) 25 | { 26 | minX = Mathf.Min(minX, position.x); 27 | minY = Mathf.Min(minY, position.y); 28 | minZ = Mathf.Min(minZ, position.z); 29 | maxX = Mathf.Max(maxX, position.x); 30 | maxY = Mathf.Max(maxY, position.y); 31 | maxZ = Mathf.Max(maxZ, position.z); 32 | } 33 | accessor.min = new float[] { minX, minY, minZ }; 34 | accessor.max = new float[] { maxX, maxY, maxZ }; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MeshIO/TriangleUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.Generic; 4 | 5 | 6 | public static class TriangleUtil 7 | { 8 | public static IEnumerable FlipTriangle(IEnumerable src) 9 | { 10 | return FlipTriangle(src.Select(x => (Int32)x)); 11 | } 12 | 13 | public static IEnumerable FlipTriangle(IEnumerable src) 14 | { 15 | return FlipTriangle(src.Select(x => (Int32)x)); 16 | } 17 | 18 | public static IEnumerable FlipTriangle(IEnumerable src) 19 | { 20 | return FlipTriangle(src.Select(x => (Int32)x)); 21 | } 22 | 23 | public static IEnumerable FlipTriangle(IEnumerable src) 24 | { 25 | var it = src.GetEnumerator(); 26 | while (true) 27 | { 28 | if (!it.MoveNext()) 29 | { 30 | yield break; 31 | } 32 | var i0 = it.Current; 33 | 34 | if (!it.MoveNext()) 35 | { 36 | yield break; 37 | } 38 | var i1 = it.Current; 39 | 40 | if (!it.MoveNext()) 41 | { 42 | yield break; 43 | } 44 | var i2 = it.Current; 45 | 46 | yield return i2; 47 | yield return i1; 48 | yield return i0; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/MigrationFlags.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF 2 | { 3 | public sealed class MigrationFlags 4 | { 5 | /// 6 | /// Before UniGLTF v0.54.0, Built-in RP Standard shader and Unlit shaders' albedo color is exported in gamma color space. 7 | /// https://github.com/vrm-c/UniVRM/pull/339 8 | /// 9 | public bool IsBaseColorFactorGamma { get; set; } 10 | 11 | /// 12 | /// Before UniGLTF v0.69, roughness value in the texture was invalid squared value. 13 | /// https://github.com/vrm-c/UniVRM/pull/780 14 | /// 15 | public bool IsRoughnessTextureValueSquared { get; set; } = false; 16 | 17 | /// 18 | /// Before UniGLTF v0.107.0, Built-in RP Standard shader's emission color is exported in gamma color space. 19 | /// https://github.com/vrm-c/UniVRM/pull/1909 20 | /// 21 | public bool IsEmissiveFactorGamma { get; set; } = false; 22 | } 23 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/Parser/AutoGltfFileParser.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// Auto detection file parser. 7 | /// Determine parsing method from the file extension. 8 | /// Detects `gltf`` zip`, others as` glb` 9 | /// 10 | public sealed class AutoGltfFileParser 11 | { 12 | private readonly string _path; 13 | 14 | public AutoGltfFileParser(string path) 15 | { 16 | _path = path; 17 | } 18 | 19 | public GltfData Parse() 20 | { 21 | var ext = Path.GetExtension(_path).ToLower(); 22 | switch (ext) 23 | { 24 | case ".gltf": 25 | return new GltfFileWithResourceFilesParser(_path).Parse(); 26 | 27 | case ".zip": 28 | return new ZipArchivedGltfFileParser(_path).Parse(); 29 | 30 | default: 31 | return new GlbFileParser(_path).Parse(); 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF 4 | { 5 | public sealed class GlbBinaryParser 6 | { 7 | private readonly byte[] _data; 8 | private readonly string _name; 9 | 10 | public GlbBinaryParser(byte[] data, string uniqueName) 11 | { 12 | _data = data; 13 | 14 | if (string.IsNullOrWhiteSpace(uniqueName)) 15 | { 16 | _name = Guid.NewGuid().ToString(); 17 | } 18 | else 19 | { 20 | _name = uniqueName; 21 | } 22 | } 23 | 24 | public GltfData Parse() 25 | { 26 | return new GlbLowLevelParser(_name, _data).Parse(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbFileParser.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// .GLB file parser. 7 | /// 8 | public sealed class GlbFileParser 9 | { 10 | private readonly string _path; 11 | 12 | public GlbFileParser(string glbFilePath) 13 | { 14 | _path = glbFilePath; 15 | } 16 | 17 | public GltfData Parse() 18 | { 19 | var data = File.ReadAllBytes(_path); 20 | return new GlbLowLevelParser(_path, data).Parse(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/Parser/GltfFileWithResourceFilesParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace UniGLTF 7 | { 8 | /// 9 | /// .GLTF file with resources in same directory parser. 10 | /// 11 | public sealed class GltfFileWithResourceFilesParser 12 | { 13 | private readonly string _gltfFilePath; 14 | private readonly string _gltfRootPath; 15 | 16 | private readonly byte[] _bytes; 17 | 18 | public GltfFileWithResourceFilesParser(string gltfFilePath) : this(gltfFilePath, File.ReadAllBytes(gltfFilePath)) 19 | { 20 | } 21 | 22 | public GltfFileWithResourceFilesParser(string gltfFilePath, byte[] bytes) 23 | { 24 | _gltfFilePath = gltfFilePath; 25 | _gltfRootPath = Path.GetDirectoryName(gltfFilePath); 26 | _bytes = bytes; 27 | } 28 | 29 | public GltfData Parse() 30 | { 31 | 32 | return GlbLowLevelParser.ParseGltf( 33 | _gltfFilePath, 34 | Encoding.UTF8.GetString(_bytes), 35 | new List(), // .gltf file has no chunks. 36 | new FileSystemStorage(_gltfRootPath), // .gltf file has resource path at file system. 37 | new MigrationFlags() 38 | ); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/ProgressInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF 4 | { 5 | public readonly struct ExportProgress 6 | { 7 | public readonly string Title; 8 | public readonly string Message; 9 | public readonly float Progress; 10 | 11 | public ExportProgress(string title, string message, float progress) 12 | { 13 | Title = title; 14 | Message = message; 15 | Progress = progress; 16 | } 17 | } 18 | 19 | public class NullProgress : IProgress 20 | { 21 | public void Report(ExportProgress value) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/SByte4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public readonly struct SByte4 : IEquatable 8 | { 9 | public readonly sbyte x; 10 | public readonly sbyte y; 11 | public readonly sbyte z; 12 | public readonly sbyte w; 13 | public SByte4(sbyte _x, sbyte _y, sbyte _z, sbyte _w) 14 | { 15 | x = _x; 16 | y = _y; 17 | z = _z; 18 | w = _w; 19 | } 20 | 21 | public bool Equals(SByte4 other) 22 | { 23 | return x == other.x && y == other.y && z == other.z && w == other.w; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/SkinJoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF 4 | { 5 | [Serializable] 6 | public struct SkinJoints : IEquatable 7 | { 8 | public ushort Joint0; 9 | public ushort Joint1; 10 | public ushort Joint2; 11 | public ushort Joint3; 12 | 13 | public SkinJoints(ushort j0, ushort j1, ushort j2, ushort j3) 14 | { 15 | Joint0 = j0; 16 | Joint1 = j1; 17 | Joint2 = j2; 18 | Joint3 = j3; 19 | } 20 | 21 | public bool Equals(SkinJoints other) 22 | { 23 | if (Joint0 != other.Joint0) return false; 24 | if (Joint1 != other.Joint1) return false; 25 | if (Joint2 != other.Joint2) return false; 26 | if (Joint3 != other.Joint3) return false; 27 | return true; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/TextureIO/ITextureDescriptorGenerator.cs: -------------------------------------------------------------------------------- 1 | using VRMShaders; 2 | 3 | namespace UniGLTF 4 | { 5 | /// 6 | /// glTF から Import できる、すべての Texture の生成情報を生成する。 7 | /// 8 | /// glTF Texture と Unity Texture の対応関係は N:M である。 9 | /// 10 | public interface ITextureDescriptorGenerator 11 | { 12 | TextureDescriptorSet Get(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/UShort2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public readonly struct UShort2 : IEquatable 8 | { 9 | public readonly ushort x; 10 | public readonly ushort y; 11 | 12 | public UShort2(ushort _x, ushort _y) 13 | { 14 | x = _x; 15 | y = _y; 16 | } 17 | 18 | public bool Equals(UShort2 other) 19 | { 20 | return x == other.x && y == other.y; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/UShort3.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public readonly struct UShort3 : IEquatable 8 | { 9 | public readonly ushort x; 10 | public readonly ushort y; 11 | public readonly ushort z; 12 | 13 | public UShort3(ushort _x, ushort _y, ushort _z) 14 | { 15 | x = _x; 16 | y = _y; 17 | z = _z; 18 | } 19 | 20 | public bool Equals(UShort3 other) 21 | { 22 | return x == other.x && y == other.y && z == other.z; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/UShort4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniGLTF 5 | { 6 | [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public readonly struct UShort4 : IEquatable 8 | { 9 | public readonly ushort x; 10 | public readonly ushort y; 11 | public readonly ushort z; 12 | public readonly ushort w; 13 | 14 | public UShort4(ushort _x, ushort _y, ushort _z, ushort _w) 15 | { 16 | x = _x; 17 | y = _y; 18 | z = _z; 19 | w = _w; 20 | } 21 | 22 | public bool Equals(UShort4 other) 23 | { 24 | return x == other.x && y == other.y && z == other.z && w == other.w; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/IO/UriByteBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF 4 | { 5 | public static class UriByteBuffer 6 | { 7 | public static Byte[] ReadEmbedded(string uri) 8 | { 9 | var pos = uri.IndexOf(";base64,"); 10 | if (pos < 0) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | else 15 | { 16 | return Convert.FromBase64String(uri.Substring(pos + 8)); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/PackageVersion.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace UniGLTF 3 | { 4 | public static partial class PackageVersion 5 | { 6 | public const int MAJOR = 0; 7 | public const int MINOR = 117; 8 | public const int PATCH = 0; 9 | public const string VERSION = "0.117.0"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/UniGLTFException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniGLTF 5 | { 6 | public class UniGLTFException : Exception 7 | { 8 | public UniGLTFException(string fmt, params object[] args) : this(string.Format(fmt, args)) { } 9 | public UniGLTFException(string msg) : base(msg) { } 10 | } 11 | 12 | public class UniGLTFNotSupportedException : UniGLTFException 13 | { 14 | public UniGLTFNotSupportedException(string fmt, params object[] args) : this(string.Format(fmt, args)) { } 15 | public UniGLTFNotSupportedException(string msg) : base(msg) { } 16 | } 17 | 18 | /// 19 | /// Exception in parse the glb header 20 | /// 21 | public class GlbParseException : UniGLTFException 22 | { 23 | public GlbParseException(string msg) : base(msg) { } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/UniGLTFVersion.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace UniGLTF 3 | { 4 | public static partial class UniGLTFVersion 5 | { 6 | public const int MAJOR = 2; 7 | public const int MINOR = 53; 8 | public const int PATCH = 0; 9 | public const string VERSION = "2.53.0"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniGLTF/UniGLTFVersion_partial.cs: -------------------------------------------------------------------------------- 1 | namespace UniGLTF 2 | { 3 | public static partial class UniGLTFVersion 4 | { 5 | public const string UNIGLTF_VERSION = "UniGLTF-" + VERSION; 6 | public const string MENU = "UniGLTF"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/BoneGizmoDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | 4 | namespace UniHumanoid 5 | { 6 | public class BoneGizmoDrawer : MonoBehaviour 7 | { 8 | const float size = 0.03f; 9 | readonly Vector3 SIZE = new Vector3(size, size, size); 10 | 11 | [SerializeField] 12 | public bool Draw = true; 13 | 14 | void OnDrawGizmos() 15 | { 16 | #if UNITY_EDITOR 17 | if (Draw && transform.parent != null) 18 | { 19 | Gizmos.color = Color.yellow; 20 | Gizmos.DrawCube(transform.position, SIZE); 21 | Gizmos.DrawLine(transform.parent.position, transform.position); 22 | 23 | UnityEditor.Handles.Label(transform.position, name); 24 | } 25 | #endif 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/Format/BvhChannel.cs: -------------------------------------------------------------------------------- 1 | namespace UniHumanoid 2 | { 3 | public enum BvhChannel 4 | { 5 | Xposition, 6 | Yposition, 7 | Zposition, 8 | Xrotation, 9 | Yrotation, 10 | Zrotation, 11 | } 12 | 13 | public static class BvhChannelExtensions 14 | { 15 | public static string ToProperty(this BvhChannel ch) 16 | { 17 | switch (ch) 18 | { 19 | case BvhChannel.Xposition: return "localPosition.x"; 20 | case BvhChannel.Yposition: return "localPosition.y"; 21 | case BvhChannel.Zposition: return "localPosition.z"; 22 | case BvhChannel.Xrotation: return "localEulerAnglesBaked.x"; 23 | case BvhChannel.Yrotation: return "localEulerAnglesBaked.y"; 24 | case BvhChannel.Zrotation: return "localEulerAnglesBaked.z"; 25 | } 26 | 27 | throw new BvhException("no property for " + ch); 28 | } 29 | 30 | public static bool IsLocation(this BvhChannel ch) 31 | { 32 | switch (ch) 33 | { 34 | case BvhChannel.Xposition: 35 | case BvhChannel.Yposition: 36 | case BvhChannel.Zposition: return true; 37 | case BvhChannel.Xrotation: 38 | case BvhChannel.Yrotation: 39 | case BvhChannel.Zrotation: return false; 40 | } 41 | 42 | throw new BvhException("no property for " + ch); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/Format/BvhChannelCurve.cs: -------------------------------------------------------------------------------- 1 | namespace UniHumanoid 2 | { 3 | public class BvhChannelCurve 4 | { 5 | public float[] Keys 6 | { 7 | get; 8 | private set; 9 | } 10 | 11 | public BvhChannelCurve(int frameCount) 12 | { 13 | Keys = new float[frameCount]; 14 | } 15 | 16 | public void SetKey(int frame, float value) 17 | { 18 | Keys[frame] = value; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/Format/BvhEndSite.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace UniHumanoid 4 | { 5 | public class BvhEndSite : BvhNode 6 | { 7 | public BvhEndSite() : base("") 8 | { 9 | } 10 | 11 | public override void Parse(StringReader r) 12 | { 13 | r.ReadLine(); // offset 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/Format/BvhException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniHumanoid 4 | { 5 | public class BvhException : Exception 6 | { 7 | public BvhException(string msg) : base(msg) { } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/HumanPoseClip.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | 4 | namespace UniHumanoid 5 | { 6 | public class HumanPoseClip : ScriptableObject 7 | { 8 | public const string TPoseResourcePath = "UniHumanoid/T-Pose.pose"; 9 | 10 | public Vector3 bodyPosition; 11 | 12 | public Quaternion bodyRotation; 13 | 14 | public float[] muscles; 15 | 16 | public HumanPose GetPose() 17 | { 18 | return new HumanPose 19 | { 20 | bodyPosition = bodyPosition, 21 | bodyRotation = bodyRotation, 22 | muscles = muscles 23 | }; 24 | } 25 | 26 | public void ApplyPose(ref HumanPose pose) 27 | { 28 | bodyPosition = pose.bodyPosition; 29 | bodyRotation = pose.bodyRotation; 30 | muscles = (float[])pose.muscles.Clone(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/IBone.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | 5 | namespace UniHumanoid 6 | { 7 | public interface IBone 8 | { 9 | string Name { get; } 10 | Vector3 SkeletonLocalPosition { get; } 11 | IBone Parent { get; } 12 | IList Children { get; } 13 | } 14 | 15 | public static class IBoneExtensions 16 | { 17 | public static IEnumerable Traverse(this IBone self) 18 | { 19 | yield return self; 20 | foreach (var child in self.Children) 21 | { 22 | foreach (var x in child.Traverse()) 23 | { 24 | yield return x; 25 | } 26 | } 27 | } 28 | 29 | public static Vector3 CenterOfDescendant(this IBone self) 30 | { 31 | var sum = Vector3.zero; 32 | int i = 0; 33 | foreach (var x in self.Traverse()) 34 | { 35 | sum += x.SkeletonLocalPosition; 36 | ++i; 37 | } 38 | return sum / i; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/IO/BvhImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniHumanoid 5 | { 6 | public static class BvhImporter 7 | { 8 | [Obsolete("use BvhImporter.Parse(path), then BvhImporter.Load()")] 9 | public static void Import(BvhImporterContext context) 10 | { 11 | context.Parse(context.Path); 12 | context.Load(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/IO/Extensions/UnityExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | 5 | namespace UniHumanoid 6 | { 7 | public static class UnityExtensions 8 | { 9 | public static Quaternion ReverseX(this Quaternion quaternion) 10 | { 11 | float angle; 12 | Vector3 axis; 13 | quaternion.ToAngleAxis(out angle, out axis); 14 | 15 | return Quaternion.AngleAxis(-angle, new Vector3(-axis.x, axis.y, axis.z)); 16 | } 17 | 18 | public static IEnumerable GetChildren(this Transform parent) 19 | { 20 | foreach (Transform child in parent) 21 | { 22 | yield return child; 23 | } 24 | } 25 | 26 | public static IEnumerable Traverse(this Transform parent) 27 | { 28 | yield return parent; 29 | 30 | foreach (Transform child in parent) 31 | { 32 | foreach (Transform descendant in Traverse(child)) 33 | { 34 | yield return descendant; 35 | } 36 | } 37 | } 38 | 39 | public static SkeletonBone ToSkeletonBone(this Transform t) 40 | { 41 | var sb = new SkeletonBone(); 42 | sb.name = t.name; 43 | sb.position = t.localPosition; 44 | sb.rotation = t.localRotation; 45 | sb.scale = t.localScale; 46 | return sb; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/MuscleInspector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | 6 | namespace UniHumanoid 7 | { 8 | public class MuscleInspector : MonoBehaviour 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniHumanoid/PoseModifier/IPoseModifier.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | 4 | namespace UniHumanoid 5 | { 6 | public interface IPoseModifier 7 | { 8 | void Modify(ref HumanPose pose); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Exceptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public class TreeValueException : ArgumentException 7 | { 8 | protected TreeValueException(string msg) : base(msg) { } 9 | } 10 | 11 | /// 12 | ///Exception failure 13 | /// 14 | public class ParserException : TreeValueException 15 | { 16 | public ParserException(string msg) : base(msg) { } 17 | } 18 | 19 | /// 20 | /// Successfully parsed, but fail to getValue 21 | /// 22 | public class DeserializationException : TreeValueException 23 | { 24 | public DeserializationException(string msg) : base(msg) { } 25 | } 26 | 27 | /// 28 | /// Formatter exception. key value violation 29 | /// 30 | public class FormatterException : TreeValueException 31 | { 32 | public FormatterException(string msg) : base(msg) { } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Extensions/DateTimeOffsetExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public static class DateTimeOffsetExtensions 7 | { 8 | public const long TicksPerSecond = 10000000; 9 | public readonly static DateTimeOffset EpochTime = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero); 10 | [Obsolete("Use EpochTime")] 11 | public readonly static DateTimeOffset EpocTime = EpochTime; 12 | #if !NET_4_6 && !NET_STANDARD_2_0 13 | public static long ToUnixTimeSeconds(this DateTimeOffset now) 14 | { 15 | if (now < EpochTime) 16 | { 17 | throw new ArgumentOutOfRangeException(); 18 | } 19 | return (now - EpochTime).Ticks / TicksPerSecond; 20 | } 21 | #endif 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public static class EnumExtensions 7 | { 8 | public static bool HasFlag(this Enum keys, Enum flag) 9 | { 10 | if (keys.GetType() != flag.GetType()) 11 | throw new ArgumentException("Type Mismatch"); 12 | return (Convert.ToUInt64(keys) & Convert.ToUInt64(flag)) != 0; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Extensions/ParserExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public static class StringExtensions 7 | { 8 | public static JsonNode ParseAsJson(this string json) 9 | { 10 | return JsonParser.Parse(json); 11 | } 12 | public static JsonNode ParseAsJson(this Utf8String json) 13 | { 14 | return JsonParser.Parse(json); 15 | } 16 | public static JsonNode ParseAsJson(this byte[] bytes) 17 | { 18 | return JsonParser.Parse(new Utf8String(bytes)); 19 | } 20 | public static JsonNode ParseAsJson(this ArraySegment bytes) 21 | { 22 | return JsonParser.Parse(new Utf8String(bytes)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Extensions/TypeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.Generic; 4 | 5 | 6 | namespace UniJSON 7 | { 8 | public static class TypeExtensions 9 | { 10 | public static bool GetIsGenericList(this Type t) 11 | { 12 | if (t == null) return false; 13 | 14 | return t.IsGenericType 15 | && (t.GetGenericTypeDefinition() == typeof(List<>)); 16 | } 17 | 18 | public static bool GetIsGenericDictionary(this Type t) 19 | { 20 | if (t == null) return false; 21 | 22 | return t.IsGenericType 23 | && (t.GetGenericTypeDefinition() == typeof(Dictionary<,>) 24 | && t.GetGenericArguments().FirstOrDefault() == typeof(string) 25 | ); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/IFileSystemAccessor.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | 4 | 5 | namespace UniJSON 6 | { 7 | public interface IFileSystemAccessor 8 | { 9 | string ReadAllText(); 10 | string ReadAllText(string relativePath); 11 | IFileSystemAccessor Get(string relativePath); 12 | } 13 | 14 | public class FileSystemAccessor : IFileSystemAccessor 15 | { 16 | string m_path; 17 | string m_baseDir; 18 | public FileSystemAccessor(string path) 19 | { 20 | m_path = path; 21 | if (Directory.Exists(path)) 22 | { 23 | m_baseDir = path; 24 | } 25 | else 26 | { 27 | m_baseDir = Path.GetDirectoryName(path); 28 | } 29 | } 30 | 31 | public override string ToString() 32 | { 33 | return "<" + Path.GetFileName(m_path) + ">"; 34 | } 35 | 36 | public string ReadAllText() 37 | { 38 | return File.ReadAllText(m_path, Encoding.UTF8); 39 | } 40 | 41 | public string ReadAllText(string relativePath) 42 | { 43 | var path = Path.Combine(m_baseDir, relativePath); 44 | return File.ReadAllText(path, Encoding.UTF8); 45 | } 46 | 47 | public IFileSystemAccessor Get(string relativePath) 48 | { 49 | var path = Path.Combine(m_baseDir, relativePath); 50 | return new FileSystemAccessor(path); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/IFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public interface IFormatter 7 | { 8 | IStore GetStore(); 9 | void Clear(); 10 | 11 | void BeginList(int n); 12 | void EndList(); 13 | 14 | void BeginMap(int n); 15 | void EndMap(); 16 | 17 | void Key(Utf8String x); 18 | 19 | void Null(); 20 | 21 | void Value(Utf8String x); 22 | void Value(String x); 23 | 24 | void Value(ArraySegment bytes); 25 | 26 | void Value(Boolean x); 27 | 28 | void Value(Byte x); 29 | void Value(UInt16 x); 30 | void Value(UInt32 x); 31 | void Value(UInt64 x); 32 | 33 | void Value(SByte x); 34 | void Value(Int16 x); 35 | void Value(Int32 x); 36 | void Value(Int64 x); 37 | 38 | void Value(Single x); 39 | void Value(Double x); 40 | 41 | void Value(DateTimeOffset x); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Utf8String/Utf8StringBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace UniJSON 4 | { 5 | public class Utf8StringBuilder 6 | { 7 | ByteBuffer m_buffer = new ByteBuffer(); 8 | 9 | public void Ascii(char c) 10 | { 11 | m_buffer.Push((byte)c); 12 | } 13 | 14 | static Encoding s_utf8 = new UTF8Encoding(false); 15 | 16 | public void Quote(string text) 17 | { 18 | Ascii('"'); 19 | m_buffer.Push(s_utf8.GetBytes(text)); 20 | Ascii('"'); 21 | } 22 | 23 | public void Add(Utf8String str) 24 | { 25 | m_buffer.Push(str.Bytes); 26 | } 27 | 28 | public Utf8String ToUtf8String() 29 | { 30 | return new Utf8String(m_buffer.Bytes); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/Utf8String/Utf8StringSplitterExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public static class Utf8StringSplitterExtensions 7 | { 8 | /// 9 | /// Split integer from start 10 | /// 11 | /// "123 " => "123" 12 | /// " 123" => FormatException 13 | /// 14 | /// must start +-0123456789 15 | /// 16 | /// 17 | /// 18 | /// 19 | public static Utf8String SplitInteger(this Utf8String src) 20 | { 21 | var i = 0; 22 | if(src[0]=='+' || src[0] == '-') 23 | { 24 | ++i; 25 | } 26 | 27 | var j = i; 28 | for(; j'9') 31 | { 32 | break; 33 | } 34 | } 35 | 36 | if (i == j) 37 | { 38 | throw new FormatException(); 39 | } 40 | 41 | return src.Subbytes(0, j); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/UniJSON/ValueNodeType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace UniJSON 5 | { 6 | public enum ValueNodeType 7 | { 8 | Null, 9 | Boolean, 10 | String, 11 | Binary, 12 | Integer, 13 | Number, 14 | Array, 15 | Object, 16 | NaN, 17 | Infinity, 18 | MinusInfinity, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Utils/CachedEnum/CachedEnum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniGLTF.Utils 4 | { 5 | /// 6 | /// CachedEnumType に対するインターフェース。 7 | /// 非 Generic class 8 | /// 9 | public static class CachedEnum 10 | { 11 | public static T Parse(string name, bool ignoreCase = false) where T : struct, Enum 12 | { 13 | if (ignoreCase) 14 | { 15 | return CachedEnumType.IgnoreCaseMap[name]; 16 | } 17 | else 18 | { 19 | return CachedEnumType.Map[name]; 20 | } 21 | } 22 | 23 | public static T ParseOrDefault(string name, bool ignoreCase = false, T defaultValue = default) 24 | where T : struct, Enum 25 | { 26 | try 27 | { 28 | return Parse(name, ignoreCase: ignoreCase); 29 | } 30 | catch (System.Collections.Generic.KeyNotFoundException) 31 | { 32 | return defaultValue; 33 | } 34 | } 35 | 36 | public static T[] GetValues() where T : struct, Enum 37 | { 38 | return CachedEnumType.Values; 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Utils/CachedEnum/CachedEnumType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | 5 | namespace UniGLTF.Utils 6 | { 7 | /// 8 | /// enum T に対する static type caching 。 9 | /// 10 | /// CachedEnumType.Values 11 | /// CachedEnumType.Map 12 | /// CachedEnumType.IgnoreCaseMap 13 | /// 14 | /// がスレッドセーフに(キャッシュされた)同じ値を返す。 15 | /// 16 | internal static class CachedEnumType where T : struct, Enum 17 | { 18 | public static IReadOnlyDictionary Map { get; } = CreateStringEnumMap(false); 19 | public static IReadOnlyDictionary IgnoreCaseMap { get; } = CreateStringEnumMap(true); 20 | public static T[] Values { get; } = (T[])Enum.GetValues(typeof(T)); 21 | 22 | private static Dictionary CreateStringEnumMap(bool ignoreCase) 23 | { 24 | var dict = ignoreCase 25 | ? new Dictionary(StringComparer.OrdinalIgnoreCase) 26 | : new Dictionary() 27 | ; 28 | 29 | // ここで Values を使うと 30 | // System.TypeInitializationException 31 | // が起きる。 32 | // static 変数初期化中に別の static 変数を参照すると未初期化がありえるぽい(初期化順?) 33 | foreach (T value in Enum.GetValues(typeof(T))) 34 | { 35 | dict.Add(value.ToString(), value); 36 | } 37 | return dict; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Utils/EuclideanTransform.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniGLTF.Utils 4 | { 5 | public readonly struct EuclideanTransform 6 | { 7 | public readonly Quaternion Rotation; 8 | public readonly Vector3 Translation; 9 | 10 | public EuclideanTransform(Quaternion rotation, Vector3 translation) 11 | { 12 | Rotation = rotation; 13 | Translation = translation; 14 | } 15 | public EuclideanTransform(Quaternion rotation) 16 | { 17 | Rotation = rotation; 18 | Translation = Vector3.zero; 19 | } 20 | public EuclideanTransform(Vector3 translation) 21 | { 22 | Rotation = Quaternion.identity; 23 | Translation = translation; 24 | } 25 | public EuclideanTransform(Matrix4x4 matrix) 26 | { 27 | Rotation = matrix.rotation; 28 | Translation = matrix.GetColumn(3); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/Runtime/Utils/TransformState.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniGLTF.Utils 4 | { 5 | public readonly struct TransformState 6 | { 7 | public Vector3 Position { get; } 8 | public Vector3 LocalPosition { get; } 9 | public Quaternion Rotation { get; } 10 | public Quaternion LocalRotation { get; } 11 | public Vector3 LocalScale { get; } 12 | 13 | public TransformState(Vector3 position, Vector3 localPosition, Quaternion rotation, Quaternion localRotation, Vector3 localScale) 14 | { 15 | Position = position; 16 | LocalPosition = localPosition; 17 | Rotation = rotation; 18 | LocalRotation = localRotation; 19 | LocalScale = localScale; 20 | } 21 | 22 | public TransformState(Transform tf) 23 | { 24 | if (tf == null) 25 | { 26 | Position = Vector3.zero; 27 | LocalPosition = Vector3.zero; 28 | Rotation = Quaternion.identity; 29 | LocalRotation = Quaternion.identity; 30 | LocalScale = Vector3.one; 31 | } 32 | else 33 | { 34 | Position = tf.position; 35 | LocalPosition = tf.localPosition; 36 | Rotation = tf.rotation; 37 | LocalRotation = tf.localRotation; 38 | LocalScale = tf.localScale; 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/UniGLTF/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.vrmc.gltf", 3 | "version": "0.117.0", 4 | "displayName": "UniGLTF", 5 | "description": "GLTF importer and exporter", 6 | "unity": "2021.3", 7 | "keywords": [ 8 | "gltf" 9 | ], 10 | "author": { 11 | "name": "VRM Consortium" 12 | }, 13 | "dependencies": { 14 | "com.vrmc.vrmshaders": "0.117.0", 15 | "com.unity.modules.animation": "1.0.0" 16 | }, 17 | "samples": [ 18 | { 19 | "displayName": "GltfViewer", 20 | "description": "UniGLTF runtime loader sample", 21 | "path": "Samples~/GltfViewer" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: InternalsVisibleTo("VRM10.Tests")] 5 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/ConstRaintException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniVRM10 4 | { 5 | public class ConstraintException : Exception 6 | { 7 | public enum ExceptionTypes 8 | { 9 | NoSource, 10 | NoModelWithModelSpace 11 | } 12 | 13 | public readonly ExceptionTypes Type; 14 | 15 | public ConstraintException(ExceptionTypes type) 16 | { 17 | Type = type; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/ConstraintAxes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10 5 | { 6 | /// 7 | /// Axesで使う。bitマスク 8 | /// 9 | [Flags] 10 | public enum AxisMask 11 | { 12 | X = 1, 13 | Y = 2, 14 | Z = 4, 15 | } 16 | 17 | [Flags] 18 | public enum YawPitchMask 19 | { 20 | Yaw = 1, 21 | Pitch = 2, 22 | } 23 | 24 | public static class AxesMaskExtensions 25 | { 26 | public static Vector3 Mask(this AxisMask mask, Vector3 src) 27 | { 28 | if (!mask.HasFlag(AxisMask.X)) 29 | { 30 | src.x = 0; 31 | } 32 | if (!mask.HasFlag(AxisMask.Y)) 33 | { 34 | src.y = 0; 35 | } 36 | if (!mask.HasFlag(AxisMask.Z)) 37 | { 38 | src.z = 0; 39 | } 40 | return src; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/ConstraintDestination.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public class ConstraintDestination 6 | { 7 | public readonly Transform Destination; 8 | public readonly TR ModelInitial; 9 | public readonly TR LocalInitial; 10 | public readonly Transform ModelRoot; 11 | 12 | public ConstraintDestination(Transform t, Transform modelRoot = null) 13 | { 14 | Destination = t; 15 | LocalInitial = TR.FromLocal(t); 16 | 17 | if (modelRoot != null) 18 | { 19 | ModelRoot = modelRoot; 20 | ModelInitial = TR.FromRelative(t, modelRoot); 21 | } 22 | } 23 | 24 | public void ApplyLocal(TR tr) 25 | { 26 | Destination.localPosition = tr.Translation; 27 | Destination.localRotation = tr.Rotation; 28 | } 29 | 30 | public void ApplyModel(TR tr) 31 | { 32 | Destination.position = tr.Translation; 33 | Destination.rotation = tr.Rotation; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/ConstraintSource.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using UniGLTF.Extensions.VRMC_node_constraint; 4 | 5 | namespace UniVRM10 6 | { 7 | public class ConstraintSource 8 | { 9 | public readonly Transform ModelRoot; 10 | readonly Transform Source; 11 | 12 | public readonly TR ModelInitial; 13 | 14 | public readonly TR LocalInitial; 15 | 16 | public TR Delta(Quaternion sourceRotationOffset) 17 | { 18 | return TR.FromLocal(Source) * (LocalInitial * new TR(sourceRotationOffset)).Inverse(); 19 | } 20 | 21 | public ConstraintSource(Transform t, Transform modelRoot = null) 22 | { 23 | { 24 | Source = t; 25 | LocalInitial = TR.FromLocal(t); 26 | } 27 | 28 | if (modelRoot != null) 29 | { 30 | ModelRoot = modelRoot; 31 | ModelInitial = TR.FromLocal(t); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/IVrm10Constraint.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public interface IVrm10Constraint 6 | { 7 | internal void Process(); 8 | 9 | GameObject ConstraintTarget { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/TransformExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public static class TransformExtensions 6 | { 7 | public static Quaternion ParentRotation(this Transform transform) 8 | { 9 | return transform.parent == null ? Quaternion.identity : transform.parent.rotation; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Constraint/Vrm10ConstraintUtil.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public static class Vrm10ConstraintUtil 4 | { 5 | /// 6 | /// 右手系と左手系を相互に変換する 7 | /// 8 | public static UniGLTF.Extensions.VRMC_node_constraint.AimAxis ReverseX(UniGLTF.Extensions.VRMC_node_constraint.AimAxis src) 9 | { 10 | switch (src) 11 | { 12 | case UniGLTF.Extensions.VRMC_node_constraint.AimAxis.PositiveX: return UniGLTF.Extensions.VRMC_node_constraint.AimAxis.NegativeX; 13 | case UniGLTF.Extensions.VRMC_node_constraint.AimAxis.NegativeX: return UniGLTF.Extensions.VRMC_node_constraint.AimAxis.PositiveX; 14 | default: return src; 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Expression/ExpressionPreset.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public enum ExpressionPreset 4 | { 5 | custom, 6 | happy, 7 | angry, 8 | sad, 9 | relaxed, 10 | surprised, 11 | aa, 12 | ih, 13 | ou, 14 | ee, 15 | oh, 16 | blink, 17 | blinkLeft, 18 | blinkRight, 19 | lookUp, 20 | lookDown, 21 | lookLeft, 22 | lookRight, 23 | neutral, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Expression/IExpressionValidator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace UniVRM10 4 | { 5 | /// 6 | /// Validate Expression constraints (ex. overrideBlink) 7 | /// 8 | public interface IExpressionValidator 9 | { 10 | /// 11 | /// Validate input weights with Expression constraints. 12 | /// 13 | void Validate(IReadOnlyDictionary inputWeights, IDictionary actualWeights, 14 | LookAtEyeDirection inputEyeDirection, out LookAtEyeDirection actualEyeDirection, 15 | out float blinkOverrideRate, out float lookAtOverrideRate, out float mouthOverrideRate); 16 | } 17 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Expression/IExpressionValidatorFactory.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public interface IExpressionValidatorFactory 4 | { 5 | IExpressionValidator Create(VRM10ObjectExpression expressionAvatar); 6 | } 7 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Expression/ILookAtEyeDirectionApplicable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace UniVRM10 4 | { 5 | /// 6 | /// Receive LooAtEyeDirection, and Apply to bone transforms. 7 | /// 8 | internal interface ILookAtEyeDirectionApplicable 9 | { 10 | void Apply(LookAtEyeDirection eyeDirection, Dictionary actualWeights); 11 | void Restore(); 12 | } 13 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Expression/MaterialColorBinding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10 5 | { 6 | [Serializable] 7 | public struct MaterialColorBinding : IEquatable 8 | { 9 | public String MaterialName; 10 | public UniGLTF.Extensions.VRMC_vrm.MaterialColorType BindType; 11 | public Vector4 TargetValue; 12 | 13 | public bool Equals(MaterialColorBinding other) 14 | { 15 | return string.Equals(MaterialName, other.MaterialName) && BindType.Equals(other.BindType) && TargetValue.Equals(other.TargetValue); 16 | } 17 | 18 | public override bool Equals(object obj) 19 | { 20 | if (ReferenceEquals(null, obj)) return false; 21 | return obj is MaterialColorBinding && Equals((MaterialColorBinding)obj); 22 | } 23 | 24 | public override int GetHashCode() 25 | { 26 | unchecked 27 | { 28 | var hashCode = (MaterialName != null ? MaterialName.GetHashCode() : 0); 29 | hashCode = (hashCode * 397) ^ BindType.GetHashCode(); 30 | hashCode = (hashCode * 397) ^ TargetValue.GetHashCode(); 31 | return hashCode; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Expression/MorphTargetBindingMerger/RuntimeMorphTargetBinding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace UniVRM10 6 | { 7 | internal readonly struct RuntimeMorphTargetBinding 8 | { 9 | public MorphTargetIdentifier TargetIdentifier { get; } 10 | public Action WeightApplier { get; } 11 | 12 | public RuntimeMorphTargetBinding(MorphTargetIdentifier targetIdentifier, Action weightApplier) 13 | { 14 | TargetIdentifier = targetIdentifier; 15 | WeightApplier = weightApplier; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/FirstPerson/Vrm10FirstPersonLayerSettings.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public static class Vrm10FirstPersonLayerSettings 6 | { 7 | public const int DEFAULT_FIRSTPERSON_ONLY_LAYER = 9; 8 | public const string FIRSTPERSON_ONLY_LAYER_NAME = "VRMFirstPersonOnly"; 9 | 10 | public const int DEFAULT_THIRDPERSON_ONLY_LAYER = 10; 11 | public const string THIRDPERSON_ONLY_LAYER_NAME = "VRMThirdPersonOnly"; 12 | 13 | public static int GetLayer(int? arg, string name, int fallback) 14 | { 15 | if (arg.HasValue) 16 | { 17 | return arg.Value; 18 | } 19 | var layer = LayerMask.NameToLayer(name); 20 | if (layer != -1) 21 | { 22 | return layer; 23 | } 24 | return fallback; 25 | } 26 | 27 | public static int GetFirstPersonOnlyLayer(int? arg) 28 | { 29 | return GetLayer(arg, FIRSTPERSON_ONLY_LAYER_NAME, DEFAULT_FIRSTPERSON_ONLY_LAYER); 30 | } 31 | 32 | public static int GetThirdPersonOnlyLayer(int? arg) 33 | { 34 | return GetLayer(arg, THIRDPERSON_ONLY_LAYER_NAME, DEFAULT_THIRDPERSON_ONLY_LAYER); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/LookAt/CurveMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | 7 | namespace UniVRM10 8 | { 9 | [Serializable] 10 | public class CurveMapper 11 | { 12 | private AnimationCurve _curve = AnimationCurve.Linear(0, 0, 1.0f, 1.0f); 13 | 14 | [Range(20.0f, 90.0f)] 15 | public float CurveXRangeDegree; 16 | 17 | [Range(0, 90.0f)] 18 | public float CurveYRangeDegree; 19 | 20 | public CurveMapper(float xRange, float yRange) 21 | { 22 | CurveXRangeDegree = xRange; 23 | CurveYRangeDegree = yRange; 24 | } 25 | 26 | public void OnValidate() 27 | { 28 | if (CurveXRangeDegree == 0) 29 | { 30 | CurveXRangeDegree = 90.0f; 31 | } 32 | } 33 | 34 | public float Map(float src) 35 | { 36 | if (src < 0) 37 | { 38 | src = 0; 39 | } 40 | else if (src > CurveXRangeDegree) 41 | { 42 | src = CurveXRangeDegree; 43 | } 44 | return _curve.Evaluate(src / CurveXRangeDegree) * CurveYRangeDegree; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/LookAt/ILookAtEyeDirectionProvider.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | internal interface ILookAtEyeDirectionProvider 4 | { 5 | LookAtEyeDirection EyeDirection { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/LookAt/LookAtEyeDirection.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public readonly struct LookAtEyeDirection 4 | { 5 | /// 6 | /// Positive is right. 7 | /// Negative is left. 8 | /// 9 | /// 10 | public float Yaw { get; } 11 | 12 | /// 13 | /// Positive is upper. 14 | /// Negative is lower. 15 | /// 16 | /// Usually in z-forward y-up left coordinates, positive is lower. 17 | /// This is inverted because of following the vrm-1.0 specification. 18 | /// 19 | public float Pitch { get; } 20 | 21 | public LookAtEyeDirection(float yaw, float pitch) 22 | { 23 | Yaw = yaw; 24 | Pitch = pitch; 25 | } 26 | 27 | public static LookAtEyeDirection Multiply(LookAtEyeDirection a, float b) 28 | { 29 | return new LookAtEyeDirection( 30 | a.Yaw * b, 31 | a.Pitch * b 32 | ); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/LookAt/LookAtInput.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | /// 6 | /// LookAt を具体的な値に解決する前の入力値 7 | /// この値を元に LookAtEyeDirection を生成し、 8 | /// LookAtEyeDirection を Bone もしくは MorphTarget に対して適用する。 9 | /// 10 | public struct LookAtInput 11 | { 12 | public LookAtEyeDirection? YawPitch; 13 | public Vector3? WorldPosition; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10 5 | { 6 | public enum VRM10SpringBoneColliderTypes 7 | { 8 | Sphere, 9 | Capsule, 10 | } 11 | 12 | [Serializable] 13 | public class VRM10SpringBoneCollider : MonoBehaviour 14 | { 15 | public VRM10SpringBoneColliderTypes ColliderType; 16 | 17 | /// bone local position 18 | public Vector3 Offset; 19 | 20 | [Range(0, 1.0f)] 21 | public float Radius; 22 | 23 | /// bone local position 24 | public Vector3 Tail; 25 | 26 | public static int SelectedGuid; 27 | 28 | public bool IsSelected => GetInstanceID() == SelectedGuid; 29 | 30 | public void OnDrawGizmosSelected() 31 | { 32 | Gizmos.matrix = transform.localToWorldMatrix; 33 | switch (ColliderType) 34 | { 35 | case VRM10SpringBoneColliderTypes.Sphere: 36 | Gizmos.color = Color.magenta; 37 | Gizmos.DrawWireSphere(Offset, Radius); 38 | break; 39 | 40 | case VRM10SpringBoneColliderTypes.Capsule: 41 | Gizmos.color = new Color(1.0f, 0.1f, 0.1f); 42 | Gizmos.DrawWireSphere(Offset, Radius); 43 | Gizmos.DrawWireSphere(Tail, Radius); 44 | Gizmos.DrawLine(Offset, Tail); 45 | break; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneColliderGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace UniVRM10 6 | { 7 | [Serializable] 8 | public class VRM10SpringBoneColliderGroup : MonoBehaviour 9 | { 10 | [SerializeField] 11 | public string Name; 12 | 13 | public string GUIName(int i) => $"{i:00}:{Name}"; 14 | 15 | [SerializeField] 16 | public List Colliders = new List(); 17 | } 18 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/VRM10Object/VRM10Object.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using VRMShaders; 3 | 4 | namespace UniVRM10 5 | { 6 | /// 7 | /// VRM関連の情報を保持するオブジェクト 8 | /// ScriptedImporter から Extract して 9 | /// Editor経由で Edit可能にするのが目的。 10 | /// ヒエラルキーに対する参照を保持できないので Humanoid, Spring, Constraint は含まず 11 | /// 下記の項目を保持することとした。 12 | /// シーンに出さずにアセットとして編集できる。 13 | /// 14 | /// * Meta 15 | /// * Expressions(enum + custom list) 16 | /// * LookAt 17 | /// * FirstPerson 18 | /// 19 | /// 20 | public class VRM10Object : PrefabRelatedScriptableObject 21 | { 22 | public static SubAssetKey SubAssetKey => new SubAssetKey(typeof(VRM10Object), "_vrm1_"); 23 | 24 | [SerializeField] 25 | public VRM10ObjectMeta Meta = new VRM10ObjectMeta(); 26 | 27 | [SerializeField] 28 | public VRM10ObjectExpression Expression = new VRM10ObjectExpression(); 29 | 30 | [SerializeField] 31 | public VRM10ObjectLookAt LookAt = new VRM10ObjectLookAt(); 32 | 33 | [SerializeField] 34 | public VRM10ObjectFirstPerson FirstPerson = new VRM10ObjectFirstPerson(); 35 | 36 | void OnValidate() 37 | { 38 | if (LookAt != null) 39 | { 40 | LookAt.HorizontalInner.OnValidate(); 41 | LookAt.HorizontalOuter.OnValidate(); 42 | LookAt.VerticalUp.OnValidate(); 43 | LookAt.VerticalDown.OnValidate(); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/VRM10Object/VRM10ObjectLookAt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UniGLTF.Extensions.VRMC_vrm; 4 | 5 | namespace UniVRM10 6 | { 7 | [Serializable] 8 | public class VRM10ObjectLookAt 9 | { 10 | public enum LookAtTargetTypes 11 | { 12 | /// 13 | /// Vrm10Instance に設定した Transform を見ます. 14 | /// 15 | SpecifiedTransform = 0, 16 | /// 17 | /// Vrm10RuntimeLookAt に設定した Yaw/Pitch 値に従います. 18 | /// 19 | YawPitchValue = 1, 20 | 21 | [Obsolete] CalcYawPitchToGaze = 0, 22 | [Obsolete] SetYawPitch = 1, 23 | } 24 | 25 | [SerializeField] 26 | public Vector3 OffsetFromHead = new Vector3(0, 0.06f, 0); 27 | 28 | [SerializeField] 29 | public LookAtType LookAtType; 30 | 31 | [SerializeField] 32 | public CurveMapper HorizontalOuter = new CurveMapper(90.0f, 10.0f); 33 | 34 | [SerializeField] 35 | public CurveMapper HorizontalInner = new CurveMapper(90.0f, 10.0f); 36 | 37 | [SerializeField] 38 | public CurveMapper VerticalDown = new CurveMapper(90.0f, 10.0f); 39 | 40 | [SerializeField] 41 | public CurveMapper VerticalUp = new CurveMapper(90.0f, 10.0f); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/Vrm10Runtime/ControlRig/ControlRigGenerationOption.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public enum ControlRigGenerationOption 4 | { 5 | /// 6 | /// コントロールリグを生成しません。 7 | /// 8 | None = 0, 9 | 10 | /// 11 | /// 推奨されるオプションです。 12 | /// コントロールリグのボーン Transform を生成し、Root の Animator はコントロールリグのボーンを制御するようになります。 13 | /// 14 | Generate = 1, 15 | Vrm0XCompatibleRig = 1, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Components/VrmAnimationInstance/IVrm10Animation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace UniVRM10 6 | { 7 | public interface IVrm10Animation : IDisposable 8 | { 9 | (INormalizedPoseProvider, ITPoseProvider) ControlRig { get; } 10 | IReadOnlyDictionary> ExpressionMap { get; } 11 | public void ShowBoxMan(bool enable); 12 | LookAtInput? LookAt { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/ControlRig/BoneInitialRotation.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | /// 6 | /// Represents the rotation at the initial pose (TPose) 7 | /// 8 | public readonly struct BoneInitialRotation 9 | { 10 | public readonly Transform Transform; 11 | 12 | public readonly Vector3 InitialLocalPosition; 13 | 14 | public readonly Quaternion InitialLocalRotation; 15 | 16 | public readonly Quaternion InitialGlobalRotation; 17 | 18 | public BoneInitialRotation(Transform transform) 19 | { 20 | Transform = transform; 21 | InitialLocalPosition = transform.localPosition; 22 | InitialLocalRotation = transform.localRotation; 23 | InitialGlobalRotation = transform.rotation; 24 | } 25 | 26 | /// 27 | /// Convert the local rotation, including the initial rotation, to a normalized local rotation 28 | /// 29 | public Quaternion NormalizedLocalRotation 30 | { 31 | get 32 | { 33 | return InitialGlobalRotation * Quaternion.Inverse(InitialLocalRotation) * Transform.localRotation * Quaternion.Inverse(InitialGlobalRotation); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/ControlRig/INormalizedPoseApplicable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10 5 | { 6 | public interface INormalizedPoseApplicable 7 | { 8 | void SetRawHipsPosition(Vector3 position); 9 | 10 | void SetNormalizedLocalRotation(HumanBodyBones bone, Quaternion normalizedLocalRotation); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/ControlRig/INormalizedPoseProvider.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public interface INormalizedPoseProvider 6 | { 7 | /// 8 | /// Get hips position in model root space 9 | /// 10 | Vector3 GetRawHipsPosition(); 11 | 12 | /// 13 | /// Get normalized local rotation 14 | /// 15 | Quaternion GetNormalizedLocalRotation(HumanBodyBones bone, HumanBodyBones parentBone); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/ControlRig/Vrm10Retarget.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public static class Vrm10Retarget 6 | { 7 | public static void Retarget((INormalizedPoseProvider Pose, ITPoseProvider TPose) source, (INormalizedPoseApplicable Pose, ITPoseProvider TPose) sink) 8 | { 9 | foreach (var (head, parent) in sink.TPose.EnumerateBoneParentPairs()) 10 | { 11 | var q = source.Pose.GetNormalizedLocalRotation(head, parent); 12 | sink.Pose.SetNormalizedLocalRotation(head, q); 13 | } 14 | 15 | // scaling hips position 16 | var scaleRef = HumanBodyBones.Hips; 17 | var scaling = sink.TPose.GetWorldTransform(scaleRef).Value.Translation.y / source.TPose.GetWorldTransform(scaleRef).Value.Translation.y; 18 | var delta = source.Pose.GetRawHipsPosition() - source.TPose.GetWorldTransform(HumanBodyBones.Hips).Value.Translation; 19 | sink.Pose.SetRawHipsPosition(sink.TPose.GetWorldTransform(HumanBodyBones.Hips).Value.Translation + delta * scaling); 20 | } 21 | 22 | public static void EnforceTPose((INormalizedPoseApplicable Pose, ITPoseProvider TPose) sink) 23 | { 24 | foreach (var (bone, parent) in sink.TPose.EnumerateBoneParentPairs()) 25 | { 26 | sink.Pose.SetNormalizedLocalRotation(bone, Quaternion.identity); 27 | } 28 | 29 | sink.Pose.SetRawHipsPosition(sink.TPose.GetWorldTransform(HumanBodyBones.Hips).Value.Translation); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/EnumFlagsAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10 5 | { 6 | [AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field)] 7 | public sealed class EnumFlagsAttribute : PropertyAttribute { } 8 | } 9 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableCollider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Serialization; 4 | 5 | namespace UniVRM10.FastSpringBones.Blittables 6 | { 7 | /// 8 | /// Blittableなコライダ 9 | /// 10 | [Serializable] 11 | public struct BlittableCollider 12 | { 13 | public BlittableColliderType colliderType; 14 | public Vector3 offset; 15 | public float radius; 16 | public Vector3 tail; 17 | public int transformIndex; 18 | } 19 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableColliderType.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10.FastSpringBones.Blittables 2 | { 3 | public enum BlittableColliderType 4 | { 5 | Sphere, 6 | Capsule, 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableExternalData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10.FastSpringBones.Blittables 4 | { 5 | /// 6 | /// 外力等の毎フレーム更新されうる外部から与えられる情報 7 | /// 8 | public struct BlittableExternalData 9 | { 10 | public Vector3 ExternalForce; 11 | } 12 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableJoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10.FastSpringBones.Blittables 5 | { 6 | /// 7 | /// SpringBoneの各関節を表すデータ型 8 | /// 9 | [Serializable] 10 | public struct BlittableJoint 11 | { 12 | public float stiffnessForce; 13 | public float gravityPower; 14 | public Vector3 gravityDir; 15 | public float dragForce; 16 | public float radius; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableLogic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10.FastSpringBones.Blittables 5 | { 6 | /// 7 | /// SpringBoneの各関節に紐付いた計算情報を表すデータ型 8 | /// 9 | [Serializable] 10 | public struct BlittableLogic 11 | { 12 | public int parentTransformIndex; 13 | public int headTransformIndex; 14 | public float length; 15 | public Vector3 currentTail; 16 | public Vector3 prevTail; 17 | public Quaternion localRotation; 18 | public Vector3 boneAxis; 19 | } 20 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableSpan.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniVRM10.FastSpringBones.Blittables 4 | { 5 | [Serializable] 6 | public struct BlittableSpan 7 | { 8 | public int startIndex; 9 | public int count; 10 | } 11 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableSpring.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniVRM10.FastSpringBones.Blittables 4 | { 5 | /// 6 | /// 1本の毛束を表すデータ型 7 | /// FastSpringBoneではこれを起点として並列化し、処理を行う 8 | /// 9 | [Serializable] 10 | public struct BlittableSpring 11 | { 12 | public BlittableSpan colliderSpan; 13 | public BlittableSpan logicSpan; 14 | public int centerTransformIndex; 15 | public int transformIndexOffset; 16 | public unsafe BlittableExternalData* ExternalData; 17 | } 18 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/Blittables/BlittableTransform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10.FastSpringBones.Blittables 5 | { 6 | /// 7 | /// Transformの必要な機能だけを絞り、Blittableに対応させたクラス 8 | /// 9 | [Serializable] 10 | public struct BlittableTransform 11 | { 12 | public Vector3 position; 13 | public Quaternion rotation; 14 | public Vector3 localPosition; 15 | public Quaternion localRotation; 16 | public Vector3 localScale; 17 | public Matrix4x4 localToWorldMatrix; 18 | public Matrix4x4 worldToLocalMatrix; 19 | } 20 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneCollider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UniVRM10.FastSpringBones.Blittables; 4 | 5 | namespace UniVRM10.FastSpringBones.System 6 | { 7 | [Serializable] 8 | public struct FastSpringBoneCollider 9 | { 10 | public Transform Transform; 11 | public BlittableCollider Collider; 12 | } 13 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneJoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UniVRM10.FastSpringBones.Blittables; 4 | 5 | namespace UniVRM10.FastSpringBones.System 6 | { 7 | [Serializable] 8 | public struct FastSpringBoneJoint 9 | { 10 | public Transform Transform; 11 | public BlittableJoint Joint; 12 | public Quaternion DefaultLocalRotation; 13 | } 14 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/InputPorts/FastSpringBoneSpring.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10.FastSpringBones.System 5 | { 6 | [Serializable] 7 | public struct FastSpringBoneSpring 8 | { 9 | public Transform center; 10 | public FastSpringBoneJoint[] joints; 11 | public FastSpringBoneCollider[] colliders; 12 | } 13 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/System/CopyToNativeArrayTransformJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using UnityEngine.Jobs; 3 | using UniVRM10.FastSpringBones.Blittables; 4 | #if ENABLE_SPRINGBONE_BURST 5 | using Unity.Burst; 6 | #endif 7 | 8 | namespace UniVRM10.FastSpringBones.System 9 | { 10 | 11 | #if ENABLE_SPRINGBONE_BURST 12 | [BurstCompile] 13 | #endif 14 | public struct PullTransformJob : IJobParallelForTransform 15 | { 16 | [WriteOnly] public NativeArray Transforms; 17 | 18 | public void Execute(int index, TransformAccess transform) 19 | { 20 | Transforms[index] = new BlittableTransform 21 | { 22 | position = transform.position, 23 | rotation = transform.rotation, 24 | localPosition = transform.localPosition, 25 | localRotation = transform.localRotation, 26 | localScale = transform.localScale, 27 | localToWorldMatrix = transform.localToWorldMatrix, 28 | worldToLocalMatrix = transform.worldToLocalMatrix 29 | }; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/FastSpringBone/System/PushTransformJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using UnityEngine.Jobs; 3 | using UniVRM10.FastSpringBones.Blittables; 4 | #if ENABLE_SPRINGBONE_BURST 5 | using Unity.Burst; 6 | #endif 7 | 8 | namespace UniVRM10.FastSpringBones.System 9 | { 10 | #if ENABLE_SPRINGBONE_BURST 11 | [BurstCompile] 12 | #endif 13 | public struct PushTransformJob : IJobParallelForTransform 14 | { 15 | [ReadOnly] 16 | public NativeArray Transforms; 17 | 18 | public void Execute(int index, TransformAccess transform) 19 | { 20 | transform.rotation = Transforms[index].rotation; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Format/VrmHumanoidBones/Vrm10HumanoidBoneAttribute.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public readonly struct Vrm10HumanoidBoneAttribute 6 | { 7 | public Vrm10HumanoidBones Bone { get; } 8 | public bool IsRequired { get; } 9 | public Vrm10HumanoidBones? ParentBone { get; } 10 | public bool? NeedsParentBone { get; } 11 | public HumanBodyBones UnityBone { get; } 12 | 13 | public Vrm10HumanoidBoneAttribute(Vrm10HumanoidBones bone, bool isRequired, Vrm10HumanoidBones? parentBone, bool? needsParentBone, HumanBodyBones unityBone) 14 | { 15 | Bone = bone; 16 | IsRequired = isRequired; 17 | ParentBone = parentBone; 18 | NeedsParentBone = needsParentBone; 19 | UnityBone = unityBone; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/ArrayExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UniVRM10 5 | { 6 | public static class ArrayExtensions 7 | { 8 | public static Vector3 ToVector3(this float[] src, Vector3 defaultValue = default) 9 | { 10 | if (src.Length != 3) return defaultValue; 11 | 12 | var v = new Vector3(); 13 | v.x = src[0]; 14 | v.y = src[1]; 15 | v.z = src[2]; 16 | return v; 17 | } 18 | 19 | public static Quaternion ToQuaternion(this float[] src) 20 | { 21 | if (src.Length != 4) return Quaternion.identity; 22 | 23 | var v = new Quaternion(src[0], src[1], src[2], src[3]); 24 | return v; 25 | } 26 | 27 | public static T Get(this ArraySegment self, int i) 28 | { 29 | var index = self.Offset + i; 30 | return self.Array[index]; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/IndexExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public static class IndexExtensions 4 | { 5 | public static bool TryGetValidIndex(this int value, int count, out int index) 6 | { 7 | if (value < 0) 8 | { 9 | index = -1; 10 | return false; 11 | } 12 | if (value >= count) 13 | { 14 | index = -1; 15 | return false; 16 | } 17 | 18 | index = value; 19 | return true; 20 | } 21 | 22 | public static bool TryGetValidIndex(this int? value, int count, out int index) 23 | { 24 | if (!value.HasValue) 25 | { 26 | index = -1; 27 | return false; 28 | } 29 | if (value < 0) 30 | { 31 | index = -1; 32 | return false; 33 | } 34 | if (value >= count) 35 | { 36 | index = -1; 37 | return false; 38 | } 39 | 40 | index = value.Value; 41 | return true; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Material/BuiltInRP/Export/BuiltInVrm10MaterialExporter.cs: -------------------------------------------------------------------------------- 1 | using UniGLTF; 2 | using UnityEngine; 3 | using VRMShaders; 4 | 5 | namespace UniVRM10 6 | { 7 | public class BuiltInVrm10MaterialExporter : IMaterialExporter 8 | { 9 | private readonly BuiltInGltfMaterialExporter _gltfExporter = new BuiltInGltfMaterialExporter(); 10 | 11 | public glTFMaterial ExportMaterial(Material m, ITextureExporter textureExporter, GltfExportSettings settings) 12 | { 13 | if (BuiltInVrm10MToonMaterialExporter.TryExportMaterialAsMToon(m, textureExporter, out var dst)) 14 | { 15 | return dst; 16 | } 17 | else 18 | { 19 | return _gltfExporter.ExportMaterial(m, textureExporter, settings); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Material/URP/Import/UrpVrm10MaterialDescriptorGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UniGLTF; 4 | using UnityEngine; 5 | using VRMShaders; 6 | 7 | namespace UniVRM10 8 | { 9 | public sealed class UrpVrm10MaterialDescriptorGenerator : IMaterialDescriptorGenerator 10 | { 11 | public MaterialDescriptor Get(GltfData data, int i) 12 | { 13 | // mtoon 14 | if (UrpVrm10MToonMaterialImporter.TryCreateParam(data, i, out var matDesc)) return matDesc; 15 | // unlit 16 | if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc; 17 | // pbr 18 | if (UrpGltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc; 19 | 20 | // fallback 21 | Debug.LogWarning($"material: {i} out of range. fallback"); 22 | return new MaterialDescriptor( 23 | GltfMaterialImportUtils.ImportMaterialName(i, null), 24 | UrpGltfPbrMaterialImporter.Shader, 25 | null, 26 | new Dictionary(), 27 | new Dictionary(), 28 | new Dictionary(), 29 | new Dictionary(), 30 | new Action[]{}); 31 | } 32 | 33 | public MaterialDescriptor GetGltfDefault() 34 | { 35 | return UrpGltfDefaultMaterialImporter.CreateParam(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Material/URP/Import/VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs: -------------------------------------------------------------------------------- 1 | using UniGLTF; 2 | 3 | namespace UniVRM10 4 | { 5 | public class Vrm10RenderPipelineMaterialDescriptorGeneratorDescriptorUtility : RenderPipelineMaterialDescriptorGeneratorUtility 6 | { 7 | public static IMaterialDescriptorGenerator GetValidVrm10MaterialDescriptorGenerator() 8 | { 9 | switch (GetRenderPipelineType()) 10 | { 11 | case RenderPipelineTypes.UniversalRenderPipeline: 12 | return new UrpVrm10MaterialDescriptorGenerator(); 13 | case RenderPipelineTypes.BuiltinRenderPipeline: 14 | return new BuiltInVrm10MaterialDescriptorGenerator(); 15 | } 16 | 17 | return null; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/MigrationData.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | public class MigrationData 4 | { 5 | /// 6 | /// マイグレーション失敗など 7 | /// 8 | public readonly string Message; 9 | 10 | /// 11 | /// vrm0 からマイグレーションした場合に、vrm0 版の meta 情報 12 | /// 13 | public readonly Migration.Vrm0Meta OriginalMetaBeforeMigration; 14 | 15 | /// 16 | /// Migration した結果のバイト列(デバッグ用) 17 | /// 18 | public readonly byte[] MigratedBytes; 19 | 20 | public MigrationData(string msg, Migration.Vrm0Meta meta = default, byte[] bytes = default) 21 | { 22 | Message = msg; 23 | OriginalMetaBeforeMigration = meta; 24 | MigratedBytes = bytes; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Model/MeshVertex0.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using UnityEngine; 4 | 5 | namespace UniVRM10 6 | { 7 | /// 8 | /// Stream0用のインターリーブされたメッシュの頂点情報を表す構造体 9 | /// そのままGPUにアップロードされる 10 | /// 11 | [Serializable, StructLayout(LayoutKind.Sequential)] 12 | internal readonly struct MeshVertex0 13 | { 14 | private readonly Vector3 _position; 15 | private readonly Vector3 _normal; 16 | 17 | public MeshVertex0( 18 | Vector3 position, 19 | Vector3 normal) 20 | { 21 | _position = position; 22 | _normal = normal; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Model/MeshVertex1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using UnityEngine; 4 | 5 | namespace UniVRM10 6 | { 7 | /// 8 | /// Stream1用のインターリーブされたメッシュの頂点情報を表す構造体 9 | /// そのままGPUにアップロードされる 10 | /// 11 | [Serializable, StructLayout(LayoutKind.Sequential)] 12 | internal readonly struct MeshVertex1 13 | { 14 | private readonly Color _color; 15 | private readonly Vector2 _texCoord; 16 | 17 | public MeshVertex1( 18 | Vector2 texCoord, 19 | Color color) 20 | { 21 | _texCoord = texCoord; 22 | _color = color; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Model/MeshVertex2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace UniVRM10 5 | { 6 | /// 7 | /// Stream2用のインターリーブされたメッシュの頂点情報を表す構造体 8 | /// そのままGPUにアップロードされる 9 | /// 10 | [Serializable, StructLayout(LayoutKind.Sequential)] 11 | internal readonly struct MeshVertex2 12 | { 13 | private readonly float _boneWeight0; 14 | private readonly float _boneWeight1; 15 | private readonly float _boneWeight2; 16 | private readonly float _boneWeight3; 17 | private readonly ushort _boneIndex0; 18 | private readonly ushort _boneIndex1; 19 | private readonly ushort _boneIndex2; 20 | private readonly ushort _boneIndex3; 21 | 22 | public MeshVertex2( 23 | ushort boneIndex0, 24 | ushort boneIndex1, 25 | ushort boneIndex2, 26 | ushort boneIndex3, 27 | float boneWeight0, 28 | float boneWeight1, 29 | float boneWeight2, 30 | float boneWeight3) 31 | { 32 | _boneIndex0 = boneIndex0; 33 | _boneIndex1 = boneIndex1; 34 | _boneIndex2 = boneIndex2; 35 | _boneIndex3 = boneIndex3; 36 | _boneWeight0 = boneWeight0; 37 | _boneWeight1 = boneWeight1; 38 | _boneWeight2 = boneWeight2; 39 | _boneWeight3 = boneWeight3; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Model/MeshVertexUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | namespace UniVRM10 5 | { 6 | internal static class MeshVertexUtility 7 | { 8 | public static void SetVertexBufferParamsToMesh(Mesh mesh, int length) 9 | { 10 | mesh.SetVertexBufferParams(length, new VertexAttributeDescriptor[] 11 | { 12 | new VertexAttributeDescriptor(VertexAttribute.Position, stream: 0), 13 | new VertexAttributeDescriptor(VertexAttribute.Normal, stream: 0), 14 | new VertexAttributeDescriptor(VertexAttribute.Color, dimension: 4, stream: 1), 15 | new VertexAttributeDescriptor(VertexAttribute.TexCoord0, dimension: 2, stream: 1), 16 | new VertexAttributeDescriptor(VertexAttribute.BlendWeight, dimension: 4, stream: 2), 17 | new VertexAttributeDescriptor(VertexAttribute.BlendIndices, VertexAttributeFormat.UInt16, 4, 2), 18 | }); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/UnityExtension.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UniVRM10 4 | { 5 | public static class UnityExtension 6 | { 7 | public static float[] ToFloat3(this Vector3 value) 8 | { 9 | return new[] { value.x, value.y, value.z }; 10 | } 11 | 12 | public static float[] ToFloat4(this Quaternion value) 13 | { 14 | return new float[] { value.x, value.y, value.z, value.w }; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/IO/Vrm10Exception.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniVRM10 4 | { 5 | public class Vrm10Exception : Exception 6 | { 7 | public Vrm10Exception(string msg) : base(msg) 8 | { } 9 | } 10 | 11 | public class Vrm10NoExtensionException : Vrm10Exception 12 | { 13 | public Vrm10NoExtensionException(string msg) : base(msg) 14 | { } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Migration/Materials/Vrm0XMToonTextureIndexMap.cs: -------------------------------------------------------------------------------- 1 | namespace UniVRM10 2 | { 3 | internal struct Vrm0XMToonTextureIndexMap 4 | { 5 | // glTF 6 | public int? MainTex; 7 | public int? BumpMap; 8 | public int? EmissionMap; 9 | // VRMC_materials_mtoon 10 | public int? ShadeTexture; 11 | public int? ReceiveShadowTexture; 12 | public int? ShadingGradeTexture; 13 | public int? RimTexture; 14 | public int? SphereAdd; 15 | public int? OutlineWidthTexture; 16 | public int? UvAnimMaskTexture; 17 | } 18 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Migration/MigrationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniVRM10 4 | { 5 | internal class MigrationException : Exception 6 | { 7 | public MigrationException(string key, string value) : base($"{key}: {value}") 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Migration/MigrationVector3.cs: -------------------------------------------------------------------------------- 1 | using UniJSON; 2 | 3 | namespace UniVRM10 4 | { 5 | internal static class MigrateVector3 6 | { 7 | /// 8 | /// VRM0は本来 (x, y, -z) と座標変換するべきところをしていない。 9 | /// 一方 VRM1 は (-x, y, z) と座標変換するように仕様を変更した。 10 | /// 11 | /// VRM0 => VRM1 の変換では、 (-x, y, z) する。 12 | /// 13 | /// 14 | /// 15 | public static float[] Migrate(JsonNode vrm0) 16 | { 17 | return new float[] 18 | { 19 | -vrm0["x"].GetSingle(), 20 | vrm0["y"].GetSingle(), 21 | vrm0["z"].GetSingle(), 22 | }; 23 | } 24 | 25 | public static float[] Migrate(JsonNode parent, string key) 26 | { 27 | if (!parent.ContainsKey(key)) 28 | { 29 | return new float[] { 0, 0, 0 }; 30 | } 31 | return Migrate(parent[key]); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Migration/Migrator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UniVRM10 4 | { 5 | public static class Migrator 6 | { 7 | /// 8 | /// マイグレーションの公開API 9 | /// 10 | /// MigrationVrm とその関連実装は、internal で runtime import 専用 11 | /// 12 | /// 13 | /// (必須)外部から供給されるライセンス情報 14 | /// 15 | public static byte[] Migrate(byte[] vrm0bytes, VRM10ObjectMeta meta, Action modGltf = null) 16 | { 17 | if (meta == null) 18 | { 19 | throw new ArgumentNullException("meta"); 20 | } 21 | foreach (var validation in meta.Validate()) 22 | { 23 | if (!validation.CanExport) 24 | { 25 | throw new ArgumentException(validation.Message); 26 | } 27 | } 28 | return MigrationVrm.Migrate(vrm0bytes, meta, modGltf); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/Runtime/Version/VRMSpecVersion.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace UniVRM10 3 | { 4 | public static partial class VRM10SpecVersion 5 | { 6 | public const int MAJOR = 1; 7 | public const int MINOR = 0; 8 | public const int PATCH = 0; 9 | public const string PRE_ID = ""; 10 | 11 | const string VERSION = "1.0.0"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.vrmc.vrm", 3 | "version": "0.117.0", 4 | "displayName": "VRM-1.0", 5 | "description": "VRM-1.0 importer", 6 | "unity": "2021.3", 7 | "keywords": [ 8 | "vrm", 9 | "importer", 10 | "avatar", 11 | "vr" 12 | ], 13 | "author": { 14 | "name": "VRM Consortium" 15 | }, 16 | "dependencies": { 17 | "com.vrmc.vrmshaders": "0.117.0", 18 | "com.vrmc.gltf": "0.117.0" 19 | }, 20 | "samples": [ 21 | { 22 | "displayName": "VRM10Viewer", 23 | "description": "VRM10 runtime loader sample", 24 | "path": "Samples~/VRM10Viewer" 25 | }, 26 | { 27 | "displayName": "VRM10FirstPersonSample", 28 | "description": "First Person layer sample with multi camera", 29 | "path": "Samples~/VRM10FirstPersonSample" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/README.md: -------------------------------------------------------------------------------- 1 | # VrmLib 2 | 3 | A 3D model utility for VRM. 4 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/Runtime/Coordinates.cs: -------------------------------------------------------------------------------- 1 | namespace VrmLib 2 | { 3 | public enum GeometryCoordinates 4 | { 5 | Unknown, 6 | 7 | /// VRM-0 8 | XYZ_RightUpBack_RH, 9 | 10 | /// VRM-1 11 | XYZ_RightUpForward_RH, 12 | 13 | /// D3D standard(Unity) 14 | XYZ_RightUpForward_LH, 15 | } 16 | 17 | public enum TextureOrigin 18 | { 19 | Unknown, 20 | 21 | // GLTF 22 | LeftTop, 23 | 24 | // Unity 25 | LeftBottom, 26 | } 27 | 28 | public struct Coordinates 29 | { 30 | public GeometryCoordinates Geometry; 31 | public TextureOrigin Texture; 32 | 33 | public static Coordinates Vrm0 => new Coordinates 34 | { 35 | Geometry = GeometryCoordinates.XYZ_RightUpBack_RH, 36 | Texture = TextureOrigin.LeftTop, 37 | }; 38 | public bool IsVrm0 => this.Equals(Vrm0); 39 | 40 | public static Coordinates Vrm1 => new Coordinates 41 | { 42 | Geometry = GeometryCoordinates.XYZ_RightUpForward_RH, 43 | Texture = TextureOrigin.LeftTop, 44 | }; 45 | public bool IsVrm1 => this.Equals(Vrm1); 46 | 47 | public static Coordinates Unity => new Coordinates 48 | { 49 | Geometry = GeometryCoordinates.XYZ_RightUpForward_LH, 50 | Texture = TextureOrigin.LeftBottom, 51 | }; 52 | 53 | public bool IsUnity => this.Equals(Unity); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/Runtime/Extensions/ListExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace VrmLib 5 | { 6 | public static class ListExtensions 7 | { 8 | public static int IndexOfThrow(this List list, T target) 9 | { 10 | var index = list.IndexOf(target); 11 | if (index == -1) 12 | { 13 | throw new KeyNotFoundException(); 14 | } 15 | return index; 16 | } 17 | 18 | public static int? IndexOfNullable(this List list, T target) 19 | { 20 | var index = list.IndexOf(target); 21 | if (index == -1) 22 | { 23 | return default; 24 | } 25 | return index; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/Runtime/GltfId.cs: -------------------------------------------------------------------------------- 1 | namespace VrmLib 2 | { 3 | /// 4 | /// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/glTFid.schema.json 5 | /// 6 | /// ImportとExportでなるべく順番を維持するべく導入。下記のベースクラスとした 7 | /// 8 | /// * Image, Texture, Material 9 | /// * Animation 10 | /// * Node, Skin, Mesh 11 | /// 12 | /// 13 | public class GltfId 14 | { 15 | public int? GltfIndex; 16 | 17 | /// 18 | /// 未指定は後ろに送る 19 | /// 20 | public int SortOrder => GltfIndex.GetValueOrDefault(int.MaxValue); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/Runtime/MathFWrap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VrmLib 4 | { 5 | public static class MathFWrap 6 | { 7 | public static readonly float PI = (float)System.Math.PI; 8 | 9 | public static float Clamp(float src, float min, float max) 10 | { 11 | return Math.Max(Math.Min(src, min), max); 12 | } 13 | public static int Clamp(int src, int min, int max) 14 | { 15 | return Math.Max(Math.Min(src, min), max); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/Runtime/MeshGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text; 3 | 4 | namespace VrmLib 5 | { 6 | public class MeshGroup : GltfId 7 | { 8 | public readonly string Name; 9 | 10 | public readonly List Meshes = new List(); 11 | 12 | public Skin Skin; 13 | 14 | public override string ToString() 15 | { 16 | var sb = new StringBuilder(); 17 | sb.Append(Name); 18 | if (Skin != null) 19 | { 20 | sb.Append("(skinned)"); 21 | } 22 | var isFirst = true; 23 | foreach (var mesh in Meshes) 24 | { 25 | if (isFirst) 26 | { 27 | isFirst = false; 28 | } 29 | else 30 | { 31 | sb.Append(", "); 32 | } 33 | sb.Append(mesh); 34 | } 35 | return sb.ToString(); 36 | } 37 | 38 | public MeshGroup(string name) 39 | { 40 | Name = name; 41 | } 42 | 43 | /// 44 | /// VRM-0.X 様式の共有頂点バッファを持っているか? 45 | /// 46 | /// * vrm-1.0 の Export では共有頂点バッファを使用しない 47 | /// * UniVRMの vrm-0.x => vrm-1.0 へのマイグレーション処理では、頂点バッファの様式変更はしない 48 | /// 49 | /// マイグレーションしたときのみtrueになる想定 50 | /// 51 | public bool HasSharedBuffer => Meshes.Count == 1 && Meshes[0].Submeshes.Count > 1; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRM10/vrmlib/Runtime/MorphTarget.cs: -------------------------------------------------------------------------------- 1 | namespace VrmLib 2 | { 3 | public class MorphTarget 4 | { 5 | public readonly string Name; 6 | public VertexBuffer VertexBuffer; 7 | 8 | public override string ToString() 9 | { 10 | var sb = new System.Text.StringBuilder(); 11 | sb.Append(Name); 12 | foreach (var kv in VertexBuffer) 13 | { 14 | sb.Append($"[{kv.Key}]"); 15 | } 16 | return sb.ToString(); 17 | } 18 | 19 | public MorphTarget(string name) 20 | { 21 | Name = name; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | Please refer to the latest release note in [Releases](https://github.com/vrm-c/UniVRM/releases) for all notable changes. 4 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/Documentation/VRMShaders.md: -------------------------------------------------------------------------------- 1 | # VRMShaders 2 | 3 | VRM model's supported shaders in Unity: 4 | 5 | * MToon 6 | * UniUnlit -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Resources/UniGLTF/NormalMapExporter.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/UniGLTF/NormalMapExporter" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | // No culling or depth 10 | Cull Off ZWrite Off ZTest Always 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2f 27 | { 28 | float2 uv : TEXCOORD0; 29 | float4 vertex : SV_POSITION; 30 | }; 31 | 32 | v2f vert (appdata v) 33 | { 34 | v2f o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.uv = v.uv; 37 | return o; 38 | } 39 | 40 | sampler2D _MainTex; 41 | 42 | fixed4 frag (v2f i) : SV_Target 43 | { 44 | half4 col = tex2D(_MainTex, i.uv); 45 | 46 | // Convert from compressed normal value to usual normal value. 47 | col.xyz = (UnpackNormal(col) + 1) * 0.5; 48 | col.w = 1; 49 | 50 | return col; 51 | } 52 | ENDCG 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/AwaitCaller/IAwaitCaller.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace VRMShaders 5 | { 6 | /// 7 | /// ImporterContext の 非同期実行 LoadAsync を補助する。 8 | /// この関数を経由して await すること。 9 | /// そうしないと、同期実行 Load 時にデッドロックに陥るかもしれない。 10 | /// (SynchronizationContext に Post された 継続が再開されない) 11 | /// 12 | public interface IAwaitCaller 13 | { 14 | /// 15 | /// フレームレートを維持するために1フレーム待つ 16 | /// 17 | /// 18 | Task NextFrame(); 19 | 20 | /// 21 | /// 非同期に実行して、終了を待つ 22 | /// 23 | /// 24 | /// 25 | Task Run(Action action); 26 | 27 | /// 28 | /// 非同期に実行して、終了を待つ 29 | /// 30 | /// 31 | /// 32 | /// 33 | Task Run(Func action); 34 | 35 | /// 36 | /// 指定した時間が経過している場合のみ、NextFrame() を使って1フレーム待つ 37 | /// 38 | /// タイムアウト時はNextFrame()を呼び出す。そうではない場合、Task.CompletedTaskを返す 39 | Task NextFrameIfTimedOut(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/AwaitCaller/ImmediateCaller.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace VRMShaders 5 | { 6 | /// 7 | /// 同期実行 8 | /// 9 | public sealed class ImmediateCaller : IAwaitCaller 10 | { 11 | public Task NextFrame() 12 | { 13 | return Task.FromResult(null); 14 | } 15 | 16 | public Task Run(Action action) 17 | { 18 | action(); 19 | return Task.FromResult(null); 20 | } 21 | 22 | public Task Run(Func action) 23 | { 24 | return Task.FromResult(action()); 25 | } 26 | 27 | public Task NextFrameIfTimedOut() => NextFrame(); 28 | } 29 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/AwaitCaller/TinyManagedTaskScheduler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | 4 | namespace VRMShaders 5 | { 6 | internal sealed class TinyManagedTaskScheduler 7 | { 8 | private readonly ConcurrentQueue<(Action, Func)> _continuationQueue = 9 | new ConcurrentQueue<(Action, Func)>(); 10 | private readonly ConcurrentQueue<(Action, Func)> _temporaryQueue = 11 | new ConcurrentQueue<(Action, Func)>(); 12 | 13 | public void ManagedUpdate() 14 | { 15 | while (_continuationQueue.TryDequeue(out var tuple)) 16 | { 17 | var (continuation, canExecute) = tuple; 18 | 19 | if (canExecute()) 20 | { 21 | continuation(); 22 | } 23 | else 24 | { 25 | _temporaryQueue.Enqueue(tuple); 26 | } 27 | } 28 | 29 | while (_temporaryQueue.TryDequeue(out var tuple)) 30 | { 31 | _continuationQueue.Enqueue(tuple); 32 | } 33 | } 34 | 35 | public void Enqueue(Action continuation, Func canExecute) 36 | { 37 | _continuationQueue.Enqueue((continuation, canExecute)); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/ColorSpace.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders 2 | { 3 | public enum ColorSpace 4 | { 5 | sRGB, 6 | Linear, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/IResponsibilityForDestroyObjects.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VRMShaders 4 | { 5 | public delegate void TakeResponsibilityForDestroyObjectFunc(SubAssetKey key, UnityEngine.Object obj); 6 | 7 | /// 8 | /// UnityObjectを破棄する責務。 9 | /// 10 | /// この interface を実装するクラスは、利用後に破棄すべき UnityObject を保持する可能性があるので 11 | /// Dispose により解放すること。 12 | /// 13 | /// [Runtime] TransferOwnership により、破棄責任を RuntimeGltfInstance に移譲する。 14 | /// RuntimeGltfInstance.OnDestroy でこれを破棄する。 15 | /// [Editor] TransferOwnership により、Asset化して破棄しない 16 | /// DestroyするとAssetが消えてしまう。 17 | /// 18 | /// 19 | public interface IResponsibilityForDestroyObjects : IDisposable 20 | { 21 | void TransferOwnership(TakeResponsibilityForDestroyObjectFunc take); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Converter/NormalConverter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VRMShaders 4 | { 5 | public static class NormalConverter 6 | { 7 | private static Material _exporter; 8 | private static Material Exporter 9 | { 10 | get 11 | { 12 | if (_exporter == null) 13 | { 14 | _exporter = new Material(Shader.Find("Hidden/UniGLTF/NormalMapExporter")); 15 | } 16 | return _exporter; 17 | } 18 | } 19 | 20 | // Unity texture to GLTF data 21 | public static Texture2D Export(Texture texture) 22 | { 23 | return TextureConverter.CopyTexture(texture, ColorSpace.Linear, false, Exporter); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Exporter/ITextureExporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace VRMShaders 5 | { 6 | /// 7 | /// Texture を用途別に変換の要不要を判断して gltf.textures の index に対応させる機能。 8 | /// 9 | /// glTF 拡張で Texture の用途を増やす必要がある場合は、この interface を継承して実装すればよい。 10 | /// 11 | public interface ITextureExporter: IDisposable 12 | { 13 | /// 14 | /// 指定の Texture を、 sRGB 色空間の値を持つ Texture に出力するように指示する。 15 | /// 16 | int RegisterExportingAsSRgb(Texture src, bool needsAlpha); 17 | 18 | /// 19 | /// 指定の Texture を、 Linear の値を持つ Texture に出力するように指示する。 20 | /// 21 | int RegisterExportingAsLinear(Texture src, bool needsAlpha); 22 | 23 | /// 24 | /// Unity Standard Shader の Metallic, Roughness, Occlusion 情報を、 glTF 仕様に準拠した 1 枚の合成テクスチャとして出力するように指示する。 25 | /// 26 | int RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(Texture metallicSmoothTexture, float smoothness, Texture occlusionTexture); 27 | 28 | /// 29 | /// 指定の Texture を、glTF 仕様に準拠した Normal Texture に出力するように指示する。 30 | /// 31 | int RegisterExportingAsNormal(Texture src); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Exporter/ITextureSerializer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VRMShaders 4 | { 5 | /// 6 | /// Texture2D を入力として byte[] を得る機能 7 | /// 8 | public interface ITextureSerializer 9 | { 10 | /// 11 | /// Texture をファイルのバイト列そのまま出力してよいかどうか判断する。 12 | /// 13 | /// exportColorSpace はその Texture2D がアサインされる glTF プロパティの仕様が定める色空間を指定する。 14 | /// Runtime 出力では常に false が望ましい。 15 | /// 16 | bool CanExportAsEditorAssetFile(Texture texture, ColorSpace exportColorSpace); 17 | 18 | /// 19 | /// Texture2D から実際のバイト列を取得する。 20 | /// 21 | /// exportColorSpace はその Texture2D がアサインされる glTF プロパティの仕様が定める色空間を指定する。 22 | /// 具体的には Texture2D をコピーする際に、コピー先の Texture2D の色空間を決定するために使用する。 23 | /// 24 | (byte[] bytes, string mime) ExportBytesWithMime(Texture2D texture, ColorSpace exportColorSpace); 25 | 26 | /// 27 | /// エクスポートに使用したい Texture に対して、事前準備を行う。 28 | /// 29 | /// たとえば UnityEditor においては、Texture Asset の圧縮設定を OFF にしたりしたい。 30 | /// 31 | void ModifyTextureAssetBeforeExporting(Texture texture); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Exporter/TextureExportTypes.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders 2 | { 3 | internal enum TextureExportTypes 4 | { 5 | // sRGB テクスチャとして出力 6 | Srgb, 7 | // Linear テクスチャとして出力 8 | Linear, 9 | // Unity Standard様式 から glTF PBR様式への変換 10 | OcclusionMetallicRoughness, 11 | // Assetを使うときはそのバイト列を無変換で、それ以外は DXT5nm 形式からのデコードを行う 12 | Normal, 13 | } 14 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Importer/ITextureDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using UnityEngine; 4 | 5 | namespace VRMShaders 6 | { 7 | /// 8 | /// 単純に Texture2D アセットを生成する機能 9 | /// 10 | public interface ITextureDeserializer 11 | { 12 | /// 13 | /// imageData をもとに Texture2D を生成する. 14 | /// await する場合は awaitCaller を用いて await しなければならない。(Editor では同期ロードをしなければならないため) 15 | /// 16 | Task LoadTextureAsync(DeserializingTextureInfo textureInfo, IAwaitCaller awaitCaller); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Importer/SamplerParam.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | 4 | namespace VRMShaders 5 | { 6 | public readonly struct SamplerParam 7 | { 8 | public TextureWrapMode WrapModesU { get; } 9 | 10 | public TextureWrapMode WrapModesV { get; } 11 | 12 | public FilterMode FilterMode { get; } 13 | 14 | public bool EnableMipMap { get; } 15 | 16 | public SamplerParam(TextureWrapMode wrapModesU, TextureWrapMode wrapModesV, FilterMode filterMode, bool enableMipMap) 17 | { 18 | WrapModesU = wrapModesU; 19 | WrapModesV = wrapModesV; 20 | FilterMode = filterMode; 21 | EnableMipMap = enableMipMap; 22 | } 23 | 24 | public static SamplerParam Default => new SamplerParam( 25 | TextureWrapMode.Repeat, 26 | TextureWrapMode.Repeat, 27 | FilterMode.Bilinear, 28 | true 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Importer/TextureDescriptorSet.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VRMShaders 4 | { 5 | /// 6 | /// TextureImportParam の集合を Unique な集合にする。 7 | /// 8 | public sealed class TextureDescriptorSet 9 | { 10 | private readonly Dictionary _texDescDict = new Dictionary(); 11 | 12 | public void Add(TextureDescriptor texDesc) 13 | { 14 | if (_texDescDict.ContainsKey(texDesc.SubAssetKey)) return; 15 | 16 | _texDescDict.Add(texDesc.SubAssetKey, texDesc); 17 | } 18 | 19 | public IEnumerable GetEnumerable() 20 | { 21 | foreach (var kv in _texDescDict) 22 | { 23 | yield return kv.Value; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Importer/TextureImportTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace VRMShaders 5 | { 6 | public enum TextureImportTypes 7 | { 8 | // runtime: 9 | // new Texture2D(linear = false) 10 | // extract: 11 | sRGB, 12 | // runtime: 13 | // new Texture2D(linear = true) 14 | // encode to DXT5nm 15 | // extract: 16 | // TextureImporter.textureType = TextureImporterType.NormalMap; 17 | NormalMap, 18 | // runtime: 19 | // new Texture2D(linear = true) 20 | // converted(Occlusion + Metallic + Smoothness) 21 | // extract: 22 | // converted(Occlusion + Metallic + Smoothness) 23 | // TextureImporter.sRGBTexture = false; 24 | StandardMap, 25 | // runtime: 26 | // new Texture2D(linear = true) 27 | // extract: 28 | // TextureImporter.sRGBTexture = false; 29 | Linear, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Texture/Util/TextureExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VRMShaders 4 | { 5 | internal static class TextureExtensions 6 | { 7 | public static bool HasMipMap(this Texture texture) 8 | { 9 | if (texture is Texture2D t2) 10 | { 11 | return t2.mipmapCount > 1; 12 | } 13 | else if (texture is RenderTexture rt) 14 | { 15 | return rt.useMipMap; 16 | } 17 | else 18 | { 19 | return false; 20 | } 21 | } 22 | 23 | public static void SetSampler(this Texture2D texture, in SamplerParam param) 24 | { 25 | if (texture == null) 26 | { 27 | return; 28 | } 29 | texture.wrapModeU = param.WrapModesU; 30 | texture.wrapModeV = param.WrapModesV; 31 | texture.filterMode = param.FilterMode; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders 2 | { 3 | public static class Symbols 4 | { 5 | /// 6 | /// #if 文を局所化する。 7 | /// VRMShaders が最下層になるため、ここに配置している 8 | /// 9 | /// 10 | public static bool VRM_DEVELOP 11 | { 12 | get 13 | { 14 | #if VRM_DEVELOP 15 | return true; 16 | #else 17 | return false; 18 | #endif 19 | } 20 | } 21 | 22 | public static bool VRM_NORMALIZE_BLENDSHAPE_TANGENT 23 | { 24 | get 25 | { 26 | #if VRM_NORMALIZE_BLENDSHAPE_TANGENT 27 | return true; 28 | #else 29 | return false; 30 | #endif 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/GLTF/IO/Runtime/Util/UnityObjectDestroyer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VRMShaders 4 | { 5 | public static class UnityObjectDestroyer 6 | { 7 | public static void DestroyRuntimeOrEditor(UnityEngine.Object o) 8 | { 9 | if (Application.isPlaying) 10 | { 11 | UnityEngine.Object.Destroy(o); 12 | } 13 | else 14 | { 15 | UnityEngine.Object.DestroyImmediate(o); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 VRM Consortium 4 | Copyright (c) 2018 Masataka SUMI for MToon 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/README.md: -------------------------------------------------------------------------------- 1 | # VRMShaders 2 | 3 | VRM model's supported shaders in Unity. 4 | 5 | Shader と関連するユーティリティを切り離したパッケージ。 6 | 7 | ## 含まれるシェーダー 8 | 9 | ### UniUnlit 10 | 11 | * Gltfの Unlit に適合するようにした。Unlit シェーダー 12 | 13 | ### MToon 14 | 15 | * https://github.com/Santarh/MToon 16 | 17 | ## UniGLTF.ShaderPropExporter.PreShaderPropExporter 18 | 19 | Unityでは、ランタイムにMaterialのPropertyを列挙することができない。 20 | Set/Get はできる。 21 | 事前に一覧を作成するユーティリティ。 22 | 23 | ## UPM usage (Unity 2019.3.4f1~) 24 | 25 | `Window` -> `Package Manager` -> `Add package from git URL` and paste `https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders`. 26 | 27 | or add the package name and git URL in `Packages/manifest.json`: 28 | 29 | ```json 30 | { 31 | "dependencies": { 32 | "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders", 33 | } 34 | } 35 | ``` 36 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/MToon/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Masataka SUMI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/MToon/MToon/Resources/Shaders/MToonSM3.cginc: -------------------------------------------------------------------------------- 1 | #include "./MToonCore.cginc" 2 | 3 | v2f vert_forward_base(appdata_full v) 4 | { 5 | UNITY_SETUP_INSTANCE_ID(v); 6 | v.normal = normalize(v.normal); 7 | return InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0); 8 | } 9 | 10 | v2f vert_forward_base_outline(appdata_full v) 11 | { 12 | UNITY_SETUP_INSTANCE_ID(v); 13 | v.normal = normalize(v.normal); 14 | return InitializeV2F(v, CalculateOutlineVertexClipPosition(v), 1); 15 | } 16 | 17 | v2f vert_forward_add(appdata_full v) 18 | { 19 | UNITY_SETUP_INSTANCE_ID(v); 20 | v.normal = normalize(v.normal); 21 | return InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0); 22 | } 23 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/MToon/MToon/Resources/Shaders/MToonSM4.cginc: -------------------------------------------------------------------------------- 1 | #include "./MToonCore.cginc" 2 | 3 | appdata_full vert_forward_base_with_outline(appdata_full v) 4 | { 5 | UNITY_SETUP_INSTANCE_ID(v); 6 | v.normal = normalize(v.normal); 7 | return v; 8 | } 9 | 10 | v2f vert_forward_add(appdata_full v) 11 | { 12 | UNITY_SETUP_INSTANCE_ID(v); 13 | v.normal = normalize(v.normal); 14 | return InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0); 15 | } 16 | 17 | [maxvertexcount(6)] 18 | void geom_forward_base(triangle appdata_full IN[3], inout TriangleStream stream) 19 | { 20 | v2f o; 21 | 22 | #if defined(MTOON_OUTLINE_WIDTH_WORLD) || defined(MTOON_OUTLINE_WIDTH_SCREEN) 23 | for (int i = 2; i >= 0; --i) 24 | { 25 | appdata_full v = IN[i]; 26 | v2f o = InitializeV2F(v, CalculateOutlineVertexClipPosition(v), 1); 27 | stream.Append(o); 28 | } 29 | stream.RestartStrip(); 30 | #endif 31 | 32 | for (int j = 0; j < 3; ++j) 33 | { 34 | appdata_full v = IN[j]; 35 | v2f o = InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0); 36 | stream.Append(o); 37 | } 38 | stream.RestartStrip(); 39 | } 40 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/MToon/MToon/Scripts/Enums.cs: -------------------------------------------------------------------------------- 1 | namespace MToon 2 | { 3 | public enum DebugMode 4 | { 5 | None = 0, 6 | Normal = 1, 7 | LitShadeRate = 2, 8 | } 9 | 10 | public enum OutlineColorMode 11 | { 12 | FixedColor = 0, 13 | MixedLighting = 1, 14 | } 15 | 16 | public enum OutlineWidthMode 17 | { 18 | None = 0, 19 | WorldCoordinates = 1, 20 | ScreenCoordinates = 2, 21 | } 22 | 23 | public enum RenderMode 24 | { 25 | Opaque = 0, 26 | Cutout = 1, 27 | Transparent = 2, 28 | TransparentWithZWrite = 3, 29 | } 30 | 31 | public enum CullMode 32 | { 33 | Off = 0, 34 | Front = 1, 35 | Back = 2, 36 | } 37 | 38 | public struct RenderQueueRequirement 39 | { 40 | public int DefaultValue; 41 | public int MinValue; 42 | public int MaxValue; 43 | } 44 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/MToon/MToon/Scripts/UtilsVersion.cs: -------------------------------------------------------------------------------- 1 | namespace MToon 2 | { 3 | public static partial class Utils 4 | { 5 | public const string Implementation = "Santarh/MToon"; 6 | public const int VersionNumber = 39; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/MToon/README.md: -------------------------------------------------------------------------------- 1 | # MToon 2 | Toon Shader with Unity Global Illumination 3 | 4 | ## Tutorial 5 | https://www.slideshare.net/VirtualCast/vrm-mtoon 6 | 7 | ## Version 8 | v3.9 9 | 10 | ## Release Note 11 | https://github.com/Santarh/MToon/releases 12 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM/VRMShaders.shadervariants: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!200 &20000000 4 | ShaderVariantCollection: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: VRMShaders 10 | m_Shaders: 11 | - first: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | second: 13 | variants: [] 14 | - first: {fileID: 4800000, guid: 1a97144e4ad27a04aafd70f7b915cedb, type: 3} 15 | second: 16 | variants: [] 17 | - first: {fileID: 4800000, guid: 8c17b56f4bf084c47872edcb95237e4a, type: 3} 18 | second: 19 | variants: [] 20 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_ATTRIBUTE_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_ATTRIBUTE_INCLUDED 3 | 4 | #include "./vrmc_materials_mtoon_render_pipeline.hlsl" 5 | 6 | struct Attributes 7 | { 8 | float4 vertex : POSITION; // UnityCG macro specified name. Accurately "positionOS" 9 | float3 normalOS : NORMAL; 10 | #if defined(_NORMALMAP) 11 | float4 tangentOS : TANGENT; 12 | #endif 13 | float2 texcoord0 : TEXCOORD0; 14 | float2 texcoord1 : TEXCOORD1; 15 | UNITY_VERTEX_INPUT_INSTANCE_ID 16 | }; 17 | 18 | struct Varyings 19 | { 20 | float2 uv : TEXCOORD0; 21 | float3 positionWS : TEXCOORD1; 22 | half3 normalWS : TEXCOORD2; 23 | #if defined(_NORMALMAP) 24 | half4 tangentWS : TEXCOORD3; 25 | #endif 26 | float3 viewDirWS : TEXCOORD4; 27 | 28 | MTOON_FOG_AND_LIGHTING_COORDS(5, 6, 7) 29 | 30 | float4 pos : SV_POSITION; // UnityCG macro specified name. Accurately "positionCS" 31 | UNITY_VERTEX_INPUT_INSTANCE_ID 32 | UNITY_VERTEX_OUTPUT_STEREO 33 | }; 34 | 35 | struct FragmentInput 36 | { 37 | Varyings varyings; 38 | MTOON_FRONT_FACE_TYPE facing : MTOON_FRONT_FACE_SEMANTIC; 39 | }; 40 | 41 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_fragment.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_DEPTHNORMALS_FRAGMENT_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_DEPTHNORMALS_FRAGMENT_INCLUDED 3 | 4 | #ifdef MTOON_URP 5 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 6 | 7 | #include "./vrmc_materials_mtoon_define.hlsl" 8 | #include "./vrmc_materials_mtoon_utility.hlsl" 9 | #include "./vrmc_materials_mtoon_input.hlsl" 10 | #include "./vrmc_materials_mtoon_attribute.hlsl" 11 | #include "./vrmc_materials_mtoon_geometry_uv.hlsl" 12 | #include "./vrmc_materials_mtoon_geometry_alpha.hlsl" 13 | #include "./vrmc_materials_mtoon_geometry_normal.hlsl" 14 | #include "./vrmc_materials_mtoon_lighting_unity.hlsl" 15 | #include "./vrmc_materials_mtoon_lighting_mtoon.hlsl" 16 | 17 | half4 MToonDepthNormalsFragment(const FragmentInput fragmentInput) : SV_Target 18 | { 19 | const Varyings input = fragmentInput.varyings; 20 | UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); 21 | 22 | // Get MToon UV (with UVAnimation) 23 | const float2 uv = GetMToonGeometry_Uv(input.uv); 24 | 25 | // Get LitColor with Alpha 26 | const half4 litColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv) * _Color; 27 | GetMToonGeometry_Alpha(litColor); 28 | 29 | // Get Normal 30 | float3 normalWS = GetMToonGeometry_Normal(input, fragmentInput.facing, uv); 31 | normalWS = NormalizeNormalPerPixel(normalWS); 32 | 33 | return half4(normalWS, 0.0); 34 | } 35 | 36 | #endif 37 | 38 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_vertex.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_DEPTHNORMALS_VERTEX_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_DEPTHNORMALS_VERTEX_INCLUDED 3 | 4 | #ifdef MTOON_URP 5 | 6 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 7 | 8 | #include "./vrmc_materials_mtoon_define.hlsl" 9 | #include "./vrmc_materials_mtoon_utility.hlsl" 10 | #include "./vrmc_materials_mtoon_input.hlsl" 11 | #include "./vrmc_materials_mtoon_attribute.hlsl" 12 | #include "./vrmc_materials_mtoon_geometry_vertex.hlsl" 13 | 14 | Varyings MToonDepthNormalsVertex(const Attributes v) 15 | { 16 | Varyings output = (Varyings)0; 17 | 18 | UNITY_SETUP_INSTANCE_ID(v); 19 | UNITY_TRANSFER_INSTANCE_ID(v, output); 20 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); 21 | 22 | #if defined(_NORMALMAP) 23 | VertexNormalInputs normalInput = GetVertexNormalInputs(v.normalOS, v.tangentOS); 24 | float3 normalWS = normalInput.normalWS; 25 | float sign = v.tangentOS.w * float(GetOddNegativeScale()); 26 | half4 tangentWS = half4(normalInput.tangentWS.xyz, sign); 27 | #else 28 | float3 normalWS = TransformObjectToWorldNormal(v.normalOS); 29 | #endif 30 | 31 | output.pos = TransformObjectToHClip(v.vertex.xyz); 32 | output.normalWS = normalWS; 33 | #if defined(_NORMALMAP) 34 | output.tangentWS = tangentWS; 35 | #endif 36 | output.uv = v.texcoord0; 37 | 38 | return output; 39 | } 40 | 41 | #endif 42 | 43 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_fragment.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_DEPTHONLY_FRAGMENT_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_DEPTHONLY_FRAGMENT_INCLUDED 3 | 4 | #ifdef MTOON_URP 5 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 6 | 7 | #include "./vrmc_materials_mtoon_define.hlsl" 8 | #include "./vrmc_materials_mtoon_utility.hlsl" 9 | #include "./vrmc_materials_mtoon_input.hlsl" 10 | #include "./vrmc_materials_mtoon_attribute.hlsl" 11 | #include "./vrmc_materials_mtoon_geometry_uv.hlsl" 12 | #include "./vrmc_materials_mtoon_geometry_alpha.hlsl" 13 | #include "./vrmc_materials_mtoon_geometry_normal.hlsl" 14 | #include "./vrmc_materials_mtoon_lighting_unity.hlsl" 15 | #include "./vrmc_materials_mtoon_lighting_mtoon.hlsl" 16 | 17 | half4 MToonDepthOnlyFragment(const FragmentInput fragmentInput) : SV_Target 18 | { 19 | const Varyings input = fragmentInput.varyings; 20 | UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); 21 | 22 | // Get MToon UV (with UVAnimation) 23 | const float2 uv = GetMToonGeometry_Uv(input.uv); 24 | 25 | // Get LitColor with Alpha 26 | const half4 litColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv) * _Color; 27 | GetMToonGeometry_Alpha(litColor); 28 | 29 | return 0; 30 | } 31 | 32 | #endif 33 | 34 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_vertex.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_DEPTHONLY_VERTEX_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_DEPTHONLY_VERTEX_INCLUDED 3 | 4 | #ifdef MTOON_URP 5 | 6 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 7 | 8 | #include "./vrmc_materials_mtoon_define.hlsl" 9 | #include "./vrmc_materials_mtoon_utility.hlsl" 10 | #include "./vrmc_materials_mtoon_input.hlsl" 11 | #include "./vrmc_materials_mtoon_attribute.hlsl" 12 | #include "./vrmc_materials_mtoon_geometry_vertex.hlsl" 13 | 14 | Varyings MToonDepthOnlyVertex(const Attributes v) 15 | { 16 | Varyings output = (Varyings)0; 17 | 18 | UNITY_SETUP_INSTANCE_ID(v); 19 | UNITY_TRANSFER_INSTANCE_ID(v, output); 20 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); 21 | 22 | output.pos = TransformObjectToHClip(v.vertex.xyz); 23 | output.uv = v.texcoord0; 24 | 25 | return output; 26 | } 27 | 28 | #endif 29 | 30 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_alpha.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_GEOMETRY_ALPHA_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_GEOMETRY_ALPHA_INCLUDED 3 | 4 | #include "./vrmc_materials_mtoon_define.hlsl" 5 | #include "./vrmc_materials_mtoon_utility.hlsl" 6 | #include "./vrmc_materials_mtoon_input.hlsl" 7 | 8 | inline half GetMToonGeometry_Alpha(half4 litColor) 9 | { 10 | if (MToon_IsAlphaTestOn()) 11 | { 12 | const half rawAlpha = litColor.a; 13 | const half tmpAlpha = (rawAlpha - _Cutoff) / max(fwidth(rawAlpha), 0.00001) + 0.5; // Alpha to Coverage 14 | clip(tmpAlpha - _Cutoff); 15 | return 1.0; 16 | } 17 | else if (MToon_IsAlphaBlendOn()) 18 | { 19 | const half alpha = litColor.a; 20 | clip(alpha - EPS_COL); 21 | return alpha; 22 | } 23 | else 24 | { 25 | return 1.0; 26 | } 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_normal.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_GEOMETRY_NORMAL_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_GEOMETRY_NORMAL_INCLUDED 3 | 4 | #include "./vrmc_materials_mtoon_render_pipeline.hlsl" 5 | #include "./vrmc_materials_mtoon_define.hlsl" 6 | #include "./vrmc_materials_mtoon_utility.hlsl" 7 | #include "./vrmc_materials_mtoon_input.hlsl" 8 | 9 | inline float3 GetMToonGeometry_NormalWithoutNormalMap(const half3 normalWS) 10 | { 11 | return normalize(normalWS); 12 | } 13 | 14 | inline float3 GetMToonGeometry_Normal(const Varyings input, const MTOON_FRONT_FACE_TYPE facing, const float2 mtoonUv) 15 | { 16 | const half3 normalWS = MTOON_IS_FRONT_VFACE(facing, input.normalWS, -input.normalWS); 17 | 18 | #if defined(_NORMALMAP) 19 | 20 | // Get Normal in WorldSpace from Normalmap if available 21 | const half3 normalTS = normalize(MToon_UnpackNormalScale(MTOON_SAMPLE_TEXTURE2D(_BumpMap, mtoonUv), _BumpScale)); 22 | return normalize(mul(normalTS, MToon_GetTangentToWorld(normalWS, input.tangentWS))); 23 | 24 | #else 25 | 26 | return GetMToonGeometry_NormalWithoutNormalMap(normalWS); 27 | 28 | #endif 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_uv.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_GEOMETRY_UV_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_GEOMETRY_UV_INCLUDED 3 | 4 | #include "./vrmc_materials_mtoon_render_pipeline.hlsl" 5 | #include "./vrmc_materials_mtoon_define.hlsl" 6 | #include "./vrmc_materials_mtoon_utility.hlsl" 7 | #include "./vrmc_materials_mtoon_input.hlsl" 8 | 9 | inline float GetMToonGeometry_Uv_Time(const float2 uvRaw) 10 | { 11 | if (MToon_IsParameterMapOn()) 12 | { 13 | return MTOON_SAMPLE_TEXTURE2D(_UvAnimMaskTex, uvRaw).b * _Time.y; 14 | } 15 | return _Time.y; 16 | } 17 | 18 | inline float2 GetMToonGeometry_Uv(const float2 geometryUv) 19 | { 20 | // get raw uv with _MainTex_ST 21 | const float2 uvRaw = TRANSFORM_TEX(geometryUv, _MainTex); 22 | 23 | const float uvAnimationTime = GetMToonGeometry_Uv_Time(uvRaw); 24 | const float2 translate = uvAnimationTime * float2(_UvAnimScrollXSpeed, _UvAnimScrollYSpeed); 25 | const float rotateRad = frac(uvAnimationTime * _UvAnimRotationSpeed) * PI_2; 26 | const float cosRotate = cos(rotateRad); 27 | const float sinRotate = sin(rotateRad); 28 | const float2 rotatePivot = float2(0.5, 0.5); 29 | return mul(float2x2(cosRotate, -sinRotate, sinRotate, cosRotate), uvRaw + translate - rotatePivot) + rotatePivot; 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_input.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_INPUT_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_INPUT_INCLUDED 3 | 4 | #include "./vrmc_materials_mtoon_render_pipeline.hlsl" 5 | 6 | // Textures 7 | MTOON_DECLARE_TEX2D(_MainTex); 8 | MTOON_DECLARE_TEX2D(_ShadeTex); 9 | MTOON_DECLARE_TEX2D(_BumpMap); 10 | MTOON_DECLARE_TEX2D(_ShadingShiftTex); 11 | MTOON_DECLARE_TEX2D(_EmissionMap); 12 | MTOON_DECLARE_TEX2D(_MatcapTex); 13 | MTOON_DECLARE_TEX2D(_RimTex); 14 | MTOON_DECLARE_TEX2D(_OutlineWidthTex); 15 | // NOTE: "tex2d() * _Time.y" returns mediump value if sampler is half precision in Android VR platform 16 | MTOON_DECLARE_TEX2D_FLOAT(_UvAnimMaskTex); 17 | 18 | CBUFFER_START(UnityPerMaterial) 19 | // Vector 20 | float4 _MainTex_ST; 21 | // Colors 22 | half4 _Color; 23 | half4 _ShadeColor; 24 | half4 _EmissionColor; 25 | half4 _MatcapColor; 26 | half4 _RimColor; 27 | half4 _OutlineColor; 28 | // Floats 29 | half _Cutoff; 30 | half _BumpScale; 31 | half _ShadingShiftFactor; 32 | half _ShadingShiftTexScale; 33 | half _ShadingToonyFactor; 34 | half _GiEqualization; 35 | half _RimFresnelPower; 36 | half _RimLift; 37 | half _RimLightingMix; 38 | half _OutlineWidth; 39 | half _OutlineLightingMix; 40 | float _UvAnimScrollXSpeed; 41 | float _UvAnimScrollYSpeed; 42 | float _UvAnimRotationSpeed; 43 | CBUFFER_END 44 | 45 | // No Using on shader 46 | // half _AlphaMode; 47 | // half _TransparentWithZWrite; 48 | // half _RenderQueueOffset; 49 | // half _DoubleSided; 50 | // half _OutlineWidthMode; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_fragment.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef VRMC_MATERIALS_MTOON_SHADOWCASTER_FRAGMENT_INCLUDED 2 | #define VRMC_MATERIALS_MTOON_SHADOWCASTER_FRAGMENT_INCLUDED 3 | 4 | #ifdef MTOON_URP 5 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 6 | 7 | #include "./vrmc_materials_mtoon_define.hlsl" 8 | #include "./vrmc_materials_mtoon_utility.hlsl" 9 | #include "./vrmc_materials_mtoon_input.hlsl" 10 | #include "./vrmc_materials_mtoon_attribute.hlsl" 11 | #include "./vrmc_materials_mtoon_geometry_uv.hlsl" 12 | #include "./vrmc_materials_mtoon_geometry_alpha.hlsl" 13 | #include "./vrmc_materials_mtoon_geometry_normal.hlsl" 14 | #include "./vrmc_materials_mtoon_lighting_unity.hlsl" 15 | #include "./vrmc_materials_mtoon_lighting_mtoon.hlsl" 16 | 17 | half4 MToonShadowCasterFragment(const FragmentInput fragmentInput) : SV_Target 18 | { 19 | const Varyings input = fragmentInput.varyings; 20 | UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); 21 | 22 | // Get MToon UV (with UVAnimation) 23 | const float2 uv = GetMToonGeometry_Uv(input.uv); 24 | 25 | // Get LitColor with Alpha 26 | const half4 litColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv) * _Color; 27 | GetMToonGeometry_Alpha(litColor); 28 | 29 | return 0; 30 | } 31 | 32 | #endif 33 | 34 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/MToonOutlineRenderFeature.cs: -------------------------------------------------------------------------------- 1 | #if MTOON_URP 2 | using UnityEngine.Rendering; 3 | using UnityEngine.Rendering.Universal; 4 | 5 | namespace VRMShaders.VRM10.MToon10.Runtime 6 | { 7 | public sealed class MToonOutlineRenderFeature : ScriptableRendererFeature 8 | { 9 | private MToonOutlineRenderPass _opaquePass; 10 | private MToonOutlineRenderPass _transparentPass; 11 | 12 | public override void Create() 13 | { 14 | _opaquePass = new MToonOutlineRenderPass(RenderPassEvent.AfterRenderingOpaques, RenderQueueRange.opaque); 15 | _transparentPass = new MToonOutlineRenderPass(RenderPassEvent.BeforeRenderingTransparents, RenderQueueRange.transparent); 16 | } 17 | 18 | public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) 19 | { 20 | renderer.EnqueuePass(_opaquePass); 21 | renderer.EnqueuePass(_transparentPass); 22 | } 23 | } 24 | } 25 | #endif -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10AlphaMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum MToon10AlphaMode 4 | { 5 | Opaque = 0, 6 | Cutout = 1, 7 | Transparent = 2, 8 | } 9 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10DoubleSidedMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum MToon10DoubleSidedMode 4 | { 5 | Off = 0, 6 | On = 1, 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10EmissiveMapKeyword.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class MToon10EmissiveMapKeyword 4 | { 5 | public const string On = "_MTOON_EMISSIVEMAP"; 6 | } 7 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10NormalMapKeyword.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class MToon10NormalMapKeyword 4 | { 5 | public const string On = "_NORMALMAP"; 6 | } 7 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10OutlineMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum MToon10OutlineMode 4 | { 5 | None = 0, 6 | World = 1, 7 | Screen = 2, 8 | } 9 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10OutlineModeKeyword.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class MToon10OutlineModeKeyword 4 | { 5 | public const string World = "_MTOON_OUTLINE_WORLD"; 6 | public const string Screen = "_MTOON_OUTLINE_SCREEN"; 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10ParameterMapKeyword.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class MToon10ParameterMapKeyword 4 | { 5 | public const string On = "_MTOON_PARAMETERMAP"; 6 | } 7 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10RimMapKeyword.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class MToon10RimMapKeyword 4 | { 5 | public const string On = "_MTOON_RIMMAP"; 6 | } 7 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/MToonDefinedValues/MToon10TransparentWithZWriteMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum MToon10TransparentWithZWriteMode 4 | { 5 | Off = 0, 6 | On = 1, 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/Properties/MToon10Meta.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class MToon10Meta 4 | { 5 | public static readonly string UnityShaderName = "VRM10/MToon10"; 6 | public static readonly string URPUnityShaderName = "VRM10/Universal Render Pipeline/MToon10"; 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/ShaderLabDefinedValues/UnityAlphaModeKeyword.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class UnityAlphaModeKeyword 4 | { 5 | public const string AlphaTest = "_ALPHATEST_ON"; 6 | public const string AlphaBlend = "_ALPHABLEND_ON"; 7 | public const string AlphaPremultiply = "_ALPHAPREMULTIPLY_ON"; 8 | } 9 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/ShaderLabDefinedValues/UnityAlphaToMaskMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum UnityAlphaToMaskMode 4 | { 5 | Off = 0, 6 | On = 1, 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/ShaderLabDefinedValues/UnityCullMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum UnityCullMode 4 | { 5 | Off = 0, 6 | // Front = 1, 7 | Back = 2, 8 | } 9 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/ShaderLabDefinedValues/UnityRenderTag.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public static class UnityRenderTag 4 | { 5 | public const string Key = "RenderType"; 6 | public const string OpaqueValue = "Opaque"; 7 | public const string TransparentCutoutValue = "TransparentCutout"; 8 | public const string TransparentValue = "Transparent"; 9 | } 10 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/MToon10/Runtime/UnityShaderLab/ShaderLabDefinedValues/UnityZWriteMode.cs: -------------------------------------------------------------------------------- 1 | namespace VRMShaders.VRM10.MToon10.Runtime 2 | { 3 | public enum UnityZWriteMode 4 | { 5 | Off = 0, 6 | On = 1, 7 | } 8 | } -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/VRM10/VRM10Shaders.shadervariants: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!200 &20000000 4 | ShaderVariantCollection: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: VRM10Shaders 10 | m_Shaders: 11 | - first: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | second: 13 | variants: [] 14 | - first: {fileID: 4800000, guid: e0edbf68d81d1f340ae8b110086b7063, type: 3} 15 | second: 16 | variants: [] 17 | - first: {fileID: 4800000, guid: 8c17b56f4bf084c47872edcb95237e4a, type: 3} 18 | second: 19 | variants: [] 20 | -------------------------------------------------------------------------------- /ModelReplacementAPI_VRMSupport/ModelReplacementAPI.VRMSupport/VRMScripts/VRMShaders/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.vrmc.vrmshaders", 3 | "version": "0.117.0", 4 | "displayName": "VRM Shaders", 5 | "description": "VRM Shaders", 6 | "unity": "2021.3", 7 | "keywords": [ 8 | "vrm", 9 | "shader" 10 | ], 11 | "author": { 12 | "name": "VRM Consortium" 13 | }, 14 | "dependencies": { 15 | "com.unity.modules.imageconversion": "1.0.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Wiki_Img/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img1.png -------------------------------------------------------------------------------- /Wiki_Img/img10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img10.png -------------------------------------------------------------------------------- /Wiki_Img/img11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img11.png -------------------------------------------------------------------------------- /Wiki_Img/img12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img12.png -------------------------------------------------------------------------------- /Wiki_Img/img13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img13.png -------------------------------------------------------------------------------- /Wiki_Img/img14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img14.png -------------------------------------------------------------------------------- /Wiki_Img/img15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img15.png -------------------------------------------------------------------------------- /Wiki_Img/img16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img16.png -------------------------------------------------------------------------------- /Wiki_Img/img17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img17.png -------------------------------------------------------------------------------- /Wiki_Img/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img2.png -------------------------------------------------------------------------------- /Wiki_Img/img201.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img201.png -------------------------------------------------------------------------------- /Wiki_Img/img202.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img202.png -------------------------------------------------------------------------------- /Wiki_Img/img203.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img203.png -------------------------------------------------------------------------------- /Wiki_Img/img204.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img204.png -------------------------------------------------------------------------------- /Wiki_Img/img205.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img205.png -------------------------------------------------------------------------------- /Wiki_Img/img206.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img206.png -------------------------------------------------------------------------------- /Wiki_Img/img207.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img207.png -------------------------------------------------------------------------------- /Wiki_Img/img208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img208.png -------------------------------------------------------------------------------- /Wiki_Img/img209.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img209.png -------------------------------------------------------------------------------- /Wiki_Img/img210.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img210.png -------------------------------------------------------------------------------- /Wiki_Img/img211.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img211.png -------------------------------------------------------------------------------- /Wiki_Img/img212.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img212.png -------------------------------------------------------------------------------- /Wiki_Img/img213.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img213.png -------------------------------------------------------------------------------- /Wiki_Img/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img3.png -------------------------------------------------------------------------------- /Wiki_Img/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img4.png -------------------------------------------------------------------------------- /Wiki_Img/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img5.png -------------------------------------------------------------------------------- /Wiki_Img/img6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img6.png -------------------------------------------------------------------------------- /Wiki_Img/img7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img7.png -------------------------------------------------------------------------------- /Wiki_Img/img8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img8.png -------------------------------------------------------------------------------- /Wiki_Img/img9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/c192493ff5ca84f01a0e98ab5caed7a3bb275a51/Wiki_Img/img9.png --------------------------------------------------------------------------------