Blender V4.5
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
8
9#include "BKE_duplilist.hh"
10#include "GPU_material.hh"
11
12#include "draw_handle.hh"
13#include "draw_shader_shared.hh"
14
15/* -------------------------------------------------------------------- */
18
19bool ObjectAttribute::sync(const blender::draw::ObjectRef &ref, const GPUUniformAttr &attr)
20{
21 /* This function mirrors `lookup_instance_property` in `cycles/blender/blender_object.cpp`. */
22
23 hash_code = attr.hash_code;
24
25 /* If requesting instance data, check the parent particle system and object. */
26 if (attr.use_dupli) {
28 ref.object, ref.dupli_object, ref.dupli_parent, attr.name, &data_x);
29 }
30 return BKE_object_dupli_find_rgba_attribute(ref.object, nullptr, nullptr, attr.name, &data_x);
31}
32
34
35/* -------------------------------------------------------------------- */
38
39bool LayerAttribute::sync(const Scene *scene, const ViewLayer *layer, const GPULayerAttr &attr)
40{
41 hash_code = attr.hash_code;
42
43 return BKE_view_layer_find_rgba_attribute(scene, layer, attr.name, &data.x);
44}
45
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])
char name[256]
uint32_t hash_code
DupliObject * dupli_object