424 lines
27 KiB
HTML
424 lines
27 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="" > <![endif]-->
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="" > <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
<title>Startup and Shutdown — NVIDIA PhysX SDK 4.1 Documentation</title>
|
|
|
|
|
|
|
|
<link rel="shortcut icon" href="_static/images/favicon.ico"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
<link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
|
|
<link rel="next" title="Threading" href="Threading.html" />
|
|
<link rel="prev" title="The PhysX API" href="API.html" />
|
|
<link href="../_static/css/nvidia_theme.css" rel="stylesheet" type="text/css">
|
|
|
|
|
|
<style>
|
|
.wy-nav-content::before {
|
|
content: "PhysX 4.1 SDK Guide";
|
|
}
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script src="../_static/js/modernizr.min.js"></script>
|
|
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav">
|
|
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search">
|
|
|
|
|
|
|
|
<a href="../Index.html" class="icon icon-home"> Python
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<div role="search">
|
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ul class="current">
|
|
<li class="toctree-l1 current"><a class="reference internal" href="Index.html">User's Guide</a><ul class="current">
|
|
<li class="toctree-l2"><a class="reference internal" href="License.html">PhysX License</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Introduction.html">Welcome to PhysX</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="HelloWorld.html">Snippets</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="BuildingWithPhysX.html">Building with PhysX</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="API.html">The PhysX API</a></li>
|
|
<li class="toctree-l2 current"><a class="current reference internal" href="">Startup and Shutdown</a><ul>
|
|
<li class="toctree-l3"><a class="reference internal" href="#introduction">Introduction</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#foundation-and-physics">Foundation and Physics</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#cooking">Cooking</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#extensions">Extensions</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#optional-sdk-components">Optional SDK Components</a></li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#delay-loading-dlls">Delay-Loading DLLs</a><ul>
|
|
<li class="toctree-l4"><a class="reference internal" href="#physxcommon-dll-and-physxfoundation-dll-load">PhysXCommon DLL and PhysXFoundation DLL load</a></li>
|
|
<li class="toctree-l4"><a class="reference internal" href="#pxdelayloadhook">PxDelayLoadHook</a></li>
|
|
<li class="toctree-l4"><a class="reference internal" href="#pxgpuloadhook">PxGpuLoadHook</a></li>
|
|
<li class="toctree-l4"><a class="reference internal" href="#physxcommon-secure-load">PhysXCommon Secure Load</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#shutting-down">Shutting Down</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Threading.html">Threading</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Geometry.html">Geometry</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="RigidBodyOverview.html">Rigid Body Overview</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="RigidBodyCollision.html">Rigid Body Collision</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="RigidBodyDynamics.html">Rigid Body Dynamics</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Simulation.html">Simulation</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="AdvancedCollisionDetection.html">Advanced Collision Detection</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Joints.html">Joints</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Articulations.html">Articulations</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-and-reduced-articulations">Maximal Coordinate and Reduced Articulations</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-articulations">Maximal Coordinate Articulations</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#reduced-coordinate-articulations">Reduced Coordinate Articulations</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="OriginShift.html">Scene Origin</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="GPURigidBodies.html">GPU Rigid Bodies</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="GeometryQueries.html">Geometry Queries</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="SceneQueries.html">Scene Queries</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Vehicles.html">Vehicles</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="CharacterControllers.html">Character Controllers</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="DebugVisualization.html">Debug Visualization</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="VisualDebugger.html">PhysX Visual Debugger (PVD)</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Statistics.html">Simulation Statistics</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="Serialization.html">Serialization</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="ExtendingSerialization.html">Extending Serialization</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="BestPractices.html">Best Practices Guide</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="MigrationFrom28.html">Migrating From PhysX SDK 2.x to 3.x</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="MigrationTo33.html">Migrating From PhysX SDK 3.2 to 3.3</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="MigrationTo34.html">Migrating From PhysX SDK 3.3 to 3.4</a></li>
|
|
<li class="toctree-l2"><a class="reference internal" href="MigrationTo40.html">Migrating From PhysX SDK 3.4 to 4.0</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
<nav class="wy-nav-top" aria-label="top navigation">
|
|
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="../Index.html">Python</a>
|
|
|
|
</nav>
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
|
|
<div class="rst-content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
|
|
<ul class="wy-breadcrumbs">
|
|
|
|
<li><a href="../Index.html">Docs</a> »</li>
|
|
|
|
<li><a href="Index.html">User's Guide</a> »</li>
|
|
|
|
<li>Startup and Shutdown</li>
|
|
|
|
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div itemprop="articleBody">
|
|
|
|
<div class="section" id="startup-and-shutdown">
|
|
<span id="startup"></span><h1>Startup and Shutdown<a class="headerlink" href="#startup-and-shutdown" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="introduction">
|
|
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
|
|
<p>The first step in using the PhysX SDK in a program is the initialization of some global objects. These objects can be released when PhysX is no longer needed to free resources. This chapter describes how to do this.</p>
|
|
</div>
|
|
<div class="section" id="foundation-and-physics">
|
|
<h2>Foundation and Physics<a class="headerlink" href="#foundation-and-physics" title="Permalink to this headline">¶</a></h2>
|
|
<p>First, in some startup code, create a <em>PxFoundation</em> object:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="k">static</span> <span class="n">PxDefaultErrorCallback</span> <span class="n">gDefaultErrorCallback</span><span class="p">;</span>
|
|
<span class="k">static</span> <span class="n">PxDefaultAllocator</span> <span class="n">gDefaultAllocatorCallback</span><span class="p">;</span>
|
|
|
|
<span class="n">mFoundation</span> <span class="o">=</span> <span class="n">PxCreateFoundation</span><span class="p">(</span><span class="n">PX_PHYSICS_VERSION</span><span class="p">,</span> <span class="n">gDefaultAllocatorCallback</span><span class="p">,</span>
|
|
<span class="n">gDefaultErrorCallback</span><span class="p">);</span>
|
|
<span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">mFoundation</span><span class="p">)</span>
|
|
<span class="n">fatalError</span><span class="p">(</span><span class="s">"PxCreateFoundation failed!"</span><span class="p">);</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Every PhysX module requires a PxFoundation instance to be available. The required parameters are a version ID, an allocator callback and an error callback. <em>PX_PHYSICS_VERSION</em>, is a macro predefined in our headers to enable PhysX to check for a version mismatch between the headers and the corresponding SDK DLLs.</p>
|
|
<p>Usually, the allocator callback and error callback are specific to the application, but PhysX provides default implementations that make it easy to get started. See <a class="reference internal" href="API.html#memorymanagement"><em>Memory Management</em></a> and <a class="reference internal" href="API.html#errorreporting"><em>Error Reporting</em></a> for more details of these callbacks. (The actual sample code supports an advanced memory allocator that tracks allocations instead of the default, but we have omitted that detail here.)</p>
|
|
<p>Now create the top-level <em>PxPhysics</em> object:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="kt">bool</span> <span class="n">recordMemoryAllocations</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
|
|
|
|
<span class="n">mPvd</span> <span class="o">=</span> <span class="n">PxCreatePvd</span><span class="p">(</span><span class="o">*</span><span class="n">gFoundation</span><span class="p">);</span>
|
|
<span class="n">PxPvdTransport</span><span class="o">*</span> <span class="n">transport</span> <span class="o">=</span> <span class="n">PxDefaultPvdSocketTransportCreate</span><span class="p">(</span><span class="n">PVD_HOST</span><span class="p">,</span> <span class="mi">5425</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>
|
|
<span class="n">mPvd</span><span class="o">-></span><span class="n">connect</span><span class="p">(</span><span class="o">*</span><span class="n">transport</span><span class="p">,</span><span class="n">PxPvdInstrumentationFlag</span><span class="o">::</span><span class="n">eALL</span><span class="p">);</span>
|
|
|
|
|
|
<span class="n">mPhysics</span> <span class="o">=</span> <span class="n">PxCreatePhysics</span><span class="p">(</span><span class="n">PX_PHYSICS_VERSION</span><span class="p">,</span> <span class="o">*</span><span class="n">mFoundation</span><span class="p">,</span>
|
|
<span class="n">PxTolerancesScale</span><span class="p">(),</span> <span class="n">recordMemoryAllocations</span><span class="p">,</span> <span class="n">mPvd</span><span class="p">);</span>
|
|
<span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">mPhysics</span><span class="p">)</span>
|
|
<span class="n">fatalError</span><span class="p">(</span><span class="s">"PxCreatePhysics failed!"</span><span class="p">);</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Again, the version ID has to be passed in. The PxTolerancesScale parameter makes it easier to author content at different scales and still have PhysX work as expected, but to get started simply pass a default object of this type. The recordMemoryAllocations parameter specifies whether to perform memory profiling. The optional PVD instance enables the debugging and profiling with the PhysX Visual Debugger.</p>
|
|
</div>
|
|
<div class="section" id="cooking">
|
|
<h2>Cooking<a class="headerlink" href="#cooking" title="Permalink to this headline">¶</a></h2>
|
|
<p>The PhysX cooking library provides utilities for creating, converting, and serializing bulk data. Depending on your application, you may wish to link to the cooking library in order to process such data at runtime. Alternatively you may be able to process all such data in advance and just load it into memory as required. Initialize the cooking library as follows:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="n">mCooking</span> <span class="o">=</span> <span class="n">PxCreateCooking</span><span class="p">(</span><span class="n">PX_PHYSICS_VERSION</span><span class="p">,</span> <span class="o">*</span><span class="n">mFoundation</span><span class="p">,</span> <span class="n">PxCookingParams</span><span class="p">(</span><span class="n">scale</span><span class="p">));</span>
|
|
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">mCooking</span><span class="p">)</span>
|
|
<span class="n">fatalError</span><span class="p">(</span><span class="s">"PxCreateCooking failed!"</span><span class="p">);</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>The PxCookingParams struct configures the cooking library to target different platforms, use non-default tolerances or produce optional outputs. It is important to use consistent PxTolerancesScale values everywhere in your application (see <a class="reference internal" href="API.html#pxtolerancescale"><em>Using Different Units</em></a> for more details).</p>
|
|
<p>The cooking library generates data through a streaming interface. In the samples, implementations of streams are provided in the PxToolkit library to read and write from files and memory buffers. Heightfield or Trianglemesh cooked meshes can be directly inserted into PxPhysics without serialization using the PxPhysicsInsertionCallback. The default callback must be used and can be obtained using the PxPhysics::getPhysicsInsertionCallback().</p>
|
|
</div>
|
|
<div class="section" id="extensions">
|
|
<h2>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline">¶</a></h2>
|
|
<p>The extensions library contains many functions that may be useful to a large class of users, but which some users may prefer to omit from their application either for code size reasons or to avoid use of certain subsystems, such as those pertaining to networking. Initializing the extensions library requires the PxPhysics object:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">PxInitExtensions</span><span class="p">(</span><span class="o">*</span><span class="n">mPhysics</span><span class="p">,</span> <span class="n">mPvd</span><span class="p">))</span>
|
|
<span class="n">fatalError</span><span class="p">(</span><span class="s">"PxInitExtensions failed!"</span><span class="p">);</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="optional-sdk-components">
|
|
<span id="optionalsdkcomponents"></span><h2>Optional SDK Components<a class="headerlink" href="#optional-sdk-components" title="Permalink to this headline">¶</a></h2>
|
|
<p>When linking PhysX as a static library on memory constrained platforms, it is possible to avoid linking the code of some PhysX features that are not always used in order to save memory. Currently the optional features are:</p>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>Articulations</li>
|
|
<li>Height Fields</li>
|
|
</ul>
|
|
</div></blockquote>
|
|
<p>If your application requires a subset of this functionality, it is recommended that you call PxCreateBasePhysics as opposed to PxCreatePhysics and then manually register the components you require. Below is an example that registers some of the options:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="n">physx</span><span class="o">::</span><span class="n">PxPhysics</span><span class="o">*</span> <span class="n">customCreatePhysics</span><span class="p">(</span><span class="n">physx</span><span class="o">::</span><span class="n">PxU32</span> <span class="n">version</span><span class="p">,</span>
|
|
<span class="n">physx</span><span class="o">::</span><span class="n">PxFoundation</span><span class="o">&</span> <span class="n">foundation</span><span class="p">,</span>
|
|
<span class="k">const</span> <span class="n">physx</span><span class="o">::</span><span class="n">PxTolerancesScale</span><span class="o">&</span> <span class="n">scale</span><span class="p">,</span>
|
|
<span class="kt">bool</span> <span class="n">trackOutstandingAllocations</span>
|
|
<span class="n">physx</span><span class="o">::</span><span class="n">PxPvd</span><span class="o">*</span> <span class="n">pvd</span><span class="p">)</span>
|
|
<span class="p">{</span>
|
|
<span class="n">physx</span><span class="o">::</span><span class="n">PxPhysics</span><span class="o">*</span> <span class="n">physics</span> <span class="o">=</span> <span class="n">PxCreateBasePhysics</span><span class="p">(</span><span class="n">version</span><span class="p">,</span> <span class="n">foundation</span><span class="p">,</span> <span class="n">scale</span><span class="p">,</span>
|
|
<span class="n">trackOutstandingAllocations</span><span class="p">,</span> <span class="n">pvd</span><span class="p">);</span>
|
|
|
|
<span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">physics</span><span class="p">)</span>
|
|
<span class="k">return</span> <span class="nb">NULL</span><span class="p">;</span>
|
|
|
|
<span class="n">PxRegisterArticulations</span><span class="p">(</span><span class="o">*</span><span class="n">physics</span><span class="p">);</span>
|
|
<span class="n">PxRegisterHeightFields</span><span class="p">(</span><span class="o">*</span><span class="n">physics</span><span class="p">);</span>
|
|
|
|
<span class="k">return</span> <span class="n">physics</span><span class="p">;</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Note that this will only save memory when linking PhysX as a static library, as we rely on the linker to strip out the unused code.</p>
|
|
</div>
|
|
<div class="section" id="delay-loading-dlls">
|
|
<h2>Delay-Loading DLLs<a class="headerlink" href="#delay-loading-dlls" title="Permalink to this headline">¶</a></h2>
|
|
<p>The PhysXCommon DLL and PhysXFoundation DLL are marked as delay-loaded inside of the PhysX, PhysXCooking and PhysXCommon projects. So it is possible to have delay-loaded PhysXFoundation, PhysXCommon, PhysX and PhysXCooking DLLs.</p>
|
|
<div class="section" id="physxcommon-dll-and-physxfoundation-dll-load">
|
|
<h3>PhysXCommon DLL and PhysXFoundation DLL load<a class="headerlink" href="#physxcommon-dll-and-physxfoundation-dll-load" title="Permalink to this headline">¶</a></h3>
|
|
<blockquote>
|
|
<div><ul class="simple">
|
|
<li>If delay load hook is specified the PhysXCommon name or PhysXFoundation name provided by user is used</li>
|
|
<li>If delay load hook is not specified, the corresponding PhysXCommon DLL or PhysXFoundation DLL is used</li>
|
|
</ul>
|
|
</div></blockquote>
|
|
</div>
|
|
<div class="section" id="pxdelayloadhook">
|
|
<h3>PxDelayLoadHook<a class="headerlink" href="#pxdelayloadhook" title="Permalink to this headline">¶</a></h3>
|
|
<p>The PxDelayLoadHook class supports loading of the PhysXCommon, PhysXFoundation DLLs with different names and paths. This can be achieved by providing different DLL paths to the PhysX SDK through a custom subclass of PxDelayLoadHook, see the following example:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="k">class</span> <span class="nc">SnippetDelayLoadHook</span><span class="o">:</span> <span class="k">public</span> <span class="n">PxDelayLoadHook</span>
|
|
<span class="p">{</span>
|
|
<span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXCommonDllName</span><span class="p">()</span> <span class="k">const</span>
|
|
<span class="p">{</span> <span class="k">return</span> <span class="s">"customPath</span><span class="se">\\</span><span class="s">PhysXCommon_x64_Renamed.dll"</span><span class="p">;</span> <span class="p">}</span>
|
|
|
|
<span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXFoundationDllName</span><span class="p">()</span> <span class="k">const</span>
|
|
<span class="p">{</span> <span class="k">return</span> <span class="s">"customPath</span><span class="se">\\</span><span class="s">PhysXFoundation_x64_Renamed.dll"</span><span class="p">;</span> <span class="p">}</span>
|
|
<span class="p">}</span> <span class="n">gDelayLoadHook</span><span class="p">;</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Now the hook must be set for PhysX, PhysXCooking, PhysXCommon:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxSetPhysXDelayLoadHook</span><span class="p">(</span><span class="o">&</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
|
|
<span class="n">PxSetPhysXCookingDelayLoadHook</span><span class="p">(</span><span class="o">&</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
|
|
<span class="n">PxSetPhysXCommonDelayLoadHook</span><span class="p">(</span><span class="o">&</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>For more information please see the SnippetDelayLoadHook.</p>
|
|
</div>
|
|
<div class="section" id="pxgpuloadhook">
|
|
<h3>PxGpuLoadHook<a class="headerlink" href="#pxgpuloadhook" title="Permalink to this headline">¶</a></h3>
|
|
<p>The PxGpuLoadHook class supports loading of the PhysXGpu DLL with a different name or path. This can be achieved by providing a different DLL path to the PhysX SDK through a custom subclass of PxGpuLoadHook, see the following example:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="k">class</span> <span class="nc">SnippetGpuLoadHook</span><span class="o">:</span> <span class="k">public</span> <span class="n">PxGpuLoadHook</span>
|
|
<span class="p">{</span>
|
|
<span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXGpuDllName</span><span class="p">()</span> <span class="k">const</span>
|
|
<span class="p">{</span> <span class="k">return</span> <span class="s">"customPath</span><span class="se">\\</span><span class="s">PhysXGpu_x64_Renamed.dll"</span><span class="p">;</span> <span class="p">}</span>
|
|
<span class="p">}</span> <span class="n">gGpuLoadHook</span><span class="p">;</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Now the hook must be set for PhysX:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxSetPhysXGpuLoadHook</span><span class="p">(</span><span class="o">&</span><span class="n">gGpuLoadHook</span><span class="p">);</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>For more information please see the SnippetDelayLoadHook.</p>
|
|
</div>
|
|
<div class="section" id="physxcommon-secure-load">
|
|
<h3>PhysXCommon Secure Load<a class="headerlink" href="#physxcommon-secure-load" title="Permalink to this headline">¶</a></h3>
|
|
<p>All PhysX DLLs distributed by NVIDIA are signed. The PhysXCommon DLL signature is checked, when it is loaded by PhysX or PhysXCooking. If signature test fails the application is terminated.</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="shutting-down">
|
|
<h2>Shutting Down<a class="headerlink" href="#shutting-down" title="Permalink to this headline">¶</a></h2>
|
|
<p>To dispose of any PhysX object, call its release() method. This will destroy the object, and all contained objects. The precise behavior depends on the object type being released, so refer to the reference guide for details. To shut down the extensions library, call the function <em>PxCloseExtensions()</em>. To shut down physics, call release() on the PxPhysics object, and this will clean up all of the physics objects:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="n">mPhysics</span><span class="o">-></span><span class="n">release</span><span class="p">();</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Do not forget to release the foundation object as well, but only after all other PhysX modules have been released:</p>
|
|
<div class="highlight-c++"><div class="highlight"><pre><span class="n">mFoundation</span><span class="o">-></span><span class="n">release</span><span class="p">();</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<footer>
|
|
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
|
|
|
<a href="Threading.html" class="btn btn-neutral float-right" title="Threading" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
|
|
|
|
|
<a href="API.html" class="btn btn-neutral" title="The PhysX API" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>
|
|
© Copyright 2008-2021 NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, CA 95051 U.S.A. All rights reserved
|
|
|
|
</p>
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT:'../',
|
|
VERSION:'4.1',
|
|
LANGUAGE:'',
|
|
COLLAPSE_INDEX:false,
|
|
FILE_SUFFIX:'.html',
|
|
HAS_SOURCE: true,
|
|
SOURCELINK_SUFFIX: ''
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
|
<script type="text/javascript" src="../_static/underscore.js"></script>
|
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function () {
|
|
SphinxRtdTheme.Navigation.enable(false);
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |