{"TotalCount":3,"Files":[{"Ident":"nolankicks.opiumpostprocess","Path":"Code/OpiumPostprocess.cs","FileName":"OpiumPostprocess.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":58305,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox;\r\nusing Sandbox.Utility;\r\n[Icon(\u0022waves\u0022), Category(\u0022Post Processing\u0022)]\r\npublic sealed class OpiumPostprocess : PostProcess, Component.ExecuteInEditor\r\n{\r\n\tIDisposable renderHook;\r\n\t[Property] public bool VertexSnapping { get; set; } = true;\r\n\t[Property] public bool UsePostProcess { get; set; } = true;\r\n\r\n\tprotected override void OnEnabled()\r\n\t{\r\n\t\trenderHook = Camera.AddHookBeforeOverlay( \u0022My Post Processing\u0022, 1000, RenderEffect);\r\n\t}\r\n\tprotected override void OnDisabled()\r\n\t{\r\n\t\trenderHook?.Dispose();\r\n\t\trenderHook = null;\r\n\t}\r\n\tRenderAttributes attributes = new RenderAttributes();\r\n\tpublic void RenderEffect(SceneCamera camera)\r\n\t{\r\n\t\tif (!camera.EnablePostProcessing) return;\r\n\t\tcamera.Attributes.SetCombo(\u0022D_VERTEX_SNAP\u0022, VertexSnapping ? 1 : 0);\r\n\t\tGraphics.GrabFrameTexture( \u0022ColorBuffer\u0022, attributes );\r\n        Graphics.GrabDepthTexture( \u0022DepthBuffer\u0022, attributes );\r\n\t\tif (UsePostProcess)\r\n\t\t{\r\n\t\t\tGraphics.Blit(Material.FromShader(Cloud.Shader(\u0022facepunch.goback_postprocess\u0022)), attributes);\r\n\t\t}\r\n\r\n\t}\r\n}\r\n"},{"Ident":"nolankicks.opiumpostprocess","Path":"UnitTests/UnitTest.cs","FileName":"UnitTest.cs","PackageType":"library","CodeKind":"UnitTest","AssetVersionId":58305,"IsPrivate":false,"Code":"global using Microsoft.VisualStudio.TestTools.UnitTesting;\r\n\r\n[TestClass]\r\npublic class TestInit\r\n{\r\n\t[AssemblyInitialize]\r\n\tpublic static void ClassInitialize( TestContext context )\r\n\t{\r\n\t\tSandbox.Application.InitUnitTest();\r\n\t}\r\n}\r\n"},{"Ident":"nolankicks.opiumpostprocess","Path":"UnitTests/LibraryTest.cs","FileName":"LibraryTest.cs","PackageType":"library","CodeKind":"UnitTest","AssetVersionId":58305,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\n[TestClass]\r\npublic partial class LibraryTests\r\n{\r\n\t[TestMethod]\r\n\tpublic void SceneTest()\r\n\t{\r\n\t\tvar scene = new Scene();\r\n\t\tusing ( scene.Push() )\r\n\t\t{\r\n\t\t\tvar go = new GameObject();\r\n\r\n\t\t\tAssert.AreEqual( 1, scene.Directory.GameObjectCount );\r\n\t\t}\r\n\t}\r\n\r\n}\r\n"}]}