mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-21 10:55:33 +03:00
Data Exchange, GLTF - Change export line type to LINE_STRIP #535
GLTF exporter mark edges as a LINE, which is 2 connected points. OCCT polylines is mostly line strip structure. Updated GLTF reader to handle new type of lines
This commit is contained in:
parent
2eeb0ed5ba
commit
b29788cae0
@ -2030,7 +2030,7 @@ void RWGltf_CafWriter::writePrimArray(const RWGltf_GltfFace& theGltfFace
|
|||||||
switch (theGltfFace.Shape.ShapeType())
|
switch (theGltfFace.Shape.ShapeType())
|
||||||
{
|
{
|
||||||
case TopAbs_EDGE:
|
case TopAbs_EDGE:
|
||||||
myWriter->Int(RWGltf_GltfPrimitiveMode_Lines);
|
myWriter->Int(RWGltf_GltfPrimitiveMode_LineStrip);
|
||||||
break;
|
break;
|
||||||
case TopAbs_VERTEX:
|
case TopAbs_VERTEX:
|
||||||
myWriter->Int(RWGltf_GltfPrimitiveMode_Points);
|
myWriter->Int(RWGltf_GltfPrimitiveMode_Points);
|
||||||
|
@ -1808,7 +1808,7 @@ bool RWGltf_GltfJsonParser::gltfParsePrimArray(TopoDS_Shape& th
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aMode != RWGltf_GltfPrimitiveMode_Triangles && aMode != RWGltf_GltfPrimitiveMode_Lines
|
if (aMode != RWGltf_GltfPrimitiveMode_Triangles && aMode != RWGltf_GltfPrimitiveMode_Lines
|
||||||
&& aMode != RWGltf_GltfPrimitiveMode_Points)
|
&& aMode != RWGltf_GltfPrimitiveMode_LineStrip && aMode != RWGltf_GltfPrimitiveMode_Points)
|
||||||
{
|
{
|
||||||
Message::SendWarning(TCollection_AsciiString() + "Primitive array within Mesh '" + theMeshId
|
Message::SendWarning(TCollection_AsciiString() + "Primitive array within Mesh '" + theMeshId
|
||||||
+ "' skipped due to unsupported mode");
|
+ "' skipped due to unsupported mode");
|
||||||
@ -1976,7 +1976,8 @@ bool RWGltf_GltfJsonParser::gltfParsePrimArray(TopoDS_Shape& th
|
|||||||
aShape = aVertices;
|
aShape = aVertices;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RWGltf_GltfPrimitiveMode_Lines: {
|
case RWGltf_GltfPrimitiveMode_Lines:
|
||||||
|
case RWGltf_GltfPrimitiveMode_LineStrip: {
|
||||||
TColgp_Array1OfPnt aNodes(1, aMeshData->NbEdges());
|
TColgp_Array1OfPnt aNodes(1, aMeshData->NbEdges());
|
||||||
for (Standard_Integer anEdgeIdx = 1; anEdgeIdx <= aMeshData->NbEdges(); ++anEdgeIdx)
|
for (Standard_Integer anEdgeIdx = 1; anEdgeIdx <= aMeshData->NbEdges(); ++anEdgeIdx)
|
||||||
{
|
{
|
||||||
@ -2011,7 +2012,7 @@ bool RWGltf_GltfJsonParser::gltfParsePrimArray(TopoDS_Shape& th
|
|||||||
aShapeAttribs.RawName = theMeshName;
|
aShapeAttribs.RawName = theMeshName;
|
||||||
|
|
||||||
// assign material and not color
|
// assign material and not color
|
||||||
if (aMode == RWGltf_GltfPrimitiveMode_Lines)
|
if (aMode == RWGltf_GltfPrimitiveMode_Lines || aMode == RWGltf_GltfPrimitiveMode_LineStrip)
|
||||||
{
|
{
|
||||||
aShapeAttribs.Style.SetColorCurv(aMeshData->BaseColor().GetRGB());
|
aShapeAttribs.Style.SetColorCurv(aMeshData->BaseColor().GetRGB());
|
||||||
}
|
}
|
||||||
|
@ -579,6 +579,7 @@ bool RWGltf_TriangulationReader::ReadStream(
|
|||||||
const TCollection_AsciiString& aName = theSourceMesh->Id();
|
const TCollection_AsciiString& aName = theSourceMesh->Id();
|
||||||
const RWGltf_GltfPrimitiveMode aPrimMode = theSourceMesh->PrimitiveMode();
|
const RWGltf_GltfPrimitiveMode aPrimMode = theSourceMesh->PrimitiveMode();
|
||||||
if (aPrimMode != RWGltf_GltfPrimitiveMode_Triangles && aPrimMode != RWGltf_GltfPrimitiveMode_Lines
|
if (aPrimMode != RWGltf_GltfPrimitiveMode_Triangles && aPrimMode != RWGltf_GltfPrimitiveMode_Lines
|
||||||
|
&& aPrimMode != RWGltf_GltfPrimitiveMode_LineStrip
|
||||||
&& aPrimMode != RWGltf_GltfPrimitiveMode_Points)
|
&& aPrimMode != RWGltf_GltfPrimitiveMode_Points)
|
||||||
{
|
{
|
||||||
Message::SendWarning(TCollection_AsciiString("Buffer '") + aName
|
Message::SendWarning(TCollection_AsciiString("Buffer '") + aName
|
||||||
|
Loading…
x
Reference in New Issue
Block a user