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.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user