1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0032139: Visualization - support single-precision floating point data within Poly_Triangulation

Introduced NCollection_AliasedArray collection defining a general byte array
to be aliased as array of elements of mutable type.

Poly_ArrayOfNodes specializes this interface for collecting 2d/3d points with single/double precision.
Poly_Triangulation relies on this new class for definition of 3D nodes and UV coordinates
using gp_Pnt and gp_Pnt2d by default as before.

RWGltf_CafReader now fills in triangulation using single precision by default (as stored in the file).
This commit is contained in:
kgv
2021-02-17 14:36:03 +03:00
committed by bugmaster
parent e44b849de9
commit 374dffea0b
14 changed files with 868 additions and 63 deletions

View File

@@ -102,6 +102,7 @@ static Standard_Integer ReadGltf (Draw_Interpretor& theDI,
Standard_Real aSystemUnitFactor = UnitsMethods::GetCasCadeLengthUnit() * 0.001;
Standard_Boolean toListExternalFiles = Standard_False;
Standard_Boolean isParallel = Standard_False;
Standard_Boolean isDoublePrec = Standard_False;
Standard_Boolean isNoDoc = (TCollection_AsciiString(theArgVec[0]) == "readgltf");
for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
{
@@ -127,6 +128,22 @@ static Standard_Integer ReadGltf (Draw_Interpretor& theDI,
++anArgIter;
}
}
else if (anArgCase == "-doubleprec"
|| anArgCase == "-doubleprecision"
|| anArgCase == "-singleprec"
|| anArgCase == "-singleprecision")
{
isDoublePrec = Standard_True;
if (anArgIter + 1 < theNbArgs
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], isDoublePrec))
{
++anArgIter;
}
if (anArgCase.StartsWith ("-single"))
{
isDoublePrec = !isDoublePrec;
}
}
else if (anArgCase == "-listexternalfiles"
|| anArgCase == "-listexternals"
|| anArgCase == "-listexternal"
@@ -184,6 +201,7 @@ static Standard_Integer ReadGltf (Draw_Interpretor& theDI,
aReader.SetSystemCoordinateSystem (RWMesh_CoordinateSystem_Zup);
aReader.SetDocument (aDoc);
aReader.SetParallel (isParallel);
aReader.SetDoublePrecision (isDoublePrec);
if (toListExternalFiles)
{
aReader.ProbeHeader (aFilePath);
@@ -1720,10 +1738,12 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
//XSDRAW::LoadDraw(theCommands);
theCommands.Add ("ReadGltf",
"ReadGltf Doc file [-parallel {on|off}] [-listExternalFiles] [-noCreateDoc]"
"ReadGltf Doc file [-parallel {on|off}] [-listExternalFiles] [-noCreateDoc] [-doublePrecision {on|off}]"
"\n\t\t: Read glTF file into XDE document."
"\n\t\t: -listExternalFiles do not read mesh and only list external files"
"\n\t\t: -noCreateDoc read into existing XDE document",
"\n\t\t: -noCreateDoc read into existing XDE document"
"\n\t\t: -doublePrecision store triangulation with double or single floating point"
"\n\t\t: precision (single by default)",
__FILE__, ReadGltf, g);
theCommands.Add ("readgltf",
"readgltf shape file"