Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-03-08 12:42:11 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-03-11 22:35:38 +0300
commitd8aa613d94caf6a3d82a8f4e9e90b9b8f5c61a7d (patch)
tree7f85577ae4f37c9bdeba31fd65411b718b19b035 /intern/cycles/render/attribute.h
parentec3eeee46b4885b9167b0dc28d273993d77b8ce6 (diff)
Cleanup: add ImageHandle to centralize image ownership logic
Diffstat (limited to 'intern/cycles/render/attribute.h')
-rw-r--r--intern/cycles/render/attribute.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h
index f1fd30fd85a..23626410ac1 100644
--- a/intern/cycles/render/attribute.h
+++ b/intern/cycles/render/attribute.h
@@ -17,6 +17,8 @@
#ifndef __ATTRIBUTE_H__
#define __ATTRIBUTE_H__
+#include "render/image.h"
+
#include "kernel/kernel_types.h"
#include "util/util_list.h"
@@ -31,19 +33,12 @@ class Attribute;
class AttributeRequest;
class AttributeRequestSet;
class AttributeSet;
-class ImageManager;
+class ImageHandle;
class Geometry;
class Hair;
class Mesh;
struct Transform;
-/* Attributes for voxels are images */
-
-struct VoxelAttribute {
- ImageManager *manager;
- int slot;
-};
-
/* Attribute
*
* Arbitrary data layers on meshes.
@@ -105,10 +100,12 @@ class Attribute {
assert(data_sizeof() == sizeof(Transform));
return (Transform *)data();
}
- VoxelAttribute *data_voxel()
+
+ /* Attributes for voxels are images */
+ ImageHandle &data_voxel()
{
- assert(data_sizeof() == sizeof(VoxelAttribute));
- return (VoxelAttribute *)data();
+ assert(data_sizeof() == sizeof(ImageHandle));
+ return *(ImageHandle *)data();
}
const char *data() const
@@ -140,10 +137,10 @@ class Attribute {
assert(data_sizeof() == sizeof(Transform));
return (const Transform *)data();
}
- const VoxelAttribute *data_voxel() const
+ const ImageHandle &data_voxel() const
{
- assert(data_sizeof() == sizeof(VoxelAttribute));
- return (const VoxelAttribute *)data();
+ assert(data_sizeof() == sizeof(ImageHandle));
+ return *(const ImageHandle *)data();
}
void zero_data(void *dst);
@@ -153,8 +150,8 @@ class Attribute {
void add(const float2 &f);
void add(const float3 &f);
void add(const uchar4 &f);
- void add(const Transform &f);
- void add(const VoxelAttribute &f);
+ void add(const Transform &tfm);
+ void add(const ImageHandle &handle);
void add(const char *data);
static bool same_storage(TypeDesc a, TypeDesc b);