Exemple #1
0
        public void Initialize(AsyncImageSaver asyncImageSaver, SegmentedImageSetup segmentedImageSetup,
                               SegmentedTagsManager segmentedTagsManager, Camera camera, SyntheticObjectListMaker syntheticObjectListMaker)
        {
            _camera = camera;
            _syntheticObjectListMaker      = syntheticObjectListMaker;
            _segmentedSegmentedTagsManager = segmentedTagsManager;
            _segmentedImageSetup           = segmentedImageSetup;
            _asyncImageSaver = asyncImageSaver;
            _objectId        = Shader.PropertyToID("_ObjectId");
            Shader.PropertyToID(nameof(SegmentedImageMaker));

            _segmentedImageSetup.SegmentedOutputMaterial.SetFloat("_NumberOfSegments", _segmentedSegmentedTagsManager.TagsCount);
            _segmentedImageSetup.SegmentedOutputMaterial.SetTexture("_TagLookUp", _segmentedSegmentedTagsManager.TagColorTexture);

            // Command buffer initialization
            var renderTexture = RenderTexture.GetTemporary(_segmentedImageSetup.ImageWidth, _segmentedImageSetup.ImageHeight, 8, RenderTextureFormat.R8);

            renderTexture.filterMode           = FilterMode.Point;
            renderTexture.useMipMap            = false;
            _indexBufferRenderTargetIdentifier = new RenderTargetIdentifier(renderTexture);

            _segmentedImageSetup.SegmentedOutputMaterial.SetTexture("_IndexedTexture", renderTexture);

            _commandBuffer = new CommandBuffer
            {
                name = "Visible Object Indexing Command Buffer"
            };
            _camera.AddCommandBuffer(CameraEvent.AfterSkybox, _commandBuffer);
        }
Exemple #2
0
 public void Initialize(AsyncImageSaver asyncImageSaver, SegmentedImageSetup segmentedImageSetup)
 {
     _asyncImageSaver     = asyncImageSaver;
     _segmentedImageSetup = segmentedImageSetup;
 }