Blender V4.3
eevee_cryptomatte.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
16#pragma once
17
19
20#include "BKE_cryptomatte.hh"
21
22extern "C" {
23struct Material;
24}
25
26namespace blender::eevee {
27
28class Instance;
29
30/* -------------------------------------------------------------------- */
35 private:
36 class Instance &inst_;
37
39
40 /* Cached pointer to the cryptomatte layer instances. */
41 bke::cryptomatte::CryptomatteLayer *object_layer_ = nullptr;
42 bke::cryptomatte::CryptomatteLayer *asset_layer_ = nullptr;
43 bke::cryptomatte::CryptomatteLayer *material_layer_ = nullptr;
44
46 CryptomatteObjectBuf cryptomatte_object_buf;
47
48 public:
49 Cryptomatte(Instance &inst) : inst_(inst){};
50
51 void begin_sync();
52 void sync_object(Object *ob, ResourceHandle res_handle);
53 void sync_material(const ::Material *material);
54 void end_sync();
55
56 template<typename PassType> void bind_resources(PassType &pass)
57 {
58 pass.bind_ssbo(CRYPTOMATTE_BUF_SLOT, &cryptomatte_object_buf);
59 }
60
61 /* Register ID to use inside cryptomatte layer and returns associated hash as float. */
62 float register_id(const eViewLayerEEVEEPassType layer, const ID &id) const;
63 void store_metadata(RenderResult *render_result);
64};
65
68} // namespace blender::eevee
eViewLayerEEVEEPassType
void bind_resources(PassType &pass)
float register_id(const eViewLayerEEVEEPassType layer, const ID &id) const
void sync_object(Object *ob, ResourceHandle res_handle)
void store_metadata(RenderResult *render_result)
void sync_material(const ::Material *material)
A running instance of the engine.
#define CRYPTOMATTE_BUF_SLOT
PassType
std::unique_ptr< CryptomatteSession, CryptomatteSessionDeleter > CryptomatteSessionPtr
Definition DNA_ID.h:413