Init
This commit is contained in:
BIN
physx/tools/binarymetadata/android/android.metaData
Normal file
BIN
physx/tools/binarymetadata/android/android.metaData
Normal file
Binary file not shown.
BIN
physx/tools/binarymetadata/linux/linux64.metaData
Normal file
BIN
physx/tools/binarymetadata/linux/linux64.metaData
Normal file
Binary file not shown.
BIN
physx/tools/binarymetadata/mac/mac64.metaData
Normal file
BIN
physx/tools/binarymetadata/mac/mac64.metaData
Normal file
Binary file not shown.
BIN
physx/tools/binarymetadata/windows/win32.metaData
Normal file
BIN
physx/tools/binarymetadata/windows/win32.metaData
Normal file
Binary file not shown.
BIN
physx/tools/binarymetadata/windows/win64.metaData
Normal file
BIN
physx/tools/binarymetadata/windows/win64.metaData
Normal file
Binary file not shown.
26
physx/tools/physxmetadatagenerator/PxBoilerPlate.h
Normal file
26
physx/tools/physxmetadatagenerator/PxBoilerPlate.h
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
80
physx/tools/physxmetadatagenerator/PxExtensionsCommon.h
Normal file
80
physx/tools/physxmetadatagenerator/PxExtensionsCommon.h
Normal file
@ -0,0 +1,80 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
#ifndef PX_EXTENSIONS_COMMON_H
|
||||
#define PX_EXTENSIONS_COMMON_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "foundation/PxSimpleTypes.h"
|
||||
#include "PxPhysXConfig.h"
|
||||
|
||||
struct PropertyOverride
|
||||
{
|
||||
const char* TypeName;
|
||||
const char* PropName;
|
||||
const char* OverridePropName;
|
||||
PropertyOverride( const char* tn, const char* pn, const char* opn )
|
||||
: TypeName( tn )
|
||||
, PropName( pn )
|
||||
, OverridePropName( opn )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//Property overrides will output this exact property name instead of the general
|
||||
//property name that would be used. The properties need to have no template arguments
|
||||
//and exactly the same initialization as the classes they are overriding.
|
||||
struct DisabledPropertyEntry
|
||||
{
|
||||
const char* mTypeName;
|
||||
const char* mPropertyName;
|
||||
DisabledPropertyEntry( const char* inTypeName, const char* inValueName )
|
||||
: mTypeName( inTypeName )
|
||||
, mPropertyName( inValueName )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct CustomProperty
|
||||
{
|
||||
const char* mPropertyType;
|
||||
const char* mTypeName;
|
||||
const char* mValueStructDefinition;
|
||||
const char* mValueStructInit;
|
||||
|
||||
CustomProperty( const char* inTypeName, const char* inName, const char* inPropertyType, const char* valueStructDefinition, const char* valueStructInit )
|
||||
: mPropertyType( inPropertyType )
|
||||
, mTypeName( inTypeName )
|
||||
, mValueStructDefinition( valueStructDefinition )
|
||||
, mValueStructInit( valueStructInit )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif // PX_EXTENSIONS_COMMON_H
|
||||
187
physx/tools/physxmetadatagenerator/PxPhysicsWithExtensionsAPI.h
Normal file
187
physx/tools/physxmetadatagenerator/PxPhysicsWithExtensionsAPI.h
Normal file
@ -0,0 +1,187 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
#ifndef PX_PHYSICS_NXPHYSICSWITHEXTENSIONS_API
|
||||
#define PX_PHYSICS_NXPHYSICSWITHEXTENSIONS_API
|
||||
|
||||
#include "PxExtensionsCommon.h"
|
||||
|
||||
//Property overrides will output this exact property name instead of the general
|
||||
//property name that would be used. The properties need to have no template arguments
|
||||
//and exactly the same initialization as the classes they are overriding.
|
||||
static PropertyOverride gPropertyOverrides[] = {
|
||||
PropertyOverride( "PxShape", "Geometry", "PxShapeGeometryProperty" ),
|
||||
PropertyOverride( "PxShape", "Materials", "PxShapeMaterialsProperty" ),
|
||||
PropertyOverride( "PxRigidActor", "Shapes", "PxRigidActorShapeCollection" ),
|
||||
PropertyOverride( "PxArticulationBase", "Links", "PxArticulationLinkCollectionProp" ),
|
||||
};
|
||||
|
||||
static DisabledPropertyEntry gDisabledProperties[] = {
|
||||
DisabledPropertyEntry( "PxSceneLimits", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxSceneDesc", "TolerancesScale" ),
|
||||
DisabledPropertyEntry( "PxSceneDesc", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxShape", "Actor" ),
|
||||
DisabledPropertyEntry( "PxArticulationLink", "Articulation" ),
|
||||
DisabledPropertyEntry( "PxArticulationJointBase", "ParentArticulationLink" ),
|
||||
DisabledPropertyEntry( "PxArticulationJointBase", "ChildArticulationLink" ),
|
||||
DisabledPropertyEntry( "PxArticulationBase", "Impl" ),
|
||||
DisabledPropertyEntry( "PxArticulationJointBase", "Impl" ),
|
||||
DisabledPropertyEntry( "PxArticulationReducedCoordinate", "LoopJoints"),
|
||||
DisabledPropertyEntry( "PxRigidActor", "IsRigidActor" ),
|
||||
DisabledPropertyEntry( "PxRigidActor", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxRigidStatic", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxRigidDynamic", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxRigidBody", "IsRigidBody" ),
|
||||
DisabledPropertyEntry( "PxRigidBody", "InternalIslandNodeIndex"),
|
||||
DisabledPropertyEntry( "PxActor", "IsRigidStatic" ),
|
||||
DisabledPropertyEntry( "PxActor", "Type" ),
|
||||
DisabledPropertyEntry( "PxActor", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxActor", "IsRigidDynamic" ),
|
||||
DisabledPropertyEntry( "PxActor", "IsArticulationLink" ),
|
||||
DisabledPropertyEntry( "PxActor", "IsRigidActor" ),
|
||||
DisabledPropertyEntry( "PxActor", "IsRigidBody" ),
|
||||
DisabledPropertyEntry( "PxMeshScale", "Inverse" ),
|
||||
DisabledPropertyEntry( "PxMeshScale", "IsIdentity" ),
|
||||
DisabledPropertyEntry( "PxMeshScale", "IsValidForTriangleMesh" ),
|
||||
DisabledPropertyEntry( "PxMeshScale", "IsValidForConvexMesh" ),
|
||||
DisabledPropertyEntry( "PxGeometry", "Type" ),
|
||||
DisabledPropertyEntry( "PxBoxGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxSphereGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxPlaneGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxCapsuleGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxConvexMeshGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxTriangleMeshGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxHeightFieldGeometry", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxJoint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxDistanceJoint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxContactJoint", "ClassName"),
|
||||
DisabledPropertyEntry( "PxFixedJoint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxRevoluteJoint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxPrismaticJoint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxSphericalJoint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxD6Joint", "ClassName" ),
|
||||
DisabledPropertyEntry( "PxJointLimitParameters", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxJointLimitParameters", "IsSoft" ),
|
||||
DisabledPropertyEntry( "PxJointLinearLimit", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxJointLinearLimitPair", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxJointAngularLimitPair", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxJointLimitCone", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxJointLimitPyramid", "IsValid" ),
|
||||
DisabledPropertyEntry( "PxD6JointDrive", "IsValid" ),
|
||||
// PT: added this for PVD-315. It's a mystery to me why we don't need to do that here for PxConvexMeshDesc. Maybe because the convex desc is in the cooking lib.
|
||||
DisabledPropertyEntry( "PxHeightFieldDesc", "IsValid" ),
|
||||
// DisabledPropertyEntry( "PxConstraint", "IsValid" ),
|
||||
// DisabledPropertyEntry( "PxTolerancesScale", "IsValid" ),
|
||||
};
|
||||
|
||||
//Append these properties to this type.
|
||||
static CustomProperty gCustomProperties[] = {
|
||||
#define DEFINE_SIM_STATS_DUAL_INDEXED_PROPERTY( propName, propType, fieldName ) CustomProperty("PxSimulationStatistics", #propName, #propType, "PxU32 " #propName "[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];", "PxMemCopy( "#propName ", inSource->"#fieldName", sizeof( "#propName" ) );" )
|
||||
DEFINE_SIM_STATS_DUAL_INDEXED_PROPERTY( NbDiscreteContactPairs, NbDiscreteContactPairsProperty, nbDiscreteContactPairs ),
|
||||
DEFINE_SIM_STATS_DUAL_INDEXED_PROPERTY( NbModifiedContactPairs, NbModifiedContactPairsProperty, nbModifiedContactPairs),
|
||||
DEFINE_SIM_STATS_DUAL_INDEXED_PROPERTY( NbCCDPairs, NbCCDPairsProperty, nbCCDPairs),
|
||||
DEFINE_SIM_STATS_DUAL_INDEXED_PROPERTY( NbTriggerPairs, NbTriggerPairsProperty, nbTriggerPairs),
|
||||
#undef DEFINE_SIM_STATS_DUAL_INDEXED_PROPERTY
|
||||
CustomProperty( "PxSimulationStatistics", "NbShapes", "NbShapesProperty", "PxU32 NbShapes[PxGeometryType::eGEOMETRY_COUNT];", "PxMemCopy( NbShapes, inSource->nbShapes, sizeof( NbShapes ) );" ),
|
||||
CustomProperty( "PxScene", "SimulationStatistics", "SimulationStatisticsProperty", "PxSimulationStatistics SimulationStatistics;", "inSource->getSimulationStatistics(SimulationStatistics);" ),
|
||||
};
|
||||
|
||||
static const char* gImportantPhysXTypes[] =
|
||||
{
|
||||
"PxRigidStatic",
|
||||
"PxRigidDynamic",
|
||||
"PxShape",
|
||||
"PxArticulation",
|
||||
"PxArticulationReducedCoordinate",
|
||||
"PxArticulationLink",
|
||||
"PxMaterial",
|
||||
"PxArticulationJointBase",
|
||||
"PxArticulationJoint",
|
||||
"PxArticulationJointReducedCoordinate",
|
||||
"PxScene",
|
||||
"PxPhysics",
|
||||
"PxLowLevelArticulationFactory",
|
||||
"PxHeightFieldDesc",
|
||||
"PxMeshScale",
|
||||
"PxConstraint",
|
||||
"PxTolerancesScale",
|
||||
"PxSimulationStatistics",
|
||||
"PxSceneDesc",
|
||||
"PxSceneLimits",
|
||||
"PxgDynamicsMemoryConfig",
|
||||
"PxBroadPhaseDesc",
|
||||
"PxGeometry",
|
||||
"PxBoxGeometry",
|
||||
"PxCapsuleGeometry",
|
||||
"PxConvexMeshGeometry",
|
||||
"PxSphereGeometry",
|
||||
"PxPlaneGeometry",
|
||||
"PxTriangleMeshGeometry",
|
||||
"PxHeightFieldGeometry",
|
||||
"PxAggregate",
|
||||
"PxPruningStructure",
|
||||
//The mesh and heightfield buffers will need to be
|
||||
//handled by hand; they are very unorthodox compared
|
||||
//to the rest of the objects.
|
||||
#if PX_SUPPORT_GPU_PHYSX
|
||||
"PxgDynamicsMemoryConfig",
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char* gExtensionPhysXTypes[] =
|
||||
{
|
||||
"PxD6JointDrive",
|
||||
"PxJointLinearLimit",
|
||||
"PxJointLinearLimitPair",
|
||||
"PxJointAngularLimitPair",
|
||||
"PxJointLimitCone",
|
||||
"PxJointLimitPyramid",
|
||||
"PxD6Joint",
|
||||
"PxDistanceJoint",
|
||||
"PxContactJoint",
|
||||
"PxFixedJoint",
|
||||
"PxPrismaticJoint",
|
||||
"PxRevoluteJoint",
|
||||
"PxSphericalJoint",
|
||||
};
|
||||
|
||||
//We absolutely never generate information about these types, even if types
|
||||
//we do care about are derived from these types.
|
||||
static const char* gAvoidedPhysXTypes[] =
|
||||
{
|
||||
"PxSerializable",
|
||||
"PxObservable",
|
||||
"PxBase",
|
||||
"PxLowLevelArticulationFactory",
|
||||
"PxBaseFlag::Enum",
|
||||
};
|
||||
|
||||
#include "PxPhysicsAPI.h"
|
||||
#include "extensions/PxExtensionsAPI.h"
|
||||
|
||||
#endif
|
||||
91
physx/tools/physxmetadatagenerator/PxVehicleExtensionAPI.h
Normal file
91
physx/tools/physxmetadatagenerator/PxVehicleExtensionAPI.h
Normal file
@ -0,0 +1,91 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
#ifndef PX_PHYSICS_NXPHYSICSWITHVEHICLEEXTENSIONS_API
|
||||
#define PX_PHYSICS_NXPHYSICSWITHVEHICLEEXTENSIONS_API
|
||||
|
||||
#include "PxExtensionsCommon.h"
|
||||
|
||||
static DisabledPropertyEntry gDisabledProperties[] = {
|
||||
DisabledPropertyEntry( "PxVehicleWheelsDynData", "MTireForceCalculators" ),
|
||||
DisabledPropertyEntry( "PxVehicleWheelsDynData", "TireForceShaderData" ),
|
||||
DisabledPropertyEntry( "PxVehicleWheelsDynData", "UserData" ),
|
||||
DisabledPropertyEntry( "PxVehicleWheels", "MActor" ),
|
||||
};
|
||||
|
||||
//Append these properties to this type.
|
||||
static CustomProperty gCustomProperties[] = {
|
||||
#define DEFINE_VEHICLETIREDATA_INDEXED_PROPERTY( propName, propType, fieldName ) CustomProperty("PxVehicleTireData", #propName, #propType, "PxReal " #propName "[3][2];", "PxMemCopy( "#propName ", inSource->"#fieldName", sizeof( "#propName" ) );" )
|
||||
DEFINE_VEHICLETIREDATA_INDEXED_PROPERTY( MFrictionVsSlipGraph, MFrictionVsSlipGraphProperty, mFrictionVsSlipGraph),
|
||||
#undef DEFINE_VEHICLETIREDATA_INDEXED_PROPERTY
|
||||
|
||||
CustomProperty( "PxVehicleEngineData", "MTorqueCurve", "MTorqueCurveProperty", "", "" ),
|
||||
};
|
||||
|
||||
static const char* gUserPhysXTypes[] =
|
||||
{
|
||||
"PxVehicleWheels",
|
||||
"PxVehicleWheelsSimData",
|
||||
"PxVehicleWheelsDynData",
|
||||
"PxVehicleDrive4W",
|
||||
"PxVehicleWheels4SimData",
|
||||
"PxVehicleDriveSimData4W",
|
||||
"PxVehicleWheelData",
|
||||
"PxVehicleSuspensionData",
|
||||
"PxVehicleDriveDynData",
|
||||
"PxVehicleDifferential4WData",
|
||||
"PxVehicleDifferentialNWData",
|
||||
"PxVehicleAckermannGeometryData",
|
||||
"PxVehicleTireLoadFilterData",
|
||||
"PxVehicleEngineData",
|
||||
"PxVehicleGearsData",
|
||||
"PxVehicleClutchData",
|
||||
"PxVehicleAutoBoxData",
|
||||
"PxVehicleTireData",
|
||||
"PxVehicleChassisData",
|
||||
"PxTorqueCurvePair",
|
||||
"PxVehicleDriveTank",
|
||||
"PxVehicleNoDrive",
|
||||
"PxVehicleDriveSimDataNW",
|
||||
"PxVehicleDriveNW",
|
||||
"PxVehicleAntiRollBarData",
|
||||
};
|
||||
|
||||
//We absolutely never generate information about these types, even if types
|
||||
//we do care about are derived from these types.
|
||||
static const char* gAvoidedPhysXTypes[] =
|
||||
{
|
||||
"PxSerializable",
|
||||
"PxObservable",
|
||||
"PxBase",
|
||||
"PxBaseFlag::Enum",
|
||||
};
|
||||
|
||||
#include "PxPhysicsAPI.h"
|
||||
#include "PxVehicleSuspWheelTire4.h"
|
||||
#endif
|
||||
136
physx/tools/physxmetadatagenerator/generateMetaData.bat
Normal file
136
physx/tools/physxmetadatagenerator/generateMetaData.bat
Normal file
@ -0,0 +1,136 @@
|
||||
::
|
||||
:: Redistribution and use in source and binary forms, with or without
|
||||
:: modification, are permitted provided that the following conditions
|
||||
:: are met:
|
||||
:: * Redistributions of source code must retain the above copyright
|
||||
:: notice, this list of conditions and the following disclaimer.
|
||||
:: * Redistributions in binary form must reproduce the above copyright
|
||||
:: notice, this list of conditions and the following disclaimer in the
|
||||
:: documentation and/or other materials provided with the distribution.
|
||||
:: * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
:: contributors may be used to endorse or promote products derived
|
||||
:: from this software without specific prior written permission.
|
||||
::
|
||||
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
:: EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
:: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
:: PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
:: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
:: EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
:: PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
:: PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
:: OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
:: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
:: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
::
|
||||
:: Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
:: batch script that runs generateMetaData.py with either
|
||||
::
|
||||
:: -environment variable PYTHON
|
||||
:: -p4sw location of python
|
||||
:: -python.exe in PATH
|
||||
::
|
||||
:: see readme.txt
|
||||
|
||||
cd %~dp0
|
||||
|
||||
:: Get PxShared path from packman, if packman available:
|
||||
set PACKMAN_CMD=..\..\buildtools\packman\packman
|
||||
if not exist !PACKMAN_CMD! goto no_packman
|
||||
|
||||
call "..\..\buildtools\update_packman.cmd"
|
||||
@if errorlevel 1 @exit /b %errorlevel%
|
||||
|
||||
call !PACKMAN_CMD! pull "%~dp0..\..\dependencies.xml" --include-tag=RequiredForMetaGen
|
||||
@if errorlevel 1 @exit /b %errorlevel%
|
||||
:: use python from packman if available
|
||||
if not defined PYTHON (
|
||||
set PYTHON=!PM_python_PATH!\python.exe
|
||||
)
|
||||
:no_packman
|
||||
|
||||
:: look for python in p4 location unless PYTHON is set
|
||||
if not defined PYTHON (
|
||||
call :find_root_path %~p0 "tools\python\3.3" _RESULT
|
||||
if not !_RESULT!==0 (
|
||||
set PYTHON=!_RESULT!\tools\python\3.3\python.exe
|
||||
)
|
||||
)
|
||||
|
||||
:: look for python in PATH unless PYTHON is set
|
||||
if not defined PYTHON (
|
||||
where python.exe > nul 2>&1
|
||||
IF !ERRORLEVEL! == 0 (
|
||||
set PYTHON=python.exe
|
||||
)
|
||||
)
|
||||
|
||||
if not defined PYTHON (
|
||||
goto no_python
|
||||
)
|
||||
|
||||
echo using: %PYTHON%
|
||||
|
||||
:: visual studio 2015 is required for the meta data generation
|
||||
:: run vcvarsall.bat to get visual studio developer console environment variables
|
||||
if not defined VS140COMNTOOLS (
|
||||
goto no_vs140
|
||||
)
|
||||
|
||||
echo calling: %VS140COMNTOOLS%..\..\VC\vcvarsall.bat
|
||||
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
%PYTHON% generateMetaData.py %1
|
||||
|
||||
endlocal
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:no_python
|
||||
echo no python found, please set PYTHON environment variable to python.exe path, or make sure python.exe is in PATH.
|
||||
endlocal
|
||||
exit /b 1
|
||||
|
||||
:no_vs140
|
||||
echo echo make sure vs 2015 is installed.
|
||||
endlocal
|
||||
exit /b 1
|
||||
|
||||
|
||||
:: **************************************************************************
|
||||
:: functions
|
||||
:: **************************************************************************
|
||||
|
||||
:: find a root directory containing a known directory (as a hint)
|
||||
:find_root_path
|
||||
setlocal
|
||||
set START_DIR=%~1
|
||||
set CONTAINED_DIR=%~2
|
||||
|
||||
:: search directory tree
|
||||
set TMP_DIR=!START_DIR!
|
||||
set OUT_DIR=0
|
||||
:find_root_path_loop
|
||||
if exist !TMP_DIR!\!CONTAINED_DIR! goto :find_root_path_loop_end
|
||||
set TMP_DIR=!TMP_DIR!..\
|
||||
|
||||
:: normalize path
|
||||
pushd !TMP_DIR!
|
||||
set OUT_DIR=!CD!
|
||||
popd
|
||||
|
||||
:: break if we reach the root, by checking the last two charactors
|
||||
if "!OUT_DIR:~-2!"==":\" (
|
||||
set OUT_DIR=0
|
||||
goto :find_root_path_loop_end
|
||||
)
|
||||
|
||||
goto :find_root_path_loop
|
||||
:find_root_path_loop_end
|
||||
|
||||
::echo no idea why we need to use % here
|
||||
endlocal & set _RESULT=%OUT_DIR%
|
||||
exit /b 0
|
||||
|
||||
236
physx/tools/physxmetadatagenerator/generateMetaData.py
Normal file
236
physx/tools/physxmetadatagenerator/generateMetaData.py
Normal file
@ -0,0 +1,236 @@
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
import re
|
||||
import platform
|
||||
import shutil
|
||||
from lib import utils
|
||||
from lib import compare
|
||||
|
||||
# test mode: create copy of reference files
|
||||
# update mode: try to open file in p4 if necessary
|
||||
def setup_targetdir(metaDataDir, isTestMode):
|
||||
if isTestMode:
|
||||
targetDir = metaDataDir + "_test"
|
||||
if os.path.isdir(targetDir):
|
||||
print("deleting", targetDir)
|
||||
shutil.rmtree(targetDir)
|
||||
|
||||
def ignore_non_autogen(dir, files):
|
||||
return filter(lambda f : not (os.path.isdir(os.path.join(dir, f))
|
||||
or re.search(r"AutoGenerated", f)), files)
|
||||
|
||||
shutil.copytree(metaDataDir, targetDir, ignore=ignore_non_autogen)
|
||||
#set write to new files:
|
||||
for root, dirs, files in os.walk(targetDir):
|
||||
for file in files:
|
||||
os.chmod(os.path.join(root, file) , stat.S_IWRITE|stat.S_IREAD)
|
||||
else:
|
||||
targetDir = metaDataDir
|
||||
|
||||
if not utils.check_files_writable(utils.list_autogen_files(targetDir)):
|
||||
utils.try_checkout_files(utils.list_autogen_files(targetDir))
|
||||
|
||||
if not utils.check_files_writable(utils.list_autogen_files(targetDir)):
|
||||
print("auto generated meta data files not writable:", targetDir)
|
||||
print("aborting")
|
||||
sys.exit(1)
|
||||
|
||||
utils.clear_files(utils.list_autogen_files(targetDir))
|
||||
return targetDir
|
||||
|
||||
# test mode: run perl script to compare reference and generated files
|
||||
def test_targetdir(targetDir, metaDataDir, isTestMode):
|
||||
|
||||
if isTestMode:
|
||||
print("compare generated meta data files with reference meta data files:")
|
||||
result = compare.compareMetaDataDirectories(targetDir, metaDataDir)
|
||||
if not result:
|
||||
print("failed!")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("passed.")
|
||||
|
||||
def get_osx_platform_path():
|
||||
cmd = "xcodebuild -showsdks"
|
||||
(stdout, stderr) = utils.run_cmd(cmd)
|
||||
if stderr != "":
|
||||
print(stderr)
|
||||
sys.exit(1)
|
||||
|
||||
match = re.search(r"(-sdk macosx\d+.\d+)", stdout, flags=re.MULTILINE)
|
||||
if not match:
|
||||
print("coundn't parse output of:\n", cmd, "\naborting!")
|
||||
sys.exit(1)
|
||||
|
||||
sdkparam = match.group(0)
|
||||
cmd = "xcodebuild -version " + sdkparam + " Path"
|
||||
(sdkPath, stderr) = utils.run_cmd(cmd)
|
||||
if stderr != "":
|
||||
print(stderr)
|
||||
sys.exit(1)
|
||||
print("using sdk path:", sdkPath.rstrip())
|
||||
return sdkPath.rstrip()
|
||||
|
||||
def includeString(path):
|
||||
return ' -I"' + path + '"'
|
||||
|
||||
###########################################################################################################
|
||||
# main
|
||||
###########################################################################################################
|
||||
|
||||
parser = argparse.ArgumentParser(description='Generates meta data source files.')
|
||||
parser.add_argument('-test', help='enables testing mode, internal only', action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
scriptDir = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
try:
|
||||
os.makedirs("temp")
|
||||
except:
|
||||
None
|
||||
|
||||
# find SDK_ROOT, EXTERNALS and PX_SHARED
|
||||
sdkRoot = utils.find_root_path(scriptDir, "source")
|
||||
|
||||
if os.path.isdir(os.path.join(sdkRoot, "../physx")):
|
||||
clangRoot = os.path.join(sdkRoot, "../externals/clang-physxmetadata/4.0.0")
|
||||
pxSharedRoot = os.path.join(sdkRoot, "../pxshared")
|
||||
else:
|
||||
clangRoot = os.path.normpath(os.environ['PM_clangMetadata_PATH'])
|
||||
pxSharedRoot = os.path.normpath(os.environ['PM_PxShared_PATH'])
|
||||
|
||||
print("testmode:", args.test)
|
||||
print("root sdk:", sdkRoot)
|
||||
print("root clang:", clangRoot)
|
||||
print("root shared:", pxSharedRoot)
|
||||
|
||||
boilerPlateFile = os.path.join(sdkRoot, os.path.normpath("tools/physxmetadatagenerator/PxBoilerPlate.h"))
|
||||
|
||||
includes = ''
|
||||
includes += includeString(pxSharedRoot + '/include')
|
||||
includes += includeString(sdkRoot + '/include')
|
||||
includes += includeString(sdkRoot + '/tools/physxmetadatagenerator')
|
||||
|
||||
print("platform:", platform.system())
|
||||
|
||||
commonFlags = '-DNDEBUG -DPX_GENERATE_META_DATA -x c++-header -std=c++0x -w -Wno-c++11-narrowing -fms-extensions '
|
||||
|
||||
if platform.system() == "Windows":
|
||||
debugFile = open("temp/clangCommandLine_windows.txt", "a")
|
||||
|
||||
# read INCLUDE variable, set by calling batch script
|
||||
sysIncludes = os.environ['INCLUDE']
|
||||
sysIncludes = sysIncludes.rstrip(';')
|
||||
sysIncludeList = sysIncludes.split(';')
|
||||
sysIncludeFlags = ' -isystem"' + '" -isystem"'.join(sysIncludeList) + '"'
|
||||
|
||||
# for some reason -cc1 needs to go first in commonFlags
|
||||
commonFlags = '-cc1 ' + commonFlags
|
||||
platformFlags = '-DPX_VC=14 -D_WIN32 ' + sysIncludeFlags
|
||||
clangExe = os.path.join(clangRoot, os.path.normpath('win32/bin/clang.exe'))
|
||||
|
||||
|
||||
elif platform.system() == "Linux":
|
||||
debugFile = open("temp/clangCommandLine_linux.txt", "a")
|
||||
|
||||
platformFlags = ''
|
||||
clangExe = os.path.join(clangRoot, os.path.normpath('linux32/bin/clang'))
|
||||
|
||||
elif platform.system() == "Darwin":
|
||||
debugFile = open("temp/clangCommandLine_osx.txt", "a")
|
||||
|
||||
platformFlags = ' -isysroot' + get_osx_platform_path()
|
||||
clangExe = os.path.join(clangRoot, os.path.normpath('osx/bin/clang'))
|
||||
else:
|
||||
print("unsupported platform, aborting!")
|
||||
sys.exit(1)
|
||||
|
||||
commonFlags += ' -boilerplate-file ' + boilerPlateFile
|
||||
|
||||
#some checks
|
||||
if not os.path.isfile(clangExe):
|
||||
print("didn't find,", clangExe, ", aborting!")
|
||||
sys.exit(1)
|
||||
|
||||
clangExe = '"' + clangExe + '"'
|
||||
|
||||
# required for execution of clang.exe
|
||||
os.environ["PWD"] = os.path.join(sdkRoot, os.path.normpath("tools/physxmetadatagenerator"))
|
||||
|
||||
###############################
|
||||
# PxPhysicsWithExtensions #
|
||||
###############################
|
||||
|
||||
print("PxPhysicsWithExtensions:")
|
||||
|
||||
srcPath = "PxPhysicsWithExtensionsAPI.h"
|
||||
metaDataDir = os.path.join(sdkRoot, os.path.normpath("source/physxmetadata"))
|
||||
|
||||
targetDir = setup_targetdir(metaDataDir, args.test)
|
||||
|
||||
cmd = " ".join(["", clangExe, commonFlags, "", platformFlags, includes, srcPath, "-o", '"'+targetDir+'"'])
|
||||
print(cmd, file = debugFile)
|
||||
(stdout, stderr) = utils.run_cmd(cmd)
|
||||
if (stderr != "" or stdout != ""):
|
||||
print(stderr, "\n", stdout)
|
||||
print("wrote meta data files in", targetDir)
|
||||
|
||||
test_targetdir(targetDir, metaDataDir, args.test)
|
||||
|
||||
###############################
|
||||
# PxVehicleExtension #
|
||||
###############################
|
||||
|
||||
print("PxVehicleExtension:")
|
||||
|
||||
srcPath = "PxVehicleExtensionAPI.h"
|
||||
metaDataDir = os.path.join(sdkRoot, os.path.normpath("source/physxvehicle/src/physxmetadata"))
|
||||
|
||||
includes += includeString(sdkRoot + '/include/vehicle')
|
||||
#TODO, get rid of source include
|
||||
includes += includeString(sdkRoot + '/source/physxvehicle/src')
|
||||
includes += includeString(pxSharedRoot + '/include/foundation')
|
||||
|
||||
targetDir = setup_targetdir(metaDataDir, args.test)
|
||||
|
||||
cmd = " ".join(["", clangExe, commonFlags, "", platformFlags, includes, srcPath, "-o", '"'+targetDir+'"'])
|
||||
print(cmd, file = debugFile)
|
||||
(stdout, stderr) = utils.run_cmd(cmd)
|
||||
if (stderr != "" or stdout != ""):
|
||||
print(stderr, "\n", stdout)
|
||||
print("wrote meta data files in", targetDir)
|
||||
|
||||
test_targetdir(targetDir, metaDataDir, args.test)
|
||||
|
||||
48
physx/tools/physxmetadatagenerator/generateMetaData.sh
Executable file
48
physx/tools/physxmetadatagenerator/generateMetaData.sh
Executable file
@ -0,0 +1,48 @@
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PHYSX_ROOT_DIR=$SCRIPT_DIR/../..
|
||||
|
||||
export GEN_META_DATA_PARAMETER=$1
|
||||
|
||||
if [ -f $PHYSX_ROOT_DIR/buildtools/update_packman.sh ] ; then
|
||||
source $PHYSX_ROOT_DIR/buildtools/update_packman.sh
|
||||
$PHYSX_ROOT_DIR/buildtools/packman/packman pull "$PHYSX_ROOT_DIR/dependencies.xml" --platform linux --include-tag=requiredForMetaGen --postscript $SCRIPT_DIR/helper.sh
|
||||
else
|
||||
export PM_PxShared_PATH="$PHYSX_ROOT_DIR/../pxshared"
|
||||
export PM_clangMetadata_PATH="$PHYSX_ROOT_DIR/../externals/clang-physxmetadata/4.0.0"
|
||||
$SCRIPT_DIR/helper.sh
|
||||
fi
|
||||
|
||||
status=$?
|
||||
if [ "$status" -ne "0" ]; then
|
||||
echo "Error $status"
|
||||
exit 1
|
||||
fi
|
||||
37
physx/tools/physxmetadatagenerator/helper.sh
Executable file
37
physx/tools/physxmetadatagenerator/helper.sh
Executable file
@ -0,0 +1,37 @@
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
python generateMetaData.py $GEN_META_DATA_PARAMETER
|
||||
status=$?
|
||||
if [ "$status" -ne "0" ]; then
|
||||
echo "Error $status"
|
||||
exit 1
|
||||
fi
|
||||
0
physx/tools/physxmetadatagenerator/lib/__init__.py
Normal file
0
physx/tools/physxmetadatagenerator/lib/__init__.py
Normal file
120
physx/tools/physxmetadatagenerator/lib/compare.py
Normal file
120
physx/tools/physxmetadatagenerator/lib/compare.py
Normal file
@ -0,0 +1,120 @@
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
# general utility module
|
||||
from __future__ import print_function
|
||||
from __future__ import with_statement
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
from . import utils
|
||||
|
||||
def compareMetaDataDirectories(candidateDir, referenceDir):
|
||||
|
||||
print("reference dir:", referenceDir)
|
||||
print("candidate dir:", candidateDir)
|
||||
|
||||
if not _checkFileExistence(candidateDir, referenceDir):
|
||||
return False
|
||||
|
||||
referenceFiles = utils.list_autogen_files(referenceDir)
|
||||
|
||||
#get corresponding candidate files without relying on os.walk order
|
||||
def mapRefToCand(refFile):
|
||||
return os.path.join(candidateDir, os.path.relpath(refFile, referenceDir))
|
||||
candidateFiles = [mapRefToCand(f) for f in referenceFiles]
|
||||
|
||||
for (fileCand, fileRef) in zip(candidateFiles, referenceFiles):
|
||||
|
||||
timeCand = os.path.getmtime(fileCand)
|
||||
timeRef = os.path.getmtime(fileRef)
|
||||
|
||||
if timeCand <= timeRef:
|
||||
print("last modified time of candidate is not later than last modified time of reference:")
|
||||
print("candidate:", fileCand, "\n", "reference:", fileRef)
|
||||
print("ref:", timeRef)
|
||||
print("cand:", timeCand)
|
||||
return False
|
||||
|
||||
#_read_file_content will remove line endings(windows/unix), but not ignore empty lines
|
||||
candLines = _read_file_content(fileCand)
|
||||
refLines = _read_file_content(fileRef)
|
||||
if not (candLines and refLines):
|
||||
return False
|
||||
|
||||
if len(candLines) != len(refLines):
|
||||
print("files got different number of lines:")
|
||||
print("candidate:", fileCand, "\n", "reference:", fileRef)
|
||||
print("ref:", len(refLines))
|
||||
print("cand:", len(candLines))
|
||||
return False
|
||||
|
||||
for (i, (lineCand, lineRef)) in enumerate(zip(candLines, refLines)):
|
||||
if (lineCand != lineRef):
|
||||
print("candidate line is not equal to refence line:")
|
||||
print("candidate:", fileCand, "\n", "reference:", fileRef)
|
||||
print("@line number:", i)
|
||||
print("ref:", lineRef)
|
||||
print("cand:", lineCand)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
##############################################################################
|
||||
# internal functions
|
||||
##############################################################################
|
||||
|
||||
#will remove line endings(windows/unix), but not ignore empty lines
|
||||
def _read_file_content(filePath):
|
||||
lines = []
|
||||
try:
|
||||
with open(filePath, "r") as file:
|
||||
for line in file:
|
||||
lines.append(line.rstrip())
|
||||
except:
|
||||
print("issue with reading file:", filePath)
|
||||
|
||||
return lines
|
||||
|
||||
def _checkFileExistence(candidateDir, referenceDir):
|
||||
candidateSet = set([os.path.relpath(f, candidateDir) for f in utils.list_autogen_files(candidateDir)])
|
||||
referenceSet = set([os.path.relpath(f, referenceDir) for f in utils.list_autogen_files(referenceDir)])
|
||||
|
||||
missingSet = referenceSet - candidateSet
|
||||
if missingSet:
|
||||
print("the following files are missing from the candidates:\n", "\n".join(missingSet))
|
||||
return False
|
||||
|
||||
excessSet = candidateSet - referenceSet
|
||||
if excessSet:
|
||||
print("too many candidate files:\n", "\n".join(excessSet))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
104
physx/tools/physxmetadatagenerator/lib/utils.py
Normal file
104
physx/tools/physxmetadatagenerator/lib/utils.py
Normal file
@ -0,0 +1,104 @@
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
# general utility module
|
||||
from __future__ import print_function
|
||||
from __future__ import with_statement
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
def list_autogen_files(dirPath):
|
||||
autogenFiles = []
|
||||
for (root, subdirs, files) in os.walk(dirPath):
|
||||
files = filter(lambda f : re.search(r"AutoGenerated", f), files)
|
||||
autogenFiles.extend([os.path.join(root, f) for f in files])
|
||||
return autogenFiles
|
||||
|
||||
#checkout files with p4 if available
|
||||
def try_checkout_files(files):
|
||||
|
||||
print("checking p4 connection parameter...")
|
||||
|
||||
# checking p4
|
||||
cmd = "p4"
|
||||
(stdout, stderr) = run_cmd(cmd)
|
||||
|
||||
if stderr == "":
|
||||
print("p4 available.")
|
||||
else:
|
||||
print("p4 unavailable.")
|
||||
return
|
||||
|
||||
cmd = "p4 edit " + " " + " ".join(files)
|
||||
(stdout, stderr) = run_cmd(cmd)
|
||||
print(stderr)
|
||||
print(stdout)
|
||||
|
||||
# check files writability
|
||||
def check_files_writable(files):
|
||||
for file in files:
|
||||
if not os.access(file, os.W_OK):
|
||||
return False
|
||||
return True
|
||||
|
||||
# find a root directory containing a known directory (as a hint)
|
||||
def find_root_path(startDir, containedDir):
|
||||
|
||||
currentDir = startDir
|
||||
|
||||
# search directory tree
|
||||
mergedDir = os.path.join(currentDir, containedDir)
|
||||
while not os.path.isdir(mergedDir):
|
||||
(currentDir, dir) = os.path.split(currentDir)
|
||||
if not dir:
|
||||
return None
|
||||
|
||||
mergedDir = os.path.join(currentDir, containedDir)
|
||||
|
||||
return currentDir
|
||||
|
||||
def run_cmd(cmd, stdin = ""):
|
||||
process = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
(stdoutRaw, stderrRaw) = process.communicate(stdin.encode('utf-8'))
|
||||
stdout = stdoutRaw.decode(encoding='utf-8')
|
||||
stderr = stderrRaw.decode(encoding='utf-8')
|
||||
return (stdout, stderr)
|
||||
|
||||
# clears content of files
|
||||
def clear_files(files):
|
||||
for file in files:
|
||||
open(file, 'w').close()
|
||||
|
||||
##############################################################################
|
||||
# internal functions
|
||||
##############################################################################
|
||||
|
||||
|
||||
54
physx/tools/physxmetadatagenerator/readme.txt
Normal file
54
physx/tools/physxmetadatagenerator/readme.txt
Normal file
@ -0,0 +1,54 @@
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions
|
||||
## are met:
|
||||
## * Redistributions of source code must retain the above copyright
|
||||
## notice, this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, this list of conditions and the following disclaimer in the
|
||||
## documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
## contributors may be used to endorse or promote products derived
|
||||
## from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
## Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
If the Physx API is changed, the API level serialization meta data files need to be updated.
|
||||
This can be done by running:
|
||||
|
||||
Windows: generateMetaData.bat
|
||||
It looks for python in
|
||||
1. environment variable PYTHON
|
||||
2. p4sw location (NVidia only)
|
||||
3. PATH
|
||||
|
||||
Linux/MacOS: generateMetaData.sh
|
||||
|
||||
Linux and osx distributions mostly come with Python pre-installed. On windows please download
|
||||
and install the latest python version from here:
|
||||
https://www.python.org/downloads
|
||||
and make sure to add python to your windows PATH (option in python installer)
|
||||
|
||||
The generateMetaData.py tests for meta data files being writable. If not, p4 commands are
|
||||
used to open the files for edit before the update. If p4 is not available (or not configured for cmd line usage, see https://www.perforce.com/perforce/r15.1/manuals/p4guide/chapter.configuration.html: "Using config files"),
|
||||
the files need to be made writable manually.
|
||||
|
||||
Requirements:
|
||||
Windows: Visual Studio 2015
|
||||
|
||||
Testing:
|
||||
generateMetaData.py -test runs the meta data generation in test mode. This mode checks that the current
|
||||
set of meta data files is still in sync with the PhysX API (i.e. already generated meta data files).
|
||||
|
||||
Reference in New Issue
Block a user