Cycles microdisplacement: Support for Catmull-Clark subdivision via OpenSubdiv
Enables Catmull-Clark subdivision meshes with support for creases and attribute subdivision. Still waiting on OpenSubdiv to fully support face varying interpolation for subdividing uv coordinates tho. Also there may be some inconsistencies with Blender's subdivision which will be resolved at a later time. Code for reading patch tables and creating patch maps is borrowed from OpenSubdiv. Reviewed By: brecht Differential Revision: https://developer.blender.org/D2111
This commit is contained in:
@@ -44,6 +44,7 @@ void Attribute::set(ustring name_, TypeDesc type_, AttributeElement element_)
|
||||
type = type_;
|
||||
element = element_;
|
||||
std = ATTR_STD_NONE;
|
||||
flags = 0;
|
||||
|
||||
/* string and matrix not supported! */
|
||||
assert(type == TypeDesc::TypeFloat || type == TypeDesc::TypeColor ||
|
||||
@@ -61,6 +62,11 @@ void Attribute::resize(Mesh *mesh, AttributePrimitive prim, bool reserve_only)
|
||||
}
|
||||
}
|
||||
|
||||
void Attribute::resize(size_t num_elements)
|
||||
{
|
||||
buffer.resize(num_elements * data_sizeof(), 0);
|
||||
}
|
||||
|
||||
void Attribute::add(const float& f)
|
||||
{
|
||||
char *data = (char*)&f;
|
||||
@@ -130,6 +136,10 @@ size_t Attribute::data_sizeof() const
|
||||
|
||||
size_t Attribute::element_size(Mesh *mesh, AttributePrimitive prim) const
|
||||
{
|
||||
if(flags & ATTR_FINAL_SIZE) {
|
||||
return buffer.size() / data_sizeof();
|
||||
}
|
||||
|
||||
size_t size;
|
||||
|
||||
switch(element) {
|
||||
|
Reference in New Issue
Block a user