Added parameter to control cylindrical shapes tessellation
+ renamed smoothing angle parameter for better user understandingpull/1208/head
parent
fff0e886a1
commit
9ef234b842
|
@ -154,8 +154,9 @@ void IFCImporter::SetupProperties(const Importer* pImp)
|
|||
{
|
||||
settings.skipSpaceRepresentations = pImp->GetPropertyBool(AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS,true);
|
||||
settings.useCustomTriangulation = pImp->GetPropertyBool(AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION,true);
|
||||
settings.conicSamplingAngle = pImp->GetPropertyFloat(AI_CONFIG_IMPORT_IFC_CONIC_SAMPLING_ANGLE, AI_IMPORT_IFC_DEFAULT_CONIC_SAMPLING_ANGLE);
|
||||
settings.skipAnnotations = true;
|
||||
settings.conicSamplingAngle = std::min(std::max(pImp->GetPropertyFloat(AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE, AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE), 5.0f), 120.0f);
|
||||
settings.cylindricalTessellation = std::min(std::max(pImp->GetPropertyInteger(AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION, AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION), 3), 180);
|
||||
settings.skipAnnotations = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ public:
|
|||
, useCustomTriangulation()
|
||||
, skipAnnotations()
|
||||
, conicSamplingAngle(10.f)
|
||||
, cylindricalTessellation(32)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -117,6 +118,7 @@ public:
|
|||
bool useCustomTriangulation;
|
||||
bool skipAnnotations;
|
||||
float conicSamplingAngle;
|
||||
int cylindricalTessellation;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ void ProcessOpenProfile(const IfcArbitraryOpenProfileDef& def, TempMesh& meshout
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh& meshout, ConversionData& /*conv*/)
|
||||
void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh& meshout, ConversionData& conv)
|
||||
{
|
||||
if(const IfcRectangleProfileDef* const cprofile = def.ToPtr<IfcRectangleProfileDef>()) {
|
||||
const IfcFloat x = cprofile->XDim*0.5f, y = cprofile->YDim*0.5f;
|
||||
|
@ -117,7 +117,7 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
|
|||
if(def.ToPtr<IfcCircleHollowProfileDef>()) {
|
||||
// TODO
|
||||
}
|
||||
const size_t segments = 32;
|
||||
const size_t segments = conv.settings.cylindricalTessellation;
|
||||
const IfcFloat delta = AI_MATH_TWO_PI_F/segments, radius = circle->Radius;
|
||||
|
||||
meshout.verts.reserve(segments);
|
||||
|
|
|
@ -877,18 +877,35 @@ enum aiComponent
|
|||
#define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Set the tessellation conic angle for IFC curves.
|
||||
/** @brief Set the tessellation conic angle for IFC smoothing curves.
|
||||
*
|
||||
* This is used by the IFC importer to determine the tessellation parameter
|
||||
* for curves.
|
||||
* @note The default value is AI_IMPORT_IFC_DEFAULT_CONIC_SAMPLING_ANGLE
|
||||
* Property type: float.
|
||||
* for smoothing curves.
|
||||
* @note The default value is AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE and the
|
||||
* accepted values are in range [5.0, 120.0].
|
||||
* Property type: Float.
|
||||
*/
|
||||
#define AI_CONFIG_IMPORT_IFC_CONIC_SAMPLING_ANGLE "IMPORT_IFC_CONIC_SAMPLING_ANGLE"
|
||||
#define AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE "IMPORT_IFC_SMOOTHING_ANGLE"
|
||||
|
||||
// default value for AI_CONFIG_IMPORT_IFC_CONIC_SAMPLING_ANGLE
|
||||
#if (!defined AI_IMPORT_IFC_DEFAULT_CONIC_SAMPLING_ANGLE)
|
||||
# define AI_IMPORT_IFC_DEFAULT_CONIC_SAMPLING_ANGLE 10.0f
|
||||
// default value for AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE
|
||||
#if (!defined AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE)
|
||||
# define AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE 10.0f
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Set the tessellation for IFC cylindrical shapes.
|
||||
*
|
||||
* This is used by the IFC importer to determine the tessellation parameter
|
||||
* for cylindrical shapes, i.e. the number of segments used to aproximate a circle.
|
||||
* @note The default value is AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION and the
|
||||
* accepted values are in range [3, 180].
|
||||
* Property type: Integer.
|
||||
*/
|
||||
#define AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION "IMPORT_IFC_CYLINDRICAL_TESSELLATION"
|
||||
|
||||
// default value for AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION
|
||||
#if (!defined AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION)
|
||||
# define AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION 32
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue