Skip to content

Commit

Permalink
[Tydra] Add is_single_indexable flag to RenderMesh.
Browse files Browse the repository at this point in the history
[Tydra] Commented out some debug log.
  • Loading branch information
syoyo committed Apr 26, 2024
1 parent 047515d commit 2140153
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/tydra/render-data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3909,6 +3909,8 @@ bool RenderSceneConverter::ConvertMesh(
}
}

dst.is_single_indexable = is_single_indexable;

dst.prim_name = mesh.name;
dst.abs_path = abs_path.full_path_name();
dst.display_name = mesh.metas().displayName.value_or("");
Expand Down
10 changes: 8 additions & 2 deletions src/tydra/render-data.hh
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ struct MaterialSubset {

// Currently normals and texcoords are converted as facevarying attribute.
struct RenderMesh {
#if 0 // deprecated.
//
// Type of Vertex attributes of this mesh.
//
Expand All @@ -825,14 +826,19 @@ struct RenderMesh {
// Facevaring(no VertexArray indices). This would impact
// rendering performance.
};
#endif

std::string prim_name; // Prim name
std::string abs_path; // Absolute Prim path in Stage
std::string display_name; // `displayName` Prim metadataum

VertexArrayType vertexArrayType{VertexArrayType::Facevarying};
// true: all vertex attributes are 'vertex'-varying. i.e, an App can simply use faceVertexIndices to draw mesh.
// false: some vertex attributes are 'facevarying'-varying. An app need to decompose 'points' and 'vertex'-varying attribute to 'facevarying' variability to draw a mesh.
bool is_single_indexable{false};

//VertexArrayType vertexArrayType{VertexArrayType::Facevarying};

std::vector<vec3> points; // varying is 'vertex'.
std::vector<vec3> points; // varying is always 'vertex'.

///
/// Initialized with USD faceVertexIndices/faceVertexCounts in GeomMesh.
Expand Down
10 changes: 5 additions & 5 deletions src/tydra/usd-export.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,15 @@ static bool ExportSkelAnimation(const Animation &anim, SkelAnimation *dst, std::
uint64_t target_id = target_idMap.at(target.first);

std::vector<float> &weights = ts_weights.at(float_to_double(tc));
DCOUT("weights.size " << weights.size() << ", target_id " << target_id);
//DCOUT("weights.size " << weights.size() << ", target_id " << target_id);
weights[size_t(target_id)] = target.second[t].value;
}
}

DCOUT("ts_weights.cbegin " << ts_weights.cbegin()->first);
DCOUT("ts_weights.cbegin isnan" << std::isnan(ts_weights.cbegin()->first));
//DCOUT("ts_weights.cbegin " << ts_weights.cbegin()->first);
//DCOUT("ts_weights.cbegin isnan" << std::isnan(ts_weights.cbegin()->first));
if ((ts_weights.size() == 1) && (std::isnan(ts_weights.cbegin()->first))) {
DCOUT("static blendshape weights");
//DCOUT("static blendshape weights");
// Author as static(default) value.
std::vector<float> ts(blendShapes.size());
for (size_t i = 0; i < ts_weights.cbegin()->second.size(); i++) {
Expand All @@ -509,7 +509,7 @@ static bool ExportSkelAnimation(const Animation &anim, SkelAnimation *dst, std::
dst->blendShapeWeights.set_value(ts);
} else {

DCOUT("timeSampled blendshape weights");
//DCOUT("timeSampled blendshape weights");
Animatable<std::vector<float>> ts;
for (const auto &s : ts_weights) {
ts.add_sample(s.first, s.second);
Expand Down

0 comments on commit 2140153

Please sign in to comment.