简单配置HAVOK环境

<blockquote> <p>如此著名的Havok物理模拟引擎,就不说了。简单配置一下Havok,尝尝鲜。</p> <p>1.下载Havok:Havok_Physics_Animation_2012-1-0_PC_XS_win32_VS2010_keycode_perpetual_20120831.zip</p> <p>解压到某个目录下/hk2012_1_0_r1。</p> <p>2.在计算机属性-&gt;高级系统设置-&gt;环境变量-&gt;系统变量中新建变量</p> <p>名字比如HAVOK_SDK,值是刚才的解压路径xxxx/hk_2012_1_0_r1</p> <p>3.VS2010新建空工程,添加main.cpp文件。</p> <p>只使用了一下Havok的hkVector,如果想深入学习可看它的doc和demo</p> <p>4.将$(HAVOK_SDK)\Source和$(HAVOK_SDK)\Lib\win32_vs2010\debug_multithreaded加入工程的VC++目录中的</p> <p>包含目录和库目录中,将hkBase.lib加入链接器-&gt;输入-&gt;附件依赖项中。</p> <p>5.main文件中键入内如如下:</p> <p>#include &lt;Windows.h&gt; <br />#include &lt;iostream&gt; <br />#include &quot;Common/Base/hkBase.h&quot; <br />//#include &quot;Common/Base/Math/hkMath.h&quot;</p> <p>using namespace std;</p> <p>int main(int argc, int argv) <br />{ <br />&#160;&#160;&#160; hkVector4 pos(10, 10, 10); <br />&#160;&#160;&#160; hkVector4 tr(20, 0, -14);</p> <p>&#160;&#160;&#160; pos.add(tr);</p> <p>&#160;&#160;&#160; cout &lt;&lt; pos(0) &lt;&lt; &quot;, &quot; &lt;&lt; pos(1) &lt;&lt; &quot;, &quot; &lt;&lt; pos(2) &lt;&lt; &quot;, &quot; &lt;&lt; pos(3) &lt;&lt; endl;</p> <p>&#160;&#160;&#160; system(&quot;pause&quot;); <br />&#160;&#160;&#160; return 0; <br />}</p> <p>// Keycode <br />#include &lt;Common/Base/keycode.cxx&gt;</p> <p>// Productfeatures <br />// we're not using anything product specific yet. We undef these so we don't get the usual <br />// product initialization for the products. <br />//#undef HK_FEATURE_PRODUCT_AI <br />//#undef HK_FEATURE_PRODUCT_ANIMATION <br />//#undef HK_FEATURE_PRODUCT_CLOTH <br />//#undef HK_FEATURE_PRODUCT_DESTRUCTION <br />//#undef HK_FEATURE_PRODUCT_BEHAVIOR <br />#undef HK_FEATURE_PRODUCT_PHYSICS <br />//#undef HK_FEATURE_PRODUCT_NEW_PHYSICS</p> <p>// Also we're not using any serialization/versioning so we don't need any of these. <br />#define HK_EXCLUDE_FEATURE_SerializeDeprecatedPre700 <br />#define HK_EXCLUDE_FEATURE_RegisterVersionPatches <br />#define HK_EXCLUDE_FEATURE_RegisterReflectedClasses <br />#define HK_EXCLUDE_FEATURE_MemoryTracker</p> <p>// This include generates an initialization function based on the products <br />// and the excluded features. <br />#include &lt;Common/Base/Config/hkProductFeatures.cxx&gt;</p> <p>/* <br />* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20120831) <br />* <br />* Confidential Information of Havok.&#160; (C) Copyright 1999-2012 <br />* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok <br />* Logo, and the Havok buzzsaw logo are trademarks of Havok.&#160; Title, ownership <br />* rights, and intellectual property rights in the Havok software remain in <br />* Havok and/or its suppliers. <br />* <br />* Use of this software for evaluation purposes is subject to and indicates <br />* acceptance of the End User licence Agreement for this product. A copy of <br />* the license is included with this software and is also available at www.havok.com/tryhavok. <br />* <br />*/</p> </blockquote> <blockquote> <p>其中hkMath.h已经包含在hkBase.h中,所以注释掉。main函数后面是从它的demo中拷贝过来的,不然编译不过。</p> <p>上面#undef HK_FEATURE_PRODUCT_PHYSICS该宏不可注释,否则会链接失败,主要是hkProductFeatures.cxx中若是启用该宏</p> <p>则调用了其他的注册代码。</p> <p>而后面的四个宏用于排除一下不用的特征,最后一个文件用于Havok环境的配置。</p> <p>在网上搜了下,没什么太多学习Havok的中文资料。不过它的自带文档还可以。</p></blockquote>

转载于:https://my.oschina.net/u/146803/blog/125989

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值