Cycles microdisplacement: ngons and attributes for subdivision meshes
This adds support for ngons and attributes on subdivision meshes. Ngons are needed for proper attribute interpolation as well as correct Catmull-Clark subdivision. Several changes are made to achieve this: - new primitive `SubdFace` added to `Mesh` - 3 more textures are used to store info on patches from subd meshes - Blender export uses loop interface instead of tessface for subd meshes - `Attribute` class is updated with a simplified way to pass primitive counts around and to support ngons. - extra points for ngons are generated for O(1) attribute interpolation - curves are temporally disabled on subd meshes to avoid various bugs with implementation - old unneeded code is removed from `subd/` - various fixes and improvements Reviewed By: brecht Differential Revision: https://developer.blender.org/D2108
This commit is contained in:
@@ -58,11 +58,11 @@ public:
|
||||
Attribute() {}
|
||||
~Attribute();
|
||||
void set(ustring name, TypeDesc type, AttributeElement element);
|
||||
void resize(int numverts, int numfaces, int numsteps, int numcurves, int numkeys, bool reserve_only);
|
||||
void resize(Mesh *mesh, AttributePrimitive prim, bool reserve_only);
|
||||
|
||||
size_t data_sizeof() const;
|
||||
size_t element_size(int numverts, int numfaces, int numsteps, int numcurves, int numkeys) const;
|
||||
size_t buffer_size(int numverts, int numfaces, int numsteps, int numcurves, int numkeys) const;
|
||||
size_t element_size(Mesh *mesh, AttributePrimitive prim) const;
|
||||
size_t buffer_size(Mesh *mesh, AttributePrimitive prim) const;
|
||||
|
||||
char *data() { return (buffer.size())? &buffer[0]: NULL; };
|
||||
float3 *data_float3() { return (float3*)data(); }
|
||||
@@ -79,6 +79,9 @@ public:
|
||||
const Transform *data_transform() const { return (const Transform*)data(); }
|
||||
const VoxelAttribute *data_voxel() const { return (const VoxelAttribute*)data(); }
|
||||
|
||||
void zero_data(void* dst);
|
||||
void add_with_weight(void* dst, void* src, float weight);
|
||||
|
||||
void add(const float& f);
|
||||
void add(const float3& f);
|
||||
void add(const uchar4& f);
|
||||
@@ -99,6 +102,7 @@ class AttributeSet {
|
||||
public:
|
||||
Mesh *triangle_mesh;
|
||||
Mesh *curve_mesh;
|
||||
Mesh *subd_mesh;
|
||||
list<Attribute> attributes;
|
||||
|
||||
AttributeSet();
|
||||
@@ -130,9 +134,9 @@ public:
|
||||
AttributeStandard std;
|
||||
|
||||
/* temporary variables used by MeshManager */
|
||||
TypeDesc triangle_type, curve_type;
|
||||
AttributeElement triangle_element, curve_element;
|
||||
int triangle_offset, curve_offset;
|
||||
TypeDesc triangle_type, curve_type, subd_type;
|
||||
AttributeElement triangle_element, curve_element, subd_element;
|
||||
int triangle_offset, curve_offset, subd_offset;
|
||||
|
||||
explicit AttributeRequest(ustring name_);
|
||||
explicit AttributeRequest(AttributeStandard std);
|
||||
|
Reference in New Issue
Block a user