Skip to content

Commit

Permalink
Use primvars_displayColor attribute instead
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Oct 19, 2023
1 parent 991ac3a commit 2a48b39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions exts/cesium.omniverse/mdl/cesium.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ export material cesium_material(
roughness_factor: roughness_factor,
emissive_factor: emissive_factor,
alpha_mode: alpha_mode,
alpha_cutoff: alpha_cutoff,
vertex_color_name: string("vertexColor")
alpha_cutoff: alpha_cutoff
);

} in material(
Expand Down
7 changes: 3 additions & 4 deletions src/core/include/cesium/omniverse/Tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
(sourceAsset) \
(subdivisionScheme) \
(vertex) \
(vertexColor) \
(_cesium_localToEcefTransform) \
(_cesium_tilesetId) \
(_deletedPrims) \
Expand Down Expand Up @@ -106,6 +105,7 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
((outputs_mdl_surface, "outputs:mdl:surface")) \
((outputs_mdl_volume, "outputs:mdl:volume")) \
((outputs_out, "outputs:out")) \
((primvars_displayColor, "primvars:displayColor")) \
((primvars_normals, "primvars:normals")) \
((primvars_st_0, "primvars:st_0")) \
((primvars_st_1, "primvars:st_1")) \
Expand All @@ -117,7 +117,6 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
((primvars_st_7, "primvars:st_7")) \
((primvars_st_8, "primvars:st_8")) \
((primvars_st_9, "primvars:st_9")) \
((primvars_vertexColor, "primvars:vertexColor")) \
((xformOp_transform_cesium, "xformOp:transform:cesium"))

TF_DECLARE_PUBLIC_TOKENS(UsdTokens, USD_TOKENS);
Expand Down Expand Up @@ -218,7 +217,7 @@ const omni::fabric::Type inputs_alpha_cutoff(omni::fabric::BaseDataType::eFloat,
const omni::fabric::Type inputs_alpha_mode(omni::fabric::BaseDataType::eInt, 1, 0, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type inputs_base_alpha(omni::fabric::BaseDataType::eFloat, 1, 0, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type inputs_base_color_factor(omni::fabric::BaseDataType::eFloat, 3, 0, omni::fabric::AttributeRole::eColor);
const omni::fabric::Type inputs_debug_color(omni::fabric::BaseDataType::eFloat, 3, 0, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type inputs_debug_color(omni::fabric::BaseDataType::eFloat, 3, 0, omni::fabric::AttributeRole::eColor);
const omni::fabric::Type inputs_emissive_factor(omni::fabric::BaseDataType::eFloat, 3, 0, omni::fabric::AttributeRole::eColor);
const omni::fabric::Type inputs_excludeFromWhiteMode(omni::fabric::BaseDataType::eBool, 1, 0, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type inputs_metallic_factor(omni::fabric::BaseDataType::eFloat, 1, 0, omni::fabric::AttributeRole::eNone);
Expand All @@ -239,9 +238,9 @@ const omni::fabric::Type outputs_out(omni::fabric::BaseDataType::eToken, 1, 0, o
const omni::fabric::Type points(omni::fabric::BaseDataType::eFloat, 3, 1, omni::fabric::AttributeRole::ePosition);
const omni::fabric::Type primvarInterpolations(omni::fabric::BaseDataType::eToken, 1, 1, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type primvars(omni::fabric::BaseDataType::eToken, 1, 1, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type primvars_displayColor(omni::fabric::BaseDataType::eFloat, 3, 1, omni::fabric::AttributeRole::eColor);
const omni::fabric::Type primvars_normals(omni::fabric::BaseDataType::eFloat, 3, 1, omni::fabric::AttributeRole::eNormal);
const omni::fabric::Type primvars_st(omni::fabric::BaseDataType::eFloat, 2, 1, omni::fabric::AttributeRole::eTexCoord);
const omni::fabric::Type primvars_vertexColor(omni::fabric::BaseDataType::eFloat, 3, 1, omni::fabric::AttributeRole::eColor);
const omni::fabric::Type Shader(omni::fabric::BaseDataType::eTag, 1, 0, omni::fabric::AttributeRole::ePrimTypeName);
const omni::fabric::Type subdivisionScheme(omni::fabric::BaseDataType::eToken, 1, 0, omni::fabric::AttributeRole::eNone);
const omni::fabric::Type _cesium_localToEcefTransform(omni::fabric::BaseDataType::eDouble, 16, 0, omni::fabric::AttributeRole::eMatrix);
Expand Down
14 changes: 7 additions & 7 deletions src/core/src/FabricGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void FabricGeometry::initialize() {
}

if (hasVertexColors) {
attributes.addAttribute(FabricTypes::primvars_vertexColor, FabricTokens::primvars_vertexColor);
attributes.addAttribute(FabricTypes::primvars_displayColor, FabricTokens::primvars_displayColor);
}

attributes.createAttributes(_path);
Expand Down Expand Up @@ -205,7 +205,7 @@ void FabricGeometry::initialize() {
}

if (hasVertexColors) {
primvarsFabric[primvarIndexVertexColor] = FabricTokens::primvars_vertexColor;
primvarsFabric[primvarIndexVertexColor] = FabricTokens::primvars_displayColor;
primvarInterpolationsFabric[primvarIndexVertexColor] = FabricTokens::vertex;
}
}
Expand Down Expand Up @@ -251,7 +251,7 @@ void FabricGeometry::reset() {
}

if (hasVertexColors) {
srw.setArrayAttributeSize(_path, FabricTokens::primvars_vertexColor, 0);
srw.setArrayAttributeSize(_path, FabricTokens::primvars_displayColor, 0);
}
}

Expand Down Expand Up @@ -307,9 +307,9 @@ void FabricGeometry::setGeometry(
gsl::span<glm::fvec3> vertexColorsSpan(vertexColorsData);
if (hasVertexColors) {
vertexColors.fill(vertexColorsSpan);
srw.setArrayAttributeSize(_path, FabricTokens::primvars_vertexColor, numVoxels * 8);
srw.setArrayAttributeSize(_path, FabricTokens::primvars_displayColor, numVoxels * 8);
}
auto vertexColorsFabric = srw.getArrayAttributeWr<glm::fvec3>(_path, FabricTokens::primvars_vertexColor);
auto vertexColorsFabric = srw.getArrayAttributeWr<glm::fvec3>(_path, FabricTokens::primvars_displayColor);

size_t vertIndex = 0;
size_t vertexCountsIndex = 0;
Expand Down Expand Up @@ -427,9 +427,9 @@ void FabricGeometry::setGeometry(
}

if (hasVertexColors) {
srw.setArrayAttributeSize(_path, FabricTokens::primvars_vertexColor, vertexColors.size());
srw.setArrayAttributeSize(_path, FabricTokens::primvars_displayColor, vertexColors.size());

auto vertexColorsFabric = srw.getArrayAttributeWr<glm::fvec3>(_path, FabricTokens::primvars_vertexColor);
auto vertexColorsFabric = srw.getArrayAttributeWr<glm::fvec3>(_path, FabricTokens::primvars_displayColor);

vertexColors.fill(vertexColorsFabric);
}
Expand Down

0 comments on commit 2a48b39

Please sign in to comment.