提交 2434bfb8 编写于 作者: M Matt Pharr

{Triangle,BilinearPatch}Mesh::ToString(): fix bugs in ToString() methods

Null-valued member variables were leading to trying to initialize std::strings
with nullptr rather than printing "nullptr".
上级 3bc8e9f5
......@@ -85,12 +85,11 @@ std::string TriangleMesh::ToString() const {
reverseOrientation, transformSwapsHandedness, nTriangles, nVertices,
vertexIndices ? StringPrintf("%s", pstd::MakeSpan(vertexIndices, 3 * nTriangles))
: np,
p ? StringPrintf("%s", pstd::MakeSpan(p, nVertices)) : nullptr,
n ? StringPrintf("%s", pstd::MakeSpan(n, nVertices)) : nullptr,
s ? StringPrintf("%s", pstd::MakeSpan(s, nVertices)) : nullptr,
uv ? StringPrintf("%s", pstd::MakeSpan(uv, nVertices)) : nullptr,
faceIndices ? StringPrintf("%s", pstd::MakeSpan(faceIndices, nTriangles))
: nullptr);
p ? StringPrintf("%s", pstd::MakeSpan(p, nVertices)) : np,
n ? StringPrintf("%s", pstd::MakeSpan(n, nVertices)) : np,
s ? StringPrintf("%s", pstd::MakeSpan(s, nVertices)) : np,
uv ? StringPrintf("%s", pstd::MakeSpan(uv, nVertices)) : np,
faceIndices ? StringPrintf("%s", pstd::MakeSpan(faceIndices, nTriangles)) : np);
}
static void PlyErrorCallback(p_ply, const char *message) {
......@@ -240,11 +239,10 @@ std::string BilinearPatchMesh::ToString() const {
reverseOrientation, transformSwapsHandedness, nPatches, nVertices,
vertexIndices ? StringPrintf("%s", pstd::MakeSpan(vertexIndices, 4 * nPatches))
: np,
p ? StringPrintf("%s", pstd::MakeSpan(p, nVertices)) : nullptr,
n ? StringPrintf("%s", pstd::MakeSpan(n, nVertices)) : nullptr,
uv ? StringPrintf("%s", pstd::MakeSpan(uv, nVertices)) : nullptr,
faceIndices ? StringPrintf("%s", pstd::MakeSpan(faceIndices, nPatches))
: nullptr);
p ? StringPrintf("%s", pstd::MakeSpan(p, nVertices)) : np,
n ? StringPrintf("%s", pstd::MakeSpan(n, nVertices)) : np,
uv ? StringPrintf("%s", pstd::MakeSpan(uv, nVertices)) : np,
faceIndices ? StringPrintf("%s", pstd::MakeSpan(faceIndices, nPatches)) : np);
}
struct FaceCallbackContext {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册