Nvidia PhysX 学习文档2: Snippets

                                                      夸耀贫穷比夸富裕更卑鄙——斋藤绿雨


Official document: https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/Manual/HelloWorld.html#snippets

红色代表需要吸收的知识。


Snippets

What are PhysX Snippets?

In the context of the PhysX SDK, a 'Snippet' is a simple, minimalistic code sample. PhysX-SDK version 3.3.0 offers a collection of Snippets to illustrate usage of the PhysX API in a concise format, free from the complexity of a sample framework or game engine. The Snippets folder is in the top-level directory of the PhysX SDK, alongside directories for Documentation, Include, Samples, etc.

The folder {SDK Root}/Snippets/compiler/{platform} contains the Snippets solution file, e.g.

Snippets/compiler/vc14win64/Snippets.sln

snippet即一个简单的例子程序,用于说明API的使用方法。这些例子不涉及复杂的框架,从而方便用户学习api的使用。Snippet目录位于Physx sdk的顶层,其同级别目录有 Documentation, Include, Samples等。

目录 {SDK Root}/Snippets/compiler/{platform} contains the Snippets solution file, e.g. Snippets/compiler/vc14win64/Snippets.sln

(这些solution文件应该是编译之后才出现的吧)

 

Although a few of the Snippets support rendering, ( Win32, Win64, OSX and Linux only ) most Snippets do not provide rendering, require no input, and provide only limited output through messages. Although Snippets can be run from a command prompt or by double-clicking the executable icon, the best way to explore Snippets is by viewing the code in the Visual Studio IDE, and running the program in the debugger.

只有几个snippet提供了渲染场景,大部分的snippet没有提供渲染,而且不需要输入,仅仅通过message提供一些输出。 用户可以通过command prompt或者双击可执行文件来运行snippet,但是,最好的方式是,通过VS.

 

HelloWorld: PhysX Basics

SnippetHelloWorld illustrates basic use of PhysX, from startup to shutdown of a simple scene, and is a good place to start learning the PhysX API. The simplest Snippets comprise a single source file, but SnippetHelloWorld, among others, supports optional rendering through a second source file. SnippetHelloWorld creates a number of box stacks on a plane, and if rendering is enabled, allows the user to create new stacks and fire a ball from the camera position.

The primary code for SnippetHelloWorld is found in {SDK Root}/Snippets/SnippetHelloWorld/SnippetHelloWorld.cpp.

SnippetHelloWorld 展示了PhysX的基本使用方法,包括,开启和关闭一个简单的scene。 The simplest Snippets comprise a single source file, but SnippetHelloWorld, among others, supports optional rendering through a second source file.

该例子在一个平面上创建很多box,如果,使能了rendering功能,用户可以创建新的box并且从相机的位置发射一个球。

主要代码: {SDK Root}/Snippets/SnippetHelloWorld/SnippetHelloWorld.cpp.

 

Using PhysX Visual Debugger with SnippetHelloWorld

As is the case with any Snippet built against PROFILE, CHECKED or DEBUG configurations of the PhysX runtime, HelloWorld will automatically connect to the PhysX Visual Debugger if that application is already running when the Snippet executable is launched.  For Snippets without rendering, PVD provides an easy way to visualize the contents of the PhysX scene presented in the Snippet. In the screenshot image below, PhysX Visual Debugger appears on the right hand side, while Visual Studio and Snippet Hello World are on the left.

As is the case with any Snippet built against PROFILE, CHECKED or DEBUG configurations of the PhysX runtime, HelloWorld例子启动时,会自动连接到PVD,如果PVD已经启动的话。

下图,左边时VS,右边时PVD:

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

First Snowflakes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值