Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

2.4 KB
Raw Blame
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2008-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

#ifndef PX_EXTENSION_METADATAOBJECTS_H
#define PX_EXTENSION_METADATAOBJECTS_H
#include "PxPhysicsAPI.h"
#include "extensions/PxExtensionsAPI.h"
#include "PxMetaDataObjects.h"


namespace physx
{

class PxD6Joint;
class PxJointLimitCone;

struct PxExtensionsPropertyInfoName
{
	enum Enum
	{
		Unnamed = PxPropertyInfoName::LastPxPropertyInfoName,
#include "PxExtensionAutoGeneratedMetaDataObjectNames.h"
		LastPxPropertyInfoName
	};
};

#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct )																			\
	template<> struct PxPropertyToValueStructMemberMap< PxExtensionsPropertyInfoName::type##_##prop >											\
	{																																			\
		PxU32 Offset;																															\
		PxPropertyToValueStructMemberMap< PxExtensionsPropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {}	\
		template<typename TOperator> void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop );	}			\
	};

#if PX_LINUX && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#include "PxExtensionAutoGeneratedMetaDataObjects.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic pop
#endif

#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP

PX_FORCE_INLINE bool isD6JointDriveAccessAllowed(PxD6Drive::Enum driveType, PxD6AngularDriveConfig::Enum angDriveConfig)
{
	PX_COMPILE_TIME_ASSERT(PxD6Drive::eX < PxD6Drive::eY);
	PX_COMPILE_TIME_ASSERT(PxD6Drive::eY < PxD6Drive::eZ);
	PX_COMPILE_TIME_ASSERT(PxD6Drive::eZ < PxD6Drive::eTWIST);
	PX_COMPILE_TIME_ASSERT(PxD6Drive::eZ < PxD6Drive::eSLERP);
	PX_COMPILE_TIME_ASSERT(PxD6Drive::eZ < PxD6Drive::eSWING1);
	PX_COMPILE_TIME_ASSERT(PxD6Drive::eZ < PxD6Drive::eSWING2);

	if (driveType > PxD6Drive::eZ)
	{
		if (angDriveConfig == PxD6AngularDriveConfig::eSWING_TWIST)
		{
			if ((driveType != PxD6Drive::eTWIST) && (driveType != PxD6Drive::eSWING1) && (driveType != PxD6Drive::eSWING2))
				return false;
		}
		else if (angDriveConfig == PxD6AngularDriveConfig::eSLERP)
		{
			if (driveType != PxD6Drive::eSLERP)
				return false;
		}
		else
		{
			return false;
		}
	}

	return true;
}

}

#endif