repurposed sliders

repurposed and renamed the 2 sliders in the gui to be for settings in vhacd
added the drop down for fillMode types but it is not hooked up to source yet
This commit is contained in:
marauder2k7 2024-05-14 17:20:17 +01:00
parent 35abe0cc29
commit 78f6206cde
4 changed files with 615 additions and 1234 deletions

View file

@ -183,7 +183,7 @@ public:
void fit26_DOP();
// Convex Hulls
void fitConvexHulls( U32 depth, F32 mergeThreshold, F32 concavityThreshold, U32 maxHullVerts,
void fitConvexHulls( U32 depth, F32 mergeThreshold, U32 concavityThreshold, U32 maxHullVerts,
F32 boxMaxError, F32 sphereMaxError, F32 capsuleMaxError );
};
@ -691,17 +691,17 @@ void MeshFit::fitK_DOP( const Vector<Point3F>& planes )
//---------------------------
// Best-fit set of convex hulls
void MeshFit::fitConvexHulls( U32 depth, F32 mergeThreshold, F32 concavityThreshold, U32 maxHullVerts,
void MeshFit::fitConvexHulls( U32 depth, F32 mergeThreshold, U32 concavityThreshold, U32 maxHullVerts,
F32 boxMaxError, F32 sphereMaxError, F32 capsuleMaxError )
{
VHACD::IVHACD::Parameters p;
p.m_fillMode = VHACD::FillMode::FLOOD_FILL;
p.m_maxNumVerticesPerCH = maxHullVerts;
p.m_shrinkWrap = true;
p.m_maxRecursionDepth = 64;
p.m_minimumVolumePercentErrorAllowed = 10;
p.m_maxRecursionDepth = depth;
p.m_minimumVolumePercentErrorAllowed = mergeThreshold;
p.m_resolution = 10000;
p.m_maxConvexHulls = depth;
p.m_maxConvexHulls = concavityThreshold;
VHACD::IVHACD* iface = VHACD::CreateVHACD_ASYNC();
@ -929,8 +929,8 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons
return true;
}}
DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char* type, const char* target, S32 depth, F32 merge, F32 concavity, S32 maxVerts, F32 boxMaxError, F32 sphereMaxError, F32 capsuleMaxError ), ( 4, 30, 30, 32, 0, 0, 0 ),
( size, type, target, depth, merge, concavity, maxVerts, boxMaxError, sphereMaxError, capsuleMaxError ), false,
DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char* type, const char* target, S32 depth, F32 merge, S32 maxHulls, S32 maxVerts, F32 boxMaxError, F32 sphereMaxError, F32 capsuleMaxError ), ( 4, 30, 30, 32, 0, 0, 0 ),
( size, type, target, depth, merge, maxHulls, maxVerts, boxMaxError, sphereMaxError, capsuleMaxError ), false,
"Autofit a mesh primitive or set of convex hulls to the shape geometry. Hulls "
"may optionally be converted to boxes, spheres and/or capsules based on their "
"volume.\n"
@ -942,7 +942,7 @@ DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char
"whole shape), or the name of an object in the shape\n"
"@param depth maximum split recursion depth (hulls only)\n"
"@param merge volume % threshold used to merge hulls together (hulls only)\n"
"@param concavity volume % threshold used to detect concavity (hulls only)\n"
"@param maxHulls allowed to be generated (hulls only)\n"
"@param maxVerts maximum number of vertices per hull (hulls only)\n"
"@param boxMaxError max % volume difference for a hull to be converted to a "
"box (hulls only)\n"
@ -984,7 +984,7 @@ DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char
fit.fit26_DOP();
else if ( !dStricmp( type, "convex hulls" ) )
{
fit.fitConvexHulls( depth, merge, concavity, maxVerts,
fit.fitConvexHulls( depth, merge, maxHulls, maxVerts,
boxMaxError, sphereMaxError, capsuleMaxError );
}
else

View file

@ -315,7 +315,7 @@ public:
const char* getImposterSettings(S32 index);
S32 addImposter(S32 size, S32 equatorSteps, S32 polarSteps, S32 dl, S32 dim, bool includePoles, F32 polarAngle);
bool removeImposter();
bool addCollisionDetail(S32 size, const char* type, const char* target, S32 depth = 4, F32 merge = 30.0f, F32 concavity = 30.0f, S32 maxVerts = 32, F32 boxMaxError = 0, F32 sphereMaxError = 0, F32 capsuleMaxError = 0);
bool addCollisionDetail(S32 size, const char* type, const char* target, S32 depth = 4, F32 merge = 30.0f, S32 maxHull = 30, S32 maxVerts = 32, F32 boxMaxError = 0, F32 sphereMaxError = 0, F32 capsuleMaxError = 0);
///@}
/// @name Sequences

View file

@ -2935,6 +2935,10 @@ function ShapeEdColWindow::onWake( %this )
%this-->colType.add( "18-DOP" );
%this-->colType.add( "26-DOP" );
%this-->colType.add( "Convex Hulls" );
%this-->fillMode.add("Flood fill");
%this-->fillMode.add("Surface only");
%this-->fillMode.add("Raycast Fill");
}
function ShapeEdColWindow::update_onShapeSelectionChanged( %this )
@ -2949,6 +2953,8 @@ function ShapeEdColWindow::update_onShapeSelectionChanged( %this )
%this-->colTarget.add( ShapeEditor.shape.getObjectName( %i ) );
%this-->colTarget.setSelected( %this-->colTarget.findText( "Bounds" ), false );
%this-->fillMode.setSelected( %this-->fillMode.findText( "Flood fill" ), false );
}
function ShapeEdColWindow::update_onCollisionChanged( %this )