Fix for attribute lookup in OSL. This uses a map in the OSL globals instead of the device texture.

This commit is contained in:
Lukas Toenne
2012-09-05 17:08:56 +00:00
parent c1dc375379
commit 674d295df3
5 changed files with 61 additions and 36 deletions

View File

@@ -84,30 +84,6 @@ bool Attribute::same_storage(TypeDesc a, TypeDesc b)
return false;
}
ustring Attribute::standard_name(AttributeStandard std)
{
if(std == ATTR_STD_VERTEX_NORMAL)
return ustring("N");
else if(std == ATTR_STD_FACE_NORMAL)
return ustring("Ng");
else if(std == ATTR_STD_UV)
return ustring("uv");
else if(std == ATTR_STD_GENERATED)
return ustring("generated");
else if(std == ATTR_STD_POSITION_UNDEFORMED)
return ustring("undeformed");
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");
else if(std == ATTR_STD_PARTICLE)
return ustring("particle");
return ustring();
}
/* Attribute Set */
AttributeSet::AttributeSet()
@@ -178,7 +154,7 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
Attribute *attr = NULL;
if(name == ustring())
name = Attribute::standard_name(std);
name = attribute_standard_name(std);
if(std == ATTR_STD_VERTEX_NORMAL)
attr = add(name, TypeDesc::TypeNormal, Attribute::VERTEX);