diff options
Diffstat (limited to 'intern/cycles/render/attribute.cpp')
-rw-r--r-- | intern/cycles/render/attribute.cpp | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index 9e90bf1b625..c1a089cc872 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -31,7 +31,7 @@ void Attribute::set(ustring name_, TypeDesc type_, Element element_) name = name_; type = type_; element = element_; - std = STD_NONE; + std = ATTR_STD_NONE; /* string and matrix not supported! */ assert(type == TypeDesc::TypeFloat || type == TypeDesc::TypeColor || @@ -81,20 +81,24 @@ bool Attribute::same_storage(TypeDesc a, TypeDesc b) return false; } -ustring Attribute::standard_name(Attribute::Standard std) +ustring Attribute::standard_name(AttributeStandard std) { - if(std == Attribute::STD_VERTEX_NORMAL) + if(std == ATTR_STD_VERTEX_NORMAL) return ustring("N"); - else if(std == Attribute::STD_FACE_NORMAL) + else if(std == ATTR_STD_FACE_NORMAL) return ustring("Ng"); - else if(std == Attribute::STD_UV) + else if(std == ATTR_STD_UV) return ustring("uv"); - else if(std == Attribute::STD_GENERATED) + else if(std == ATTR_STD_GENERATED) return ustring("generated"); - else if(std == Attribute::STD_POSITION_UNDEFORMED) + else if(std == ATTR_STD_POSITION_UNDEFORMED) return ustring("undeformed"); - else if(std == Attribute::STD_POSITION_UNDISPLACED) + else if(std == ATTR_STD_POSITION_UNDISPLACED) return ustring("undisplaced"); + else if(std == ATTR_STD_MOTION_PRE) + return ustring("motion_pre"); + else if(std == ATTR_STD_MOTION_POST) + return ustring("motion_post"); return ustring(); } @@ -164,24 +168,28 @@ void AttributeSet::remove(ustring name) } } -Attribute *AttributeSet::add(Attribute::Standard std, ustring name) +Attribute *AttributeSet::add(AttributeStandard std, ustring name) { Attribute *attr = NULL; if(name == ustring()) name = Attribute::standard_name(std); - if(std == Attribute::STD_VERTEX_NORMAL) + if(std == ATTR_STD_VERTEX_NORMAL) attr = add(name, TypeDesc::TypeNormal, Attribute::VERTEX); - else if(std == Attribute::STD_FACE_NORMAL) + else if(std == ATTR_STD_FACE_NORMAL) attr = add(name, TypeDesc::TypeNormal, Attribute::FACE); - else if(std == Attribute::STD_UV) + else if(std == ATTR_STD_UV) attr = add(name, TypeDesc::TypePoint, Attribute::CORNER); - else if(std == Attribute::STD_GENERATED) + else if(std == ATTR_STD_GENERATED) attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX); - else if(std == Attribute::STD_POSITION_UNDEFORMED) + else if(std == ATTR_STD_POSITION_UNDEFORMED) attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX); - else if(std == Attribute::STD_POSITION_UNDISPLACED) + else if(std == ATTR_STD_POSITION_UNDISPLACED) + attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX); + else if(std == ATTR_STD_MOTION_PRE) + attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX); + else if(std == ATTR_STD_MOTION_POST) attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX); else assert(0); @@ -191,7 +199,7 @@ Attribute *AttributeSet::add(Attribute::Standard std, ustring name) return attr; } -Attribute *AttributeSet::find(Attribute::Standard std) +Attribute *AttributeSet::find(AttributeStandard std) { foreach(Attribute& attr, attributes) if(attr.std == std) @@ -200,7 +208,7 @@ Attribute *AttributeSet::find(Attribute::Standard std) return NULL; } -void AttributeSet::remove(Attribute::Standard std) +void AttributeSet::remove(AttributeStandard std) { Attribute *attr = find(std); @@ -218,7 +226,7 @@ void AttributeSet::remove(Attribute::Standard std) Attribute *AttributeSet::find(AttributeRequest& req) { - if(req.std == Attribute::STD_NONE) + if(req.std == ATTR_STD_NONE) return find(req.name); else return find(req.std); @@ -240,14 +248,14 @@ void AttributeSet::clear() AttributeRequest::AttributeRequest(ustring name_) { name = name_; - std = Attribute::STD_NONE; + std = ATTR_STD_NONE; type = TypeDesc::TypeFloat; element = ATTR_ELEMENT_NONE; offset = 0; } -AttributeRequest::AttributeRequest(Attribute::Standard std_) +AttributeRequest::AttributeRequest(AttributeStandard std_) { name = ustring(); std = std_; @@ -296,7 +304,7 @@ void AttributeRequestSet::add(ustring name) requests.push_back(AttributeRequest(name)); } -void AttributeRequestSet::add(Attribute::Standard std) +void AttributeRequestSet::add(AttributeStandard std) { foreach(AttributeRequest& req, requests) if(req.std == std) @@ -308,7 +316,7 @@ void AttributeRequestSet::add(Attribute::Standard std) void AttributeRequestSet::add(AttributeRequestSet& reqs) { foreach(AttributeRequest& req, reqs.requests) { - if(req.std == Attribute::STD_NONE) + if(req.std == ATTR_STD_NONE) add(req.name); else add(req.std); @@ -324,7 +332,7 @@ bool AttributeRequestSet::find(ustring name) return false; } -bool AttributeRequestSet::find(Attribute::Standard std) +bool AttributeRequestSet::find(AttributeStandard std) { foreach(AttributeRequest& req, requests) if(req.std == std) |