Skip to content

Commit

Permalink
refactored write_array_of_AOVs, renamed to aov_array_set_flt
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahf committed Sep 26, 2018
1 parent ea3554e commit d4458f5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cryptomatte/cryptomatte.h
Original file line number Diff line number Diff line change
Expand Up @@ -944,11 +944,11 @@ struct CryptomatteData {
hash_object_rgb(sg, nsp_hash_clr, obj_hash_clr, mat_hash_clr);

if (aov_array_cryptoasset)
write_array_of_AOVs(sg, aov_array_cryptoasset, nsp_hash_clr.r);
aov_array_set_flt(sg, aov_array_cryptoasset, nsp_hash_clr.r);
if (aov_array_cryptoobject)
write_array_of_AOVs(sg, aov_array_cryptoobject, obj_hash_clr.r);
aov_array_set_flt(sg, aov_array_cryptoobject, obj_hash_clr.r);
if (aov_array_cryptomaterial)
write_array_of_AOVs(sg, aov_array_cryptomaterial, mat_hash_clr.r);
aov_array_set_flt(sg, aov_array_cryptomaterial, mat_hash_clr.r);

nsp_hash_clr.r = obj_hash_clr.r = mat_hash_clr.r = 0.0f;

Expand All @@ -970,7 +970,7 @@ struct CryptomatteData {
if (!result.empty())
hash = hash_name_rgb(result.c_str());

write_array_of_AOVs(sg, aovArray, hash.r);
aov_array_set_flt(sg, aovArray, hash.r);
hash.r = 0.0f;
AiAOVSetRGBA(sg, aov_name, hash);
}
Expand Down Expand Up @@ -1020,6 +1020,15 @@ struct CryptomatteData {
}
}

void aov_array_set_flt(AtShaderGlobals* sg, const AtArray* aov_names, float id) const {
for (uint32_t i = 0; i < AiArrayGetNumElements(aov_names); i++) {
const AtString aov_name = AiArrayGetStr(aov_names, i);
if (aov_name.empty())
return;
AiAOVSetFlt(sg, aov_name, id);
}
}

///////////////////////////////////////////////
// Building Cryptomatte Arnold Nodes
///////////////////////////////////////////////
Expand Down Expand Up @@ -1257,15 +1266,6 @@ struct CryptomatteData {
return aovs;
}

void write_array_of_AOVs(AtShaderGlobals* sg, const AtArray* names, float id) const {
for (uint32_t i = 0; i < AiArrayGetNumElements(names); i++) {
AtString aovName = AiArrayGetStr(names, i);
if (aovName.empty())
return;
AiAOVSetFlt(sg, aovName, id);
}
}

AtNode* setup_manifest_driver() {
AtString manifest_driver_name("cryptomatte_manifest_driver");
AtNode* manifest_driver = AiNodeLookUpByName(manifest_driver_name);
Expand Down

0 comments on commit d4458f5

Please sign in to comment.