RavEngine
Loading...
Searching...
No Matches
PxSimpleTypes.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#ifndef PX_SIMPLE_TYPES_H
30#define PX_SIMPLE_TYPES_H
31
36// Platform specific types:
37// Design note: Its OK to use int for general loop variables and temps.
38
39#include "foundation/PxPreprocessor.h"
40#if PX_VC
41#pragma warning(push)
42#pragma warning(disable : 4668) // suppressing warning generated by Microsoft Visual Studio when including this standard
43// header
44#endif
45
46#if PX_LINUX
47#ifndef __STDC_LIMIT_MACROS
48#define __STDC_LIMIT_MACROS
49#endif
50#endif
51
52#include <stdint.h>
53#if PX_VC
54#pragma warning(pop)
55#endif
56
57#if PX_VC // we could use inttypes.h starting with VC12
58#define PX_PRIu64 "I64u"
59#else
60#if !PX_APPLE_FAMILY
61#ifndef __STDC_FORMAT_MACROS
62#define __STDC_FORMAT_MACROS
63#endif
64#endif
65#include <inttypes.h>
66#define PX_PRIu64 PRIu64
67#endif
68
69#if !PX_DOXYGEN
70namespace physx
71{
72#endif
73typedef int64_t PxI64;
74typedef uint64_t PxU64;
75typedef int32_t PxI32;
76typedef uint32_t PxU32;
77typedef int16_t PxI16;
78typedef uint16_t PxU16;
79typedef int8_t PxI8;
80typedef uint8_t PxU8;
81typedef float PxF32;
82typedef double PxF64;
83typedef float PxReal;
84// Int-as-bool type - has some uses for efficiency and with SIMD
85typedef PxI32 PxIntBool;
86static const PxIntBool PxIntFalse = 0;
87static const PxIntBool PxIntTrue = 1;
88#if !PX_DOXYGEN
89} // namespace physx
90#endif
91
92#define PX_SIGN_BITMASK 0x80000000
93
94// Type ranges
95
96#define PX_MAX_F32 3.4028234663852885981170418348452e+38F
97// maximum possible float value
98#define PX_MAX_F64 DBL_MAX // maximum possible double value
99
100#define PX_EPS_F32 FLT_EPSILON // maximum relative error of float rounding
101#define PX_EPS_F64 DBL_EPSILON // maximum relative error of double rounding
102
103#define PX_MAX_REAL PX_MAX_F32
104#define PX_EPS_REAL PX_EPS_F32
105#define PX_NORMALIZATION_EPSILON float(1e-20f)
106
107// Legacy type ranges used by PhysX
108#define PX_MAX_I8 INT8_MAX
109#define PX_MIN_I8 INT8_MIN
110#define PX_MAX_U8 UINT8_MAX
111#define PX_MIN_U8 UINT8_MIN
112#define PX_MAX_I16 INT16_MAX
113#define PX_MIN_I16 INT16_MIN
114#define PX_MAX_U16 UINT16_MAX
115#define PX_MIN_U16 UINT16_MIN
116#define PX_MAX_I32 INT32_MAX
117#define PX_MIN_I32 INT32_MIN
118#define PX_MAX_U32 UINT32_MAX
119#define PX_MIN_U32 UINT32_MIN
120
122#endif
123
uint64 uint64_t
Definition fwd.hpp:145
int8 int8_t
Definition fwd.hpp:43
int64 int64_t
Definition fwd.hpp:85
uint32 uint32_t
Definition fwd.hpp:131
uint8 uint8_t
Definition fwd.hpp:103
int32 int32_t
Definition fwd.hpp:71
uint16 uint16_t
Definition fwd.hpp:117
int16 int16_t
Definition fwd.hpp:57
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39