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>2014-03-29 16:03:48 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-03-29 16:03:48 +0400
commit27043b8e40f74c8b0917850d1aefbd6315fa46a5 (patch)
tree26360d0ab051bb94312e40fef974851f3c20f6e0 /intern/cycles/render/attribute.h
parent393216a6df934a78f541d98def7a948a89f9b5c8 (diff)
Cycles code internals: add support for mesh voxel grid attributes.
These are internally stored as a 3D image textures, but accessible like e.g. UV coordinates though the attribute node and getattribute(). This is convenient for rendering e.g. smoke objects where data like density is really a property of the mesh, and it avoids having to specify the smoke object in a texture node, instead the material will work with any smoke domain.
Diffstat (limited to 'intern/cycles/render/attribute.h')
-rw-r--r--intern/cycles/render/attribute.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h
index 5160224f4e3..3dc7b7f7401 100644
--- a/intern/cycles/render/attribute.h
+++ b/intern/cycles/render/attribute.h
@@ -27,12 +27,20 @@
CCL_NAMESPACE_BEGIN
class Attribute;
-class AttributeSet;
class AttributeRequest;
class AttributeRequestSet;
+class AttributeSet;
+class ImageManager;
class Mesh;
struct Transform;
+/* Attributes for voxels are images */
+
+struct VoxelAttribute {
+ ImageManager *manager;
+ int slot;
+};
+
/* Attribute
*
* Arbitrary data layers on meshes.
@@ -48,6 +56,7 @@ public:
AttributeElement element;
Attribute() {}
+ ~Attribute();
void set(ustring name, TypeDesc type, AttributeElement element);
void reserve(int numverts, int numfaces, int numsteps, int numcurves, int numkeys, bool resize);
@@ -60,19 +69,23 @@ public:
float4 *data_float4() { return (float4*)data(); }
float *data_float() { return (float*)data(); }
Transform *data_transform() { return (Transform*)data(); }
+ VoxelAttribute *data_voxel() { return ( VoxelAttribute*)data(); }
const char *data() const { return (buffer.size())? &buffer[0]: NULL; }
const float3 *data_float3() const { return (const float3*)data(); }
const float4 *data_float4() const { return (const float4*)data(); }
const float *data_float() const { return (const float*)data(); }
const Transform *data_transform() const { return (const Transform*)data(); }
+ const VoxelAttribute *data_voxel() const { return (const VoxelAttribute*)data(); }
void add(const float& f);
void add(const float3& f);
void add(const Transform& f);
+ void add(const VoxelAttribute& f);
static bool same_storage(TypeDesc a, TypeDesc b);
static const char *standard_name(AttributeStandard std);
+ static AttributeStandard name_standard(const char *name);
};
/* Attribute Set