⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 构建高级粒子系统.htm

📁 3D图象编程中粒子系统相关的一些资料。包括通用粒子系统的原理
💻 HTM
📖 第 1 页 / 共 3 页
字号:
                  particle systems and removes all systems which died after the 
                  update.</TD></TR>
              <TR bgColor=#ffffff>
                <TD class=ColorCode vAlign=top width="18%">Render</TD>
                <TD class=EtoC colSpan=2 vAlign=top>Renders all active and 
                  visible systems.</TD></TR>
              <TR bgColor=#ffffff>
                <TD class=ColorCode vAlign=top width="18%">Shutdown</TD>
                <TD class=EtoC colSpan=2 vAlign=top>Shuts down the manager 
                  (removes all allocated systems).</TD></TR>
              <TR bgColor=#ffffff>
                <TD class=ColorCode vAlign=top width="18%">DoesExist</TD>
                <TD class=EtoC colSpan=2 vAlign=top>Checks whether a given 
                  particle system still exists in the particle manager (if it 
                  has not been removed yet).</TD></TR>
              <TR bgColor=#ffffff>
                <TD class=BGRed colSpan=3 vAlign=top>
                  <DIV align=center><B><FONT color=#cccccc>表3 
                  粒子管理器类的成员函数</FONT></B></DIV></TD></TR></TBODY></TABLE><BR>  AddSystem函数可能只有一个参数:指向粒子类的指针。这将允许你根据需要轻易地增加一个烟系统或火系统。下面是我如何在引擎中增加一个粒子系统的例子:<BR><BR>  <SPAN 
            class=ColorCode>gParticleMgr-&gt;AddSystem( new 
            Smoke(nrSmokeParticles, position, ...) 
            );</SPAN><BR><BR>  在世界更新函数中我调用了gParticleMgr-&gt;Update()函数,这个函数自动更新所有的系统并释放死亡的系统。Render函数然后渲染所有的可见粒子系统。因为我们不想在每一帧跟踪系统中的所有粒子以判断是否所有的粒子均已死亡(这样系统可被删除),我们将使用Update函数来代替。如果这个函数返回TRUE,这意味着系统处于存活状态。反之系统已死亡并可以被删除。粒子管理程序的Update函数如清单2所示。<BR><BR>  <SPAN 
            class=ColorCatchword>// 清单2 - Update function of the particle 
            manager.</SPAN><BR>  <SPAN class=ColorCode>for (int i=0; 
            i&lt;particleSystems.Length())</SPAN>  <SPAN class=ColorCatchword>// 
            traverse all particle systems<BR></SPAN>  <SPAN 
            class=ColorCode>{<BR>    if 
            (!particleSystems[i]-&gt;Update())</SPAN>    <SPAN 
            class=ColorCatchword>// if the system died, remove 
            it<BR></SPAN>    <SPAN class=ColorCode>{<BR>      delete 
            particleSystems[i];</SPAN>      <SPAN class=ColorCatchword>// 
            release it from memory<BR></SPAN>      <SPAN 
            class=ColorCode>particleSystems.SwapRemove(i);</SPAN>    <SPAN 
            class=ColorCatchword>// remove number i, and fill the 
            gap<BR>                         // with the last entry in the 
            array<BR></SPAN>    <SPAN 
            class=ColorCode>}<BR>    else<BR>      i++;<BR>  }</SPAN><BR><BR>  在我的粒子系统中,其中分配的所有具有相同底纹和混合方式的粒子将连续地渲染,同时将底纹转换和上载减到最小。这样,如果在屏幕上有十个可见的烟系统,就只有一个底纹转换和状态改变将被执行。<BR><A 
            name=5.0></A><BR><B>5、设计,然后再编码</B><BR>  设计一个灵活的,快速的和可扩展的高级粒子系统并不很困难,如果你花时间来考虑你将如何在游戏中使用它,并且由此细致设计你的系统。由于在此讨论的系统使用带有继承的类,你也可以在.DLL文件中加入独立的粒子系统形式。这就使建立某种插件(<SPAN 
            class=English>Plug-In</SPAN>)系统成为可能,而这可能是某些开发者所感兴趣的。<BR>  你也可以下载我的粒子系统(我为Oxygen3D开发的最新的引擎)的源程序。这些源码不是独立的可编辑系统,但如果你遇到问题,它应该能帮助你。如果你还有任何问题或意见,请直接给我发电子邮件。<BR><BR>  <IMG 
            height=16 src="download.gif" width=16> <A 
            class=BlackLink 
            href="http://mays.soage.com/develop/effect/200111/image/AParSystem/AdvancedParticles.zip">附带的源程序</A>(12K)、<A 
            class=BlackLink 
            href="http://www.mysticgd.com/misc/AdvancedParticleSystems.pdf">英文版的原稿</A>(PDF 
            1.0MB)<BR><BR>
            <HR align=center noShade SIZE=1 width="95%">
            <BR>  <B>原作者及其它</B><BR>  <SPAN class=English>John van der Burg is 
            the lead programmer for Mystic Game Development, located in the 
            Netherlands. Currently he is working on Oxygen3D, which is his third 
            hardware-only engine and his eighth engine overall. Currently he is 
            doing freelance work on LOOSE CANNON for Digital Anvil and for OMG 
            Games on THE CREST OF DHARIM. He previously freelanced for Lionhead 
            Studios on BLACK AND WHITE, and for Orange Games on CORE. You can 
            find screenshots of his previous work at <A class=cLink 
            href="http://www.mysticgd.com/" 
            target=_blank>http://www.mysticgd.com/</A>.Feel free to drop him a 
            line at<A class=cLink 
            href="mailto:john@mysticgd.com.">mailto:john@mysticgd.com.</A>.</SPAN><BR><BR>
            <TABLE align=center border=0 cellPadding=2 cellSpacing=0 
class=BGRed>
              <TBODY>
              <TR>
                <TD align=middle><IMG height=250 
                  src="APSother-4.jpg" width=250></TD>
                <TD><FONT color=#cccccc face="Times New Roman, Times, serif">A 
                  blood system. Blood colors were set based on the colors in the 
                  light maps. Blood on dark areas looks dark as well. The red 
                  areas in the bottom screenshot are the blood splats on the 
                  camera lens, dripping down the lens. 
            </FONT></TD></TR></TBODY></TABLE><BR>
            <TABLE align=center border=0 cellPadding=2 cellSpacing=0 
class=BGRed>
              <TBODY>
              <TR>
                <TD align=middle><IMG height=250 
                  src="APSother-5.jpg" width=250></TD>
                <TD><FONT color=#cccccc 
                  face="Times New Roman, Times, serif">This was constructed from 
                  sparks and a big real-time calculated flare explosion (not 
                  just a texture). </FONT></TD></TR></TBODY></TABLE><BR>
            <TABLE align=center border=0 cellPadding=2 cellSpacing=0 
class=BGRed>
              <TBODY>
              <TR>
                <TD align=middle><IMG height=250 
                  src="APSother-6.jpg" width=250></TD>
                <TD><FONT color=#cccccc 
                  face="Times New Roman, Times, serif">This image is the same as 
                  the above one, but with some extra animated explo- sions 
                  (animated textures) and shockwaves, which are admittedly very 
                  small and may be difficult to see in this 
              image.</FONT></TD></TR></TBODY></TABLE><BR>
            <TABLE align=center border=0 cellPadding=2 cellSpacing=0 
class=BGRed>
              <TBODY>
              <TR>
                <TD align=middle><IMG height=250 
                  src="APSother-7.jpg" width=250></TD>
                <TD><FONT color=#cccccc 
                  face="Times New Roman, Times, serif">This electricity has its 
                  own render function. A hierarchy tree was constructed to 
                  represent the electricity flow using branches and 
                  sub-branches. It is a thunder- storm lightning effect with the 
                  branches animated. Particle shapes are being con- structed for 
                  every part in the electricity 
            tree.</FONT></TD></TR></TBODY></TABLE><BR>
            <TABLE align=center border=0 cellPadding=2 cellSpacing=0 
class=BGRed>
              <TBODY>
              <TR>
                <TD align=middle><IMG height=250 
                  src="APSother-8.jpg" width=250></TD>
                <TD><FONT color=#cccccc face="Times New Roman, Times, serif">A 
                  rain effect, using stretched shapes for the particles. The 
                  rain also splats on the ground by calling the sparks system 
                  with adjusted settings and texture.</FONT></TD></TR></TBODY></TABLE><!-- #EndEditable --></TD></TR>
        <TR>
          <TD class=BGGray width="100%">
            <DIV align=right><!-- #BeginEditable "%B2%D9%D7%F7%CC%A8" --><A 
            class=BlackLink 
            href="http://mays.soage.com/develop/effect/200111/AParSystem.htm#7758258"><B>返回</B></A><!-- #EndEditable --> 
            </DIV></TD></TR>
        <TR>
          <TD class=BGGray width="100%">
</TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD width=0%></TD>
    <TD class=BGGray colSpan=2 height=3 vAlign=top></TD>
    <TD colSpan=2></TD>
    <TD colSpan=3 vAlign=top width="84%"></TD></TR></TBODY></TABLE><BR></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -