├── Graphics ├── Shared │ ├── Resources │ │ ├── sss │ │ ├── pcss │ │ ├── segi │ │ ├── box.png │ │ ├── btn.png │ │ ├── btn act.png │ │ ├── btn on.png │ │ ├── toggle.png │ │ ├── TextField.png │ │ ├── bluenoise.png │ │ ├── btn focus.png │ │ ├── btn onact.png │ │ ├── toggle on.png │ │ ├── blue noise.png │ │ ├── btn on focus.png │ │ ├── scroll horiz.png │ │ ├── scroll vert.png │ │ ├── slider horiz.png │ │ ├── slider thumb.png │ │ ├── toggle act.png │ │ ├── toggle focus.png │ │ ├── PopupWindowOff.png │ │ ├── PopupWindowOn.png │ │ ├── scroll vert up.png │ │ ├── toggle on act.png │ │ ├── toolbar button.png │ │ ├── TextField focused.png │ │ ├── scroll horiz left.png │ │ ├── scroll vert down.png │ │ ├── scroll vert thumb.png │ │ ├── slider thumb act.png │ │ ├── toggle on focus.png │ │ ├── toolbar button on.png │ │ ├── scroll horiz right.png │ │ ├── scroll horiz thumb.png │ │ ├── scroll vert up act.png │ │ ├── slider thumb focus.png │ │ ├── toolbar button act.png │ │ ├── scroll horiz left act.png │ │ ├── scroll horiz right act.png │ │ ├── scroll vert down act.png │ │ ├── toolbar button act on.png │ │ ├── Noise Textures │ │ │ ├── LDR_RGBA_0.png │ │ │ ├── LDR_RGBA_1.png │ │ │ ├── LDR_RGBA_10.png │ │ │ ├── LDR_RGBA_11.png │ │ │ ├── LDR_RGBA_12.png │ │ │ ├── LDR_RGBA_13.png │ │ │ ├── LDR_RGBA_14.png │ │ │ ├── LDR_RGBA_15.png │ │ │ ├── LDR_RGBA_16.png │ │ │ ├── LDR_RGBA_17.png │ │ │ ├── LDR_RGBA_18.png │ │ │ ├── LDR_RGBA_19.png │ │ │ ├── LDR_RGBA_2.png │ │ │ ├── LDR_RGBA_20.png │ │ │ ├── LDR_RGBA_21.png │ │ │ ├── LDR_RGBA_22.png │ │ │ ├── LDR_RGBA_23.png │ │ │ ├── LDR_RGBA_24.png │ │ │ ├── LDR_RGBA_25.png │ │ │ ├── LDR_RGBA_26.png │ │ │ ├── LDR_RGBA_27.png │ │ │ ├── LDR_RGBA_28.png │ │ │ ├── LDR_RGBA_29.png │ │ │ ├── LDR_RGBA_3.png │ │ │ ├── LDR_RGBA_30.png │ │ │ ├── LDR_RGBA_31.png │ │ │ ├── LDR_RGBA_32.png │ │ │ ├── LDR_RGBA_33.png │ │ │ ├── LDR_RGBA_34.png │ │ │ ├── LDR_RGBA_35.png │ │ │ ├── LDR_RGBA_36.png │ │ │ ├── LDR_RGBA_37.png │ │ │ ├── LDR_RGBA_38.png │ │ │ ├── LDR_RGBA_39.png │ │ │ ├── LDR_RGBA_4.png │ │ │ ├── LDR_RGBA_40.png │ │ │ ├── LDR_RGBA_41.png │ │ │ ├── LDR_RGBA_42.png │ │ │ ├── LDR_RGBA_43.png │ │ │ ├── LDR_RGBA_44.png │ │ │ ├── LDR_RGBA_45.png │ │ │ ├── LDR_RGBA_46.png │ │ │ ├── LDR_RGBA_47.png │ │ │ ├── LDR_RGBA_48.png │ │ │ ├── LDR_RGBA_49.png │ │ │ ├── LDR_RGBA_5.png │ │ │ ├── LDR_RGBA_50.png │ │ │ ├── LDR_RGBA_51.png │ │ │ ├── LDR_RGBA_52.png │ │ │ ├── LDR_RGBA_53.png │ │ │ ├── LDR_RGBA_54.png │ │ │ ├── LDR_RGBA_55.png │ │ │ ├── LDR_RGBA_56.png │ │ │ ├── LDR_RGBA_57.png │ │ │ ├── LDR_RGBA_58.png │ │ │ ├── LDR_RGBA_59.png │ │ │ ├── LDR_RGBA_6.png │ │ │ ├── LDR_RGBA_60.png │ │ │ ├── LDR_RGBA_61.png │ │ │ ├── LDR_RGBA_62.png │ │ │ ├── LDR_RGBA_63.png │ │ │ ├── LDR_RGBA_7.png │ │ │ ├── LDR_RGBA_8.png │ │ │ └── LDR_RGBA_9.png │ │ ├── localization.chinesesimplified.txt │ │ ├── localization.japanese.txt │ │ └── localization.korean.txt │ ├── Alloy │ │ ├── AreaLight │ │ │ ├── Defaults │ │ │ │ └── DefaultSpotCookie.tif │ │ │ └── AlloyAreaLight.cs │ │ ├── AlloyPropertyAttributes.cs │ │ └── AlloyUtils.cs │ ├── SSS │ │ ├── SSS_buffers_viewer.cs │ │ └── SSS_convolution.cs │ ├── Setting │ │ ├── LightSettings.cs │ │ ├── LightingSettings.cs │ │ ├── GlobalSettings.cs │ │ ├── SSSSettings.cs │ │ ├── DynamicSkyboxSettings.cs │ │ └── CameraSettings.cs │ ├── SceneController.cs │ ├── Shared.shproj │ ├── ReflectionExtensions.cs │ ├── SSSManager.cs │ ├── CharaController.cs │ ├── Texture │ │ ├── ExternalTextureManager.cs │ │ ├── TextureManager.cs │ │ └── InternalTextureManager.cs │ ├── SEGI │ │ └── SEGIPreset.cs │ ├── Inspector │ │ ├── PresetInspector.cs │ │ ├── Inspector.cs │ │ ├── SSSInspector.cs │ │ └── SettingsInspector.cs │ ├── CullingMaskExtensions.cs │ ├── PresetManager.cs │ ├── PostProcessingManager.cs │ ├── Patch │ │ └── Studio.cs │ ├── LocalizationManager.cs │ ├── Preset.cs │ ├── Utility.cs │ ├── FocusPuller.cs │ └── Graphics.cs ├── AIGraphics │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── packages.config │ ├── Graphics.cs │ └── AIGraphics.csproj ├── HS2Graphics │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Graphics.cs │ ├── packages.config │ └── HS2Graphics.csproj ├── AIGraphics.sln └── .editorconfig ├── ISSUE_TEMPLATE.md ├── README.md ├── .gitattributes └── .gitignore /Graphics/Shared/Resources/sss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/sss -------------------------------------------------------------------------------- /Graphics/Shared/Resources/pcss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/pcss -------------------------------------------------------------------------------- /Graphics/Shared/Resources/segi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/segi -------------------------------------------------------------------------------- /Graphics/Shared/Resources/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/box.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/btn.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/btn act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/btn act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/btn on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/btn on.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toggle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toggle.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/TextField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/TextField.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/bluenoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/bluenoise.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/btn focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/btn focus.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/btn onact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/btn onact.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toggle on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toggle on.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/blue noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/blue noise.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/btn on focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/btn on focus.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll horiz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll horiz.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll vert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll vert.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/slider horiz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/slider horiz.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/slider thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/slider thumb.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toggle act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toggle act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toggle focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toggle focus.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/PopupWindowOff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/PopupWindowOff.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/PopupWindowOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/PopupWindowOn.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll vert up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll vert up.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toggle on act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toggle on act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toolbar button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toolbar button.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/TextField focused.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/TextField focused.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll horiz left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll horiz left.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll vert down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll vert down.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll vert thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll vert thumb.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/slider thumb act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/slider thumb act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toggle on focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toggle on focus.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toolbar button on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toolbar button on.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll horiz right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll horiz right.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll horiz thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll horiz thumb.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll vert up act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll vert up act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/slider thumb focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/slider thumb focus.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toolbar button act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toolbar button act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll horiz left act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll horiz left act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll horiz right act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll horiz right act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/scroll vert down act.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/scroll vert down act.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/toolbar button act on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/toolbar button act on.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_0.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_1.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_10.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_11.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_12.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_13.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_14.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_15.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_16.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_17.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_18.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_19.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_2.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_20.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_21.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_22.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_23.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_24.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_25.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_26.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_27.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_28.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_29.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_3.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_30.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_31.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_32.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_33.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_34.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_35.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_36.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_37.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_38.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_39.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_4.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_40.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_41.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_42.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_43.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_44.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_45.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_46.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_47.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_48.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_49.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_5.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_50.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_51.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_52.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_53.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_54.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_55.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_56.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_57.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_58.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_59.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_6.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_60.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_61.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_61.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_62.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_62.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_63.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_63.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_7.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_8.png -------------------------------------------------------------------------------- /Graphics/Shared/Resources/Noise Textures/LDR_RGBA_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Resources/Noise Textures/LDR_RGBA_9.png -------------------------------------------------------------------------------- /Graphics/Shared/Alloy/AreaLight/Defaults/DefaultSpotCookie.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ore-/Graphics/HEAD/Graphics/Shared/Alloy/AreaLight/Defaults/DefaultSpotCookie.tif -------------------------------------------------------------------------------- /Graphics/Shared/Alloy/AlloyPropertyAttributes.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class MinValueAttribute : PropertyAttribute 4 | { 5 | public float Min; 6 | 7 | public MinValueAttribute(float min) 8 | { 9 | Min = min; 10 | } 11 | } 12 | 13 | 14 | public class MaxValueAttribute : PropertyAttribute 15 | { 16 | public float Max; 17 | 18 | public MaxValueAttribute(float min) 19 | { 20 | Max = min; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Graphics/Shared/SSS/SSS_buffers_viewer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [ExecuteInEditMode] 6 | public class SSS_buffers_viewer : MonoBehaviour 7 | { 8 | 9 | public Texture InputBuffer; 10 | // [ImageEffectOpaque]//con esto se ejecuta antes de stack 11 | private void OnRenderImage(RenderTexture source, RenderTexture destination) 12 | { 13 | if (InputBuffer) 14 | UnityEngine.Graphics.Blit(InputBuffer, destination); 15 | else 16 | UnityEngine.Graphics.Blit(source, destination); 17 | } 18 | } -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Expected Behavior 4 | 5 | 6 | ## Current Behavior 7 | 8 | 9 | ## Used AI_Graphics Version 10 | 11 | 12 | ## Steps to Reproduce 13 | 14 | 15 | 16 | 1. 17 | 2. 18 | 3. 19 | 4. 20 | -------------------------------------------------------------------------------- /Graphics/Shared/Setting/LightSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Graphics.Settings 2 | { 3 | internal class LightSettings 4 | { 5 | internal static float IntensityMin = 0f; 6 | internal static float IntensityMax = 8f; 7 | internal static float IntensityDefault = 1f; 8 | internal static float RotationXMin = -90f; 9 | internal static float RotationXMax = 90f; 10 | internal static float RotationYMin = -179.9f; 11 | internal static float RotationYMax = 180f; 12 | 13 | internal enum LightType 14 | { 15 | Directional, 16 | Point, 17 | Spot 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Graphics/Shared/SceneController.cs: -------------------------------------------------------------------------------- 1 | using KKAPI.Studio.SaveLoad; 2 | using KKAPI.Utilities; 3 | using Studio; 4 | 5 | namespace Graphics 6 | { 7 | internal class SceneController : SceneCustomFunctionController 8 | { 9 | protected override void OnSceneLoad(SceneOperationKind operation, ReadOnlyDictionary loadedItems) 10 | { 11 | Studio.Studio studio = GetStudio(); 12 | Graphics parent = Graphics.Instance; 13 | parent?.SkyboxManager?.SetupDefaultReflectionProbe(); 14 | parent?.PresetManager?.Load(GetExtendedData()); 15 | } 16 | 17 | protected override void OnSceneSave() 18 | { 19 | SetExtendedData(Graphics.Instance?.PresetManager.GetExtendedData()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Graphics/Shared/Alloy/AlloyUtils.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public static class AlloyUtils 4 | { 5 | public const string Name = "Alloy"; 6 | public const string Version = "4.3.0"; 7 | public const float SectionColorMax = 20.0f; 8 | 9 | public const string Path = Name + "/"; 10 | public const string MenuItem = "Window/" + Path; 11 | public const string ComponentMenu = Path + Name + " "; 12 | 13 | public static string AssetsPath => Application.dataPath + "/" + Path; 14 | 15 | //public static float IntensityToLumens(float intensity) { 16 | // return Mathf.Floor(Mathf.GammaToLinearSpace(intensity) * 100.0f); 17 | //} 18 | 19 | //public static float LumensToIntensity(float lumens) { 20 | // return Mathf.LinearToGammaSpace(lumens / 100.0f); 21 | //} 22 | } 23 | -------------------------------------------------------------------------------- /Graphics/Shared/Shared.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 732e22fd-82a6-47e9-b18e-aff3ede653ed 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Graphics 2 | Graphics settings plugin for AIGirl and HoneySelect2 3 | 4 | Inspired and heavily influenced by PHIBL. 5 | 6 | Please refer to unity's [post processing stack manual](https://docs.unity3d.com/2018.2/Documentation/Manual/PostProcessingOverview.html) for detailed description of the settings. [日本語](https://docs.unity3d.com/ja/2018.2/Manual/PostProcessingOverview.html) 7 | 8 | Similar to PHIBL, Graphics uses cubemaps for imaged based lighting (IBL). Some sample cubemaps available [here](https://mega.nz/#F!PEMRkASB!I0ZTv4OgV-mSxX07MWDMQw). Put them in a folder named "cubemaps" at the root of the installation folder. You can configure the path for them with [Configuration Manager](https://github.com/BepInEx/BepInEx.ConfigurationManager). 9 | 10 | ## Attributions 11 | [Alloy](https://github.com/Josh015/Alloy) 12 | [SEGI](https://github.com/sonicether/SEGI) 13 | [PCSS](https://github.com/TheMasonX/UnityPCSS) 14 | [keijiro/PostProcessingUtilities](https://github.com/keijiro/PostProcessingUtilities) 15 | [IllusionModdingAPI](https://github.com/IllusionMods/IllusionModdingAPI) 16 | -------------------------------------------------------------------------------- /Graphics/Shared/ReflectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Graphics 4 | { 5 | internal static class ReflectionExtensions 6 | { 7 | internal static T GetFieldValue(this object obj, string name) 8 | { 9 | // Set the flags so that private and public fields from instances will be found 10 | BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; 11 | FieldInfo field = obj.GetType().GetField(name, bindingFlags); 12 | return (T)field?.GetValue(obj); 13 | } 14 | 15 | internal static void SetFieldValue(this object obj, string name, object value) 16 | { 17 | // Set the flags so that private and public fields from instances will be found 18 | BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; 19 | FieldInfo field = obj.GetType().GetField(name, bindingFlags); 20 | field?.SetValue(obj, value); 21 | } 22 | 23 | internal static void CallMethod(this object obj, string methodName, object[] values) 24 | { 25 | obj.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance).Invoke(obj, values); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Graphics/AIGraphics/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Graphics")] 8 | [assembly: AssemblyDescription("Graphics Plugin for AI-Shoujo")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Graphics")] 11 | [assembly: AssemblyCopyright("Copyright © 2020")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("535a64f6-5478-4f5e-8b99-9cd6ac4d4a97")] 20 | 21 | // Version information for an assembly consists of the following four values: 22 | // 23 | // Major Version 24 | // Minor Version 25 | // Build Number 26 | // Revision 27 | // 28 | // You can specify all the values or you can default the Build and Revision Numbers 29 | // by using the '*' as shown below: 30 | // [assembly: AssemblyVersion("1.0.*")] 31 | [assembly: AssemblyFileVersion(Graphics.Graphics.Version)] 32 | [assembly: AssemblyVersion(Graphics.Graphics.Version)] -------------------------------------------------------------------------------- /Graphics/HS2Graphics/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Graphics")] 8 | [assembly: AssemblyDescription("Graphics Plugin for Honey Select 2")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("Graphics")] 11 | [assembly: AssemblyCopyright("Copyright © 2020")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("04b05781-2d6a-4804-969b-d2be6a4639ad")] 20 | 21 | // Version information for an assembly consists of the following four values: 22 | // 23 | // Major Version 24 | // Minor Version 25 | // Build Number 26 | // Revision 27 | // 28 | // You can specify all the values or you can default the Build and Revision Numbers 29 | // by using the '*' as shown below: 30 | // [assembly: AssemblyVersion("1.0.*")] 31 | [assembly: AssemblyFileVersion(Graphics.Graphics.Version)] 32 | [assembly: AssemblyVersion(Graphics.Graphics.Version)] 33 | -------------------------------------------------------------------------------- /Graphics/Shared/SSSManager.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Graphics 4 | { 5 | public class SSSManager 6 | { 7 | internal static SSS SSSInstance; 8 | 9 | // Initialize Components 10 | internal void Initialize() 11 | { 12 | SSSInstance = Graphics.Instance.CameraSettings.MainCamera.GetOrAddComponent(); 13 | } 14 | 15 | // When user enabled the option 16 | internal void Start() 17 | { 18 | // Apparently after release, it's going to be generated again automatically. 19 | // https://docs.unity3d.com/ScriptReference/RenderTexture.Release.html 20 | } 21 | 22 | // When user disabled the option 23 | internal void Destroy() 24 | { 25 | // cleanup render texture. 26 | Clear(ref SSSInstance.LightingTex); 27 | Clear(ref SSSInstance.LightingTexBlurred); 28 | Clear(ref SSSInstance.SSS_ProfileTex); 29 | 30 | SSSInstance.LightingTex.Release(); 31 | SSSInstance.LightingTexBlurred.Release(); 32 | SSSInstance.SSS_ProfileTex.Release(); 33 | } 34 | 35 | private static void Clear(ref RenderTexture texture) 36 | { 37 | RenderTexture rt = RenderTexture.active; 38 | RenderTexture.active = texture; 39 | GL.Clear(true, true, Color.clear); 40 | RenderTexture.active = rt; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Graphics/Shared/CharaController.cs: -------------------------------------------------------------------------------- 1 | using KKAPI; 2 | using KKAPI.Chara; 3 | using System.Collections; 4 | using AIChara; 5 | using UnityEngine; 6 | 7 | namespace Graphics 8 | { 9 | // TODO: Optimize Character Focus Controller... Somehow adding male is killing fps!? 10 | internal class CharaController : CharaCustomFunctionController 11 | { 12 | protected override void OnCardBeingSaved(GameMode currentGameMode) 13 | { 14 | //no action 15 | } 16 | 17 | protected override void OnReload(GameMode currentGameMode) 18 | { 19 | StartCoroutine(LoadColliders(currentGameMode)); 20 | } 21 | 22 | private IEnumerator LoadColliders(GameMode currentGameMode) 23 | { 24 | if (GameMode.Maker == currentGameMode || GameMode.Studio == currentGameMode) 25 | ChaControl.LoadHitObject(); 26 | 27 | yield return new WaitUntil(() => null != ChaControl.objHitBody && null != ChaControl.objHitHead); 28 | ForceColliderUpdate(false); 29 | } 30 | 31 | internal void ForceColliderUpdate(bool force) 32 | { 33 | GameObject[] hitObjects = { ChaControl.objHitBody, ChaControl.objHitHead }; 34 | foreach (GameObject hitObject in hitObjects) 35 | { 36 | if (ReferenceEquals(null, hitObject)) 37 | return; 38 | 39 | SkinnedCollisionHelper[] componentsInChildren = hitObject.GetComponentsInChildren(true); 40 | foreach (SkinnedCollisionHelper skinnedCollisionHelper in componentsInChildren) 41 | { 42 | skinnedCollisionHelper.gameObject.SetActive(true); 43 | skinnedCollisionHelper.forceUpdate = force; 44 | skinnedCollisionHelper.updateOncePerFrame = !force; 45 | } 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Graphics/Shared/Texture/ExternalTextureManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace Graphics.Textures 7 | { 8 | internal class ExternalTextureManager : TextureManager 9 | { 10 | internal override string SearchPattern { get; set; } 11 | 12 | internal override IEnumerator LoadPreview(string path) 13 | { 14 | if (!File.Exists(path)) yield break; 15 | 16 | byte[] textureByte = File.ReadAllBytes(path); 17 | yield return textureByte; 18 | if (null == textureByte) 19 | { 20 | _assetsToLoad--; 21 | yield break; 22 | } 23 | Texture2D texture = KKAPI.Utilities.TextureUtils.LoadTexture(textureByte); 24 | yield return texture; 25 | Texture2D preview = new Texture2D(texture.width, texture.height, texture.format, false); 26 | UnityEngine.Graphics.CopyTexture(texture, preview); 27 | Util.ResizeTexture(preview, 64, 64, false); 28 | Previews.Add(preview); 29 | TexturePaths.Add(path); 30 | texture = null; 31 | _assetsToLoad--; 32 | } 33 | internal override IEnumerator LoadTexture(string path, Action onChanged = null) 34 | { 35 | if (!File.Exists(path)) yield break; 36 | 37 | byte[] textureByte = File.ReadAllBytes(path); 38 | yield return textureByte; 39 | if (null == textureByte) 40 | { 41 | yield break; 42 | } 43 | CurrentTexture = KKAPI.Utilities.TextureUtils.LoadTexture(textureByte); 44 | yield return CurrentTexture; 45 | onChanged(CurrentTexture); 46 | } 47 | 48 | internal void LoadTexture(int index, Action onChanged = null) 49 | { 50 | if (index < 0 || index >= TexturePaths?.Count) 51 | { 52 | return; 53 | } 54 | StartCoroutine(LoadTexture(CurrentTexturePath = TexturePaths?[index], onChanged)); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Graphics/HS2Graphics/Graphics.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using KKAPI; 3 | using System.Collections; 4 | using UnityEngine; 5 | using UnityEngine.SceneManagement; 6 | 7 | namespace Graphics 8 | { 9 | public partial class Graphics : BaseUnityPlugin 10 | { 11 | private void OnSceneLoaded(Scene scene, LoadSceneMode mode) 12 | { 13 | StartCoroutine(InitializeLight(scene)); 14 | CullingMaskExtensions.RefreshLayers(); 15 | } 16 | 17 | private IEnumerator InitializeLight(Scene scene) 18 | { 19 | yield return new WaitUntil(() => _lightManager != null); 20 | 21 | if (GameMode.Maker == KoikatuAPI.GetCurrentGameMode() && scene.name == "CharaCustom") 22 | { 23 | GameObject lights = GameObject.Find("CharaCustom/CustomControl/CharaCamera/Main Camera/Lights Custom"); 24 | if (ReferenceEquals(lights, null)) 25 | { 26 | Transform backLight = lights.transform.Find("Directional Light Back"); 27 | if (ReferenceEquals(backLight, null)) 28 | { 29 | Light light = backLight.GetComponent(); 30 | if (ReferenceEquals(light, null)) 31 | { 32 | light.enabled = false; 33 | } 34 | } 35 | } 36 | } 37 | 38 | LightManager.Light(); 39 | } 40 | 41 | private bool IsLoaded() 42 | { 43 | switch (KoikatuAPI.GetCurrentGameMode()) 44 | { 45 | case GameMode.Maker: 46 | return KKAPI.Maker.MakerAPI.InsideAndLoaded; 47 | case GameMode.Studio: 48 | return KKAPI.Studio.StudioAPI.StudioLoaded; 49 | case GameMode.MainGame: 50 | return "MyRoom" == SceneManager.GetActiveScene().name && SceneManager.GetActiveScene().isLoaded && null != Camera.main; //HS2API doesn't provide an api for in game check 51 | default: 52 | return false; 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Graphics/AIGraphics/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Graphics/Shared/Texture/TextureManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Graphics.Textures 6 | { 7 | internal abstract class TextureManager : MonoBehaviour 8 | { 9 | private string _assetPath; 10 | internal int _assetsToLoad = 0; 11 | internal bool HasAssetsLoaded => 0 == _assetsToLoad; 12 | internal List Previews { get; set; } 13 | internal Texture[] PreviewArray { get; set; } 14 | internal abstract string SearchPattern { get; set; } 15 | internal virtual List TexturePaths { get; set; } 16 | internal virtual Texture CurrentTexture { get; set; } 17 | internal virtual string CurrentTexturePath { get; set; } 18 | internal virtual int CurrentTextureIndex 19 | { 20 | get => Array.IndexOf(TexturePaths.ToArray(), CurrentTexturePath); 21 | set => throw new System.NotImplementedException(); 22 | } 23 | 24 | internal abstract System.Collections.IEnumerator LoadTexture(string path, Action onChanged = null); 25 | internal abstract System.Collections.IEnumerator LoadPreview(string path); 26 | 27 | internal string AssetPath 28 | { 29 | get => _assetPath; 30 | set 31 | { 32 | _assetPath = value; 33 | StartCoroutine(LoadAssets()); 34 | } 35 | } 36 | 37 | internal virtual System.Collections.IEnumerator LoadAssets() 38 | { 39 | CurrentTexturePath = ""; 40 | List paths = Util.GetFiles(AssetPath, SearchPattern); 41 | //populate TexturePaths in each preview load to ensure index is consistent between TexturePaths and Previews 42 | TexturePaths = new List(); 43 | Previews = new List(); 44 | _assetsToLoad = paths.Count; 45 | foreach (string path in paths) 46 | { 47 | StartCoroutine(LoadPreview(path)); 48 | } 49 | yield return new WaitUntil(() => HasAssetsLoaded); 50 | PreviewArray = Previews.ToArray(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Graphics/Shared/SEGI/SEGIPreset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | //https://github.com/sonicether/SEGI 5 | namespace Graphics 6 | { 7 | public class SEGIPreset : ScriptableObject 8 | { 9 | public SEGI.VoxelResolution voxelResolution = SEGI.VoxelResolution.high; 10 | public bool voxelAA = false; 11 | [Range(0, 2)] 12 | public int innerOcclusionLayers = 1; 13 | public bool infiniteBounces = true; 14 | 15 | [Range(0.01f, 1.0f)] 16 | public float temporalBlendWeight = 0.15f; 17 | public bool useBilateralFiltering = true; 18 | public bool halfResolution = true; 19 | public bool stochasticSampling = true; 20 | public bool doReflections = true; 21 | 22 | [Range(1, 128)] 23 | public int cones = 13; 24 | [Range(1, 32)] 25 | public int coneTraceSteps = 8; 26 | [Range(0.1f, 2.0f)] 27 | public float coneLength = 1.0f; 28 | [Range(0.5f, 6.0f)] 29 | public float coneWidth = 6.0f; 30 | [Range(0.0f, 4.0f)] 31 | public float coneTraceBias = 0.63f; 32 | [Range(0.0f, 4.0f)] 33 | public float occlusionStrength = 1.0f; 34 | [Range(0.0f, 4.0f)] 35 | public float nearOcclusionStrength = 0.0f; 36 | [Range(0.001f, 4.0f)] 37 | public float occlusionPower = 1.0f; 38 | [Range(0.0f, 4.0f)] 39 | public float nearLightGain = 1.0f; 40 | [Range(0.0f, 4.0f)] 41 | public float giGain = 1.0f; 42 | [Range(0.0f, 2.0f)] 43 | public float secondaryBounceGain = 1.0f; 44 | [Range(12, 128)] 45 | public int reflectionSteps = 64; 46 | [Range(0.001f, 4.0f)] 47 | public float reflectionOcclusionPower = 1.0f; 48 | [Range(0.0f, 1.0f)] 49 | public float skyReflectionIntensity = 1.0f; 50 | public bool gaussianMipFilter = false; 51 | 52 | [Range(0.1f, 4.0f)] 53 | public float farOcclusionStrength = 1.0f; 54 | [Range(0.1f, 4.0f)] 55 | public float farthestOcclusionStrength = 1.0f; 56 | 57 | [Range(3, 16)] 58 | public int secondaryCones = 6; 59 | [Range(0.1f, 4.0f)] 60 | public float secondaryOcclusionStrength = 1.0f; 61 | } 62 | } -------------------------------------------------------------------------------- /Graphics/HS2Graphics/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Graphics/AIGraphics/Graphics.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using Graphics.Settings; 3 | using KKAPI; 4 | using KKAPI.Studio.SaveLoad; 5 | using System.Collections; 6 | using UnityEngine; 7 | using UnityEngine.SceneManagement; 8 | 9 | namespace Graphics 10 | { 11 | public partial class Graphics : BaseUnityPlugin 12 | { 13 | 14 | private void OnSceneLoaded(Scene scene, LoadSceneMode mode) 15 | { 16 | if (scene.name == "map_title" && PostProcessingSettings != null) 17 | { 18 | PostProcessingSettings.ResetVolume(); 19 | } 20 | else 21 | { 22 | StartCoroutine(InitializeLight(scene)); 23 | } 24 | CullingMaskExtensions.RefreshLayers(); 25 | } 26 | 27 | private IEnumerator InitializeLight(Scene scene) 28 | { 29 | yield return new WaitUntil(() => _lightManager != null); 30 | 31 | if (GameMode.Maker == KoikatuAPI.GetCurrentGameMode() && scene.name == "CharaCustom") 32 | { 33 | GameObject lights = GameObject.Find("CharaCustom/CustomControl/CharaCamera/Main Camera/Lights Custom"); 34 | if (lights != null) 35 | { 36 | Transform backLight = lights.transform.Find("Directional Light Back"); 37 | if (backLight != null) 38 | { 39 | Light light = backLight.GetComponent(); 40 | if (light != null) 41 | { 42 | light.enabled = false; 43 | } 44 | } 45 | } 46 | } 47 | 48 | LightManager.Light(); 49 | } 50 | 51 | private bool IsLoaded() 52 | { 53 | switch (KoikatuAPI.GetCurrentGameMode()) 54 | { 55 | case GameMode.Maker: 56 | return KKAPI.Maker.MakerAPI.InsideAndLoaded; 57 | case GameMode.Studio: 58 | return KKAPI.Studio.StudioAPI.StudioLoaded; 59 | case GameMode.MainGame: 60 | return null != GameObject.Find("MapScene") && SceneManager.GetActiveScene().isLoaded && null != Camera.main; //KKAPI doesn't provide an api for in game check 61 | default: 62 | return false; 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /Graphics/AIGraphics.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30002.166 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIGraphics", "AIGraphics\AIGraphics.csproj", "{535A64F6-5478-4F5E-8B99-9CD6AC4D4A97}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A707771D-D402-406D-8B19-87C96E5922C8}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | EndProjectSection 12 | EndProject 13 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Shared", "Shared\Shared.shproj", "{732E22FD-82A6-47E9-B18E-AFF3EDE653ED}" 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HS2Graphics", "HS2Graphics\HS2Graphics.csproj", "{04B05781-2D6A-4804-969B-D2BE6A4639AD}" 16 | EndProject 17 | Global 18 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 19 | Shared\Shared.projitems*{04b05781-2d6a-4804-969b-d2be6a4639ad}*SharedItemsImports = 4 20 | Shared\Shared.projitems*{535a64f6-5478-4f5e-8b99-9cd6ac4d4a97}*SharedItemsImports = 4 21 | Shared\Shared.projitems*{732e22fd-82a6-47e9-b18e-aff3ede653ed}*SharedItemsImports = 13 22 | EndGlobalSection 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Release|Any CPU = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {535A64F6-5478-4F5E-8B99-9CD6AC4D4A97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {535A64F6-5478-4F5E-8B99-9CD6AC4D4A97}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {535A64F6-5478-4F5E-8B99-9CD6AC4D4A97}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {535A64F6-5478-4F5E-8B99-9CD6AC4D4A97}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {04B05781-2D6A-4804-969B-D2BE6A4639AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {04B05781-2D6A-4804-969B-D2BE6A4639AD}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {04B05781-2D6A-4804-969B-D2BE6A4639AD}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {04B05781-2D6A-4804-969B-D2BE6A4639AD}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {216071F6-66C8-4340-87FE-ECC7C7B4E7DC} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Graphics/Shared/Inspector/PresetInspector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using static Graphics.Inspector.Util; 4 | 5 | namespace Graphics.Inspector 6 | { 7 | internal static class PresetInspector 8 | { 9 | private const string _nameCue = "(preset name)"; 10 | private static string _nameToSave = _nameCue; 11 | private static int _presetIndexOld = -1; 12 | private static int _presetIndexCurrent = -1; 13 | 14 | private static bool ShouldUpdate => _presetIndexCurrent != -1 && _presetIndexCurrent != _presetIndexOld; 15 | 16 | private static Vector2 presetScrollView; 17 | internal static void Draw(PresetManager presetManager) 18 | { 19 | GUILayout.BeginVertical(GUIStyles.Skin.box); 20 | Label("Presets",""); 21 | GUILayout.Space(1); 22 | if (presetManager.PresetNames.IsNullOrEmpty()) 23 | { 24 | Label("No presets found",""); 25 | } 26 | else 27 | { 28 | presetScrollView = GUILayout.BeginScrollView(presetScrollView); 29 | _presetIndexCurrent = Array.IndexOf(presetManager.PresetNames, presetManager.CurrentPreset); 30 | _presetIndexCurrent = GUILayout.SelectionGrid(_presetIndexCurrent, presetManager.PresetNames, Inspector.Width / 200); 31 | if (ShouldUpdate) 32 | { 33 | presetManager.CurrentPreset = presetManager.PresetNames[_presetIndexCurrent]; 34 | _presetIndexOld = _presetIndexCurrent; // to prevent continous update; 35 | } 36 | 37 | GUILayout.EndScrollView(); 38 | } 39 | GUILayout.Space(1); 40 | GUILayout.BeginHorizontal(); 41 | _nameToSave = GUILayout.TextField(_nameToSave); 42 | bool isValidFileName = (0 != _nameToSave.Length && 256 >= _nameToSave.Length); 43 | bool isCue = (_nameCue == _nameToSave); 44 | if (Button("Save") && isValidFileName && !isCue) 45 | { 46 | presetManager.Save(_nameToSave); 47 | presetManager.CurrentPreset = _nameToSave; 48 | _presetIndexOld = Array.IndexOf(presetManager.PresetNames, presetManager.CurrentPreset); 49 | } 50 | GUILayout.EndHorizontal(); 51 | GUILayout.Space(1); 52 | if (!isCue && !isValidFileName) 53 | { 54 | GUILayout.Label("Please specify a valid file name."); 55 | } 56 | 57 | GUILayout.EndVertical(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Graphics/Shared/Texture/InternalTextureManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using UnityEngine; 6 | 7 | namespace Graphics.Textures 8 | { 9 | internal class InternalTextureManager : TextureManager 10 | { 11 | private List _texturePaths; 12 | internal string[] TextureNames { get; set; } 13 | internal List Textures { get; set; } 14 | internal override string SearchPattern { get; set; } 15 | 16 | internal override IEnumerator LoadPreview(string path) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | 21 | internal override IEnumerator LoadTexture(string path, Action onChanged = null) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | 26 | internal override System.Collections.IEnumerator LoadAssets() 27 | { 28 | CurrentTexturePath = ""; 29 | Textures = new List(); 30 | foreach (string asset in TexturePaths) 31 | { 32 | Texture2D texture = CommonLib.LoadAsset(AssetPath, asset, false, string.Empty); 33 | yield return texture; 34 | if (texture != null) 35 | { 36 | Textures.Add(texture); 37 | } 38 | _assetsToLoad--; 39 | } 40 | yield return new WaitUntil(() => HasAssetsLoaded); 41 | TextureNames = TexturePaths.Select(path => getName(path)).ToArray(); 42 | } 43 | 44 | internal string CurrentTextureName => getName(CurrentTexturePath); 45 | 46 | private string getName(string path) 47 | { 48 | string name = path.StartsWith(SearchPattern) ? path.Remove(0, SearchPattern.Length) : path; 49 | return name; 50 | } 51 | 52 | internal Texture GetTexture(string textureName) 53 | { 54 | int index = TexturePaths.IndexOf(SearchPattern + textureName); 55 | return GetTexture(index); 56 | } 57 | 58 | internal Texture GetTexture(int index) 59 | { 60 | if (0 <= index) 61 | { 62 | CurrentTexture = Textures[index]; 63 | CurrentTexturePath = TexturePaths[index]; 64 | return CurrentTexture; 65 | } 66 | return null; 67 | } 68 | 69 | internal override List TexturePaths 70 | { 71 | get => _texturePaths; 72 | set 73 | { 74 | _texturePaths = value; 75 | _assetsToLoad = _texturePaths.Count; 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Graphics/Shared/CullingMaskExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Graphics 5 | { 6 | //https://www.gamasutra.com/blogs/CharlesCordingley/20141124/230710/Unity3D_Culling_Mask_Tip.php 7 | internal static class CullingMaskExtensions 8 | { 9 | internal static List Layers { get; private set; } 10 | 11 | internal static void RefreshLayers() 12 | { 13 | List layers = new List(); 14 | for (int i = 0; i <= 31; i++) 15 | { 16 | var layerN = LayerMask.LayerToName(i); 17 | if (layerN.Length > 0) 18 | layers.Add(layerN); 19 | } 20 | Layers = layers; 21 | } 22 | 23 | internal static int LayerCullingShow(int cullingMask, int layerMask) 24 | { 25 | cullingMask |= layerMask; 26 | return cullingMask; 27 | } 28 | 29 | internal static int LayerCullingShow(int cullingMask, string layer) 30 | { 31 | return LayerCullingShow(cullingMask, 1 << LayerMask.NameToLayer(layer)); 32 | } 33 | 34 | internal static int LayerCullingHide(int cullingMask, int layerMask) 35 | { 36 | cullingMask &= ~layerMask; 37 | return cullingMask; 38 | } 39 | 40 | internal static int LayerCullingHide(int cullingMask, string layer) 41 | { 42 | return LayerCullingHide(cullingMask, 1 << LayerMask.NameToLayer(layer)); 43 | } 44 | 45 | internal static int LayerCullingToggle(int cullingMask, int layerMask) 46 | { 47 | cullingMask ^= layerMask; 48 | return cullingMask; 49 | } 50 | 51 | internal static int LayerCullingToggle(int cullingMask, string layer) 52 | { 53 | return LayerCullingToggle(cullingMask, 1 << LayerMask.NameToLayer(layer)); 54 | } 55 | 56 | internal static bool LayerCullingIncludes(int cullingMask, int layerMask) 57 | { 58 | return (cullingMask & layerMask) > 0; 59 | } 60 | 61 | internal static bool LayerCullingIncludes(int cullingMask, string layer) 62 | { 63 | return LayerCullingIncludes(cullingMask, 1 << LayerMask.NameToLayer(layer)); 64 | } 65 | 66 | internal static int LayerCullingToggle(int cullingMask, int layerMask, bool isOn) 67 | { 68 | bool included = LayerCullingIncludes(cullingMask, layerMask); 69 | if (isOn && !included) 70 | { 71 | return LayerCullingShow(cullingMask, layerMask); 72 | } 73 | else if (!isOn && included) 74 | { 75 | return LayerCullingHide(cullingMask, layerMask); 76 | } 77 | return cullingMask; 78 | } 79 | 80 | internal static int LayerCullingToggle(int cullingMask, string layer, bool isOn) 81 | { 82 | return LayerCullingToggle(cullingMask, 1 << LayerMask.NameToLayer(layer), isOn); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Graphics/Shared/Setting/LightingSettings.cs: -------------------------------------------------------------------------------- 1 | using MessagePack; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | 5 | namespace Graphics.Settings 6 | { 7 | [MessagePackObject(keyAsPropertyName: true)] 8 | public class LightingSettings 9 | { 10 | private string textAmbientIntensity = "1"; 11 | private string textReflectionIntensity = "1"; 12 | private string textReflectionBounces = "1"; 13 | 14 | internal static int[] ReflectionResolutions = { 128, 256, 512, 1024, 2048 }; 15 | public enum AIAmbientMode 16 | { 17 | Skybox = AmbientMode.Skybox, 18 | Trilight = AmbientMode.Trilight, 19 | Flat = AmbientMode.Flat, 20 | } 21 | 22 | internal Material SkyboxSetting 23 | { 24 | get => RenderSettings.skybox; 25 | set => RenderSettings.skybox = value; 26 | } 27 | 28 | internal Light SunSetting => RenderSettings.sun; 29 | 30 | public AIAmbientMode AmbientModeSetting 31 | { 32 | get => (AIAmbientMode)RenderSettings.ambientMode; 33 | set 34 | { 35 | if (value != AIAmbientMode.Skybox) 36 | { 37 | RenderSettings.ambientLight = Color.white; 38 | } 39 | RenderSettings.ambientMode = (AmbientMode)value; 40 | } 41 | } 42 | 43 | public float AmbientIntensity 44 | { 45 | get => RenderSettings.ambientIntensity; 46 | set 47 | { 48 | if (RenderSettings.ambientIntensity != value) 49 | { 50 | textAmbientIntensity = value.ToString("N0"); 51 | RenderSettings.ambientIntensity = value; 52 | } 53 | } 54 | } 55 | 56 | public DefaultReflectionMode ReflectionMode 57 | { 58 | get => RenderSettings.defaultReflectionMode; 59 | set => RenderSettings.defaultReflectionMode = value; 60 | } 61 | 62 | public int ReflectionResolution 63 | { 64 | get => RenderSettings.defaultReflectionResolution; 65 | set => RenderSettings.defaultReflectionResolution = value; 66 | } 67 | 68 | public float ReflectionIntensity 69 | { 70 | get => RenderSettings.reflectionIntensity; 71 | set 72 | { 73 | if (RenderSettings.reflectionIntensity != value) 74 | { 75 | textReflectionIntensity = value.ToString("N2"); 76 | RenderSettings.reflectionIntensity = value; 77 | } 78 | } 79 | } 80 | 81 | public int ReflectionBounces 82 | { 83 | get => RenderSettings.reflectionBounces; 84 | set 85 | { 86 | if (RenderSettings.reflectionBounces != value) 87 | { 88 | textReflectionBounces = value.ToString("N0"); 89 | RenderSettings.reflectionBounces = value; 90 | } 91 | } 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /Graphics/Shared/PresetManager.cs: -------------------------------------------------------------------------------- 1 | using ExtensibleSaveFormat; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | namespace Graphics 7 | { 8 | internal class PresetManager 9 | { 10 | private readonly string _path; 11 | private string _currentPresetName; 12 | private Dictionary _presetNameToPath; 13 | private readonly Graphics _parent; 14 | 15 | internal PresetManager(string presetPath, Graphics parent) 16 | { 17 | _path = presetPath; 18 | _parent = parent; 19 | LoadPresets(); 20 | } 21 | 22 | private void LoadPresets() 23 | { 24 | _presetNameToPath = Util.GetRelativeFileNameToFullPathMap(_path, "*.preset"); 25 | } 26 | 27 | internal string PresetPath(string presetName) 28 | { 29 | return _presetNameToPath.TryGetValue(presetName, out string presetPath) ? presetPath : ""; 30 | } 31 | internal string[] PresetNames => _presetNameToPath.Keys.ToArray(); 32 | 33 | internal string CurrentPreset 34 | { 35 | get => _currentPresetName; 36 | set 37 | { 38 | Load(value); 39 | _currentPresetName = value; 40 | } 41 | } 42 | 43 | internal void Save(string presetName) 44 | { 45 | Preset preset = new Preset(_parent.Settings, _parent.CameraSettings, _parent.LightingSettings, _parent.PostProcessingSettings, _parent.SkyboxManager.skyboxParams, _parent.SSSSettings); 46 | preset.Save(presetName); 47 | LoadPresets(); 48 | } 49 | 50 | internal PluginData GetExtendedData() 51 | { 52 | Preset preset = new Preset(_parent.Settings, _parent.CameraSettings, _parent.LightingSettings, _parent.PostProcessingSettings, _parent.SkyboxManager.skyboxParams, _parent.SSSSettings); 53 | PluginData saveData = new PluginData(); 54 | preset.UpdateParameters(); 55 | byte[] presetData = preset.Serialize(); 56 | saveData.data.Add("bytes", presetData); 57 | saveData.version = 1; 58 | return saveData; 59 | } 60 | 61 | internal bool Load(string presetName) 62 | { 63 | Preset preset = new Preset(_parent.Settings, _parent.CameraSettings, _parent.LightingSettings, _parent.PostProcessingSettings, _parent.SkyboxManager.skyboxParams, _parent.SSSSettings); 64 | return preset.Load(presetName); 65 | } 66 | 67 | internal void Load(PluginData data) 68 | { 69 | if (data != null && data.data.TryGetValue("bytes", out object val)) 70 | { 71 | byte[] presetData = (byte[])val; 72 | if (!presetData.IsNullOrEmpty()) 73 | { 74 | Preset preset = new Preset(_parent.Settings, _parent.CameraSettings, _parent.LightingSettings, _parent.PostProcessingSettings, _parent.SkyboxManager.skyboxParams, _parent.SSSSettings); 75 | preset.Load(presetData); 76 | } 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Graphics/Shared/PostProcessingManager.cs: -------------------------------------------------------------------------------- 1 | using Graphics.Textures; 2 | using System; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace Graphics 7 | { 8 | 9 | internal class PostProcessingManager : MonoBehaviour 10 | { 11 | private Graphics _parent; 12 | private ExternalTextureManager _lensDirtManager; 13 | private InternalTextureManager _lutManager; 14 | private readonly string _lutAssetPath = "studio/lut/00.unity3d"; 15 | private readonly List _lutTexturePaths = new List() 16 | { 17 | "Lut_Default", "Lut_TimeDay", "Lut_TimeSundown", "Lut_TimeNight", "Lut_Warm", "Lut_Cold", 18 | "Lut_Dull", "Lut_Pale", "Lut_Soft", "Lut_Strong", "Lut_Deep", "Lut_Bright", "Lut_Sepia", "Lut_Monochrome", 19 | "Lut_MonoRed", "Lut_MonoBlue", "Lut_MonoGreen", "Lut_LimitRed", "Lut_LimitBlue", "Lut_LimitGreen", 20 | "Lut_InvertMono", "Lut_Invert", "Lut_Sarmo", "Lut_Posterize", 21 | "Lut_OldPoster1", "Lut_OldPoster2", "Lut_RobotSalvation", "Lut_Greyish", "Lut_DarkGreyish", 22 | "Lut_Art", "Lut_Comic", "Lut_Aliens", "Lut_Fog", "Lut_Desert", "Lut_Vibrance_D" 23 | }; 24 | 25 | internal string LensDirtTexturesPath 26 | { 27 | get => _lensDirtManager.AssetPath; 28 | set => _lensDirtManager.AssetPath = value; 29 | } 30 | 31 | internal Texture CurrentLensDirtTexture => _lensDirtManager.CurrentTexture; 32 | 33 | internal string CurrentLensDirtTexturePath => _lensDirtManager.CurrentTexturePath; 34 | 35 | internal int CurrentLensDirtTextureIndex => _lensDirtManager.CurrentTextureIndex; 36 | 37 | internal Texture[] LensDirtPreviews => _lensDirtManager.PreviewArray; 38 | 39 | internal void LoadLensDirtTexture(int index, Action onChanged = null) 40 | { 41 | _lensDirtManager.LoadTexture(index, onChanged); 42 | } 43 | internal void LoadLensDirtTexture(string path, Action onChanged = null) 44 | { 45 | StartCoroutine(_lensDirtManager.LoadTexture(path, onChanged)); 46 | } 47 | 48 | internal Texture CurrentLUTTexture => _lutManager.CurrentTexture; 49 | 50 | internal string CurrentLUTName => _lutManager.CurrentTextureName.IsNullOrEmpty() ? LUTNames[0] : _lutManager.CurrentTextureName; 51 | 52 | internal int CurrentLUTIndex => _lutManager.CurrentTextureIndex >= 0 ? _lutManager.CurrentTextureIndex : 0; 53 | 54 | internal string[] LUTNames => _lutManager.TextureNames; 55 | 56 | internal Texture LoadLUT(int index) 57 | { 58 | return _lutManager.GetTexture(index); 59 | } 60 | 61 | internal Texture LoadLUT(string name) 62 | { 63 | return _lutManager.GetTexture(name); 64 | } 65 | 66 | internal Graphics Parent 67 | { 68 | get => _parent; 69 | set 70 | { 71 | _parent = value; 72 | _lensDirtManager = _parent.GetOrAddComponent(); 73 | _lensDirtManager.SearchPattern = "*.png"; 74 | _lutManager = _parent.GetOrAddComponent(); 75 | _lutManager.TexturePaths = _lutTexturePaths; 76 | _lutManager.SearchPattern = "Lut_"; 77 | _lutManager.AssetPath = _lutAssetPath; 78 | } 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /Graphics/Shared/Inspector/Inspector.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using static Graphics.Inspector.Util; 3 | 4 | namespace Graphics.Inspector 5 | { 6 | internal class Inspector 7 | { 8 | private static Rect _windowRect; 9 | private readonly int _windowID = 0; 10 | private enum Tab { Lighting, Lights, PostProcessing, SSS, Presets, Settings }; 11 | private Tab SelectedTab { get; set; } 12 | internal Graphics Parent { get; set; } 13 | 14 | internal Inspector(Graphics parent) 15 | { 16 | Parent = parent; 17 | _windowRect = new Rect(StartOffsetX, StartOffsetY, Width, Height); 18 | } 19 | 20 | internal static int Width 21 | { 22 | get => Graphics.ConfigWindowWidth.Value; 23 | set 24 | { 25 | Graphics.ConfigWindowWidth.Value = value; 26 | _windowRect.width = value; 27 | } 28 | } 29 | 30 | internal static int Height 31 | { 32 | get => Graphics.ConfigWindowHeight.Value; 33 | set 34 | { 35 | Graphics.ConfigWindowHeight.Value = value; 36 | _windowRect.height = value; 37 | } 38 | } 39 | 40 | internal static int StartOffsetX 41 | { 42 | get => Graphics.ConfigWindowOffsetX.Value; 43 | set => Graphics.ConfigWindowOffsetX.Value = value; 44 | } 45 | 46 | internal static int StartOffsetY 47 | { 48 | get => Graphics.ConfigWindowOffsetY.Value; 49 | set => Graphics.ConfigWindowOffsetY.Value = value; 50 | } 51 | 52 | internal void DrawWindow() 53 | { 54 | _windowRect = GUILayout.Window(_windowID, _windowRect, WindowFunction, ""); 55 | EatInputInRect(_windowRect); 56 | StartOffsetX = (int)_windowRect.x; 57 | StartOffsetY = (int)_windowRect.y; 58 | } 59 | 60 | private void WindowFunction(int thisWindowID) 61 | { 62 | GUILayout.BeginVertical(GUIStyles.Skin.box); 63 | SelectedTab = Toolbar(SelectedTab); 64 | DrawTabs(SelectedTab); 65 | GUILayout.FlexibleSpace(); 66 | GUILayout.EndVertical(); 67 | GUI.DragWindow(); 68 | } 69 | 70 | private void DrawTabs(Tab tabSelected) 71 | { 72 | GUILayout.Space(10); 73 | switch (tabSelected) 74 | { 75 | case Tab.Lighting: 76 | LightingInspector.Draw(Parent.LightingSettings, Parent.SkyboxManager, Parent.Settings.ShowAdvancedSettings); 77 | break; 78 | case Tab.Lights: 79 | LightInspector.Draw(Parent.Settings, Parent.LightManager, Parent.Settings.ShowAdvancedSettings); 80 | break; 81 | case Tab.PostProcessing: 82 | PostProcessingInspector.Draw(Parent.PostProcessingSettings, Parent.PostProcessingManager, Parent.Settings.ShowAdvancedSettings); 83 | break; 84 | case Tab.SSS: 85 | SSSInspector.Draw(); 86 | break; 87 | case Tab.Presets: 88 | PresetInspector.Draw(Parent.PresetManager); 89 | break; 90 | case Tab.Settings: 91 | SettingsInspector.Draw(Parent.CameraSettings, Parent.Settings, Parent.Settings.ShowAdvancedSettings); 92 | break; 93 | } 94 | } 95 | 96 | private static void EatInputInRect(Rect eatRect) 97 | { 98 | if (eatRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) 99 | { 100 | Input.ResetInputAxes(); 101 | } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Graphics/Shared/Setting/GlobalSettings.cs: -------------------------------------------------------------------------------- 1 | using Graphics.Inspector; 2 | using MessagePack; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | namespace Graphics.Settings 7 | { 8 | [MessagePackObject(keyAsPropertyName: true)] 9 | public class GlobalSettings 10 | { 11 | private int _pixelLightCount; 12 | 13 | public int PixelLightCount 14 | { 15 | get => QualitySettings.pixelLightCount; 16 | set => QualitySettings.pixelLightCount = _pixelLightCount = value; 17 | } 18 | 19 | public AnisotropicFiltering AnisotropicFiltering 20 | { 21 | get => QualitySettings.anisotropicFiltering; 22 | set => QualitySettings.anisotropicFiltering = value; 23 | } 24 | 25 | public int AntiAliasing 26 | { 27 | get => QualitySettings.antiAliasing; 28 | set => QualitySettings.antiAliasing = value; 29 | } 30 | 31 | public bool RealtimeReflectionProbes 32 | { 33 | get => QualitySettings.realtimeReflectionProbes; 34 | set => QualitySettings.realtimeReflectionProbes = value; 35 | } 36 | 37 | public ShadowmaskMode ShadowmaskModeSetting 38 | { 39 | get => QualitySettings.shadowmaskMode; 40 | set => QualitySettings.shadowmaskMode = value; 41 | } 42 | 43 | public ShadowQuality ShadowQualitySetting 44 | { 45 | get => QualitySettings.shadows; 46 | set => QualitySettings.shadows = value; 47 | } 48 | 49 | public ShadowResolution ShadowResolutionSetting 50 | { 51 | get => QualitySettings.shadowResolution; 52 | set => QualitySettings.shadowResolution = value; 53 | } 54 | 55 | public ShadowProjection ShadowProjectionSetting 56 | { 57 | get => QualitySettings.shadowProjection; 58 | set => QualitySettings.shadowProjection = value; 59 | } 60 | 61 | public float ShadowDistance 62 | { 63 | get => QualitySettings.shadowDistance; 64 | set => QualitySettings.shadowDistance = value; 65 | } 66 | 67 | public float ShadowNearPlaneOffset 68 | { 69 | get => QualitySettings.shadowNearPlaneOffset; 70 | set => QualitySettings.shadowNearPlaneOffset = value; 71 | } 72 | 73 | public bool LightsUseLinearIntensity 74 | { 75 | get => GraphicsSettings.lightsUseLinearIntensity; 76 | set => GraphicsSettings.lightsUseLinearIntensity = value; 77 | } 78 | 79 | public bool LightsUseColorTemperature 80 | { 81 | get => GraphicsSettings.lightsUseColorTemperature; 82 | set 83 | { 84 | if (value) 85 | { 86 | LightsUseLinearIntensity = value; 87 | } 88 | 89 | GraphicsSettings.lightsUseColorTemperature = value; 90 | } 91 | } 92 | 93 | public bool UsePCSS 94 | { 95 | get => BuiltinShaderMode.UseCustom == GraphicsSettings.GetShaderMode(BuiltinShaderType.ScreenSpaceShadows) 96 | && PCSSLight.pcssName == GraphicsSettings.GetCustomShader(BuiltinShaderType.ScreenSpaceShadows).name; 97 | set 98 | { 99 | if (value) 100 | { 101 | PCSSLight.EnablePCSS(); 102 | } 103 | else 104 | { 105 | PCSSLight.DisablePCSS(); 106 | } 107 | Graphics.Instance.LightManager.Light(); 108 | } 109 | } 110 | 111 | internal int FontSize 112 | { 113 | get => GUIStyles.FontSize; 114 | set => GUIStyles.FontSize = Graphics.ConfigFontSize.Value = value; 115 | } 116 | 117 | internal bool ShowAdvancedSettings { get; set; } 118 | } 119 | } -------------------------------------------------------------------------------- /Graphics/Shared/Inspector/SSSInspector.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using static Graphics.Inspector.Util; 3 | 4 | namespace Graphics.Inspector 5 | { 6 | internal static class SSSInspector 7 | { 8 | internal static void Draw() 9 | { 10 | if (ReferenceEquals(null, Graphics.Instance.CameraSettings.MainCamera)) return; 11 | 12 | SSS sss = SSSManager.SSSInstance; 13 | if (ReferenceEquals(null, sss)) 14 | { 15 | Label("No subsurface scattering settings found on camera.", ""); 16 | return; 17 | } 18 | Toggle("Enabled", sss.Enabled, false, enabled => 19 | { 20 | sss.Enabled = enabled; 21 | if (!enabled) Graphics.Instance.SSSManager.Destroy(); 22 | else Graphics.Instance.SSSManager.Start(); 23 | }); 24 | if (!sss.Enabled) return; 25 | GUILayout.BeginVertical(GUIStyles.Skin.box); 26 | { 27 | Label("Blur", "", true); 28 | Toggle("Profile per object", sss.ProfilePerObject, false, perObj => sss.ProfilePerObject = perObj); 29 | if( !sss.ProfilePerObject) 30 | SliderColor("Scattering colour", sss.sssColor, colour => sss.sssColor = colour); 31 | Slider("Blur size", sss.ScatteringRadius, 0f, 10f, "N1", radius => sss.ScatteringRadius = radius); 32 | Slider("Postprocess iterations", sss.ScatteringIterations, 0, 10, iterations => sss.ScatteringIterations = iterations); 33 | Slider("Shader iterations per pass", sss.ShaderIterations, 1, 20, iterations => sss.ShaderIterations = iterations); 34 | Slider("Downscale factor", sss.Downsampling, 1f, 4f, "N1", sampling => sss.Downsampling = sampling); 35 | Slider("Max Distance", sss.maxDistance, 0, 10000, distance => sss.maxDistance = distance); 36 | Toggle("Debug distance", sss.DEBUG_DISTANCE, false, debug => sss.DEBUG_DISTANCE = debug); 37 | SelectionMask("Layers", sss.SSS_Layer, layer => sss.SSS_Layer = layer); 38 | } 39 | GUILayout.EndVertical(); 40 | GUILayout.BeginVertical(GUIStyles.Skin.box); 41 | { 42 | Toggle("Dither", sss.Dither, false, dither => sss.Dither = dither); 43 | if (sss.Dither) 44 | { 45 | Slider("Dither intensity", sss.DitherIntensity, 0f, 5f, "N1", intensity => sss.DitherIntensity = intensity); 46 | Slider("Dither scale", sss.DitherScale, 1f, 100f, "N1", scale => sss.DitherScale = scale); 47 | } 48 | } 49 | GUILayout.EndVertical(); 50 | GUILayout.BeginVertical(GUIStyles.Skin.box); 51 | { 52 | Label("Debug", "", true); 53 | Label("Camera Name", sss.transform.parent.name); 54 | if (sss.LightingTex) 55 | Label("Buffer size", sss.LightingTex.width + " x " + sss.LightingTex.height); 56 | Label("Light pass shader", ReferenceEquals(sss.LightingPassShader, null) ? "NULL" : sss.LightingPassShader.name); 57 | Selection("View Buffer", sss.toggleTexture, texture => sss.toggleTexture = texture); 58 | GUILayout.Space(1); 59 | Label("Edge test", "", true); 60 | Slider("Depth test", sss.DepthTest, 0f, 1f, "N3", depth => sss.DepthTest = depth); 61 | Slider("Normal test", sss.NormalTest, 0f, 1f, "N3", normal => sss.NormalTest = normal); 62 | Toggle("Apply edge test to dither noise", sss.DitherEdgeTest, false, dither => sss.DitherEdgeTest = dither); 63 | Toggle("Fix pixel leaks", sss.FixPixelLeaks, false, fix => sss.FixPixelLeaks = fix); 64 | if (sss.FixPixelLeaks) 65 | { 66 | Slider("Normal test", sss.EdgeOffset, 1f, 1.2f, "N3", offset => sss.EdgeOffset = offset); 67 | } 68 | Toggle("Profile Test (per obj)", sss.UseProfileTest, false, profileTest => sss.UseProfileTest = profileTest); 69 | if (sss.ProfilePerObject && sss.UseProfileTest) 70 | { 71 | Slider("Profile Colour Test", sss.ProfileColorTest, 0f, 1f, "N3", test => sss.ProfileColorTest = test); 72 | Slider("Profile Radius Test", sss.ProfileRadiusTest, 0f, 1f, "N3", test => sss.ProfileRadiusTest = test); 73 | } 74 | } 75 | GUILayout.EndVertical(); 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /Graphics/Shared/Patch/Studio.cs: -------------------------------------------------------------------------------- 1 | using Graphics.Settings; 2 | using HarmonyLib; 3 | using Studio; 4 | using System; 5 | using UnityEngine; 6 | using UnityEngine.UI; 7 | 8 | namespace Graphics.Patch 9 | { 10 | internal static class StudioHooks 11 | { 12 | public static void Init() 13 | { 14 | //HarmonyWrapper.PatchAll(typeof(StudioHooks)); 15 | HarmonyLib.Harmony.CreateAndPatchAll(typeof(StudioHooks)); 16 | } 17 | 18 | [HarmonyPostfix, HarmonyPatch(typeof(MPLightCtrl), "Awake")] 19 | static void MPLightCtrl_Awake_Postfix(MPLightCtrl __instance) 20 | { 21 | var instance = Traverse.Create(__instance); 22 | var viIntensity = instance.Field("viIntensity").GetValue(); 23 | var ValueInfo = Traverse.Create(viIntensity); 24 | var slider = ValueInfo.Field("slider").GetValue(); 25 | slider.minValue = LightSettings.IntensityMin; 26 | slider.maxValue = LightSettings.IntensityMax; 27 | } 28 | 29 | [HarmonyPrefix, HarmonyPatch(typeof(MPLightCtrl), "OnValueChangeIntensity")] 30 | static bool MPLightCtrl_OnValueChangeIntensity_Prefix(MPLightCtrl __instance, float _value) 31 | { 32 | var instance = Traverse.Create(__instance); 33 | var m_OCILight = instance.Field("m_OCILight").GetValue(); 34 | var viIntensity = instance.Field("viIntensity").GetValue(); 35 | var ValueInfo = Traverse.Create(viIntensity); 36 | var inputField = ValueInfo.Field("inputField").GetValue(); 37 | if (instance.Field("isUpdateInfo").GetValue()) 38 | { 39 | return false; 40 | } 41 | if (m_OCILight.SetIntensity(_value, false)) 42 | { 43 | inputField.text = m_OCILight.lightInfo.intensity.ToString("0.000"); 44 | } 45 | return false; 46 | } 47 | [HarmonyPrefix, HarmonyPatch(typeof(MPLightCtrl), "OnEndEditIntensity")] 48 | static bool MPLightCtrl_OnEndEditIntensity_Prefix(MPLightCtrl __instance, string _text) 49 | { 50 | var instance = Traverse.Create(__instance); 51 | var m_OCILight = instance.Field("m_OCILight").GetValue(); 52 | var viIntensity = instance.Field("viIntensity").GetValue(); 53 | var ValueInfo = Traverse.Create(viIntensity); 54 | var inputField = ValueInfo.Field("inputField").GetValue(); 55 | var slider = ValueInfo.Field("slider").GetValue(); 56 | float value = Mathf.Clamp(StringToFloat(_text), LightSettings.IntensityMin, LightSettings.IntensityMax); 57 | m_OCILight.SetIntensity(value, false); 58 | inputField.text = m_OCILight.lightInfo.intensity.ToString("0.00"); 59 | slider.value = m_OCILight.lightInfo.intensity; 60 | return false; 61 | } 62 | 63 | private static float StringToFloat(string _text) 64 | { 65 | return (!float.TryParse(_text, out float num)) ? 0f : num; 66 | } 67 | 68 | [HarmonyPrefix, HarmonyPatch(typeof(Studio.Studio), nameof(Studio.Studio.AddLight))] 69 | static bool Studio_AddLight_Prefix(Studio.Studio __instance, int _no) 70 | { 71 | var instance = Traverse.Create(__instance); 72 | OCILight ocilight = Studio.AddObjectLight.Add(_no); 73 | Singleton.Instance.Clear(); 74 | if (Studio.Studio.optionSystem.autoHide) 75 | { 76 | RootButtonCtrl ctrl = instance.Property("rootButtonCtrl").Value; 77 | ctrl.OnClick(-1); 78 | } 79 | if (Studio.Studio.optionSystem.autoSelect && ocilight != null) 80 | { 81 | TreeNodeCtrl ctrl = instance.Field("m_TreeNodeCtrl").GetValue(); 82 | ctrl.SelectSingle(ocilight.treeNodeObject, true); 83 | } 84 | Graphics.Instance?.LightManager?.Light(); 85 | return false; 86 | } 87 | 88 | [HarmonyPostfix, HarmonyPatch(typeof(AddObjectLight), nameof(AddObjectLight.Load), new Type[] { 89 | typeof(OILightInfo), typeof(ObjectCtrlInfo), typeof(TreeNodeObject), typeof(bool), typeof(int) 90 | })] 91 | public static void PCSSInitialization(ref OCILight __result, OILightInfo _info, ObjectCtrlInfo _parent, TreeNodeObject _parentNode, bool _addInfo, int _initialPosition) 92 | { 93 | Graphics.Instance?.LightManager?.Light(); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Graphics/Shared/Resources/localization.chinesesimplified.txt: -------------------------------------------------------------------------------- 1 | Lighting,整体照明 2 | Lights,部分照明 3 | PostProcessing,后期处理 4 | Presets,快速设置 5 | Mode,模式 6 | SMAA Quality,SMAA 质量 7 | Settings,设置 8 | Camera,照相机 9 | Point Lights,单点光 10 | Spot Lights,聚光灯 11 | Directional Lights,平行光源 12 | English,英语 13 | Japanese,日本语 14 | Korean,韩语 15 | Shadows,阴影 16 | Reflection Probes,反射探头 17 | Colour,颜色 18 | Anti-aliasing,抗锯齿处理 19 | Ambient Occlusion,环境光遮罩 20 | Amplify Ambient Occlusion,放大环境光遮罩 21 | Auto Exposure,自动曝光控制 22 | Red,红色 23 | Blue,蓝色 24 | Green,绿色 25 | Screen Space Reflection,画面反射 26 | Fog,雾化效果 27 | Depth Of Field,景深 28 | Motion Blur,动态模糊效果 29 | Eye Adaptation,曝光度 30 | Bloom,辉光 31 | Color Grading,色感 32 | User Lut,用户LUT色感 33 | LUT Blend,LUT 融合 34 | Chromatic Aberration,色差 35 | Grain,电影颗粒效果 36 | Vignette,边缘晕影 37 | Dithering,抖动 38 | Intensity,强度 39 | Clear Flags,渲染默认值 40 | Skybox,天空环境 41 | Depth,深度 42 | Nothing,无 43 | Near Clipping Plane,最低渲染距离 44 | Far Clipping Plane,最高渲染距离 45 | Clipping Planes - Near,最低渲染距离 46 | Clipping Planes - Far,最高渲染距离 47 | Rendering Path,渲染方式 48 | Field of View,视角范围 49 | Occulsion Culling,隐藏动态区域 50 | Allow HDR,打开 HDR 51 | Allow MSAA (Forward Only),打开MSAA(Forward 渲染专用) 52 | Allow DynamicResolution,打开动态分辨率 53 | Colour Space,色域 54 | Linear,线性 55 | Quality Level,游戏图像设置 56 | Pixel Light Count,像素光源数 57 | Anisotropic Textures,各向异性纹理 58 | MSAA Multiplier,MSAA 强度 59 | Realtime Reflection Probes,实时反射探头 60 | Shadowmask Mode,阴影遮罩模式 61 | Shadowmask,阴影遮罩 62 | DistanceShadowmask,长距离阴影遮罩 63 | Shadow Resolution,阴影分辨率 64 | Low,低 65 | Medium,一般 66 | High,高 67 | Very High,极高 68 | VeryHigh,极高 69 | Shadow Projection,阴影投射 70 | CloseFit,固定分配 71 | StableFit,稳定分配 72 | Shadow Distance,阴影渲染距离 73 | Shadow Near Plane Offset,阴影近距离补偿 74 | Font Size,字体大小 75 | Language,语言 76 | Window Width,窗口宽度 77 | Window Height,窗口高度 78 | Show Advanced Settings,高级设置 79 | Disable,禁用 80 | All,全部 81 | Environment Skybox,全光背景 82 | Environment Lighting,全光照明 83 | Source,光源 84 | Trilight,三色光 85 | Flat,单色光 86 | Environment Reflections,全光反射 87 | Resolution,分辨率 88 | Bounces,反射 89 | Type,类型 90 | Runtime setting,运行时设置 91 | Importance,重要性 92 | Box Projection,箱形地域反射 93 | Blend Distance,融合距离 94 | Box Size,地域尺寸 95 | Box Offset,地域偏移 96 | Cubemap capture settings,全光背景捕获设置 97 | Background,背景 98 | Fast Mode,高速模式 99 | Lens Dirt,透镜覆盖 100 | Dirt Intensity,覆盖强度 101 | White Balance,白色平衡 102 | Temperature,色温 103 | Tint,色调 104 | Tone,风格 105 | Saturation,饱和度 106 | Brightness,亮度调节 107 | Contrast,对比度 108 | Lift,暗部调节(提升) 109 | Gamma,灰部调节(伽玛) 110 | Gain,高光调节(增益) 111 | Value,值 112 | Auto Focus,自动对焦 113 | Aperture,光圈值 114 | Focal Distance,焦距 115 | Focal Length,焦距 116 | Max Blur Size,最大模糊尺寸 117 | Luminance Contribution,亮度贡献 118 | Preset,预设 119 | Lower,更低 120 | Higher,更高 121 | Ultra,最高 122 | Overkill,完全最大值 123 | Distance Fade,衰减距离 124 | Smoothness,平滑度 125 | Roundness,圆形度 126 | Shutter Angle,快门角度 127 | Sample Count,采样计数 128 | Ambient Only,仅环境光 129 | Cache Aware,缓存感知 130 | Downsample,标准化采样 131 | Apply Method,使用方式 132 | PerPixel Normals,每像素法线 133 | Bias,偏斜 134 | Power Exponent,幂指数 135 | Radius,范围 136 | Thickness,厚度 137 | Blur Enabled,启用混频过滤器 138 | Blur Sharpness,模糊过滤器 139 | Blur Passes,循环混频过滤器 140 | Blur Radius,混频滤波器范围 141 | Filter Enabled,启用过滤器 142 | Filter Blending,切换过滤器 143 | Filter Response,滤波器反应 144 | Fade Enabled,淡入启用 145 | Fade Length,淡入度长度 146 | Fade Start,淡入淡出开始 147 | Fade To Intensity,淡入强度 148 | Fade To Power Exponent,衰减幂指数 149 | Fade To Radius,淡入半径 150 | Fade To Thickness,淡入变厚 151 | Fade To Tint,淡入淡薄 152 | Histogram Filtering (%),透明滤波器(%) 153 | Lower Bound,下限 154 | Upper Bound,上限 155 | Min Luminance (EV),最小亮度 (EV) 156 | Max Luminance (EV),最大亮度 (EV) 157 | Speed from light to dark,明暗切换速度 158 | Speed from dark to light,暗明切换速度 159 | Progressive,逐行扫描 160 | Fixed,固定值 161 | Threshold,阙值 162 | SoftKnee,光切换值 163 | Clamp,最大值 164 | Diffusion,色彩模糊值 165 | AnamorphicRatio,纵横比例(中央值0) 166 | Hue Shift,色移 167 | Size,尺寸 168 | Maximum March Distance,最大反射距离 169 | Color,颜色 170 | Rounded,圆形 171 | Time Slicing Mode,时间调度模式 172 | SolidColor,单色 173 | Keep Alpha,保留阿尔法值 174 | None,无 175 | Weight,重量 176 | Jitter Spread,抖动伸展 177 | Stationary Blending,静态转换 178 | Motion Blending,动态切换 179 | Sharpness,清晰度 180 | HardOnly,仅硬阴影 181 | ChineseSimplified,简体中文 182 | Enabled, 启用 183 | Blur, 模糊 184 | Profile per object, 每个用户的配置文件 185 | Scattering colour, 散射颜色 186 | Blur size, 模糊大小 187 | Postprocess iterations, 后期处理迭代 188 | Shader iterations per pass,每轮着色器迭代次数 189 | Downscale factor, 缩放比例因子 190 | Max distance, 最大距离 191 | Debug distance, 调试距离 192 | Layers, 层级 193 | Dither,抖动 194 | Dither intensity, 抖动强度 195 | Dither scale, 抖动范围 196 | Debug, 调试 197 | Camera Name, 摄像机名称 198 | Buffer size,缓存大小 199 | Light Pass shader,光通道着色器 200 | View Buffer,查看缓存 201 | Edge test, 边缘检测 202 | Depth Test,深度测试 203 | Normal test,正态检验 204 | Apply edge test to dither noise,抖动噪声的边缘检测 205 | Fix pixel leaks,修复像素漏洞 206 | Profile Test (per obj),配置测试 207 | -------------------------------------------------------------------------------- /Graphics/Shared/Setting/SSSSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using MessagePack; 3 | using UnityEngine; 4 | 5 | namespace Graphics.Settings 6 | { 7 | [MessagePackObject(true)] 8 | [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] 9 | public class SSSSettings 10 | { 11 | public float BlurSize = 0.1f; // Small Values by default. 12 | public float[] Color = {1f, 0f, 0f}; // red by default. 13 | public bool Debug = false; 14 | public bool DebugDistance = false; 15 | public float DepthTest; 16 | public bool Dither; // disabled by default. 17 | public float DitherIntensity; 18 | public float DitherScale; 19 | public float DownscaleFactor = 1; // Default Resolution by default. 20 | public bool EdgeDitherNoise; 21 | public bool Enabled; // disabled by default. 22 | public bool FixPixelLeaks; 23 | public float FixPixelLeaksNormal; 24 | public int LayerBitMask; 25 | public int MaxDistance = 10000; 26 | public float NormalTest; 27 | public int ProcessIterations = 1; 28 | public float ProfileColorTest; 29 | public bool ProfilePerObject; 30 | public float ProfileRadiusTest; 31 | public bool ProfileTest; 32 | public int ShaderIterations = 1; 33 | public SSS.ToggleTexture ToggleTexture; 34 | 35 | public void SaveParameters() 36 | { 37 | SSS instance = SSSManager.SSSInstance; 38 | if (ReferenceEquals(null, instance)) return; 39 | 40 | Enabled = instance.Enabled; 41 | ProfilePerObject = instance.ProfilePerObject; 42 | Color = new[] {instance.sssColor.r, instance.sssColor.g, instance.sssColor.b}; 43 | BlurSize = instance.ScatteringRadius; 44 | ProcessIterations = instance.ScatteringIterations; 45 | ShaderIterations = instance.ShaderIterations; 46 | DownscaleFactor = instance.Downsampling; 47 | MaxDistance = instance.maxDistance; 48 | LayerBitMask = instance.SSS_Layer; 49 | 50 | Dither = instance.Dither; 51 | DitherIntensity = instance.DitherIntensity; 52 | DitherScale = instance.DitherScale; 53 | 54 | ToggleTexture = instance.toggleTexture; 55 | DepthTest = instance.DepthTest; 56 | NormalTest = instance.NormalTest; 57 | EdgeDitherNoise = instance.DitherEdgeTest; 58 | FixPixelLeaks = instance.FixPixelLeaks; 59 | FixPixelLeaksNormal = instance.EdgeOffset; 60 | ProfileTest = instance.UseProfileTest; 61 | ProfileColorTest = instance.ProfileColorTest; 62 | ProfileRadiusTest = instance.ProfileRadiusTest; 63 | } 64 | 65 | private void RescueWithHelicopter() 66 | { 67 | BlurSize = Mathf.Clamp(BlurSize, 0, 100); 68 | ProcessIterations = Mathf.Clamp(ProcessIterations, 1, 100); 69 | ShaderIterations = Mathf.Clamp(ShaderIterations, 1, 100); 70 | DownscaleFactor = Mathf.Clamp(DownscaleFactor, 0.5f, 100); 71 | } 72 | 73 | public void LoadParameters() 74 | { 75 | SSS instance = SSSManager.SSSInstance; 76 | if (ReferenceEquals(null, instance)) return; 77 | RescueWithHelicopter(); 78 | if (!Enabled) Graphics.Instance.SSSManager.Destroy(); 79 | else Graphics.Instance.SSSManager.Start(); 80 | 81 | instance.Enabled = Enabled; 82 | instance.ProfilePerObject = ProfilePerObject; 83 | instance.sssColor = ReferenceEquals(Color, null) ? UnityEngine.Color.white : new Color(Color[0], Color[1], Color[2]); 84 | instance.ScatteringRadius = BlurSize; 85 | instance.ScatteringIterations = ProcessIterations; 86 | instance.ShaderIterations = ShaderIterations; 87 | instance.Downsampling = DownscaleFactor; 88 | instance.maxDistance = MaxDistance; 89 | instance.SSS_Layer = LayerBitMask; 90 | 91 | instance.Dither = Dither; 92 | instance.DitherIntensity = DitherIntensity; 93 | instance.DitherScale = DitherScale; 94 | 95 | instance.toggleTexture = ToggleTexture; 96 | instance.DepthTest = DepthTest; 97 | instance.NormalTest = NormalTest; 98 | instance.DitherEdgeTest = EdgeDitherNoise; 99 | instance.FixPixelLeaks = FixPixelLeaks; 100 | instance.EdgeOffset = FixPixelLeaksNormal; 101 | instance.UseProfileTest = ProfileTest; 102 | instance.ProfileColorTest = ProfileColorTest; 103 | instance.ProfileRadiusTest = ProfileRadiusTest; 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /Graphics/Shared/LocalizationManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using UnityEngine; 6 | 7 | namespace Graphics 8 | { 9 | public class LocalizationManager : MonoBehaviour 10 | { 11 | public enum Language 12 | { 13 | English = SystemLanguage.English, 14 | Korean = SystemLanguage.Korean, 15 | Japanese = SystemLanguage.Japanese, 16 | ChineseSimplified = SystemLanguage.ChineseSimplified 17 | } 18 | 19 | private static bool Initialized { get; set; } 20 | private static string _localizationPath; 21 | private static Language _currentLanguage; 22 | private static Dictionary> _lookup; 23 | private static Dictionary _textLookup; 24 | private static Graphics _parent; 25 | 26 | internal static string LocalizationPath 27 | { 28 | get => _localizationPath; 29 | set 30 | { 31 | _parent?.StartCoroutine(Load(value)); 32 | _localizationPath = value; 33 | } 34 | } 35 | 36 | internal static Language DefaultLanguage() 37 | { 38 | return Enum.IsDefined(typeof(Language), (Language)Application.systemLanguage) ? (Language)Application.systemLanguage : Language.English; 39 | } 40 | 41 | internal static Language CurrentLanguage 42 | { 43 | get => _currentLanguage; 44 | set 45 | { 46 | _currentLanguage = value; 47 | Graphics.ConfigLanguage.Value = value; 48 | _parent?.StartCoroutine(LoadLocalization((SystemLanguage)_currentLanguage)); 49 | } 50 | 51 | } 52 | private static string CurrentLocale() 53 | { 54 | return Enum.GetName(typeof(Language), CurrentLanguage); 55 | } 56 | 57 | internal static string Localized(string text, bool fallBackOnDefault = true) 58 | { 59 | if (null != _textLookup && _textLookup.TryGetValue(text, out string localized)) 60 | { 61 | return localized; 62 | } 63 | 64 | return fallBackOnDefault ? text : ""; 65 | } 66 | 67 | internal static bool HasLocalization() 68 | { 69 | return null != _lookup && _lookup.ContainsKey(CurrentLocale()); 70 | } 71 | private static IEnumerator LoadLocalization(SystemLanguage language) 72 | { 73 | yield return new WaitUntil(() => Initialized); 74 | if (Enum.IsDefined(typeof(Language), (Language)language)) 75 | { 76 | _lookup.TryGetValue(CurrentLocale(), out _textLookup); 77 | } 78 | } 79 | 80 | private static IEnumerator Load(string path) 81 | { 82 | Initialized = false; 83 | _lookup = new Dictionary>(StringComparer.OrdinalIgnoreCase); 84 | List paths = Util.GetFiles(path, "localization.*.txt"); 85 | yield return paths; 86 | foreach (string localization in paths) 87 | { 88 | string[] languageTokens = Path.GetFileNameWithoutExtension(localization).Split('.'); 89 | if (2 != languageTokens.Length) 90 | { 91 | continue; 92 | } 93 | 94 | IEnumerable lines; 95 | try 96 | { 97 | lines = File.ReadLines(localization); 98 | } 99 | catch 100 | { 101 | Graphics.Instance.Log.Log(BepInEx.Logging.LogLevel.Error, "Failed to read from " + localization); 102 | continue; 103 | } 104 | yield return lines; 105 | Dictionary languageDictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); 106 | _lookup.Add(languageTokens[1], languageDictionary); 107 | foreach (string line in lines) 108 | { 109 | string[] tokens = line.Split(','); 110 | if (2 == tokens.Length) 111 | { 112 | languageDictionary.Add(tokens[0], tokens[1]); 113 | } 114 | } 115 | } 116 | Initialized = true; 117 | } 118 | 119 | internal static Graphics Parent 120 | { 121 | get => _parent; 122 | set 123 | { 124 | _parent = value; 125 | LocalizationPath = Graphics.ConfigLocalizationPath.Value; 126 | } 127 | } 128 | } 129 | } -------------------------------------------------------------------------------- /Graphics/Shared/Resources/localization.japanese.txt: -------------------------------------------------------------------------------- 1 | All,すべて 2 | Allow Dynamic Resolution,ダイナミック解像度 3 | Allow HDR,高度なレンダリング機能(HDR) 4 | Allow MSAA (Forward Only),MSAA(フォワードレンダリング) 5 | Ambient Occlusion,アンビエントオクルージョン 6 | Ambient Only,アンビエントのみ 7 | Amplify Ambient Occlusion,Amplifyアンビエントオクルージョン 8 | anamorphicratio,アナモルフィック比 9 | Anisotropic Textures,異方性テクスチャ 10 | Anti-aliasing,アンチエイリアス 11 | aperture,絞り値 12 | Auto Exposure,自動露出 13 | auto focus,オートフォーカス 14 | Background,背景 15 | Baked,ベイク 16 | bias,バイアス 17 | Blend Distance,ブレンド距離 18 | Bloom,ブルーム 19 | Blue,青 20 | Bounces,バウンス 21 | Box Offset,オフセット 22 | Box Projection,ボックスプロジェクション 23 | Box Size,サイズ 24 | brightness,輝度 25 | Cam Light,カメラライト 26 | Camera,カメラ 27 | ChineseSimplified,中国語 28 | Chromatic Aberration,色収差 29 | clamp,クランプ 30 | Clear Flags,フラグをクリア 31 | Clipping Planes - Far,クリッピングプレーン-遠 32 | Clipping Planes - Near,クリッピングプレーン-近 33 | Color Grading,カラーグレーディング 34 | colored,色付き 35 | Colour,色 36 | Colour Grading,カラーグレーディング 37 | Colour Space,色空間 38 | contrast,コントラスト 39 | Cubemap capture settings,キューブマップキャプチャ設定 40 | culling mask,カリングマスク 41 | custom,カスタム 42 | depth,深度 43 | Depth of Field,被写界深度 44 | diffusion,拡散 45 | Directional Light,ディレクショナルライト 46 | Directional Lights,ディレクショナルライト 47 | dirt intensity,汚れの強度 48 | disable,無効にする 49 | distance fade,距離フェード 50 | Dithering,ディザリング 51 | Enable,可能にする 52 | English,英語 53 | Environment Lighting,環境ライティング 54 | Environment Reflections,環境反射 55 | Environment Skybox,環境スカイボックス 56 | Exposure,露出 57 | Eye Adaptation,アイアダプテーション 58 | far clipping plane,クリッピング平面ー遠 59 | Fast Mode,高速モード 60 | field of view,視野 61 | fixed,不動 62 | Flat,フラット 63 | focal distance,焦点遠近 64 | focal length,焦点距離 65 | Fog,フォグ 66 | Font Size,フォントサイズ 67 | ForceEnable,強制的に有効にする 68 | FromQualitySettings,品質設定から 69 | gain,ゲイン 70 | gamma,ガンマ 71 | Grain,グレイン 72 | Green,緑 73 | hard only,ハード 74 | HDR,高度なレンダリング機能 (HDR) 75 | high,高 76 | higher,より高い 77 | histogram filtering (%),ヒストグラムフィルタリング(%) 78 | horizontal rotation,水平回転 79 | Hue Shift,色彩シフト 80 | Importance,重要性 81 | Indirect Multiplier,間接乗数 82 | Intensity,強度 83 | Japanese,日本語 84 | Jitter Spread,ジッタの間隔 85 | Korean,韓国語 86 | Language,言語 87 | large,大 88 | LDR,低ダイナミックレンジ (LDR) 89 | lens dirt,レンズ汚れ 90 | lift,リフト 91 | Lighting,ライティング 92 | Lights,ライト 93 | Lights Use Color Temperature,光色温度 94 | Lights Use Linear Intensity,光線形強度 95 | low,低 96 | lower,より低い 97 | lower bound,下限 98 | luminance contribution,輝度寄与 99 | LUT,ルックアップテーブル(LUT) 100 | LUT Blend,LUTブレンド 101 | max blur size,最大ぼかしサイズ 102 | Max Luminance (EV),最大輝度(EV) 103 | maximum march distance,最大行進距離 104 | medium,中 105 | Min Luminance (EV),最小輝度(EV) 106 | mode,モード 107 | Motion Blending,ブレンド移動係数 108 | Motion Blur,モーションブラー 109 | MSAA Multiplier,MSAA乗数 110 | near clipping plane,クリッピング平面ー近 111 | near plane,近く平面 112 | No custom cubemaps found,カスタムキューブマップが見つかりません。 113 | No presets found,プリセットが見つかりません。 114 | None,無し 115 | normal bias,通常のバイアス 116 | nothing,何もない 117 | occlusion culling,閉塞カリング 118 | overkill,やり過ぎ 119 | Pixel Light Count,ピクセルライト数 120 | Please specify a valid file name.,有効なファイル名を指定してください。 121 | Point Lights,ポイントライト 122 | post process layer,ポストプロセス層 123 | post process volume,ポストプロセスボリューム 124 | PostProcessing,ポストプロセシング 125 | preset,プリセット 126 | Presets,プリセット 127 | progressive,プログレッシブ 128 | Quality Level,品質レベル 129 | Realtime,リアルタイム 130 | Realtime Reflection Probes,リアルタイムリフレクションプローブ 131 | Red,赤 132 | Reflection Probes,リフレクションプローブ 133 | render mode,レンダリングモード 134 | Rendering,レンダリング 135 | rendering path,レンダリングパス 136 | Resolution,解像度 137 | Rotation,回転 138 | rounded,丸みを帯びた 139 | roundness,丸み 140 | Runtime settings,ランタイム設定 141 | Sample Count,サンプル数 142 | saturation,飽和 143 | save,セーブ 144 | Screen Space Reflection,スクリーンスペースリフレクション 145 | Select a light source on the left panel.,左側のパネルで光源を選択してください。 146 | Selected light is disabled.,選択したライトは無効になっています。 147 | Settings,設定 148 | Shadow Distance,影の距離 149 | Shadow Near Plane Offset,影のウニアプレーンオフセット 150 | Shadow Projection,影の投影 151 | Shadow Resolution,影の解像度 152 | Shadow Type,タイプ 153 | Shadowmask Mode,影のウマスクモード 154 | Shadows,影 155 | Sharpness,鮮明 156 | Show Advanced Settings,詳細設定を表示する 157 | Shutter Angle,シャッター角度 158 | size,サイズ 159 | Skybox,スカイボックス 160 | Skybox Material,スカイボックス素材 161 | Skybox Tint,スカイボックス色彩 162 | SMAA Quality,SMAA品質 163 | small,小さい 164 | smoothness,滑らかさ 165 | softknee,ソフトニー 166 | Source,光源 167 | specular highlight,スペキュラハイライト 168 | speed from dark to light,暗い場所から明るい場所への速度 169 | speed from light to dark,明るい場所から暗い場所への速度 170 | Spot Lights,スポットライト 171 | Stationary Blending,ブレンド静止係数 172 | Strength,強度 173 | Sun Source,太陽源 174 | Temperature,温度 175 | thickness,厚薄 176 | Thickness Modifier,厚薄 177 | threshold,しきい値 178 | Time Slicing Mode,時間スライスモード 179 | Tint,色彩 180 | Tone,トーン 181 | Trilight,トリライト 182 | Type,種類 183 | upper bound,上界 184 | Ultra,ウルトラ 185 | Use Alloy Light,Alloyライト 186 | User Lut,ユーザー LUT 187 | value,値 188 | vertical rotation,垂直回転 189 | veryhigh,非常に高 190 | verylarge,非常に大きい 191 | Vignette,ビネット 192 | Weight,ウエート 193 | White Balance,ホワイトバランス 194 | Window Height,ウィンドウの高さ 195 | Window Width,ウィンドウ幅  -------------------------------------------------------------------------------- /Graphics/Shared/Resources/localization.korean.txt: -------------------------------------------------------------------------------- 1 | Lighting,전체조명 2 | Lights,부분조명 3 | PostProcessing,후처리셰이더 4 | Presets,빠른설정 5 | Mode,모드 6 | SMAA Quality,SMAA 퀄리티 7 | Settings,설정 8 | Camera,카메라 9 | Point Lights,포인트 조명 10 | Spot Lights,스팟 조명 11 | Directional Lights,방향 조명 12 | English,English 13 | Japanese,日本語 14 | Korean,한국어 15 | Shadows,그림자 16 | Reflection Probes,반사 설정 17 | Colour,색 18 | Anti-aliasing,안티 앨리어싱 19 | Ambient Occlusion,간접 그림자 20 | Amplify Ambient Occlusion,Amplify 간접 그림자 21 | Auto Exposure,자동 노출도 22 | Red,빨강 23 | Blue,파랑 24 | Green,초록 25 | Screen Space Reflection,화면 반사 26 | Fog,안개 27 | Depth Of Field,피사계심도 28 | Motion Blur,모션 블러 29 | Eye Adaptation,노출 적응 30 | Bloom,빛퍼짐 31 | Color Grading,색감 32 | User Lut,사용자 LUT 색감 33 | LUT Blend,LUT 전환율 34 | Chromatic Aberration,광학 색분리 35 | Grain,필름 노이즈 36 | Vignette,가장자리 어둡게 37 | Dithering,디더링 38 | Intensity,강도 39 | Clear Flags,렌더 기본값 40 | Skybox,스카이박스 41 | Depth,깊이 42 | Nothing,없음 43 | Near Clipping Plane,최저 렌더링 거리 44 | Far Clipping Plane,최고 렌더링 거리 45 | Clipping Planes - Near,최저 렌더링 거리 46 | Clipping Planes - Far,최고 렌더링 거리 47 | Rendering Path,렌더링 방식 48 | Field of View,시야각 49 | Occulsion Culling,동적 지역 숨김 50 | Allow HDR,HDR 허용 51 | Allow MSAA (Forward Only),MSAA 허용 (Forward 렌더링 전용) 52 | Allow DynamicResolution,동적 해상도 허용 53 | Colour Space,색조 범위 54 | Linear,선형 55 | Quality Level,게임 그래픽 설정 56 | Pixel Light Count,픽셀 조명 수 57 | Anisotropic Textures,이방성 텍스처 58 | MSAA Multiplier,MSAA 강도 59 | Realtime Reflection Probes,실시간 반사구 최신화 60 | Shadowmask Mode,그림자 마스크 모드 61 | Shadowmask,그림자마스크 62 | DistanceShadowmask,장거리 그림자마스크 63 | Shadow Resolution,그림자 해상도 64 | Low,낮음 65 | Medium,보통 66 | High,높음 67 | Very High,매우 높음 68 | VeryHigh,매우 높음 69 | Shadow Projection,그림자 투사 방법 70 | CloseFit,가장 가까운대로 투사 71 | StableFit,안정적으로 투사 72 | Shadow Distance,그림자 렌더링 거리 73 | Shadow Near Plane Offset,그림자 근접면 거리 74 | Font Size,글꼴 크기 75 | Language,언어 76 | Window Width,창 가로 크기 77 | Window Height,창 세로 크기 78 | Show Advanced Settings,고급 사용자용 메뉴 사용 79 | Disable,비활성 80 | All,전부 81 | Environment Skybox,전체광 배경 82 | Environment Lighting,전체광 조명 83 | Source,근원지 84 | Trilight,삼색 85 | Flat,단색 86 | Environment Reflections,전체광 반사 87 | Resolution,해상도 88 | Bounces,반사 반복 89 | Type,종류 90 | Runtime setting,실시간 세팅 91 | Importance,중요도 92 | Box Projection,박스형 지역 반사 93 | Blend Distance,전환 거리 94 | Box Size,지역 사이즈 95 | Box Offset,지역 위치 96 | Cubemap capture settings,전체광 배경 캡처 설정 97 | Background,배경 98 | Fast Mode,고속 모드 99 | Lens Dirt,렌즈 먼지 100 | Dirt Intensity,먼지 세기 101 | White Balance,백색 균형 102 | Temperature,색 온도 103 | Tint,색조 104 | Tone,톤 105 | Saturation,색 강도 106 | Brightness,밝기 107 | Contrast,대비 108 | Lift,리프트 109 | Gamma,감마 110 | Gain,게인 111 | Value,값 112 | Auto Focus,자동 초점 113 | Aperture,조리개 값 114 | Focal Distance,초점 거리 115 | Focal Length,초점 길이 116 | Max Blur Size,최대 흐림 사이즈 117 | Luminance Contribution,조명 기여도 118 | Preset,빠른 설정 119 | Lower,매우 낮음 120 | Higher,매우 높음 121 | Ultra,가장 높음 122 | Overkill,완전 최대치 123 | Distance Fade,사라짐 거리 124 | Smoothness,부드러움 125 | Roundness,원형율 126 | Shutter Angle,셔터 각도 127 | Sample Count,표본 수 128 | Ambient Only,주변환경만 적용 129 | Cache Aware,캐시 사용 130 | Downsample,표본 표준화 131 | Apply Method,적용 방식 132 | PerPixel Normals,픽셀 노말값 133 | Bias,치우침 134 | Power Exponent,강도 제곱근 135 | Radius,범위 136 | Thickness,굵기 137 | Blur Enabled,흐림 필터 사용 138 | Blur Sharpness,흐림 필터 선명하게 139 | Blur Passes,흐림 필터 반복 140 | Blur Radius,흐림 필터 범위 141 | Filter Enabled,필터 사용 142 | Filter Blending,필터 전환 143 | Filter Response,필터 반응 144 | Fade Enabled,거리 전환 사용 145 | Fade Length,거리 전환 길이 146 | Fade Start,거리 전환 시작점 147 | Fade To Intensity,거리 전환 목표 강도 148 | Fade To Power Exponent,거리 전환 목표 강도 제곱근 149 | Fade To Radius,거리 전환 목표 범위 150 | Fade To Thickness,거리 전환 목표 굵기 151 | Fade To Tint,거리 전환 목표 색조 152 | Histogram Filtering (%),히스토그램 필터링(%) 153 | Lower Bound,최저 범위 154 | Upper Bound,최고 범위 155 | Min Luminance (EV),최저 밝기 (EV) 156 | Max Luminance (EV),최고 밝기 (EV) 157 | Speed from light to dark,밝은 곳에서 어두운 곳으로 전환 속도 158 | Speed from dark to light,어두운 곳에서 밝은 곳으로 전환 속도 159 | Progressive,점진적 160 | Fixed,고정값 161 | Threshold,최소 요구값 162 | SoftKnee,빛퍼짐 전환값 163 | Clamp,최대값 164 | Diffusion,색퍼짐값 165 | AnamorphicRatio,가로세로 비율 (중앙값 0) 166 | Hue Shift,색변환율 167 | Size,크기 168 | Maximum March Distance,최대 반사 거리 169 | Color,색 170 | Rounded,원형 171 | Time Slicing Mode,시간 스케쥴 모드 172 | SolidColor,단색 173 | Keep Alpha,알파값 유지 174 | None,없음 175 | Weight,무게 176 | Jitter Spread,끊김 분산 177 | Stationary Blending,정적 전환 178 | Motion Blending,동작 전환 179 | Sharpness,선명도 180 | HardOnly,부드러움 없는 그림자 181 | ChineseSimplified,간체중국어 182 | Enabled, 활성화 183 | Blur, 흐림 184 | Profile per object, 오브젝트별 프로파일 185 | Scattering colour, 빛번짐 색상 186 | Blur size, 흐림 범위 187 | Postprocess iterations, 후처리 계산 188 | Shader iterations per pass, 패스당 셰이더 계산 189 | Downscale factor, 렌더 축소율 190 | Max distance, 최대 거리 191 | Debug distance, 디버그 거리 192 | Layers, 렌더링 레이어 193 | Dither, 디더링 194 | Dither intensity, 디더링 강도 195 | Dither scale, 디더링 범위 196 | Debug, 디버그 197 | Camera Name, 카메라 이름 198 | Buffer size, 버퍼 크기 199 | Light Pass shader, 빛 패스 셰이더 200 | View Buffer, 범위 버퍼 201 | Edge test, 경계선 테스트 202 | Depth Test, 깊이 테스트 203 | Normal test , 노말 테스트 204 | Apply edge test to dither noise, 디더링 노이즈에 경계선 테스트 적용 205 | Fix pixel leaks, 픽셀 누출 수정 206 | Profile Test (per obj), 프로파일 테스트(오브젝트별) 207 | -------------------------------------------------------------------------------- /Graphics/Shared/SSS/SSS_convolution.cs: -------------------------------------------------------------------------------- 1 | using Graphics; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | [ExecuteInEditMode] 6 | public class SSS_convolution : MonoBehaviour 7 | { 8 | //public bool Enabled = true; 9 | float FOV_compensation = 0; 10 | float initFOV; 11 | [HideInInspector] public bool AllowMSAA; 12 | [HideInInspector] 13 | [Range(0, 1f)] 14 | public float BlurRadius = 1; 15 | [HideInInspector] 16 | public Shader BlurShader = null; 17 | Camera _ThisCamera; 18 | [HideInInspector] 19 | public RenderTextureFormat rtFormat; 20 | [HideInInspector] 21 | public Material _BlurMaterial = null; 22 | Material BlurMaterial 23 | { 24 | get 25 | { 26 | if (_BlurMaterial == null && BlurShader) 27 | { 28 | _BlurMaterial = new Material(BlurShader); 29 | _BlurMaterial.hideFlags = HideFlags.HideAndDontSave; 30 | } 31 | return _BlurMaterial; 32 | } 33 | } 34 | [HideInInspector] 35 | [Range(0, 10)] 36 | public int iterations = 3; 37 | Camera ParentCamera; 38 | 39 | void OnEnable() 40 | { 41 | 42 | _ThisCamera = gameObject.GetComponent(); 43 | try 44 | { 45 | ParentCamera = transform.parent.GetComponent(); 46 | } 47 | catch 48 | { 49 | ParentCamera = FindObjectOfType().GetComponent(); 50 | } 51 | 52 | initFOV = ParentCamera.fieldOfView; 53 | } 54 | //private void Update() 55 | //{ 56 | // if (Input.GetKeyDown(KeyCode.P)) 57 | // Enabled = !Enabled; 58 | //} 59 | // Called by the camera to apply the image effect 60 | //[SerializeField] 61 | RenderTexture buffer; 62 | [HideInInspector] 63 | public RenderTexture blurred; 64 | int AA = 1; 65 | float Pitagoras(float x, float y) 66 | { 67 | return Mathf.Sqrt(x * x + y * y); 68 | } 69 | 70 | [ImageEffectOpaque] 71 | void OnRenderImage(RenderTexture source, RenderTexture destination) 72 | { 73 | 74 | // if (Enabled) 75 | { 76 | FOV_compensation = initFOV / _ThisCamera.fieldOfView; 77 | //BlurMaterial.SetFloat("BlurRadius", BlurRadius * FOV_compensation); 78 | 79 | int rtW = source.width; 80 | int rtH = source.height; 81 | float ScreenSizeCorrection = Pitagoras(rtH, rtW) / Pitagoras(1920, 1080); 82 | 83 | BlurRadius *= FOV_compensation; 84 | BlurRadius *= ScreenSizeCorrection;//so everything will be fine with high-res screenshots 85 | //float ratio = rtW / rtH; 86 | //print(ratio); 87 | //https://github.com/Heep042/Unity-Graphics-Demo/blob/master/Assets/Standard%20Assets/Effects/ImageEffects/Scripts/Bloom.cs 88 | if (_ThisCamera.allowMSAA && QualitySettings.antiAliasing > 0 && AllowMSAA) 89 | AA = QualitySettings.antiAliasing; 90 | else 91 | AA = 1; 92 | 93 | buffer = RenderTexture.GetTemporary(rtW, rtH, 0, rtFormat, RenderTextureReadWrite.Linear, AA); 94 | 95 | UnityEngine.Graphics.Blit(source, buffer); 96 | 97 | for (int i = 0; i < iterations; i++) 98 | { 99 | // Blur vertical 100 | RenderTexture buffer2 = RenderTexture.GetTemporary(rtW, rtH, 0, rtFormat, RenderTextureReadWrite.Linear, AA); 101 | BlurMaterial.SetVector("_TexelOffsetScale", new Vector4(0, BlurRadius, 0, 0)); 102 | UnityEngine.Graphics.Blit(buffer, buffer2, BlurMaterial); 103 | RenderTexture.ReleaseTemporary(buffer); 104 | buffer = buffer2; 105 | 106 | // Blur horizontal 107 | buffer2 = RenderTexture.GetTemporary(rtW, rtH, 0, rtFormat, RenderTextureReadWrite.Linear, AA); 108 | BlurMaterial.SetVector("_TexelOffsetScale", new Vector4(BlurRadius, 0, 0, 0)); 109 | UnityEngine.Graphics.Blit(buffer, buffer2, BlurMaterial); 110 | RenderTexture.ReleaseTemporary(buffer); 111 | buffer = buffer2; 112 | 113 | 114 | //Circular blur 115 | /* RenderTexture buffer2 = RenderTexture.GetTemporary(rtW, rtH, 0, rtFormat, RenderTextureReadWrite.Linear, AA); 116 | BlurMaterial.SetFloat("_TexelOffsetScale", BlurRadius * FOV_compensation); 117 | Graphics.Blit(buffer, buffer2, BlurMaterial); 118 | RenderTexture.ReleaseTemporary(buffer); 119 | buffer = buffer2;*/ 120 | } 121 | 122 | Debug.Assert(blurred); 123 | UnityEngine.Graphics.Blit(buffer, blurred); 124 | 125 | UnityEngine.Graphics.Blit(source, destination); 126 | RenderTexture.ReleaseTemporary(buffer); 127 | } 128 | //else 129 | //{ 130 | // Graphics.Blit(source, destination); 131 | // Graphics.Blit(source, blurred); 132 | //} 133 | } 134 | } 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /Graphics/Shared/Preset.cs: -------------------------------------------------------------------------------- 1 | using Graphics.Settings; 2 | using Graphics.Textures; 3 | using MessagePack; 4 | using System; 5 | using System.IO; 6 | using UnityEngine; 7 | 8 | namespace Graphics 9 | { 10 | // TODO: Find better way to save the data... maybe builder? idk... 11 | [MessagePackObject(keyAsPropertyName: true)] 12 | public struct Preset 13 | { 14 | public GlobalSettings global; 15 | public CameraSettings camera; 16 | public LightingSettings lights; 17 | public PostProcessingSettings pp; 18 | public SSSSettings sss; 19 | public SkyboxParams skybox; 20 | public SkyboxSettings skyboxSetting; 21 | 22 | public Preset(GlobalSettings global, CameraSettings camera, LightingSettings lights, PostProcessingSettings pp, SkyboxParams skybox, SSSSettings sss) 23 | { 24 | this.camera = camera; 25 | this.global = global; 26 | this.lights = lights; 27 | this.pp = pp; 28 | this.skybox = skybox; 29 | this.sss = sss; 30 | 31 | // Skybox setting is generated when preset is being saved. 32 | skyboxSetting = null; 33 | } 34 | 35 | public void UpdateParameters() 36 | { 37 | pp.SaveParameters(); 38 | sss?.SaveParameters(); 39 | SkyboxManager manager = Graphics.Instance.SkyboxManager; 40 | 41 | Material mat = manager.Skybox; 42 | if (mat) 43 | { 44 | SkyboxSettings setting = null; 45 | 46 | // Generate Setting Class 47 | // TODO: Find better way... 48 | // TODO: Add EnviroSky Support (AI) 49 | // TODO: Add AIOSky Support (HS2) 50 | // TODO: Stronger exception handling for different games. 51 | if (mat.shader.name == ProceduralSkyboxSettings.shaderName) setting = new ProceduralSkyboxSettings(); 52 | else if (mat.shader.name == TwoPointColorSkyboxSettings.shaderName) setting = new TwoPointColorSkyboxSettings(); 53 | else if (mat.shader.name == FourPointGradientSkyboxSetting.shaderName) setting = new FourPointGradientSkyboxSetting(); 54 | else if (mat.shader.name == HemisphereGradientSkyboxSetting.shaderName) setting = new HemisphereGradientSkyboxSetting(); 55 | 56 | if (setting != null) 57 | { 58 | setting.Save(); 59 | skyboxSetting = setting; 60 | } 61 | } 62 | 63 | skybox = manager.skyboxParams; 64 | } 65 | public byte[] Serialize() 66 | { 67 | return MessagePackSerializer.Serialize(this); 68 | } 69 | public void Save(string name = "default", string path = "", bool overwrite = true) 70 | { 71 | if (path == "") 72 | { 73 | path = Graphics.ConfigPresetPath.Value; // Runtime Config Preset Path. 74 | } 75 | 76 | string targetPath = Path.Combine(path, name + ".preset"); 77 | Directory.CreateDirectory(Path.GetDirectoryName(targetPath)); 78 | UpdateParameters(); 79 | byte[] bytes = Serialize(); 80 | if (File.Exists(targetPath) && overwrite) 81 | { 82 | File.Delete(targetPath); 83 | File.WriteAllBytes(targetPath, bytes); 84 | File.WriteAllText(Path.Combine(path, "debug.json"), MessagePackSerializer.ToJson(this)); 85 | } 86 | else 87 | { 88 | File.WriteAllBytes(targetPath, bytes); 89 | } 90 | } 91 | public bool Load(string name = "default") 92 | { 93 | string targetPath = Graphics.Instance.PresetManager.PresetPath(name); 94 | if (File.Exists(targetPath)) 95 | { 96 | try 97 | { 98 | byte[] bytes = File.ReadAllBytes(targetPath); 99 | Load(bytes); 100 | return true; 101 | } 102 | catch (Exception e) 103 | { 104 | Graphics.Instance.Log.Log(BepInEx.Logging.LogLevel.Error, string.Format("Couldn't open preset file '{0}'", name + ".preset")); 105 | Graphics.Instance.Log.Log(BepInEx.Logging.LogLevel.Error, e.Message); 106 | return false; 107 | } 108 | } 109 | else 110 | { 111 | Graphics.Instance.Log.Log(BepInEx.Logging.LogLevel.Error, string.Format("Couldn't find preset file '{0}'", name + ".preset")); 112 | return false; 113 | } 114 | } 115 | 116 | public void Load(byte[] bytes) 117 | { 118 | Deserialize(bytes); 119 | ApplyParameters(); 120 | } 121 | 122 | public void Deserialize(byte[] bytes) 123 | { 124 | this = MessagePackSerializer.Deserialize(bytes); 125 | } 126 | 127 | public void ApplyParameters() 128 | { 129 | pp.LoadParameters(); 130 | sss?.LoadParameters(); 131 | 132 | SkyboxManager manager = Graphics.Instance.SkyboxManager; 133 | if (manager) 134 | { 135 | if (skyboxSetting != null) 136 | manager.dynSkyboxSetting = skyboxSetting; 137 | manager.skyboxParams = skybox; 138 | manager.PresetUpdate = true; 139 | manager.LoadSkyboxParams(); 140 | } 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /Graphics/Shared/Alloy/AreaLight/AlloyAreaLight.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | #endif 4 | 5 | using System; 6 | using UnityEngine; 7 | using UnityEngine.Serialization; 8 | 9 | [ExecuteInEditMode] 10 | [RequireComponent(typeof(Light))] 11 | [AddComponentMenu(AlloyUtils.ComponentMenu + "Area Light")] 12 | public class AlloyAreaLight : MonoBehaviour 13 | { 14 | // Minimum non-zero value for light size, so we can use sign for specular toggle. 15 | private const float c_minimumLightSize = 0.00001f; 16 | 17 | // Minimum light intensity to prevent divide by zero (because Epsilon causes infinity). 18 | private const float c_minimumLightIntensity = 0.01f; 19 | 20 | [HideInInspector] 21 | public Texture2D DefaultSpotLightCookie; 22 | 23 | [FormerlySerializedAs("m_size")] 24 | [SerializeField] 25 | private float m_radius; 26 | 27 | [SerializeField] 28 | private float m_length; 29 | 30 | [SerializeField] 31 | private bool m_hasSpecularHightlight = true; 32 | private Light m_light; 33 | private Color m_lastColor; 34 | private float m_lastIntensity; 35 | private float m_lastRange; 36 | 37 | private Light Light 38 | { 39 | get 40 | { 41 | // Ensures that we have the light component, even if light is disabled. 42 | if (m_light == null) 43 | { 44 | m_light = GetComponent(); 45 | } 46 | 47 | return m_light; 48 | } 49 | } 50 | 51 | public float Radius 52 | { 53 | get => m_radius; 54 | set 55 | { 56 | if (m_radius != value) 57 | { 58 | m_radius = value; 59 | UpdateBinding(); 60 | } 61 | } 62 | } 63 | 64 | public float Length 65 | { 66 | get => m_length; 67 | set 68 | { 69 | if (m_length != value) 70 | { 71 | m_length = value; 72 | UpdateBinding(); 73 | } 74 | } 75 | } 76 | 77 | public bool HasSpecularHighlight 78 | { 79 | get => m_hasSpecularHightlight; 80 | set 81 | { 82 | if (m_hasSpecularHightlight != value) 83 | { 84 | m_hasSpecularHightlight = value; 85 | UpdateBinding(); 86 | } 87 | } 88 | } 89 | 90 | private void Reset() 91 | { 92 | m_hasSpecularHightlight = true; 93 | m_radius = 0.0f; 94 | m_length = 0.0f; 95 | 96 | m_lastColor = Color.black; 97 | m_lastIntensity = 0.0f; 98 | m_lastRange = 0.0f; 99 | 100 | UpdateBinding(); 101 | } 102 | 103 | // Must run after all other light scripts and animation clips. 104 | private void LateUpdate() 105 | { 106 | Light l = Light; 107 | 108 | // Poll the Light component, since we can't extend it. 109 | if (l.color != m_lastColor 110 | || l.intensity != m_lastIntensity 111 | || l.range != m_lastRange) 112 | { 113 | UpdateBinding(); 114 | } 115 | } 116 | 117 | public void UpdateBinding() 118 | { 119 | Light l = Light; 120 | Color color = l.color; 121 | float intensity = l.intensity; 122 | float range = l.range; 123 | 124 | #if UNITY_EDITOR 125 | EnsureCookie(); 126 | #endif 127 | 128 | if (l.type == LightType.Directional) 129 | { 130 | m_radius = Mathf.Clamp01(m_radius); 131 | color.a = 10.0f * m_radius; // Cancel 0.1 * n in the shader. 132 | } 133 | else 134 | { 135 | // Radius packed into fractional component of number. 136 | float maxRadius = range; 137 | m_radius = Mathf.Clamp(m_radius, 0.0f, maxRadius); 138 | color.a = Mathf.Min(0.999f, m_radius / maxRadius); 139 | 140 | if (l.type == LightType.Point) 141 | { 142 | // Length packed into integer component of number. 143 | float maxLength = 2.0f * range; 144 | m_length = Mathf.Clamp(m_length, 0.0f, maxLength); 145 | color.a += Mathf.Ceil(1000.0f * Mathf.Min(1.0f, m_length / maxLength)); 146 | } 147 | } 148 | 149 | // Specular highlight toggle in sign component of number. 150 | color.a = Mathf.Max(c_minimumLightSize, color.a); // Must be non-zero! 151 | color.a *= (m_hasSpecularHightlight ? 1.0f : -1.0f); 152 | 153 | // Cancel Unity's implicit intensity multiply. 154 | color.a /= Mathf.Max(intensity, c_minimumLightIntensity); 155 | l.color = color; 156 | 157 | m_lastColor = color; 158 | m_lastIntensity = intensity; 159 | m_lastRange = range; 160 | } 161 | 162 | #if UNITY_EDITOR 163 | public void EnsureCookie() { 164 | var l = Light; 165 | 166 | if (l.type == LightType.Spot && l.cookie == null) { 167 | l.cookie = DefaultSpotLightCookie; 168 | EditorUtility.SetDirty(this); 169 | } else if (l.type == LightType.Point && l.cookie == DefaultSpotLightCookie) { 170 | l.cookie = null; 171 | EditorUtility.SetDirty(this); 172 | } 173 | } 174 | #endif 175 | 176 | // DEPRECATED BEGIN 177 | [Obsolete("Please use Unity Light component's \"color\" field.")] 178 | public Color Color { 179 | get => Light.color; 180 | set => Light.color = value; 181 | } 182 | 183 | [Obsolete("Please use Unity Light component's \"intensity\" field.")] 184 | public float Intensity { 185 | get => Light.intensity; 186 | set => Light.intensity = value; 187 | } 188 | 189 | [Obsolete("No longer used. Please remove all references to it.")] 190 | public bool IsAnimated { get; set; } 191 | // DEPRECATED END 192 | } 193 | -------------------------------------------------------------------------------- /Graphics/Shared/Inspector/SettingsInspector.cs: -------------------------------------------------------------------------------- 1 | using Graphics.Settings; 2 | using UnityEngine; 3 | using static Graphics.Inspector.Util; 4 | 5 | namespace Graphics.Inspector 6 | { 7 | internal static class SettingsInspector 8 | { 9 | private const float FOVMin = 10f; 10 | private const float FOVMax = 120f; 11 | private const float FOVDefault = 23.5f; 12 | 13 | internal static void Draw(CameraSettings cameraSettings, GlobalSettings renderingSettings, bool showAdvanced) 14 | { 15 | GUILayout.BeginVertical(GUIStyles.Skin.box); 16 | { 17 | Label("Camera", "", true); 18 | cameraSettings.ClearFlag = Selection("Clear Flags", cameraSettings.ClearFlag, flag => cameraSettings.ClearFlag = flag); 19 | if (showAdvanced) 20 | { 21 | //changing studio camera's culling mask breaks studio, possibly due to cinemachine 22 | GUI.enabled = false; 23 | SelectionMask("Culling Mask", cameraSettings.CullingMask, mask => cameraSettings.CullingMask = mask); 24 | GUI.enabled = true; 25 | } 26 | Slider("Near Clipping Plane", cameraSettings.NearClipPlane, 0.01f, 15000f, "N2", ncp => { cameraSettings.NearClipPlane = ncp; }); 27 | Slider("Far Clipping Plane", cameraSettings.FarClipPlane, 0.01f, 15000f, "N2", ncp => { cameraSettings.FarClipPlane = ncp; }); 28 | Selection("Rendering Path", cameraSettings.RenderingPath, path => cameraSettings.RenderingPath = path); 29 | Slider("Field of View", cameraSettings.Fov, FOVMin, FOVMax, "N0", fov => { cameraSettings.Fov = fov; }); 30 | Toggle("Occlusion Culling", cameraSettings.OcculsionCulling, false, culling => cameraSettings.OcculsionCulling = culling); 31 | Toggle("Allow HDR", cameraSettings.HDR, false, hdr => cameraSettings.HDR = hdr); 32 | Toggle("Allow MSAA (Forward Only)", cameraSettings.MSAA, false, msaa => cameraSettings.MSAA = msaa); 33 | Toggle("Allow Dynamic Resolution", cameraSettings.DynamicResolution, false, dynamic => cameraSettings.DynamicResolution = dynamic); 34 | GUILayout.Space(10); 35 | Label("Rendering", "", true); 36 | GUILayout.Space(1); 37 | Label("Colour Space", QualitySettings.activeColorSpace.ToString()); 38 | Label("Quality Level", QualitySettings.names[QualitySettings.GetQualityLevel()]); 39 | Text("Pixel Light Count", renderingSettings.PixelLightCount, count => renderingSettings.PixelLightCount = count); 40 | Selection("Anisotropic Textures", renderingSettings.AnisotropicFiltering, filtering => renderingSettings.AnisotropicFiltering = filtering); 41 | Slider("MSAA Multiplier", renderingSettings.AntiAliasing, 0, 8, aa => renderingSettings.AntiAliasing = aa); 42 | Toggle("Realtime Reflection Probes", renderingSettings.RealtimeReflectionProbes, false, realtime => renderingSettings.RealtimeReflectionProbes = realtime); 43 | GUILayout.Space(10); 44 | Label("Shadows", "", true); 45 | GUILayout.Space(1); 46 | Selection("Shadowmask Mode", renderingSettings.ShadowmaskModeSetting, mode => renderingSettings.ShadowmaskModeSetting = mode); 47 | Selection("Shadows", renderingSettings.ShadowQualitySetting, setting => renderingSettings.ShadowQualitySetting = setting); 48 | Selection("Shadow Resolution", renderingSettings.ShadowResolutionSetting, resolution => renderingSettings.ShadowResolutionSetting = resolution); 49 | Selection("Shadow Projection", renderingSettings.ShadowProjectionSetting, projection => renderingSettings.ShadowProjectionSetting = projection); 50 | Text("Shadow Distance", renderingSettings.ShadowDistance, "N2", distance => renderingSettings.ShadowDistance = distance); 51 | Text("Shadow Near Plane Offset", renderingSettings.ShadowNearPlaneOffset, "N2", offset => renderingSettings.ShadowNearPlaneOffset = offset); 52 | if (showAdvanced) 53 | { 54 | Toggle("Use PCSS (Experimental)", renderingSettings.UsePCSS, false, pcss => renderingSettings.UsePCSS = pcss); 55 | if (renderingSettings.UsePCSS) 56 | { 57 | Slider("Blocker Sample Count", PCSSLight.Blocker_SampleCount, 1, 64, count => PCSSLight.Blocker_SampleCount = count); 58 | Slider("PCF Sample Count", PCSSLight.PCF_SampleCount, 1, 64, count => PCSSLight.PCF_SampleCount = count); 59 | Slider("Softness", PCSSLight.Softness, 0f, 7.5f, "N2", softness => PCSSLight.Softness = softness); 60 | Slider("Softness Falloff", PCSSLight.SoftnessFalloff, 0f, 5f, "N2", softnessFalloff => PCSSLight.SoftnessFalloff = softnessFalloff); 61 | Slider("Blocker Gradient Bias", PCSSLight.Blocker_GradientBias, 0f, 1f, "N2", bias => PCSSLight.Blocker_GradientBias = bias); 62 | Slider("PCF Gradient Bias", PCSSLight.PCF_GradientBias, 0f, 1f, "N2", bias => PCSSLight.PCF_GradientBias = bias); 63 | Slider("Max Static Gradient Bias", PCSSLight.MaxStaticGradientBias, 0f, 0.15f, "N2", bias => PCSSLight.MaxStaticGradientBias = bias); 64 | Slider("Cascade Blend Distance", PCSSLight.CascadeBlendDistance, 0f, 1f, "N2", distance => PCSSLight.CascadeBlendDistance = distance); 65 | } 66 | } 67 | GUILayout.Space(10); 68 | Selection("Language", LocalizationManager.CurrentLanguage, language => LocalizationManager.CurrentLanguage = language); 69 | Slider("Font Size", renderingSettings.FontSize, 12, 17, size => renderingSettings.FontSize = size); 70 | Slider("Window Width", Inspector.Width, 400, Screen.width / 2, size => Inspector.Width = size); 71 | Slider("Window Height", Inspector.Height, 400, Screen.height, size => Inspector.Height = size); 72 | GUILayout.Space(10); 73 | Toggle("Show Advanced Settings", renderingSettings.ShowAdvancedSettings, false, advanced => renderingSettings.ShowAdvancedSettings = advanced); 74 | } 75 | GUILayout.EndVertical(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Graphics/Shared/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using UnityEngine; 6 | 7 | namespace Graphics 8 | { 9 | internal class Util 10 | { 11 | internal static void ResizeTexture(Texture2D tex, int width, int height, bool doVFlip, FilterMode mode = FilterMode.Trilinear) 12 | { 13 | Scale(tex, width, height); 14 | if (doVFlip) FlipTextureVertically(tex); 15 | } 16 | 17 | //https://pastebin.com/qkkhWs2J 18 | internal static void Scale(Texture2D tex, int width, int height, FilterMode mode = FilterMode.Trilinear) 19 | { 20 | Rect texR = new Rect(0, 0, width, height); 21 | _gpu_scale(tex, width, height, mode); 22 | 23 | tex.Resize(width, height); 24 | tex.ReadPixels(texR, 0, 0, true); 25 | tex.Apply(true); 26 | } 27 | 28 | // Internal unility that renders the source texture into the RTT - the scaling method itself. 29 | //static void _gpu_scale(Texture2D src, int width, int height, FilterMode fmode) 30 | internal static void _gpu_scale(Texture2D src, int width, int height, FilterMode fmode) 31 | { 32 | //We need the source texture in VRAM because we render with it 33 | src.filterMode = fmode; 34 | src.Apply(true); 35 | 36 | //Using RTT for best quality and performance. Thanks, Unity 5 37 | RenderTexture rtt = new RenderTexture(width, height, 32); 38 | 39 | //Set the RTT in order to render to it 40 | UnityEngine.Graphics.SetRenderTarget(rtt); 41 | 42 | //Setup 2D matrix in range 0..1, so nobody needs to care about sized 43 | GL.LoadPixelMatrix(0, 1, 1, 0); 44 | 45 | //Then clear & draw the texture to fill the entire RTT. 46 | GL.Clear(true, true, new Color(0, 0, 0, 0)); 47 | UnityEngine.Graphics.DrawTexture(new Rect(0, 0, 1, 1), src); 48 | rtt = null; 49 | } 50 | 51 | internal static void FlipTextureVertically(Texture2D original) 52 | { 53 | Color[] originalPixels = original.GetPixels(); 54 | 55 | Color[] newPixels = new Color[originalPixels.Length]; 56 | 57 | int width = original.width; 58 | int rows = original.height; 59 | 60 | for (int x = 0; x < width; x++) 61 | { 62 | for (int y = 0; y < rows; y++) 63 | { 64 | newPixels[x + y * width] = originalPixels[x + (rows - y - 1) * width]; 65 | } 66 | } 67 | 68 | original.SetPixels(newPixels); 69 | original.Apply(); 70 | } 71 | 72 | internal static void RenderToTarget(Camera dest, RenderTexture targetTexture, Shader CameraShader) 73 | { 74 | dest.targetTexture = targetTexture; 75 | if (CameraShader != null) 76 | dest.RenderWithShader(CameraShader, "RenderType"); 77 | else 78 | dest.Render(); 79 | } 80 | 81 | internal static List GetFiles(string path, string fileSearchPattern = "*", string dirSearchPattern = "*", SearchOption searchOption = SearchOption.AllDirectories) 82 | { 83 | List files = GetFiles(path, fileSearchPattern); 84 | 85 | if (searchOption == SearchOption.TopDirectoryOnly) 86 | { 87 | return files; 88 | } 89 | 90 | List directories = new List(GetDirectories(path, dirSearchPattern)); 91 | 92 | for (int i = 0; i < directories.Count; i++) 93 | { 94 | directories.AddRange(GetDirectories(directories[i], dirSearchPattern)); 95 | } 96 | 97 | for (int i = 0; i < directories.Count; i++) 98 | { 99 | files.AddRange(GetFiles(directories[i], fileSearchPattern)); 100 | } 101 | 102 | return files; 103 | } 104 | 105 | internal static Dictionary GetRelativeFileNameToFullPathMap(string path, string fileSearchPattern) 106 | { 107 | return GetFiles(path, fileSearchPattern, "*", SearchOption.AllDirectories).ToDictionary(entry 108 | => GetRelativePathWithFileExtension(entry,path), entry => entry); 109 | } 110 | 111 | private static string GetRelativePathWithFileExtension(string fileFullPath, string basePath) 112 | { 113 | string fileDir = Path.GetDirectoryName(fileFullPath); 114 | string baseDir = Path.GetDirectoryName(basePath); 115 | if (string.Equals(Path.GetFullPath(fileDir), Path.GetFullPath(baseDir), StringComparison.OrdinalIgnoreCase)) 116 | return Path.GetFileNameWithoutExtension(fileFullPath); 117 | 118 | // Uri requires trailing backslash for relative path to work as expected 119 | if (!baseDir.EndsWith("\\")) 120 | baseDir += "\\"; 121 | 122 | if (!fileDir.EndsWith("\\")) 123 | fileDir += "\\"; 124 | 125 | Uri baseUri = new Uri(baseDir); 126 | Uri fullUri = new Uri(fileDir); 127 | Uri relativeUri = baseUri.MakeRelativeUri(fullUri); 128 | 129 | // Uri's use forward slashes so convert back to backward slashes 130 | return Path.Combine(relativeUri.ToString().Replace("../", "").Replace("/", "\\"), Path.GetFileNameWithoutExtension(fileFullPath)); 131 | } 132 | 133 | private static List GetDirectories(string path, string searchPattern) 134 | { 135 | try 136 | { 137 | return Directory.GetDirectories(path, searchPattern).ToList(); 138 | } 139 | catch (Exception) 140 | { 141 | return new List(); 142 | } 143 | } 144 | 145 | private static List GetFiles(string path, string searchPattern) 146 | { 147 | try 148 | { 149 | return Directory.GetFiles(path, searchPattern).ToList(); 150 | } 151 | catch (Exception) 152 | { 153 | return new List(); 154 | } 155 | } 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Graphics/AIGraphics/AIGraphics.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {535A64F6-5478-4F5E-8B99-9CD6AC4D4A97} 8 | Library 9 | Properties 10 | Graphics 11 | Graphics 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | D:\AI-Syoujyo\BepInEx\plugins\gps\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE;AI 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\IllusionLibs.BepInEx.Harmony.2.0.3.1\lib\net35\0Harmony.dll 36 | False 37 | 38 | 39 | ..\packages\IllusionModdingAPI.AIAPI.1.13.0\lib\net46\AIAPI.dll 40 | False 41 | 42 | 43 | ..\packages\ExtensibleSaveFormat.AIGirl.15.2.0\lib\net46\AI_ExtensibleSaveFormat.dll 44 | False 45 | 46 | 47 | ..\packages\IllusionLibs.AIGirl.Assembly-CSharp.2020.5.29\lib\net46\Assembly-CSharp.dll 48 | False 49 | 50 | 51 | ..\packages\IllusionLibs.BepInEx.5.1.0\lib\net35\BepInEx.dll 52 | False 53 | 54 | 55 | ..\packages\IllusionLibs.BepInEx.Harmony.2.0.3.1\lib\net35\BepInEx.Harmony.dll 56 | False 57 | 58 | 59 | ..\packages\IllusionLibs.AIGirl.Cinemachine.2018.2.21.1\lib\net46\Cinemachine.dll 60 | False 61 | 62 | 63 | ..\packages\IllusionLibs.AIGirl.MessagePack.2020.5.29\lib\net46\MessagePack.dll 64 | False 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | ..\packages\IllusionLibs.AIGirl.UniRx.2020.5.29\lib\net46\UniRx.dll 76 | False 77 | 78 | 79 | ..\packages\IllusionLibs.AIGirl.Unity.Postprocessing.Runtime.2018.2.21.1\lib\net46\Unity.Postprocessing.Runtime.dll 80 | False 81 | 82 | 83 | ..\packages\IllusionLibs.AIGirl.UnityEngine.CoreModule.2018.2.21.1\lib\net46\UnityEngine.dll 84 | False 85 | 86 | 87 | ..\packages\IllusionLibs.AIGirl.UnityEngine.AssetBundleModule.2018.2.21.1\lib\net46\UnityEngine.AssetBundleModule.dll 88 | False 89 | 90 | 91 | ..\packages\IllusionLibs.AIGirl.UnityEngine.CoreModule.2018.2.21.1\lib\net46\UnityEngine.CoreModule.dll 92 | False 93 | 94 | 95 | ..\packages\IllusionLibs.AIGirl.UnityEngine.ImageConversionModule.2018.2.21.1\lib\net46\UnityEngine.ImageConversionModule.dll 96 | False 97 | 98 | 99 | ..\packages\IllusionLibs.AIGirl.UnityEngine.IMGUIModule.2018.2.21.1\lib\net46\UnityEngine.IMGUIModule.dll 100 | False 101 | 102 | 103 | ..\packages\IllusionLibs.AIGirl.UnityEngine.PhysicsModule.2018.2.21.1\lib\net46\UnityEngine.PhysicsModule.dll 104 | False 105 | 106 | 107 | ..\packages\IllusionLibs.AIGirl.UnityEngine.TextRenderingModule.2018.2.21.1\lib\net46\UnityEngine.TextRenderingModule.dll 108 | False 109 | 110 | 111 | ..\packages\IllusionLibs.AIGirl.UnityEngine.UI.2018.2.21.1\lib\net46\UnityEngine.UI.dll 112 | False 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /Graphics/Shared/FocusPuller.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | // Utility scripts for the post processing stack 4 | // https://github.com/keijiro/PostProcessingUtilities 5 | namespace Graphics 6 | { 7 | public class FocusPuller : MonoBehaviour 8 | { 9 | private float _velocity; 10 | private float _speed = 6f; 11 | private Vector3 lastDoFPoint; 12 | private bool initialFrame; 13 | private GameObject _ftgo; 14 | private Transform _target; 15 | #if DEBUG 16 | private LineDrawer lineDrawer; 17 | #endif 18 | 19 | internal LayerMask HitLayer { get; set; } 20 | internal float MaxDistance { get; set; } 21 | internal Vector3 TargetFocusPoint { get; private set; } 22 | internal Vector3 TargetPosition { get => null != _target ? _target.position : Vector3.zero; } 23 | internal Vector3 TransformPosition { get => null != _target ? transform.position : Vector3.zero; } 24 | internal Vector3 HitPoint { get; private set; } 25 | internal Vector3 RayOrigin { get; private set; } 26 | internal float Speed 27 | { 28 | get => _speed; 29 | set => _speed = Mathf.Max(MinSpeed, value); 30 | } 31 | internal static float MinSpeed = 1f; 32 | internal static float MaxSpeed = 12f; 33 | internal static string ColliderLayer = "H_MetaBallB"; 34 | internal static string DefaultLayer = "Default"; 35 | 36 | private void Awake() 37 | { 38 | _ftgo = new GameObject("FocusTarget"); 39 | _target = _ftgo.transform; 40 | HitLayer = CullingMaskExtensions.LayerCullingShow(Graphics.Instance.CameraSettings.MainCamera.cullingMask, ColliderLayer); 41 | HitLayer = CullingMaskExtensions.LayerCullingHide(HitLayer, DefaultLayer); 42 | MaxDistance = Graphics.Instance.CameraSettings.MainCamera.farClipPlane; 43 | #if DEBUG 44 | lineDrawer = new LineDrawer(); 45 | #endif 46 | } 47 | 48 | private void OnEnable() 49 | { 50 | initialFrame = true; 51 | } 52 | 53 | private void OnValidate() 54 | { 55 | Speed = _speed; 56 | } 57 | 58 | private void OnPreRender() 59 | { 60 | if (_target == null) return; 61 | 62 | if (initialFrame) 63 | { 64 | initialFrame = false; 65 | Focus(new Vector3(Screen.width / 2, Screen.height / 2)); 66 | } 67 | else 68 | { 69 | Focus(Input.mousePosition); 70 | } 71 | 72 | // Retrieve the current value. 73 | float d1 = Graphics.Instance.PostProcessingSettings.FocalDistance; 74 | #if DEBUG 75 | lineDrawer.DrawLineInGameView(transform.position, _target.position, Color.green); 76 | #endif 77 | // Calculate the depth of the focus point. 78 | float d2 = Vector3.Dot(_target.position - transform.position, transform.forward); 79 | if (d2 < 0.1f) 80 | { 81 | d2 = 0.1f; 82 | } 83 | 84 | // Damped-spring interpolation. 85 | float dt = Time.deltaTime; 86 | float n1 = _velocity - (d1 - d2) * Speed * Speed * dt; 87 | float n2 = 1 + Speed * dt; 88 | _velocity = n1 / (n2 * n2); 89 | float d = d1 + _velocity * dt; 90 | 91 | // Apply the result. 92 | Graphics.Instance.PostProcessingSettings.FocalDistance = d; 93 | } 94 | 95 | private void Focus(Vector3 PointOnScreen) 96 | { 97 | TargetFocusPoint = PointOnScreen; 98 | // our ray 99 | var ray = transform.GetComponent().ScreenPointToRay(PointOnScreen); 100 | RayOrigin = ray.origin; 101 | #if DEBUG 102 | lineDrawer.DrawLineInGameView(ray.origin, ray.direction * 100, Color.yellow); 103 | #endif 104 | if (Physics.Raycast(ray, out RaycastHit hit, MaxDistance, HitLayer)) 105 | { 106 | HitPoint = hit.point; 107 | #if DEBUG 108 | lineDrawer.DrawLineInGameView(ray.origin, hit.point, Color.green); 109 | #endif 110 | // do we have a new point? 111 | if (lastDoFPoint == hit.point) 112 | { 113 | return; 114 | } 115 | 116 | _target.position = hit.point; 117 | // asign the last hit 118 | lastDoFPoint = hit.point; 119 | } 120 | /* 121 | * debug - Do any of the rays hit? 122 | * RaycastHit[] results = new RaycastHit[10]; 123 | 124 | if (0 < Physics.RaycastNonAlloc(ray, results, MaxDistance)) 125 | { 126 | foreach (var result in results) 127 | { 128 | // Check for null since some array spots might be 129 | if (result.collider != null) 130 | { 131 | Graphics.Instance.Log.Log(BepInEx.Logging.LogLevel.All, "hit " + result.collider.gameObject.name); 132 | } 133 | } 134 | } 135 | else 136 | { 137 | Graphics.Instance.Log.Log(BepInEx.Logging.LogLevel.All, "didn't hit"); 138 | } 139 | */ 140 | } 141 | #if DEBUG 142 | public struct LineDrawer 143 | { 144 | private LineRenderer lineRenderer; 145 | private float lineSize; 146 | 147 | public LineDrawer(float lineSize = 0.2f) 148 | { 149 | GameObject lineObj = new GameObject("LineObj"); 150 | lineRenderer = lineObj.AddComponent(); 151 | //Particles/Additive 152 | lineRenderer.material = new Material(Shader.Find("Hidden/Internal-Colored")); 153 | 154 | this.lineSize = lineSize; 155 | } 156 | 157 | private void init(float lineSize = 0.2f) 158 | { 159 | if (lineRenderer == null) 160 | { 161 | GameObject lineObj = new GameObject("LineObj"); 162 | lineRenderer = lineObj.AddComponent(); 163 | //Particles/Additive 164 | lineRenderer.material = new Material(Shader.Find("Hidden/Internal-Colored")); 165 | 166 | this.lineSize = lineSize; 167 | } 168 | } 169 | 170 | //Draws lines through the provided vertices 171 | public void DrawLineInGameView(Vector3 start, Vector3 end, Color color) 172 | { 173 | if (lineRenderer == null) 174 | { 175 | init(0.2f); 176 | } 177 | 178 | //Set color 179 | lineRenderer.startColor = color; 180 | lineRenderer.endColor = color; 181 | 182 | //Set width 183 | lineRenderer.startWidth = lineSize; 184 | lineRenderer.endWidth = lineSize; 185 | 186 | //Set line count which is 2 187 | lineRenderer.positionCount = 2; 188 | 189 | //Set the postion of both two lines 190 | lineRenderer.SetPosition(0, start); 191 | lineRenderer.SetPosition(1, end); 192 | } 193 | 194 | public void Destroy() 195 | { 196 | if (lineRenderer != null) 197 | { 198 | UnityEngine.Object.Destroy(lineRenderer.gameObject); 199 | } 200 | } 201 | } 202 | #endif 203 | } 204 | } -------------------------------------------------------------------------------- /Graphics/HS2Graphics/HS2Graphics.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {04B05781-2D6A-4804-969B-D2BE6A4639AD} 8 | Library 9 | Properties 10 | Graphics 11 | Graphics 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\IllusionLibs.BepInEx.Harmony.2.0.3.1\lib\net35\0Harmony.dll 36 | False 37 | 38 | 39 | ..\packages\IllusionLibs.HoneySelect2.Assembly-CSharp.2020.5.29\lib\net46\Assembly-CSharp.dll 40 | False 41 | 42 | 43 | ..\packages\IllusionLibs.HoneySelect2.Assembly-CSharp-firstpass.2020.5.29\lib\net35\Assembly-CSharp-firstpass.dll 44 | False 45 | 46 | 47 | ..\packages\IllusionLibs.BepInEx.5.1.0\lib\net35\BepInEx.dll 48 | False 49 | 50 | 51 | ..\packages\IllusionLibs.BepInEx.Harmony.2.0.3.1\lib\net35\BepInEx.Harmony.dll 52 | False 53 | 54 | 55 | ..\packages\IllusionLibs.HoneySelect2.Cinemachine.2018.4.11\lib\net46\Cinemachine.dll 56 | False 57 | 58 | 59 | ..\packages\IllusionModdingAPI.HS2API.1.13.0\lib\net46\HS2API.dll 60 | False 61 | 62 | 63 | ..\packages\ExtensibleSaveFormat.HoneySelect2.15.2.0\lib\net46\HS2_ExtensibleSaveFormat.dll 64 | False 65 | 66 | 67 | ..\packages\IllusionLibs.HoneySelect2.IL.2020.5.29\lib\net46\IL.dll 68 | False 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | ..\packages\IllusionLibs.HoneySelect2.UniRx.2020.5.29\lib\net46\UniRx.dll 80 | False 81 | 82 | 83 | ..\packages\IllusionLibs.HoneySelect2.Unity.Postprocessing.Runtime.2018.4.11\lib\net46\Unity.Postprocessing.Runtime.dll 84 | False 85 | 86 | 87 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.CoreModule.2018.4.11\lib\net46\UnityEngine.dll 88 | False 89 | 90 | 91 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.AssetBundleModule.2018.4.11\lib\net46\UnityEngine.AssetBundleModule.dll 92 | False 93 | 94 | 95 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.CoreModule.2018.4.11\lib\net46\UnityEngine.CoreModule.dll 96 | False 97 | 98 | 99 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.ImageConversionModule.2018.4.11\lib\net46\UnityEngine.ImageConversionModule.dll 100 | False 101 | 102 | 103 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.IMGUIModule.2018.4.11\lib\net46\UnityEngine.IMGUIModule.dll 104 | False 105 | 106 | 107 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.PhysicsModule.2018.4.11\lib\net46\UnityEngine.PhysicsModule.dll 108 | False 109 | 110 | 111 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.TextRenderingModule.2018.4.11\lib\net46\UnityEngine.TextRenderingModule.dll 112 | False 113 | 114 | 115 | ..\packages\IllusionLibs.HoneySelect2.UnityEngine.UI.2018.4.11\lib\net46\UnityEngine.UI.dll 116 | False 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /Graphics/Shared/Setting/DynamicSkyboxSettings.cs: -------------------------------------------------------------------------------- 1 | using Graphics.Textures; 2 | using MessagePack; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using UnityEngine; 9 | 10 | namespace Graphics.Settings 11 | { 12 | [Union(0, typeof(ProceduralSkyboxSettings))] 13 | [Union(1, typeof(TwoPointColorSkyboxSettings))] 14 | [Union(2, typeof(FourPointGradientSkyboxSetting))] 15 | [Union(3, typeof(HemisphereGradientSkyboxSetting))] 16 | public abstract class SkyboxSettings 17 | { 18 | virtual public void Save() { } 19 | virtual public void Load() { } 20 | } 21 | 22 | [MessagePackObject(keyAsPropertyName: true)] 23 | public class ProceduralSkyboxSettings : SkyboxSettings 24 | { 25 | [IgnoreMember] 26 | public static readonly string shaderName = "Skybox/Procedural"; 27 | 28 | public enum SunDisk 29 | { 30 | None, 31 | Simple, 32 | HighQuality, 33 | } 34 | 35 | public SunDisk sunDisk; 36 | public float sunSize; 37 | public float sunsizeConvergence; 38 | public float atmosphereThickness; 39 | public Color skyTint; 40 | public Color groundTint; 41 | public float exposure; 42 | 43 | public override void Save() 44 | { 45 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 46 | if (mat != null && mat.shader.name == shaderName) 47 | { 48 | sunDisk = (ProceduralSkyboxSettings.SunDisk)mat.GetInt("_SunDisk"); 49 | sunSize = mat.GetFloat("_SunSize"); 50 | sunsizeConvergence = mat.GetFloat("_SunSizeConvergence"); 51 | atmosphereThickness = mat.GetFloat("_AtmosphereThickness"); 52 | skyTint = mat.GetColor("_SkyTint"); 53 | groundTint = mat.GetColor("_GroundColor"); 54 | exposure = mat.GetFloat("_Exposure"); 55 | } 56 | } 57 | public override void Load() 58 | { 59 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 60 | if (mat != null && mat.shader.name == shaderName) 61 | { 62 | mat.SetInt("_SunDisk", (int)sunDisk); 63 | mat.SetFloat("_SunSize", sunSize); 64 | mat.SetFloat("_SunSizeConvergence", sunsizeConvergence); 65 | mat.SetFloat("_AtmosphereThickness", atmosphereThickness); 66 | mat.SetColor("_SkyTint", skyTint); 67 | mat.SetColor("_GroundColor", groundTint); 68 | mat.SetFloat("_Exposure", exposure); 69 | } 70 | } 71 | } 72 | 73 | [MessagePackObject(keyAsPropertyName: true)] 74 | public class TwoPointColorSkyboxSettings : SkyboxSettings 75 | { 76 | public float intensityA; 77 | public float intensityB; 78 | public Color colorA = new Color(); 79 | public Color colorB = new Color(); 80 | public Vector4 directionA = new Vector4(); 81 | public Vector4 directionB = new Vector4(); 82 | 83 | [IgnoreMember] 84 | public static readonly string shaderName = "SkyBox/Simple Two Colors"; 85 | public override void Save() 86 | { 87 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 88 | if (mat != null && mat.shader.name == shaderName) 89 | { 90 | intensityA = mat.GetFloat("_IntensityA"); 91 | intensityB = mat.GetFloat("_IntensityB"); 92 | colorA = mat.GetColor("_ColorA"); 93 | colorB = mat.GetColor("_ColorB"); 94 | directionA = mat.GetVector("_DirA"); 95 | directionB = mat.GetVector("_DirB"); 96 | } 97 | } 98 | public override void Load() 99 | { 100 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 101 | if (mat != null && mat.shader.name == shaderName) 102 | { 103 | mat.SetFloat("_IntensityA", intensityA); 104 | mat.SetFloat("_IntensityB", intensityB); 105 | mat.SetColor("_ColorA", colorA); 106 | mat.SetColor("_ColorB", colorB); 107 | mat.SetVector("_DirA", directionA); 108 | mat.SetVector("_DirB", directionB); 109 | } 110 | } 111 | } 112 | 113 | [MessagePackObject(keyAsPropertyName: true)] 114 | public class FourPointGradientSkyboxSetting : SkyboxSettings 115 | { 116 | public Color colorA = new Color(); 117 | public Color colorB = new Color(); 118 | public Color colorC = new Color(); 119 | public Color colorD = new Color(); 120 | public Vector3 directionA = new Vector3(); 121 | public Vector3 directionB = new Vector3(); 122 | public Vector3 directionC = new Vector3(); 123 | public Vector3 directionD = new Vector3(); 124 | public float exponentA; 125 | public float exponentB; 126 | public float exponentC; 127 | public float exponentD; 128 | 129 | 130 | [IgnoreMember] 131 | public static readonly string shaderName = "SkyboxPlus/Gradients"; 132 | public override void Save() 133 | { 134 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 135 | if (mat != null && mat.shader.name == shaderName) 136 | { 137 | colorA = mat.GetColor("_Color1"); 138 | colorB = mat.GetColor("_Color2"); 139 | colorC = mat.GetColor("_Color3"); 140 | colorD = mat.GetColor("_Color4"); 141 | directionA = mat.GetVector("_Direction1"); 142 | directionB = mat.GetVector("_Direction2"); 143 | directionC = mat.GetVector("_Direction3"); 144 | directionD = mat.GetVector("_Direction4"); 145 | exponentA = mat.GetFloat("_Exponent1"); 146 | exponentB = mat.GetFloat("_Exponent2"); 147 | exponentC = mat.GetFloat("_Exponent3"); 148 | exponentD = mat.GetFloat("_Exponent4"); 149 | } 150 | } 151 | public override void Load() 152 | { 153 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 154 | if (mat != null && mat.shader.name == shaderName) 155 | { 156 | mat.SetColor("_Color1", colorA); 157 | mat.SetColor("_Color2", colorB); 158 | mat.SetColor("_Color3", colorC); 159 | mat.SetColor("_Color4", colorD); 160 | mat.SetVector("_Direction1", directionA); 161 | mat.SetVector("_Direction2", directionB); 162 | mat.SetVector("_Direction3", directionC); 163 | mat.SetVector("_Direction4", directionD); 164 | mat.SetFloat("_Exponent1", exponentA); 165 | mat.SetFloat("_Exponent2", exponentB); 166 | mat.SetFloat("_Exponent3", exponentC); 167 | mat.SetFloat("_Exponent4", exponentD); 168 | } 169 | } 170 | } 171 | 172 | [MessagePackObject(keyAsPropertyName: true)] 173 | public class HemisphereGradientSkyboxSetting : SkyboxSettings 174 | { 175 | public Color colorA = new Color(); 176 | public Color colorB = new Color(); 177 | public Color colorC = new Color(); 178 | 179 | [IgnoreMember] 180 | public static readonly string shaderName = "SkyboxPlus/Hemisphere"; 181 | 182 | public override void Save() 183 | { 184 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 185 | if (mat != null && mat.shader.name == shaderName) 186 | { 187 | colorA = mat.GetColor("_TopColor"); 188 | colorB = mat.GetColor("_MiddleColor"); 189 | colorC = mat.GetColor("_BottomColor"); 190 | } 191 | } 192 | public override void Load() 193 | { 194 | Material mat = Graphics.Instance?.SkyboxManager?.Skybox; 195 | if (mat != null && mat.shader.name == shaderName) 196 | { 197 | mat.SetColor("_TopColor", colorA); 198 | mat.SetColor("_MiddleColor", colorB); 199 | mat.SetColor("_BottomColor", colorC); 200 | } 201 | } 202 | } 203 | 204 | } 205 | -------------------------------------------------------------------------------- /Graphics/Shared/Setting/CameraSettings.cs: -------------------------------------------------------------------------------- 1 | using Cinemachine; 2 | using MessagePack; 3 | using UnityEngine; 4 | using static KKAPI.Studio.StudioAPI; 5 | 6 | namespace Graphics.Settings 7 | { 8 | [MessagePackObject(keyAsPropertyName: true)] 9 | public class CameraSettings 10 | { 11 | private Camera _camera; 12 | private CameraClearFlags _clearFlags; 13 | private RenderingPath _renderingPath; 14 | private bool _occulsionCulling; 15 | private bool _hdr; 16 | private bool _msaa; 17 | private bool _dynamicResolution; 18 | private float _fov; 19 | private float _nearClipPlane; 20 | private float _farClipPlane; 21 | 22 | public CameraSettings() 23 | { 24 | _clearFlags = MainCamera.clearFlags; 25 | _renderingPath = MainCamera.renderingPath; 26 | _occulsionCulling = MainCamera.useOcclusionCulling; 27 | _hdr = MainCamera.allowHDR; 28 | _msaa = MainCamera.allowMSAA; 29 | _dynamicResolution = MainCamera.allowDynamicResolution; 30 | } 31 | 32 | public enum AICameraClearFlags 33 | { 34 | Skybox = CameraClearFlags.Skybox, 35 | Colour = CameraClearFlags.SolidColor, 36 | Depth = CameraClearFlags.Depth, 37 | Nothing = CameraClearFlags.Nothing, 38 | } 39 | 40 | public enum AIRenderingPath 41 | { 42 | VertexLit = UnityEngine.RenderingPath.VertexLit, 43 | Forward = UnityEngine.RenderingPath.Forward, 44 | Deferred = UnityEngine.RenderingPath.DeferredShading, 45 | } 46 | 47 | public AICameraClearFlags ClearFlag 48 | { 49 | get => (AICameraClearFlags)MainCamera.clearFlags; 50 | set => _clearFlags = MainCamera.clearFlags = (CameraClearFlags)value; 51 | } 52 | 53 | public int CullingMask 54 | { 55 | get => MainCamera.cullingMask; 56 | set 57 | { 58 | //Debug.Log("trying to set culling mask from " + MainCamera.cullingMask + " to " + value); 59 | //MainCamera.cullingMask = value; 60 | } 61 | } 62 | 63 | public AIRenderingPath RenderingPath 64 | { 65 | get => (AIRenderingPath)MainCamera.renderingPath; 66 | set 67 | { 68 | if (AIRenderingPath.Forward != value) 69 | { 70 | MSAA = false; 71 | } 72 | 73 | _renderingPath = MainCamera.renderingPath = (RenderingPath)value; 74 | } 75 | } 76 | 77 | public bool OcculsionCulling 78 | { 79 | get => MainCamera.useOcclusionCulling; 80 | set => _occulsionCulling = MainCamera.useOcclusionCulling = value; 81 | } 82 | 83 | public bool HDR 84 | { 85 | get => MainCamera.allowHDR; 86 | set => _hdr = MainCamera.allowHDR = value; 87 | } 88 | 89 | public bool MSAA 90 | { 91 | get => MainCamera.allowMSAA; 92 | set 93 | { 94 | //MSAA is Forward only 95 | if (value && RenderingPath != AIRenderingPath.Forward) 96 | { 97 | return; 98 | } 99 | 100 | _msaa = MainCamera.allowMSAA = value; 101 | } 102 | } 103 | 104 | public bool DynamicResolution 105 | { 106 | get => MainCamera.allowDynamicResolution; 107 | set => _dynamicResolution = MainCamera.allowDynamicResolution = value; 108 | } 109 | 110 | public float Fov 111 | { 112 | get 113 | { 114 | // if (default(float) == _fov) 115 | { 116 | if (InsideStudio) 117 | { 118 | Studio.CameraControl control = (Studio.CameraControl)MainCamera.GetComponent().ActiveVirtualCamera; 119 | return control.fieldOfView; 120 | } 121 | else 122 | { 123 | return MainCamera.fieldOfView; 124 | } 125 | } 126 | // return _fov; 127 | } 128 | set 129 | { 130 | if (value != _fov) 131 | { 132 | if (InsideStudio) 133 | { 134 | 135 | Studio.CameraControl control = (Studio.CameraControl)MainCamera.GetComponent().ActiveVirtualCamera; 136 | control.fieldOfView = value; 137 | } 138 | else 139 | { 140 | MainCamera.fieldOfView = value; 141 | } 142 | _fov = value; 143 | } 144 | } 145 | } 146 | 147 | public float NearClipPlane 148 | { 149 | get 150 | { 151 | // if (default(float) == _nearClipPlane) 152 | { 153 | if (InsideStudio) 154 | { 155 | Studio.CameraControl control = (Studio.CameraControl)MainCamera.GetComponent().ActiveVirtualCamera; 156 | return control.State.Lens.NearClipPlane; 157 | } 158 | else 159 | { 160 | return MainCamera.nearClipPlane; 161 | } 162 | } 163 | // return _nearClipPlane; 164 | } 165 | set 166 | { 167 | if (InsideStudio) 168 | { 169 | Studio.CameraControl control = (Studio.CameraControl)MainCamera.GetComponent().ActiveVirtualCamera; 170 | 171 | LensSettings lensSettings = control.GetFieldValue("lensSettings"); 172 | lensSettings.NearClipPlane = value; 173 | control.SetFieldValue("lensSettings", lensSettings); 174 | 175 | CameraState cameraState = control.GetFieldValue("cameraState"); 176 | cameraState.Lens = lensSettings; 177 | control.SetFieldValue("cameraState", cameraState); 178 | } 179 | else 180 | { 181 | MainCamera.nearClipPlane = value; 182 | } 183 | _nearClipPlane = value; 184 | } 185 | } 186 | 187 | public float FarClipPlane 188 | { 189 | get 190 | { 191 | // if (default(float) == _farClipPlane) 192 | { 193 | if (InsideStudio) 194 | { 195 | Studio.CameraControl control = (Studio.CameraControl)MainCamera.GetComponent().ActiveVirtualCamera; 196 | return control.State.Lens.FarClipPlane; 197 | } 198 | else 199 | { 200 | return MainCamera.farClipPlane; 201 | } 202 | } 203 | // return _farClipPlane; 204 | } 205 | set 206 | { 207 | if (InsideStudio) 208 | { 209 | Studio.CameraControl control = (Studio.CameraControl)MainCamera.GetComponent().ActiveVirtualCamera; 210 | 211 | LensSettings lensSettings = control.GetFieldValue("lensSettings"); 212 | lensSettings.FarClipPlane = value; 213 | control.SetFieldValue("lensSettings", lensSettings); 214 | 215 | CameraState cameraState = control.GetFieldValue("cameraState"); 216 | cameraState.Lens = lensSettings; 217 | control.SetFieldValue("cameraState", cameraState); 218 | } 219 | else 220 | { 221 | MainCamera.farClipPlane = value; 222 | } 223 | _farClipPlane = value; 224 | } 225 | } 226 | 227 | internal Camera MainCamera 228 | { 229 | get 230 | { 231 | if (null == _camera && 0 < Camera.allCameras.Length) 232 | { 233 | //foreach (var cam in Camera.allCameras) 234 | _camera = Camera.main; 235 | } 236 | return _camera; 237 | } 238 | } 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /Graphics/.editorconfig: -------------------------------------------------------------------------------- 1 | # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019 2 | # Remove the line below if you want to inherit .editorconfig settings from higher directories 3 | root = true 4 | 5 | # C# files 6 | [*.cs] 7 | 8 | #### Core EditorConfig Options #### 9 | 10 | # Indentation and spacing 11 | indent_size = 4 12 | indent_style = space 13 | tab_width = 4 14 | 15 | # New line preferences 16 | end_of_line = crlf 17 | insert_final_newline = false 18 | 19 | #### .NET Coding Conventions #### 20 | 21 | # Organize usings 22 | dotnet_separate_import_directive_groups = false 23 | dotnet_sort_system_directives_first = false 24 | 25 | # this. and Me. preferences 26 | dotnet_style_qualification_for_event = false:silent 27 | dotnet_style_qualification_for_field = false:silent 28 | dotnet_style_qualification_for_method = false:silent 29 | dotnet_style_qualification_for_property = false:silent 30 | 31 | # Language keywords vs BCL types preferences 32 | dotnet_style_predefined_type_for_locals_parameters_members = true:silent 33 | dotnet_style_predefined_type_for_member_access = true:silent 34 | 35 | # Parentheses preferences 36 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent 37 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent 38 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent 39 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent 40 | 41 | # Modifier preferences 42 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent 43 | 44 | # Expression-level preferences 45 | dotnet_style_coalesce_expression = true:suggestion 46 | dotnet_style_collection_initializer = true:suggestion 47 | dotnet_style_explicit_tuple_names = true:suggestion 48 | dotnet_style_null_propagation = true:suggestion 49 | dotnet_style_object_initializer = true:suggestion 50 | dotnet_style_prefer_auto_properties = true:silent 51 | dotnet_style_prefer_compound_assignment = true:suggestion 52 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent 53 | dotnet_style_prefer_conditional_expression_over_return = true:silent 54 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 55 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 56 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion 57 | dotnet_style_prefer_simplified_interpolation = true:suggestion 58 | 59 | # Field preferences 60 | dotnet_style_readonly_field = true:suggestion 61 | 62 | # Parameter preferences 63 | dotnet_code_quality_unused_parameters = all:suggestion 64 | 65 | #### C# Coding Conventions #### 66 | 67 | # var preferences 68 | csharp_style_var_elsewhere = false:silent 69 | csharp_style_var_for_built_in_types = false:silent 70 | csharp_style_var_when_type_is_apparent = false:silent 71 | 72 | # Expression-bodied members 73 | csharp_style_expression_bodied_accessors = true:silent 74 | csharp_style_expression_bodied_constructors = false:silent 75 | csharp_style_expression_bodied_indexers = true:silent 76 | csharp_style_expression_bodied_lambdas = true:silent 77 | csharp_style_expression_bodied_local_functions = false:silent 78 | csharp_style_expression_bodied_methods = false:silent 79 | csharp_style_expression_bodied_operators = false:silent 80 | csharp_style_expression_bodied_properties = true:silent 81 | 82 | # Pattern matching preferences 83 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 84 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion 85 | csharp_style_prefer_switch_expression = true:suggestion 86 | 87 | # Null-checking preferences 88 | csharp_style_conditional_delegate_call = true:suggestion 89 | 90 | # Modifier preferences 91 | csharp_prefer_static_local_function = true:suggestion 92 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent 93 | 94 | # Code-block preferences 95 | csharp_prefer_braces = true:silent 96 | csharp_prefer_simple_using_statement = true:suggestion 97 | 98 | # Expression-level preferences 99 | csharp_prefer_simple_default_expression = true:suggestion 100 | csharp_style_deconstructed_variable_declaration = true:suggestion 101 | csharp_style_inlined_variable_declaration = true:suggestion 102 | csharp_style_pattern_local_over_anonymous_function = true:suggestion 103 | csharp_style_prefer_index_operator = true:suggestion 104 | csharp_style_prefer_range_operator = true:suggestion 105 | csharp_style_throw_expression = true:suggestion 106 | csharp_style_unused_value_assignment_preference = discard_variable:suggestion 107 | csharp_style_unused_value_expression_statement_preference = discard_variable:silent 108 | 109 | # 'using' directive preferences 110 | csharp_using_directive_placement = outside_namespace:silent 111 | 112 | #### C# Formatting Rules #### 113 | 114 | # New line preferences 115 | csharp_new_line_before_catch = true 116 | csharp_new_line_before_else = true 117 | csharp_new_line_before_finally = true 118 | csharp_new_line_before_members_in_anonymous_types = true 119 | csharp_new_line_before_members_in_object_initializers = true 120 | csharp_new_line_before_open_brace = all 121 | csharp_new_line_between_query_expression_clauses = true 122 | 123 | # Indentation preferences 124 | csharp_indent_block_contents = true 125 | csharp_indent_braces = false 126 | csharp_indent_case_contents = true 127 | csharp_indent_case_contents_when_block = true 128 | csharp_indent_labels = one_less_than_current 129 | csharp_indent_switch_labels = true 130 | 131 | # Space preferences 132 | csharp_space_after_cast = false 133 | csharp_space_after_colon_in_inheritance_clause = true 134 | csharp_space_after_comma = true 135 | csharp_space_after_dot = false 136 | csharp_space_after_keywords_in_control_flow_statements = true 137 | csharp_space_after_semicolon_in_for_statement = true 138 | csharp_space_around_binary_operators = before_and_after 139 | csharp_space_around_declaration_statements = false 140 | csharp_space_before_colon_in_inheritance_clause = true 141 | csharp_space_before_comma = false 142 | csharp_space_before_dot = false 143 | csharp_space_before_open_square_brackets = false 144 | csharp_space_before_semicolon_in_for_statement = false 145 | csharp_space_between_empty_square_brackets = false 146 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 147 | csharp_space_between_method_call_name_and_opening_parenthesis = false 148 | csharp_space_between_method_call_parameter_list_parentheses = false 149 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 150 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 151 | csharp_space_between_method_declaration_parameter_list_parentheses = false 152 | csharp_space_between_parentheses = false 153 | csharp_space_between_square_brackets = false 154 | 155 | # Wrapping preferences 156 | csharp_preserve_single_line_blocks = true 157 | csharp_preserve_single_line_statements = true 158 | 159 | #### Naming styles #### 160 | 161 | # Naming rules 162 | 163 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion 164 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface 165 | dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i 166 | 167 | dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion 168 | dotnet_naming_rule.types_should_be_pascal_case.symbols = types 169 | dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case 170 | 171 | dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion 172 | dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members 173 | dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case 174 | 175 | # Symbol specifications 176 | 177 | dotnet_naming_symbols.interface.applicable_kinds = interface 178 | dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 179 | dotnet_naming_symbols.interface.required_modifiers = 180 | 181 | dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum 182 | dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 183 | dotnet_naming_symbols.types.required_modifiers = 184 | 185 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method 186 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 187 | dotnet_naming_symbols.non_field_members.required_modifiers = 188 | 189 | # Naming styles 190 | 191 | dotnet_naming_style.pascal_case.required_prefix = 192 | dotnet_naming_style.pascal_case.required_suffix = 193 | dotnet_naming_style.pascal_case.word_separator = 194 | dotnet_naming_style.pascal_case.capitalization = pascal_case 195 | 196 | dotnet_naming_style.begins_with_i.required_prefix = I 197 | dotnet_naming_style.begins_with_i.required_suffix = 198 | dotnet_naming_style.begins_with_i.word_separator = 199 | dotnet_naming_style.begins_with_i.capitalization = pascal_case -------------------------------------------------------------------------------- /Graphics/Shared/Graphics.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using BepInEx.Configuration; 3 | using Graphics.Inspector; 4 | using Graphics.Patch; 5 | using Graphics.Settings; 6 | using Graphics.Textures; 7 | using KKAPI; 8 | using KKAPI.Chara; 9 | using KKAPI.Studio.SaveLoad; 10 | using System; 11 | using System.Collections; 12 | using UnityEngine; 13 | using UnityEngine.SceneManagement; 14 | 15 | namespace Graphics 16 | { 17 | [BepInIncompatibility("dhhai4mod")] 18 | [BepInPlugin(GUID, PluginName, Version)] 19 | [BepInDependency(KoikatuAPI.GUID, KoikatuAPI.VersionConst)] 20 | [BepInDependency(ExtensibleSaveFormat.ExtendedSave.GUID)] 21 | public partial class Graphics : BaseUnityPlugin 22 | { 23 | public const string GUID = "ore.graphics"; 24 | public const string PluginName = "Graphics"; 25 | public const string Version = "0.3.3"; 26 | 27 | public static ConfigEntry ConfigShortcut { get; private set; } 28 | public static ConfigEntry ConfigCubeMapPath { get; private set; } 29 | public static ConfigEntry ConfigPresetPath { get; private set; } 30 | public static ConfigEntry ConfigLensDirtPath { get; private set; } 31 | public static ConfigEntry ConfigLocalizationPath { get; private set; } 32 | public static ConfigEntry ConfigLanguage { get; private set; } 33 | public static ConfigEntry ConfigFontSize { get; internal set; } 34 | public static ConfigEntry ConfigWindowWidth { get; internal set; } 35 | public static ConfigEntry ConfigWindowHeight { get; internal set; } 36 | public static ConfigEntry ConfigWindowOffsetX { get; internal set; } 37 | public static ConfigEntry ConfigWindowOffsetY { get; internal set; } 38 | 39 | public Preset preset; 40 | 41 | private bool _showGUI; 42 | private bool _isLoaded = false; 43 | private CursorLockMode _previousCursorLockState; 44 | private bool _previousCursorVisible; 45 | #if AI 46 | private float _previousTimeScale; 47 | #endif 48 | private SkyboxManager _skyboxManager; 49 | private LightManager _lightManager; 50 | private PostProcessingManager _postProcessingManager; 51 | private PresetManager _presetManager; 52 | private SSSManager _sssManager; 53 | private Inspector.Inspector _inspector; 54 | 55 | internal GlobalSettings Settings { get; private set; } 56 | internal CameraSettings CameraSettings { get; private set; } 57 | internal LightingSettings LightingSettings { get; private set; } 58 | internal PostProcessingSettings PostProcessingSettings { get; private set; } 59 | internal SSSSettings SSSSettings { get; private set; } 60 | 61 | internal BepInEx.Logging.ManualLogSource Log => Logger; 62 | 63 | public static Graphics Instance { get; private set; } 64 | 65 | public Graphics() 66 | { 67 | if (Instance != null) 68 | { 69 | throw new InvalidOperationException("Can only create one instance of Graphics"); 70 | } 71 | 72 | Instance = this; 73 | 74 | ConfigShortcut = Config.Bind("Config", "Keyboard Shortcut", KeyCode.F5, new ConfigDescription("Keyboard Shortcut")); 75 | ConfigPresetPath = Config.Bind("Config", "Preset Location", Application.dataPath + "/../presets/", new ConfigDescription("Where presets are stored")); 76 | ConfigCubeMapPath = Config.Bind("Config", "Cubemap path", Application.dataPath + "/../cubemaps/", new ConfigDescription("Where cubemaps are stored")); 77 | ConfigLensDirtPath = Config.Bind("Config", "Lens dirt texture path", Application.dataPath + "/../lensdirts/", new ConfigDescription("Where lens dirt textures are stored")); 78 | ConfigLocalizationPath = Config.Bind("Config", "Localization path", Application.dataPath + "/../BepInEx/plugins/Graphics/Resources/", new ConfigDescription("Where localizations are stored")); 79 | ConfigLanguage = Config.Bind("Config", "Language", LocalizationManager.DefaultLanguage(), new ConfigDescription("Default Language")); 80 | ConfigFontSize = Config.Bind("Config", "Font Size", 12, new ConfigDescription("Font Size")); 81 | GUIStyles.FontSize = ConfigFontSize.Value; 82 | ConfigWindowWidth = Config.Bind("Config", "Window Width", 750, new ConfigDescription("Window Width")); 83 | Inspector.Inspector.Width = ConfigWindowWidth.Value; 84 | ConfigWindowHeight = Config.Bind("Config", "Window Height", 1024, new ConfigDescription("Window Height")); 85 | Inspector.Inspector.Height = ConfigWindowHeight.Value; 86 | ConfigWindowOffsetX = Config.Bind("Config", "Window Position Offset X", (Screen.width - ConfigWindowWidth.Value) / 2, new ConfigDescription("Window Position Offset X")); 87 | Inspector.Inspector.StartOffsetX = ConfigWindowOffsetX.Value; 88 | ConfigWindowOffsetY = Config.Bind("Config", "Window Position Offset Y", (Screen.height - ConfigWindowHeight.Value) / 2, new ConfigDescription("Window Position Offset Y")); 89 | Inspector.Inspector.StartOffsetY = ConfigWindowOffsetY.Value; 90 | } 91 | 92 | private void Awake() 93 | { 94 | CharacterApi.RegisterExtraBehaviour(GUID); 95 | StudioSaveLoadApi.RegisterExtraBehaviour(GUID); 96 | SceneManager.sceneLoaded += OnSceneLoaded; 97 | } 98 | 99 | private IEnumerator Start() 100 | { 101 | if (IsStudio()) 102 | StudioHooks.Init(); 103 | yield return new WaitUntil(() => 104 | { 105 | return IsLoaded(); 106 | }); 107 | Settings = new GlobalSettings(); 108 | CameraSettings = new CameraSettings(); 109 | LightingSettings = new LightingSettings(); 110 | PostProcessingSettings = new PostProcessingSettings(CameraSettings.MainCamera); 111 | SSSSettings = new SSSSettings(); 112 | 113 | _sssManager = new SSSManager(); 114 | _sssManager.Initialize(); 115 | 116 | _skyboxManager = Instance.GetOrAddComponent(); 117 | _skyboxManager.Parent = this; 118 | _skyboxManager.AssetPath = ConfigCubeMapPath.Value; 119 | _skyboxManager.Logger = Logger; 120 | DontDestroyOnLoad(_skyboxManager); 121 | 122 | _postProcessingManager = Instance.GetOrAddComponent(); 123 | _postProcessingManager.Parent = this; 124 | _postProcessingManager.LensDirtTexturesPath = ConfigLensDirtPath.Value; 125 | DontDestroyOnLoad(_postProcessingManager); 126 | 127 | LocalizationManager.Parent = this; 128 | LocalizationManager.CurrentLanguage = ConfigLanguage.Value; 129 | 130 | _lightManager = new LightManager(this); 131 | _presetManager = new PresetManager(ConfigPresetPath.Value, this); 132 | 133 | yield return new WaitUntil(() => PCSSLight.LoadAssets()); 134 | yield return new WaitUntil(() => SEGI.LoadAssets()); 135 | 136 | _inspector = new Inspector.Inspector(this); 137 | _isLoaded = true; 138 | } 139 | 140 | internal SkyboxManager SkyboxManager => _skyboxManager; 141 | internal PostProcessingManager PostProcessingManager => _postProcessingManager; 142 | internal LightManager LightManager => _lightManager; 143 | internal PresetManager PresetManager => _presetManager; 144 | internal SSSManager SSSManager => _sssManager; 145 | 146 | internal void OnGUI() 147 | { 148 | if (Show) 149 | { 150 | Cursor.lockState = CursorLockMode.None; 151 | Cursor.visible = true; 152 | 153 | GUISkin originalSkin = GUI.skin; 154 | GUI.skin = GUIStyles.Skin; 155 | _inspector.DrawWindow(); 156 | GUI.skin = originalSkin; 157 | } 158 | } 159 | 160 | internal void Update() 161 | { 162 | if (!_isLoaded) 163 | { 164 | return; 165 | } 166 | 167 | if (Input.GetKeyDown(ConfigShortcut.Value)) 168 | { 169 | Show = !Show; 170 | } 171 | 172 | if (Show) 173 | { 174 | Cursor.lockState = CursorLockMode.None; 175 | Cursor.visible = true; 176 | } 177 | } 178 | 179 | internal void LateUpdate() 180 | { 181 | if (Show) 182 | { 183 | Cursor.lockState = CursorLockMode.None; 184 | Cursor.visible = true; 185 | } 186 | } 187 | 188 | internal bool IsStudio() 189 | { 190 | return GameMode.Studio == KoikatuAPI.GetCurrentGameMode(); 191 | } 192 | 193 | private bool Show 194 | { 195 | get => _showGUI; 196 | set 197 | { 198 | if (_showGUI != value) 199 | { 200 | if (value) 201 | { 202 | #if AI 203 | if (KKAPI.KoikatuAPI.GetCurrentGameMode() == KKAPI.GameMode.MainGame) 204 | { 205 | _previousTimeScale = Time.timeScale; 206 | Time.timeScale = 0; 207 | } 208 | #endif 209 | _previousCursorLockState = Cursor.lockState; 210 | _previousCursorVisible = Cursor.visible; 211 | } 212 | else 213 | { 214 | #if AI 215 | if (KKAPI.KoikatuAPI.GetCurrentGameMode() == KKAPI.GameMode.MainGame) 216 | { 217 | Time.timeScale = _previousTimeScale; 218 | } 219 | #endif 220 | if (!_previousCursorVisible || _previousCursorLockState != CursorLockMode.None) 221 | { 222 | Cursor.lockState = _previousCursorLockState; 223 | Cursor.visible = _previousCursorVisible; 224 | } 225 | } 226 | _showGUI = value; 227 | } 228 | } 229 | } 230 | } 231 | } --------------------------------------------------------------------------------