RavEngine
Loading...
Searching...
No Matches
SerializationCommon.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#pragma once
30
31#include "vehicle2/PxVehicleAPI.h"
32
33#if PX_SWITCH
34#pragma clang diagnostic push
35#pragma clang diagnostic ignored "-Wexpansion-to-defined"
36#elif PX_OSX
37#pragma clang diagnostic push
38#pragma clang diagnostic ignored "-Wexpansion-to-defined"
39#pragma clang diagnostic ignored "-Wdocumentation"
40#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
41#elif PX_LINUX && PX_CLANG
42#pragma clang diagnostic push
43#pragma clang diagnostic ignored "-Wdocumentation"
44#endif
45#include "rapidjson/document.h"
46#include "rapidjson/prettywriter.h"
47#if (PX_LINUX && PX_CLANG) || PX_SWITCH || PX_OSX
48#pragma clang diagnostic pop
49#endif
50
51namespace snippetvehicle2
52{
53
54using namespace physx;
55using namespace physx::vehicle2;
56
57bool openDocument(const char* directory, const char* filename, rapidjson::Document&);
58
59bool readCommandResponseParams
60(const rapidjson::Value& value, const PxVehicleAxleDescription& axleDesc,
61 PxVehicleCommandResponseParams& responseParams);
62bool writeCommandResponseParams
63(const PxVehicleCommandResponseParams& responseParams, const PxVehicleAxleDescription& axleDesc,
64 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
65
66bool readVec3(const rapidjson::Value& values, PxVec3& r);
67bool writeVec3(const PxVec3& r, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
68
69bool readQuat(const rapidjson::Value& values, PxQuat& r);
70bool writeQuat(const PxQuat& r, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
71
72bool readTransform(const rapidjson::Value& values, PxTransform& r);
73bool writeTransform(const PxTransform& r, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
74
75bool readFloatLookupTable(const rapidjson::Value& values, PxVehicleFixedSizeLookupTable<PxReal, 3>& lookupTable);
76bool readFloatLookupTable(const rapidjson::Value& values, PxVehicleFixedSizeLookupTable<PxReal, PxVehicleEngineParams::eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES>& lookupTable);
77bool readVec3LookupTable(const rapidjson::Value& values, PxVehicleFixedSizeLookupTable<PxVec3, 3>& lookupTable);
78bool writeVec3LookupTable(const PxVehicleFixedSizeLookupTable<PxVec3, 3>& lookupTable, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
79bool writeFloatLookupTable(const PxVehicleFixedSizeLookupTable<PxReal, 3>& lookupTable, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
80bool writeFloatLookupTable(const PxVehicleFixedSizeLookupTable<PxReal, PxVehicleEngineParams::eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES>& lookupTable, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
81}//namespace snippetvehicle2
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition PxQuat.h:50
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
3 Element vector class.
Definition PxVec3.h:50
Express a function as a sequence of points {(x, y)} that form a piecewise polynomial.
Definition PxVehicleParams.h:808
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxVehicleParams.h:53
A description of the per wheel response to an input command.
Definition PxVehicleCommandParams.h:177