Blender V4.3
draw_resource.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#include "RNA_access.hh"
11#include "RNA_path.hh"
12#include "RNA_types.hh"
13
14#include "draw_handle.hh"
15#include "draw_manager.hh"
16#include "draw_shader_shared.hh"
17
18/* -------------------------------------------------------------------- */
22bool ObjectAttribute::sync(const blender::draw::ObjectRef &ref, const GPUUniformAttr &attr)
23{
24 /* This function mirrors `lookup_instance_property` in `cycles/blender/blender_object.cpp`. */
25
26 hash_code = attr.hash_code;
27
28 /* If requesting instance data, check the parent particle system and object. */
29 if (attr.use_dupli) {
31 ref.object, ref.dupli_object, ref.dupli_parent, attr.name, &data_x);
32 }
33 return BKE_object_dupli_find_rgba_attribute(ref.object, nullptr, nullptr, attr.name, &data_x);
34}
35
38/* -------------------------------------------------------------------- */
42bool LayerAttribute::sync(const Scene *scene, const ViewLayer *layer, const GPULayerAttr &attr)
43{
44 hash_code = attr.hash_code;
45
46 return BKE_view_layer_find_rgba_attribute(scene, layer, attr.name, &data.x);
47}
48
bool BKE_object_dupli_find_rgba_attribute(const Object *ob, const DupliObject *dupli, const Object *dupli_parent, const char *name, float r_value[4])
bool BKE_view_layer_find_rgba_attribute(const Scene *scene, const ViewLayer *layer, const char *name, float r_value[4])
uint32_t hash_code
DupliObject * dupli_object