
include "vphysics2/interface.h"
include "vphysics2/surfaceproperties_resource.h"

native accessor g_pPhysicsSystem as NativeEngine.g_pPhysicsSystem
{
	int NumWorlds();

	IPhysicsWorld CreateWorld();
	void DestroyWorld( IPhysicsWorld world );

	IPhysSurfacePropertyController GetSurfacePropertyController();

	bool CastHeightField( cref out Vector3 vOut, Vector3 vRayStart, Vector3 vRayDelta, CastTo[uint16_t*] void* Heights, int SizeX, int SizeY, float SizeScale, float HeightScale );

	inline CPhysAggregateData GetAggregateData( string resourceName )
	{
		HPhysAggregateData_Internal hPhysicsData = g_pResourceSystem->FindExistingResourceByName< RESOURCE_TYPE_PHYSICSDATA_INTERNAL >( CResourceName( resourceName ) );
		if ( !hPhysicsData.HasData() )
			return nullptr;

		return hPhysicsData;
	}

	void UpdateSurfaceProperties( CPhysSurfaceProperties pSurfaceProperties );
}

native class IPhysSurfacePropertyController as NativeEngine.IPhysSurfacePropertyController
{
	int GetSurfacePropCount();
	CPhysSurfaceProperties GetSurfaceProperty( int nIndex );
	CPhysSurfaceProperties AddProperty( string name, string basename, string description );
}

