??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕人妻色偷偷久久,国内精品伊人久久久久网站,久久精品国产精品亚洲精品http://www.shnenglu.com/billhsu/category/7690.htmlzh-cnThu, 23 Jun 2011 13:22:17 GMTThu, 23 Jun 2011 13:22:17 GMT60Android游戏计时http://www.shnenglu.com/billhsu/archive/2011/01/30/139627.htmlBill HsuBill HsuSun, 30 Jan 2011 15:16:00 GMThttp://www.shnenglu.com/billhsu/archive/2011/01/30/139627.htmlhttp://www.shnenglu.com/billhsu/comments/139627.htmlhttp://www.shnenglu.com/billhsu/archive/2011/01/30/139627.html#Feedback0http://www.shnenglu.com/billhsu/comments/commentRss/139627.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/139627.htmlhttp://androgeek.info/?p=299

以前代码l验很多都是Zwindows的,所以对android下面的计时函C是太了解?br>
在写Friut3DӞ我用的代码是用gettimeofday()来计时的。但是效果不好,游戏里有个场景跑h十分卡,acepig兄和我都觉得q个问题很诡异。开始觉得这是模型的问题Q现在看来是计时函数不精惹得祸?br>
看看当时写的获取pȝ旉的代码:

static long getTime(void)

{
gettimeofday(
&now, NULL);
return (long)(now.tv_sec*1000 + now.tv_usec/1000);
}


今天在一个google讨论l里得知gettimeofday()记得的tick是不准确的。而这个游戏逻辑依赖于time delta来计各个物体运动,计时不精,渲染自然会卡ѝ?br>
于是用纳U的准度的clock_gettime()重写了getTime()函数Q?br>
static long _getTime(void)

{
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, 
&now);
return now.tv_sec*1000000 + now.tv_nsec/1000;

}


改了计时函数后,游戏各个场景都流畅了?br>

Bill Hsu 2011-01-30 23:16 发表评论
]]>
骨骼动画中的反向动力?/title><link>http://www.shnenglu.com/billhsu/archive/2010/08/26/124852.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Thu, 26 Aug 2010 09:29:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2010/08/26/124852.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/124852.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2010/08/26/124852.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/124852.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/124852.html</trackback:ping><description><![CDATA[<span id="tv97pnx" class="Apple-style-span" style="border-collapse: separate; color: #000000; font-family: Simsun; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;">IK在骨骼动画里常常能看刎ͼ作用是Ҏ子骨骼的方位推算出它的那些父骨骼方位。可是一直都是知道有那么回事Q但是又不太知道具体是怎么实现的?br />在multi-crash.com上看C?a target="_blank" ><span style="font-style: italic;">骨骼动画反向动力?IK)的实?nbsp; </span></a>Q内容写的很易懂?br />q是ZCCD(</span>Cyclic Coordinate Descent<span id="jz7h7d9" class="Apple-style-span" style="border-collapse: separate; color: #000000; font-family: Simsun; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;">)法的。还有种雅可比矩늚法Q不q这U算法我q不太清楚,希望高手指教啊?br />下面讲讲CCDQ先看这张图?br /><img style="width: 540px; height: 214px;" src="http://www.shnenglu.com/images/cppblog_com/billhsu/ccd.gif" border="0" alt="" /><br />注意图中的红U和l线Q红U是当前骨骼与目标骨骼的q线Q绿U是目标骨骼与最l位|的q线?br />从子骨骼到父骨骼的顺序P代计,旋{U线到绿Uѝ这样多q代几次׃得到较好的结果?br /><br />要注意的是需要对骨骼的旋转范围加以限Ӟ因ؓZ的关节不是以可以L方式旋{的?br /><img src="http://www.shnenglu.com/images/cppblog_com/billhsu/ccd3.JPG" border="0" alt="" /><br />[例如图中蓝色部分为可以旋转的范围]<br /><br /><span style="font-style: italic;"></span></span><img src ="http://www.shnenglu.com/billhsu/aggbug/124852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2010-08-26 17:29 <a href="http://www.shnenglu.com/billhsu/archive/2010/08/26/124852.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android NDK 开发OpenGL ES 2.0一些注意点http://www.shnenglu.com/billhsu/archive/2010/08/10/122914.htmlBill HsuBill HsuTue, 10 Aug 2010 03:37:00 GMThttp://www.shnenglu.com/billhsu/archive/2010/08/10/122914.htmlhttp://www.shnenglu.com/billhsu/comments/122914.htmlhttp://www.shnenglu.com/billhsu/archive/2010/08/10/122914.html#Feedback1http://www.shnenglu.com/billhsu/comments/commentRss/122914.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/122914.html自己也试了试用NDK~一个OpenGL ES 2.0的程序,可是Q编译的时候出C一大堆错?br>
如图Q满屏幕都是 undefined reference to 那些OpenGL ES函数?br>看来是库文g没有链接q来?br>
q是NDK例子里的Android.mk的写法:
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    :
= libgl2jni
LOCAL_CFLAGS    :
= -Werror
LOCAL_SRC_FILES :
= gl_code.cpp
LOCAL_LDLIBS    :
= -llog -lGLESv2

include $(BUILD_SHARED_LIBRARY)

问题出在用U色标出的那行?br>
把那句修改ؓQ?br>
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_LDLIBS
+=-L$(SYSROOT)/usr/lib -lGLESv2

可以正常编译了?br>
q有一些注意点是:
~译E序前要cleanQ否则编译会出错Q?br>每次更新了自q.so文g后,在eclipse的那个java目里要记着refresh一下?br>


Bill Hsu 2010-08-10 11:37 发表评论
]]>
靠得住的休眠函数XSleephttp://www.shnenglu.com/billhsu/archive/2010/07/30/121679.htmlBill HsuBill HsuFri, 30 Jul 2010 02:55:00 GMThttp://www.shnenglu.com/billhsu/archive/2010/07/30/121679.htmlhttp://www.shnenglu.com/billhsu/comments/121679.htmlhttp://www.shnenglu.com/billhsu/archive/2010/07/30/121679.html#Feedback0http://www.shnenglu.com/billhsu/comments/commentRss/121679.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/121679.html今天在csdn上看C一文章:http://blog.csdn.net/lanzhengpeng2/archive/2008/05/06/2401554.aspx
讲的也正好是q个问题Q记录一下?br>
在用timeGetTime()的代码块的前后加?span class="Apple-style-span" style="border-collapse: separate; color: #000000; font-family: Simsun; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;">timeBeginPeriod(1)?/span>timeEndPeriod(1)Q就可以提高timeGetTime()的精度?br>
同时Q可以利用timeSetEvent写了一个靠得住的休眠函数[代码来自上述文章]Q?br>
static void XSleep(DWORD dwDelay,HANDLE hEvent)
 {
  MMRESULT hTimer 
= timeSetEvent(dwDelay,1,(LPTIMECALLBACK)hEvent,0,TIME_ONESHOT | TIME_CALLBACK_EVENT_SET);
  MsgWaitForMultipleObjectsEx(
1,&hEvent,INFINITE,QS_ALLINPUT,0); //当有Windows消息Ӟq能l箋处理Windows消息。故选择了这个函数?/span>
  timeKillEvent(hTimer);
 }

消息循环[代码来自上述文章]Q?br>
 MSG msg;
 DWORD dwLastTime;
 HANDLE hSleepEvent 
= CreateEvent(NULL,FALSE,FALSE,NULL);

 timeBeginPeriod(
1);

 dwLastTime 
= timeGetTime();
 
while(isActive())
 {
  
//需要一直处理Windows消息到无消息处理为止
  for(;PeekMessage(&msg,NULL,0,0,PM_REMOVE);)
  {
   
if(msg.message == WM_QUIT)
   {
    CloseHandle(hSleepEvent);
    timeEndPeriod(
1);
    
return ;
   }
   
if(!TranslateAccelerator(msg.hwnd,hAccelTable,&msg))
   {
    TranslateMessage(
&msg);
    DispatchMessage(
&msg);
   }
  }

  DWORD FrameDelay 
= max(1,1000/max(1,GetMaxFPS()));
  DWORD dwTime 
= timeGetTime();
  
if(dwLastTime + FrameDelay > dwTime)
  {
   XSleep(dwLastTime 
+ FrameDelay - dwTime,hSleepEvent);
  }
  
else
  {
   update();
   dwLastTime 
+= ((dwTime - dwLastTime) / FrameDelay) * FrameDelay; //当实际C重低于预期数时Q这D代码可以完成蟩帧功能;当实际数大于等于预期数时Q这D代码仍然可以帧之间的旉间隔固定。之前谢Boss没有处理好的主要是q个?/span>
  }
 }

 CloseHandle(hSleepEvent);
 timeEndPeriod(
1);
q样Q时间误差就会在1ms之内了,游戏也就不会抖动了?br>

Bill Hsu 2010-07-30 10:55 发表评论
]]>
Zshader的骨D皮计?/title><link>http://www.shnenglu.com/billhsu/archive/2010/04/01/111326.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Thu, 01 Apr 2010 14:10:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2010/04/01/111326.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/111326.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2010/04/01/111326.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/111326.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/111326.html</trackback:ping><description><![CDATA[     摘要: 我的古董昑֍很操蛋,好端端的shaderQ传骨骼矩阵q去Q硬是没反应。?<br>d觅觅Q找C NVIDIA SDK 的exampleQ终于解决了?<br>N我的昑֍不支持BLENDINDICES和BLENDWEIGHT? <br>把BLENDINDICES和BLENDWEIGHT用TEXCOORD[n]表示才正常。?<br>不说废话Q直接上代码?nbsp; <a href='http://www.shnenglu.com/billhsu/archive/2010/04/01/111326.html'>阅读全文</a><img src ="http://www.shnenglu.com/billhsu/aggbug/111326.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2010-04-01 22:10 <a href="http://www.shnenglu.com/billhsu/archive/2010/04/01/111326.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GPU水面模拟http://www.shnenglu.com/billhsu/archive/2010/03/23/110376.htmlBill HsuBill HsuTue, 23 Mar 2010 12:59:00 GMThttp://www.shnenglu.com/billhsu/archive/2010/03/23/110376.htmlhttp://www.shnenglu.com/billhsu/comments/110376.htmlhttp://www.shnenglu.com/billhsu/archive/2010/03/23/110376.html#Feedback0http://www.shnenglu.com/billhsu/comments/commentRss/110376.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/110376.html

效果比较单,只是模拟了下水面的反效果。折与FresnelpL没有考虑?br />
水面模拟大致需要分q么几步Q?br />1.剪裁掉水面以下的点[gpu里的clipplane要注意{换到Clip Space]Q?br />摄像机攑ֈ同原摄像机关于水面对U的位置Q比如原来摄像机?x,y,z)Q?br />此时p把摄像机攑֜(x,-y,z)Qup向量也要讄成向下的?br />再把场景渲染到Render Target的纹理上(我用的纹理大是256*256)Q不知道Z么Render Target的纹理大不能超q窗口大,过的话渲染会出错,知道的大大告诉我一下哈?br />
于是Q就得到了这样一个纹理:


2.上面得到的U理与水面的点对应.
把Vertex Shader中乘q变换矩阵后的坐标传到Pixel Shader,
在PS中计?br />
        float2 clipspace = input.Coord.xy / input.Coord.w;
        clipspace.x=((clipspace.x * 0.5f) + 0.5f);
        clipspace.y = ((clipspace.y * -0.5f) + 0.5f);
        clipspace.x=1-clipspace.x;
既可以让水面点与纹理对应,然后再想办法把纹理坐标扰乱来模拟水面波动?br />
3.再渲染一ơ场景就可以了?br />
大家也可以参考下Azure的水面渲染源代码Q?a temp_href=" http://www.azure.com.cn/article.asp?id=186" href="%20http://www.azure.com.cn/article.asp?id=186">
http://www.azure.com.cn/article.asp?id=186


Bill Hsu 2010-03-23 20:59 发表评论
]]>
可编E管道下的剪裁^?/title><link>http://www.shnenglu.com/billhsu/archive/2010/01/20/106088.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Wed, 20 Jan 2010 14:00:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2010/01/20/106088.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/106088.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2010/01/20/106088.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/106088.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/106088.html</trackback:ping><description><![CDATA[ <p class="MsoNormal"> <span>剪裁q面</span> <span>(Clip Plane)</span> <span>在图形学领域有着重要的作用,比如水面模拟中,渲染折射U理Ӟ我们必d水面以上的顶炚w过剪裁q面剪裁掉?/span> </p> <p class="MsoNormal"> <span>在过ȝ固定渲染道时代Q剪裁^面的实现较ؓ单,比如?/span> <span>DirectX 9</span> <span>中,可以先设定剪裁^面在世界坐标pM的方E?/span> <span>(ax+by+cz+d=0)</span> <span>Q再调用</span> <span>SetClipPlane(DWORD Index,CONST float * pPlane)</span> <span>q个</span> <span>API</span> <span>函数可以了?/span> </p> <p class="MsoNormal"> <span> </span> </p> <p class="MsoNormal"> <span>附上例子E序Q?/span> </p> <p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; -moz-background-inline-policy: continuous;" align="left"> <span style="font-size: 10pt; color: black;">vPosition=D3DXVECTOR3(0,0,0);</span> <span style="font-size: 10pt; color: green;">//</span> <span style="font-size: 10pt; color: green;">q面上一个点<span><br /></span></span> <span style="font-size: 10pt; color: black;">vNormal=D3DXVECTOR3(0,1,0);</span> <span style="font-size: 10pt; color: green;">//</span> <span style="font-size: 10pt; color: green;">法向?span><br /></span></span> <span style="font-size: 10pt; color: black;">D3DXPlaneFromPointNormal( &clipplane, &vPosition, &vNormal );</span> <span style="font-size: 10pt; color: green;">//</span> <span style="font-size: 10pt; color: green;">生成剪裁q面<span><br /></span></span> <span style="font-size: 10pt; color: black;"> <br /> m_pDevice()->SetClipPlane( 0, (</span> <span style="font-size: 10pt; color: blue;">float</span> <span style="font-size: 10pt; color: black;">*)clipplane); </span> </p> <p class="MsoNormal"> <span> </span> </p> <p class="MsoNormal"> <span>然而,在现在的可编E管?/span> <span>(programmable pipeline)</span> <span>下,讄的剪裁^面会被在剪裁坐标pM处理Q而不是在世界坐标pM?/span> </p> 解决q个问题的方法有Q?br /><br /> 1Q?l要剪裁的顶点做标记Q在Pixel Shader中把它剪裁掉?br /><br /> 2Q?使用q斜q面裁剪QOblique Near-Plane ClippingQ,即修Ҏq阵,要剪裁的顶Ҏ在视截体之外Q从而避免了该顶点的l制?br /><br /> 3Q?修改q面方程Q之从世界坐标p{换到剪裁坐标pR?span><br /><br /><br /> 上述Ҏ中,W一U和W二U效率ƈ不高Q在</span><span>Pixel Shader</span><span>中剪裁没有减Q何不必要的顶点处理,而计近斜^面裁剪矩阵较为繁琐。所以,Ҏ三是最佳选择?/span><p class="MsoNormal"><span> </span><span>要将一个^面从世界坐标p{换到剪裁坐标p,必须求出q个变换矩阵?/span></p><p class="MsoNormal"><span>讑^面方E?/span><span>ax+by+cz+d=0</span><span>Q用一?/span><span>4</span><span>l向量来</span><span>n</span><span>表示</span><span>(a,b,c,d)</span><span>Q设q面上有个点</span><span>p:(x,y,z,1)</span><span>。根据^面方E的定义Q有Q?/span></p><p class="MsoNormal"><span><br /></span></p><p class="MsoNormal"><strong>n</strong><sup>T</sup><strong>p</strong> = ax + by + cz + d = 0</p><p class="MsoNormal"></p><p class="MsoNormal"><span>讄?/span><span>R</span><span>可以让点</span><span>P</span><span>从世界坐标系转换到剪裁坐标系Q矩?/span><span>Q</span><span>可以让^?/span><span>n</span><span>实现同样的变换。那么,有:</span></p><p class="MsoNormal" style="text-align: center;" align="center"></p><div align="left"><strong>p</strong>'= <strong>R</strong><strong>p</strong></div><div align="left"><strong>n'</strong>= <strong>Q</strong><strong>n</strong></div><p class="MsoNormal"><span>其中</span><span>p'</span><span>?/span><span>n'</span><span>分别是{换后的点与^面?/span></p><br /><div align="left"><strong>n</strong><span>'</span><sup>T</sup><strong>p'</strong>= 0</div><div align="left">(<strong>Q</strong><strong>n</strong>)<sup>T</sup> (<strong>R</strong><strong>p</strong>) = 0 <br /><strong>n</strong><sup>T</sup><strong>Q</strong><sup>T</sup><strong>R</strong><strong>p</strong> = 0<br /><br /><br /><span>如果Q?/span><strong>Q</strong><sup>T</sup><strong>R</strong> = <strong>I</strong></div><br /><p class="MsoNormal"><span>那么Q?/span></p><p class="MsoNormal"><strong>n</strong><sup>T</sup><strong>Q</strong><sup>T</sup><strong>R</strong><strong>p</strong> = <strong>n</strong><sup>T</sup><strong>I</strong><strong>p</strong> = <strong>n</strong><sup>T</sup><strong>p</strong> = 0</p><p class="MsoNormal"><span>于是Q?/span></p><div align="left"><strong>Q</strong><sup>T</sup> = <strong>R</strong><sup>-1</sup><strong><br /> Q</strong> = (<strong>R</strong><sup>-1</sup>)<sup>T</sup></div><br /><p class="MsoNormal"><span>?/span><span>DirectX 3D</span><span>中,一个点从世界坐标系转换到剪裁坐标系Q所用的矩阵察矩阵与投媄矩阵的乘U,卻I</span></p><p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); -moz-background-inline-policy: continuous;"><span style="font-size: 10pt; color: black;">D3DXMATRIX  TranMatrix = matView*matProj;</span></p><p class="MsoNormal"><span style="font-size: 9pt;">(TranMatrix</span><span style="font-size: 9pt;">为所求的变换矩阵Q?span>matView</span>?span>matProj</span>分别?/span><span>观察矩阵与投q?/span><span>)</span></p><p class="MsoNormal"><span> </span></p><p class="MsoNormal"><span>附上?/span><span>D3D</span><span>中变换的完整代码Q?/span></p><p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; -moz-background-inline-policy: continuous;" align="left"><span style="font-size: 10pt; color: black;">D3DXPLANE tempPlane = clipplane;<br /> D3DXPlaneNormalize(&tempPlane, &tempPlane);<br /><br /> D3DXMATRIX  TranMatrix = matView*matProj;<br /> D3DXMatrixInverse(&TranMatrix, NULL, &TranMatrix);<br /> D3DXMatrixTranspose(&TranMatrix, &TranMatrix);<br /> D3DXPlaneTransform(&tempPlane, &tempPlane, &TranMatrix);</span></p><p class="MsoNormal" style="background: none repeat scroll 0% 0% rgb(238, 238, 238); text-align: left; -moz-background-inline-policy: continuous;" align="left"></p><p class="MsoNormal"></p><p class="MsoNormal"><span>参考资料:</span></p><p class="MsoNormal"><span>1.Back Face Culling Notes ,Jordan Smith (University of California, Berkeley)<br /></span></p><p class="MsoNormal"><span>http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/backfacecull.shtml</span> </p><p class="MsoNormal">2.GameDev Forum</p><p class="MsoNormal">http://www.gamedev.net/community/forums/topic.asp?topic_id=402381</p><p class="MsoNormal">3.Oblique Near-Plane Clipping with Orthographic Camera ,Aras</p><p class="MsoNormal">http://aras-p.info/texts/obliqueortho.html</p><img src ="http://www.shnenglu.com/billhsu/aggbug/106088.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2010-01-20 22:00 <a href="http://www.shnenglu.com/billhsu/archive/2010/01/20/106088.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>发日志纪念~~W一ơ写导出插ghttp://www.shnenglu.com/billhsu/archive/2009/11/25/101921.htmlBill HsuBill HsuWed, 25 Nov 2009 11:25:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/11/25/101921.htmlhttp://www.shnenglu.com/billhsu/comments/101921.htmlhttp://www.shnenglu.com/billhsu/archive/2009/11/25/101921.html#Feedback2http://www.shnenglu.com/billhsu/comments/commentRss/101921.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/101921.html

今天l于把模型导出插件最基本的功?-导出|格l写好了?/p>

c++和max sdk一L的感觉很怪,pȝ崩溃了Nơ,不过Qȝ能导出网g~

 

有图有真相,截图U念

(注意Q模型是从value的csol中弄出来?

在d3d中渲染导出的模型B

在d3d中渲染导出的模型B


我的模型导出插gB

导出数据hQ?/p>

[q是一个带贴图的立方体的导出数据]

 

8//  8个顶?br /> -6.70302 -21.2068 -5.46039
17.1883 -6.46757 0.162097
-22.4049 2.22378 -0.162097
1.48644 16.963 5.46039
-8.48039 -28.3257 20.7542
15.411 -13.5865 26.3767
-24.1823 -4.89514 26.0525
-0.290929 9.84411 31.675

12//  12个纹理坐?br /> 0 1 0
1 1 0
0 0 0
1 0 0
0 1 0
1 1 0
0 0 0
1 0 0
0 1 0
1 1 0
0 0 0
1 0 0

12//  12个面引烦
0 9 2 11 3 10
3 10 1 8 0 9
4 8 5 9 7 11
7 11 6 10 4 8
0 4 1 5 5 7
5 7 4 6 0 4
1 0 3 1 7 3
7 3 5 2 1 0
3 4 2 5 6 7
6 7 7 6 3 4
2 0 0 1 4 3
4 3 6 2 2 0



Bill Hsu 2009-11-25 19:25 发表评论
]]>
DirectX 3D 讑֤丢失(lost device)的处?/title><link>http://www.shnenglu.com/billhsu/archive/2009/10/17/98823.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Sat, 17 Oct 2009 05:10:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2009/10/17/98823.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/98823.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2009/10/17/98823.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/98823.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/98823.html</trackback:ping><description><![CDATA[ <font color="#000000"> 低手交流Q高手勿?br /><br />当初觉得DX中设备丢失很讨厌Q差点就投奔OpenGL了?br /> 不过现在发现其实也没那么ȝ啦,写点东西Q给不清?/font> <font color="#000000">讑֤丢失怎么处理的同学参考下?br /><br /></font>在创建时使用D3DPOOL_MANAGED标志的资源可以不需要重新蝲入,但D3DPOOL_DEFAULT加蝲的资源就需要先释放Q后重徏?br /><br />通常需要这样处理的有ID3DXFont和ID3DXSpriteQ?X模型什么的׃需要?br />在发现设备丢失时Q我们要调用 <span style="color: rgb(0, 0, 0);">OnLostDevice(</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">)</span>函数让D3DPOOL_DEFAULT加蝲的资源释放掉?br />好在ID3DXFont和ID3DXSprite有设备丢失处理函敎ͼ直接调用好?div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> OnLostDevice(</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">)<br />{<br /></span><span style="color: rgb(0, 0, 0);">    m_sprite</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnLostDevice();</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    m_font</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnLostDevice();<br />}<br /></span></div><br />可是Q怎么知道讑֤丢失了呢Q?br />如果讑֤丢失QPresent()函数׃“出问题”,q回值是D3DERR_DEVICELOST?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">EndScene();<br /><br />HRESULT hr;<br />hr </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Present(NULL, NULL, NULL, NULL);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(hr </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> D3DERR_DEVICELOST)<br />{<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">TestCooperativeLevel() </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> D3DERR_DEVICENOTRESET)<br />    {<br />        OnLostDevice();<br />        OnResetDevice();<br />    }<br />}</span></div><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">TestCooperativeLevel()</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> D3DERR_DEVICENOTRESETӞ可以恢复设备了?br />于是Q我们调?/span><span style="color: rgb(0, 0, 0);">OnLostDevice(</span><span style="color: rgb(0, 0, 0);">)</span>让D3DPOOL_DEFAULT加蝲的资源释放掉Q之后,调用<span style="color: rgb(0, 0, 0);">OnResetDevice()来恢复设备就可以了?br /><br />怎么恢复讑֤呢?<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> OnResetDevice(</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">)<br />{<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(FAILED(m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Reset(</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">d3dpp)))<br />    {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br />    }<br /><br />    m_sprite</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnResetDevice();<br />    m_font</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">OnResetDevice();<br /><br />    InitDevice();<br />}</span></div>先让D3D讑֤resetQ然后调?/span>ID3DXFont和ID3DXSprite的恢复函敎ͼ最后,需要把<span style="color: rgb(0, 0, 0);">D3D讑֤中的状态啊Q矩阵变换啊q些重新讄下就完成了,也就是调?/span><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">InitDevice()?br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> InitDevice()<br />{<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetRenderState( D3DRS_ZENABLE, TRUE );<br /><br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetRenderState( D3DRS_AMBIENT, </span><span style="color: rgb(0, 0, 0);">0xffffffff</span><span style="color: rgb(0, 0, 0);"> );<br /><br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetSamplerState(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetSamplerState(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetSamplerState(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">, D3DSAMP_MIPFILTER, D3DTEXF_POINT);<br /><br />D3DXMatrixPerspectiveFovLH( </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matProj, D3DX_PI</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">1000.0f</span><span style="color: rgb(0, 0, 0);"> );<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetTransform( D3DTS_PROJECTION, </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matProj );<br /><br />vEyeVec</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">D3DXVECTOR3(</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">);<br />vLookatVec</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">D3DXVECTOR3(</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">);<br />vUpVec</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">D3DXVECTOR3(</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">1.0f</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0.0f</span><span style="color: rgb(0, 0, 0);">);<br />D3DXMatrixLookAtLH( </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matView, </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">vEyeVec, </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">vLookatVec, </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">vUpVec );<br />m_pIDirect3DDevice</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">SetTransform( D3DTS_VIEW, </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);">matView );<br /><br />}</span></div><br /></span></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br /></span><font color="#000000">啊,q样讑֤丢失处理好?br /><br />//<br /></font><font color="#ffffff">tag:DirectX 3D  d3d lost device TestCooperativeLevel OnLostDevice</font><font color="#ffffff"> 恢复讑֤ 讑֤丢失 DeviceLost</font><font color="#000000"><br /></font><br /><img src ="http://www.shnenglu.com/billhsu/aggbug/98823.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2009-10-17 13:10 <a href="http://www.shnenglu.com/billhsu/archive/2009/10/17/98823.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>游戏开发者年?009http://www.shnenglu.com/billhsu/archive/2009/10/11/98318.htmlBill HsuBill HsuSun, 11 Oct 2009 09:56:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/10/11/98318.htmlhttp://www.shnenglu.com/billhsu/comments/98318.htmlhttp://www.shnenglu.com/billhsu/archive/2009/10/11/98318.html#Feedback0http://www.shnenglu.com/billhsu/comments/commentRss/98318.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/98318.html

看到了不比较震撼的技术?br /> 感触最qq是Cry Engine3的展収ͼ
他们的次世代效果太强大了Q还有那个场景编辑器Q感觉无敌了=_=

独立游戏展上的一些游戏创意还是很好的Q可我玩不好===


鄙视下腾讯游戏,占了好大一个台Q就摆了2个显C器…?br />
拍的照片









Bill Hsu 2009-10-11 17:56 发表评论
]]>
3d~程的无敌组?/title><link>http://www.shnenglu.com/billhsu/archive/2009/08/03/91991.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Mon, 03 Aug 2009 00:35:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2009/08/03/91991.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/91991.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2009/08/03/91991.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/91991.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/91991.html</trackback:ping><description><![CDATA[发现有了Irrlicht+IrrNewt+IrrKlang Q?d~程无敌了。?br /><br /> 介一?br /><br /> 1.Irrlicht<br /><div forimg="1"><a target="_blank"><img src="http://irrlicht.sourceforge.net/images/general/irrlichtlogo.gif" small="0" class="blogimg" border="0" /></a></div> Irrlicht在开?d引擎里算很好的一个,<br /> 而且它是LGPL( Lesser General Public License)协议的,你可以随意用它?br /> 主页Q?a target="_blank">http://irrlicht.sourceforge.net/</a><br /><br /> 2.IrrNewt<br /><div forimg="1"><a target="_blank"><img src="http://aresfps.sourceforge.net/irrnewt.gif" small="0" class="blogimg" border="0" height="64" width="219" /></a></div> IrrNewt是把Newton dynamic(一个物理引?和Irrlicht(3d囑Ş引擎)l合的一个库Q?br /> 用了它的会让游戏效果很震撼?br /> 主页Q?a target="_blank">http://aresfps.sourceforge.net/irrnewt.htm</a><br /><br /> 3.IrrKlang<br /><div forimg="1"><a target="_blank"><img src="http://www.ambiera.com/irrklang/images/irrklang2_link_big.png" small="0" class="blogimg" border="0" height="63" width="218" /></a></div> 它是为Irrlicht设计的声韛_擎,支持3d?d声效?br /> 主页Q?a target="_blank">http://www.ambiera.com/irrklang/</a><img src ="http://www.shnenglu.com/billhsu/aggbug/91991.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2009-08-03 08:35 <a href="http://www.shnenglu.com/billhsu/archive/2009/08/03/91991.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>自己写的3D游戏http://www.shnenglu.com/billhsu/archive/2009/07/29/91578.htmlBill HsuBill HsuWed, 29 Jul 2009 05:04:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/07/29/91578.htmlhttp://www.shnenglu.com/billhsu/comments/91578.htmlhttp://www.shnenglu.com/billhsu/archive/2009/07/29/91578.html#Feedback6http://www.shnenglu.com/billhsu/comments/commentRss/91578.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/91578.html

q个游戏使用了我自己开发的开?D引擎Rap3d?br /> 个h感觉Rap3d用v来很方便Q?br /> 如果您想使用Q请讉KRap3d在sourceforge的项目主c?br />http://rap3d.sf.net

游戏介绍Q?br /> 地球被火星h占领Q?br /> 你驾驶hcL先进的飞船“猛”号Q?br /> 冲入了火星h基地Q勇敢地战斗Q?br /> 地球命运Q在你之手…?br />



开发环境:
Visual C++ 2003 & Directx9.0c SDK
在windowspȝ都可以运?br />
操作Q?br /> 用上下左右键控制您的飞船
用控刉[Ctrl]击,用[Esc]键退出游?br /> 具体玩法见游戏Help.


下蝲猛禽dQ?a >
http://rap3d.googlecode.com/files/Rap3d%20Demo--RaptorMission.rar
?br /> http://show.gameres.com/RaptorMission/RaptorMission.zip

Win7/Vista使用前把包里的d3d9.dll删掉



Bill Hsu 2009-07-29 13:04 发表评论
]]>
自己写的Rap3d 引擎 开源发布啦http://www.shnenglu.com/billhsu/archive/2009/07/25/91123.htmlBill HsuBill HsuSat, 25 Jul 2009 07:00:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/07/25/91123.htmlhttp://www.shnenglu.com/billhsu/comments/91123.htmlhttp://www.shnenglu.com/billhsu/archive/2009/07/25/91123.html#Feedback5http://www.shnenglu.com/billhsu/comments/commentRss/91123.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/91123.html我在sourceforge上申请了开源项目,在那里可以下载到Rap3d SDK.
http://rap3d.sf.net/

Rap3d SDK 中有引擎的用说明和几个例子Q上手很快的?br />

What Rap3d can do?

1.Display 3d models

2.Bill Board,Sprite,Animation..

3.Music playing

4.Draw text on screen

http://rap3d.sf.net/




Bill Hsu 2009-07-25 15:00 发表评论
]]>
Rap3d更新http://www.shnenglu.com/billhsu/archive/2009/06/23/88346.htmlBill HsuBill HsuTue, 23 Jun 2009 02:12:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/06/23/88346.htmlhttp://www.shnenglu.com/billhsu/comments/88346.htmlhttp://www.shnenglu.com/billhsu/archive/2009/06/23/88346.html#Feedback1http://www.shnenglu.com/billhsu/comments/commentRss/88346.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/88346.html
增加?TextureManager?
BillBoard动画播放,方便渲染爆炸效果


Bill Hsu 2009-06-23 10:12 发表评论
]]>
游戏中CPU使用率的控制http://www.shnenglu.com/billhsu/archive/2009/06/12/87472.htmlBill HsuBill HsuFri, 12 Jun 2009 04:00:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/06/12/87472.htmlhttp://www.shnenglu.com/billhsu/comments/87472.htmlhttp://www.shnenglu.com/billhsu/archive/2009/06/12/87472.html#Feedback18http://www.shnenglu.com/billhsu/comments/commentRss/87472.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/87472.html应该用Sleep(1)把多余的片段q给CPU,
像这P
while(true)
{
DWORD start_time 
= GetTickCount();
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT) break;
TranslateMessage(
&msg);
DispatchMessage(
&msg);
}

update(float(GetTickCount() - start_time));
while((GetTickCount() - start_time) < 30) Sleep(1);
}

update(float timeDelta)是游戏逻辑与画面更新的函数?br />效果图:



Bill Hsu 2009-06-12 12:00 发表评论
]]>
3D引擎计划http://www.shnenglu.com/billhsu/archive/2009/06/10/87356.htmlBill HsuBill HsuWed, 10 Jun 2009 13:15:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/06/10/87356.htmlhttp://www.shnenglu.com/billhsu/comments/87356.htmlhttp://www.shnenglu.com/billhsu/archive/2009/06/10/87356.html#Feedback0http://www.shnenglu.com/billhsu/comments/commentRss/87356.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/87356.html 其实也就是把一些类装一下,让开发更l,以开源和实用为第一准则?br />



Bill Hsu 2009-06-10 21:15 发表评论
]]>
寻\法整理http://www.shnenglu.com/billhsu/archive/2009/01/23/72513.htmlBill HsuBill HsuFri, 23 Jan 2009 09:22:00 GMThttp://www.shnenglu.com/billhsu/archive/2009/01/23/72513.htmlhttp://www.shnenglu.com/billhsu/comments/72513.htmlhttp://www.shnenglu.com/billhsu/archive/2009/01/23/72513.html#Feedback3http://www.shnenglu.com/billhsu/comments/commentRss/72513.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/72513.html
1.DFS
优先深入每个图,直到扑ֈ目标节点
往往可以扑ֈ到达路线Q可往往不是最优的?br />09-1-23-DFS.JPG


2.BFS
q度优先地寻扄标节炏V?br />往往可以扑ֈ最优\径,但耗时多?br />09-1-23-BFS.JPG


3.Dijkstra
使用了动态规划(原文中称为“边放松”)//该ؓ贪心Q本人罪q?br />速度较快
09-1-23-Dijkstra.JPG


4.A*
与Dijkstra怼Q用启发因?F=G+H)Q速度是以上算法里最快的?br />可以看看Q?br />http://hi.baidu.com/probill/blog/item/80d71f1b19e2fe1e8718bfe5.html
09-1-23-Astar.JPG

5.创徏D?br />09-1-23-Nav.JPG


Bill Hsu 2009-01-23 17:22 发表评论
]]>
用GDI实现3Dhttp://www.shnenglu.com/billhsu/archive/2008/12/27/70517.htmlBill HsuBill HsuSat, 27 Dec 2008 09:18:00 GMThttp://www.shnenglu.com/billhsu/archive/2008/12/27/70517.htmlhttp://www.shnenglu.com/billhsu/comments/70517.htmlhttp://www.shnenglu.com/billhsu/archive/2008/12/27/70517.html#Feedback1http://www.shnenglu.com/billhsu/comments/commentRss/70517.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/70517.html
不过x看,好像实现h也ƈ不难。。?br />和所有基?DE序一P先把视椎变换为单位立方体Q?br />3_thumb.jpg
变换矩阵为:
5.jpg

当然QDirectX和OpenGL里都有现成的函数Q?br />
//OpenGL
void gluPerspective(GLdouble fovy,
    GLdouble aspect,
    GLdouble zNear,
    GLdouble zFar);

//DirectX
D3DXMatrixPerspectiveFovLH( D3DXMATRIX *pOut,
    FLOAT fovY,
    FLOAT Aspect,
    FLOAT zn,
    FLOAT zf
); 

单位立方体中的点正交投媄得到?x,y,z)*视口变换矩阵 得到 (x',y',z')?br />(x',y')对应屏幕点,z'为其深度Q用于点的竞争?br />把每个三角面匚wU理用GDI基本函数d来就可以了?br />

CSDN的那个程?br />rtwtsdgdg.JPG



Bill Hsu 2008-12-27 17:18 发表评论
]]>
A* (A-star A?寻\法http://www.shnenglu.com/billhsu/archive/2008/11/01/65700.htmlBill HsuBill HsuSat, 01 Nov 2008 10:19:00 GMThttp://www.shnenglu.com/billhsu/archive/2008/11/01/65700.htmlhttp://www.shnenglu.com/billhsu/comments/65700.htmlhttp://www.shnenglu.com/billhsu/archive/2008/11/01/65700.html#Feedback0http://www.shnenglu.com/billhsu/comments/commentRss/65700.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/65700.html仔细看了看gamedev.net的一片文?A* Pathfinding for Beginners http://www.gamedev.net/reference/articles/article2003.asp )Q对A*更了解了一点,写点东西记录一下?br />A*是一U启发式的算法,所谓的"启发?Q就是对每一个搜索的位置q行评估Q也是把找的位|离目标的距d成找点的一个依据,然后猜测q个Ҏ否最?"启发?是猜测)?br />
image001.jpg

Z扑ֈ最佳的那个?br />可以规定Q?br />G = 从v点,沿着产生的\径,Ud到网g指定Ҏ的距R?br />H = 从网g那个ҎUd到终点B的预估移动距R?br />
F = G + H
F最的点可以认为是该选的炏V?br />
引用一下原文的译Q?br />我们令水qx者垂直移动的耗费?0Q对角线方向耗费?4。我们取q些值是因ؓ沿对角线的距L沿水qx垂直Ud耗费的的根号2Q别怕)Q或者约1.414倍。ؓ了简化,我们?0?4q似。比例基本正,同时我们避免了求根运和数?br />

既然我们在计沿特定路径通往某个Ҏ的G|求值的Ҏ是取它父节点的G|然后依照它相对父节点是对角线方向或者直角方?非对角线)Q分别增?4?0。例子中q个Ҏ的需求会变得更多Q因为我们从LҎ以外获取了不止一个方根{?br />
H值可以用不同的方法估。我们这里用的Ҏ被称为曼哈顿ҎQ它计算从当前格到目的格之间水^和垂直的Ҏ的数量dQ忽略对角线方向。然后把l果乘以10。这被成为曼哈顿Ҏ是因为它看v来像计算城市中从一个地方到另外一个地方的街区敎ͼ在那里你不能沿对角线方向I过街区。很重要的一点,我们忽略了一切障物。这是对剩余距离的一个估,而非实际|q也是这一Ҏ被称为启发式的原因。想知道更多Q你可以在这里找到方E和额外的注解?br />


W一步搜索的l果可以在下面的图表中看到。F,G和H的评分被写在每个Ҏ里。正如在紧挨起始格右侧的Ҏ所表示的,F被打印在左上角,G在左下角QH则在右下角?/span>

image003.jpg

引用一下原文的译Q?/span>

我们做如下操作开始搜索:
   
1Q从点A开始,q且把它作ؓ待处理点存入一个“开启列表”。开启列表就像一张购物清单。尽现在列表里只有一个元素,但以后就会多h。你的\径可能会通过它包含的ҎQ也可能不会。基本上Q这是一个待查方格的列表?br />   2Q寻找v点周围所有可到达或者可通过的方|跌有墙Q水Q或其他无法通过地Ş的方根{也把他们加入开启列表。ؓ所有这些方g存点A作ؓ“父Ҏ”。当我们xq\径的时候,父方格的资料是十分重要的。后面会解释它的具体用途?br />   3Q从开启列表中删除点AQ把它加入到一个“关闭列表”,列表中保存所有不需要再ơ检查的Ҏ?br />
Zl箋搜烦Q我们简单的从开启列表中选择F值最低的Ҏ。然后,寚w中的方格做如下处理Q?br />
   
4Q把它从开启列表中删除Q然后添加到关闭列表中?br />   5Q检查所有相L子。蟩q那些已l在关闭列表中的或者不可通过?有墙Q水的地形,或者其他无法通过的地?Q把他们dq开启列表,如果他们q不在里面的话。把选中的方g为新的方格的父节炏V?br />   6Q如果某个相L已经在开启列表里了,查现在的q条路径是否更好。换句话_查如果我们用新的路径到达它的话,G值是否会更低一些。如果不是,那就什么都不做?br />      另一斚wQ如果新的G值更低,那就把相L格的父节Ҏ为目前选中的方|在上面的图表中,把箭头的方向改ؓ指向q个ҎQ。最后,重新计算F和G的倹{如果这看v来不够清晎ͼ你可以看下面的图C?/span>


image004.jpg

image005.jpg

image006.jpg

image007.jpg

q样可以找到最佌\径了?br />



Bill Hsu 2008-11-01 18:19 发表评论
]]>
四元数入?/title><link>http://www.shnenglu.com/billhsu/archive/2008/09/30/63099.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Tue, 30 Sep 2008 11:34:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2008/09/30/63099.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/63099.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2008/09/30/63099.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/63099.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/63099.html</trackback:ping><description><![CDATA[四元数常常可以在3D的书上看到?br />但我的那?D囑Ş学书上,在没讲四元数是干什么的之前Q就列了几张U的公式Q?br />大概因ؓ自己q在上高中,不知道的太多Q看了半天没看懂。。?br />l于Q在gameres上看C某强人翻译的一个?元数宝典 ”(原文是日本h写的。。。)Q感觉很好,分n下?br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">★旋转篇Q?br /> 我将说明使用了四元数Qsi yuan shu, quaternionQ的旋{的操作步?br />Q?/span><span style="color: rgb(0, 0, 0);">Q?/span><span style="color: rgb(0, 0, 0);">Q四元数的虚部,实部和写?br />所谓四元数Q就是把4个实数组合v来的东西?br />4个元素中Q一个是实部Q其?个是虚部?br />比如Q叫做Q的四元数Q实部t而虚部是x,y,z构成Q则像下面这样写?br />Q </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (t; x, y, z) <br />又,使用向量 V</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">(x,y,z)Q?br />Q </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (t; V)  <br />也可以这么写?br /><br />正规地用虚数单位i,j,k的写法的话,<br />Q </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> t </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> xi </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> yj </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> zk <br />也这样写Q不q,我不大?br /><br />Q?/span><span style="color: rgb(0, 0, 0);">Q?/span><span style="color: rgb(0, 0, 0);">Q四元数之间的乘?br />虚数单位之间的乘法?br />ii </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">, ij </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ji </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> k (其他的组合也是@环地以下同文) <br />有这么一U规则。(我总觉得,q就像是向量U(外积Q,对吧Q?br />用这个规则一点点地计很ȝQ所以请用像下面q样的公式计?br /><br />A </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (a; U) <br />B </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (b; V) <br />AB </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (ab </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> U·V; aV </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> bU </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> U×V)<br />不过Q“U·V”是内积Q「U×V」是外积的意思?br />注意Q一般AB</span><span style="color: rgb(0, 0, 0);"><></span><span style="color: rgb(0, 0, 0);">BA所以乘法的左右要注意!<br /><br />Q?/span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">Q?ơ元的坐标的四元数表C?br />如要某坐标(x,y,z)用四元数表示Q?br />P </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; x, y, z) <br />则要q么写?br /> <br />另外Q即使实部是零以外的|下文的结果也一栗用零的话省事所以我推荐?br /><br />Q?/span><span style="color: rgb(0, 0, 0);">Q?/span><span style="color: rgb(0, 0, 0);">Q旋转的四元数表C?br />以原点ؓ旋{中心Q旋转的轴是(, β, )<br />Q但 </span><span style="color: rgb(0, 0, 0);">^</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> β</span><span style="color: rgb(0, 0, 0);">^</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">^</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">Q, <br />Q右手系的坐标定义的话,望向向量(, β, )的前q方向反旉圎ͼ <br />转θ角的旋转,用四元数表示是Q?br />Q </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (cos(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">);  sin(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">), β sin(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">),  sin(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">)) <br />R </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (cos(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> sin(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">), </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">β sin(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">), </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> sin(θ</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">)) <br />(另外R 叫 Q 的共轭四元数。) <br /><br />那么Q如要实行旋转,<br /><b>则?font color="#ff6600">R P Q<font color="#ffcc00"> </font></font></b></span><font color="#ffcc00"><b><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">0</span></b></font><span style="color: rgb(0, 0, 0);"><b><font color="#ff6600">; {案)</font> </b><br /><br />请像q样三明d地计。这个值的虚部是旋{之后的点的坐标倹{?br /> Q另外,实部应该为零。请验算看看Q?/span></div><br />例子代码<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);"> Quaternion.cpp <br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);"> (C) Toru Nakata, toru-nakata@aist.go.jp <br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);"> 2004 Dec 29 </span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">  <br />#include </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">math.h</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> <br />#include </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">iostream.h</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> <br />  <br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);"> Define Data type </span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">typedef </span><span style="color: rgb(0, 0, 255);">struct</span><span style="color: rgb(0, 0, 0);"> <br />{ <br />              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> t; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> real-component </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> x; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> x-component </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> y; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> y-component </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> z; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> z-component </span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">} quaternion; <br />  <br /><br /></span><b><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">/ Bill 注:Kakezan </span></b><span style="color: rgb(128, 128, 128);"><font color="#669900"><b>在日语里?“乘法”的意?/b></font><br /></span><span style="color: rgb(0, 0, 0);">quaternion Kakezan(quaternion left, quaternion right) <br />{ <br />              quaternion ans; <br />              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> d1, d2, d3, d4; <br />  <br />              d1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.t; <br />              d2 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.x </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.x; <br />              d3 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.y </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.y; <br />              d4 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.z </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.z; <br />              ans.t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d4; <br />  <br />              d1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.x; <br />              d2 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  right.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> left.x; <br />              d3 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.y </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.z; <br />              d4 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.z </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.y; <br />              ans.x </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d4; <br />  <br />              d1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.y; <br />              d2 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  right.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> left.y; <br />              d3 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.z </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.x; <br />              d4 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.x </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.z; <br />              ans.y </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d4; <br />  <br />              d1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.z; <br />              d2 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  right.t </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> left.z; <br />              d3 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  left.x </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.y; <br />              d4 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">left.y </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> right.x; <br />              ans.z </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">  d1</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d2</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d3</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> d4; <br />              <br />              </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> ans; <br />} <br />  <br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">/ Make Rotational quaternion </span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">quaternion MakeRotationalQuaternion(</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> radian, </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> AxisX, </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> AxisY, </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> AxisZ) <br />{ <br />              quaternion ans; <br />              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> norm; <br />              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> ccc, sss; <br />              <br />              ans.t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> ans.x </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> ans.y </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> ans.z </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">; <br />  <br />              norm </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> AxisX </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">  AxisX </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">  AxisY </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">  AxisY </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">  AxisZ </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">  AxisZ; <br />              </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(norm </span><span style="color: rgb(0, 0, 0);"><=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> ans; <br />  <br />              norm </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1.0</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"> sqrt(norm); <br />              AxisX </span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);"> norm; <br />              AxisY </span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);"> norm; <br />              AxisZ </span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);"> norm; <br />  <br />              ccc </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> cos(</span><span style="color: rgb(0, 0, 0);">0.5</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> radian); <br />              sss </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> sin(</span><span style="color: rgb(0, 0, 0);">0.5</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> radian); <br />  <br />              ans.t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> ccc; <br />              ans.x </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> sss </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> AxisX; <br />              ans.y </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> sss </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> AxisY; <br />              ans.z </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> sss </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> AxisZ; <br />  <br />              </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> ans; <br />} <br />  <br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">/ Put XYZ into  quaternion </span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">quaternion PutXYZToQuaternion(</span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> PosX, </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> PosY, </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> PosZ) <br />{ <br />              quaternion ans; <br />  <br />              ans.t </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">; <br />              ans.x </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> PosX; <br />              ans.y </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> PosY; <br />              ans.z </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> PosZ; <br />  <br />              </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> ans; <br />} <br />  <br /></span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);">// main </span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> main() <br />{ <br />              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> px, py, pz; <br />              </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> ax, ay, az, th; <br />              quaternion ppp, qqq, rrr; <br />  <br />              cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Point Position (x, y, z) </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> endl; <br />              cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  x = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />              cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> px; <br />              cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  y = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />              cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> py; <br />              cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  z = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />              cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> pz; <br />              ppp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> PutXYZToQuaternion(px, py, pz); <br />  <br />              </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">) { <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\nRotation Degree ? (Enter 0 to Quit) </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> endl; <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  angle = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />                            cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> th; <br />                            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(th </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0.0</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">; <br />  <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Rotation Axis Direction ? (x, y, z) </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> endl; <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  x = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />                            cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> ax; <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  y = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />                            cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> ay; <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">  z = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">; <br />                            cin </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> az; <br />  <br />  <br />                            th </span><span style="color: rgb(0, 0, 0);">*=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3.1415926535897932384626433832795</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">180.0</span><span style="color: rgb(0, 0, 0);">; </span><span style="color: rgb(128, 128, 128);">///</span><span style="color: rgb(0, 128, 0);"> Degree -> radian; </span><span style="color: rgb(128, 128, 128);"><br /></span><span style="color: rgb(0, 0, 0);">  <br />                            qqq </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> MakeRotationalQuaternion(th, ax, ay, az); <br />                            rrr </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> MakeRotationalQuaternion(</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">th, ax, ay, az); <br />  <br />                            ppp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Kakezan(rrr, ppp); <br />                            ppp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Kakezan(ppp, qqq); <br />  <br />                            cout </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\nAnser X = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> ppp.x <br />                                          </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\n      Y = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> ppp.y <br />                                          </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\n      Z = </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> ppp.z </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> endl; <br />  <br />              } <br />  <br />              </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; <br />}  <br /></span></div>http://staff.aist.go.jp/toru-nakata/quaternion.html<br />http://bbs.gameres.com/showthread.asp?threadid=73511<br /><br /><img src ="http://www.shnenglu.com/billhsu/aggbug/63099.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-09-30 19:34 <a href="http://www.shnenglu.com/billhsu/archive/2008/09/30/63099.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>越3DQ?D来了。。?/title><link>http://www.shnenglu.com/billhsu/archive/2008/09/15/61846.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Mon, 15 Sep 2008 03:56:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2008/09/15/61846.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/61846.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2008/09/15/61846.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/61846.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/61846.html</trackback:ping><description><![CDATA[在gameres上看到的Q感觉很创意。。?br> <br> 实现Ҏ<br> 准备两个摄像机,对准同一点,交替渲染U和l的画面Q带上红l眼?img src="http://www.shnenglu.com/images/cppblog_com/slowhand/glass.jpg" class="blogimg" small="0" border="0" width="67" height="35">卛_观察?D的场景了Q?br> <br> 大家可以看看那这里,有源代码(C++&D3d实现?<br> http://bbs.gameres.com/showthread.asp?threadid=73818<br> <br> <div forimg="1"><img src="http://bbs.gameres.com/upload/sf_20089914631.jpg" class="blogimg" small="0" border="0" width="488" height="305"><br> 一?D的例?/div><img src ="http://www.shnenglu.com/billhsu/aggbug/61846.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-09-15 11:56 <a href="http://www.shnenglu.com/billhsu/archive/2008/09/15/61846.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>irrlicht--q个引擎很强大。。?/title><link>http://www.shnenglu.com/billhsu/archive/2008/08/23/59735.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Sat, 23 Aug 2008 09:53:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2008/08/23/59735.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/59735.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2008/08/23/59735.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/59735.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/59735.html</trackback:ping><description><![CDATA[<img style="width: 472px; height: 373px;" alt="" src="http://www.shnenglu.com/images/cppblog_com/billhsu/irr.JPG"><br><br>上次在sourceforge.net(大名鼎鼎的开源代码网?上看到的Q这个irrlicht真很了不P 虽然是开源的Q不q感觉已l达到那些几万美元的商业U的3D引擎上具有的Ҏ。而且跨^収ͼ写一ơ代码可以在多种操作pȝ上编译?br> <br> 支持<span><font face="Times New Roman">.3ds, .md2, .obj, .pk3, .ms3d, .bsp, .x, .bmp, .tga, .jpg, .psd, .pcx</font></span><span>{等文gQ速度快的没得_比我写的那些3D渲染库类快好几个U别?/span><span>那个UI库,也是无敌的。。?/span><br>开源的力量太强大了?br> <br> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;">癑ֺ癄QIrrlicht是一个d国神话故事中的一U动物的名字Q它能够发光和飞,可以在大部分的沼泽地附近发现它。单?Irrlicht"是两个d国单词("irr"意思是疯狂的;?Licht"意思是光)的组合。在p中,它被译ؓ"鬼火"?/div> <br> 主页Q?<br> http://irrlicht.sourceforge.net/ <img src ="http://www.shnenglu.com/billhsu/aggbug/59735.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-08-23 17:53 <a href="http://www.shnenglu.com/billhsu/archive/2008/08/23/59735.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>脚本引擎RapScript V0.0.0.1发布http://www.shnenglu.com/billhsu/archive/2008/08/10/58429.htmlBill HsuBill HsuSun, 10 Aug 2008 03:05:00 GMThttp://www.shnenglu.com/billhsu/archive/2008/08/10/58429.htmlhttp://www.shnenglu.com/billhsu/comments/58429.htmlhttp://www.shnenglu.com/billhsu/archive/2008/08/10/58429.html#Feedback4http://www.shnenglu.com/billhsu/comments/commentRss/58429.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/58429.htmlq䆾代码目前比较p糕Q有点ؕQ而且没有错误处理Q但开源是一U习惯。。?br>
先介l一下怎么用:
把RapScript.h RapScript.cpp RapStack.h加入工程Q然后在自己的main.cpp里加?br>
#include "RapScript.h"

RapScript XXX;

XXX是对象名Q可以自己取?br>
关于函数互交Q?br>比如_你在C++中写了一个函敎ͼ
void test(int a,int b)
{
cout 
<<"In void test(int a,int b) a:"<<a<<" b: "<<b<<endl;
}
要调用它Q要在写一个:
void rap_test()
{
int a=rapscript.para[0].v_int;//参数一
int b=rapscript.para[1].v_int;//参数?/span>
test(a,b);

}
然后在合适的位置(比如int main()?加入
rapscript.tmp_cmd.cmd_name="test";
rapscript.tmp_cmd.v_type
=rapscript.CMD_VOID;
rapscript.tmp_cmd.fp_void
=rap_test;
rapscript.cmd_list.push_back(rapscript.tmp_cmd);
调用rapscript.run_rap();
脚本׃执行了?br>说明一下:
1.在脚本中写命令时要这Ptest(a;b;);//我偷懒了
2.所有变量用前必d明(如int a;string b;Q?br>目前只支持int ?string
3.Bug多?br>4.if()?for(){暂时不支持
5.如果你愿意修Ҏ代码Q只要合理,׃被采用,名字也会加入Author里。。?br>
下蝲RapScript V0.0.0.1源代?/a>
┏━┓   ┏━━┓   ┏┓     
┃┃┣━┳━┫━━╋━┳┳╋╋━┳━━┓
┃ ┫━┃┃┣━━┃┣┫┏┫┃┃┣┓┏┛
┗┻┠Z┫┏┠Z━┻━┻┛┗┫┏┛┗┛ 
             ┗┛        ┗┛    




Bill Hsu 2008-08-10 11:05 发表评论
]]>
RapScript开发日?2008.8.6http://www.shnenglu.com/billhsu/archive/2008/08/06/58176.htmlBill HsuBill HsuWed, 06 Aug 2008 12:19:00 GMThttp://www.shnenglu.com/billhsu/archive/2008/08/06/58176.htmlhttp://www.shnenglu.com/billhsu/comments/58176.htmlhttp://www.shnenglu.com/billhsu/archive/2008/08/06/58176.html#Feedback1http://www.shnenglu.com/billhsu/comments/commentRss/58176.htmlhttp://www.shnenglu.com/billhsu/services/trackbacks/58176.html
int a;
int b;
a
=(1+2)*3*3;
b
=a/3;
效果图:


估计??日京奥开q前会以源代码的形式攑ևW一个可用的版本Q?br>支持与C++的命令互?用RapScript调用你在C++E序中写的函??br>
很好使用的,只要把RapScript.h RapScript.cpp RapStack.h加入工程里就可以了?br>兼容性很好,臛_支持g++和VC(MFC和非MFC都支??br>每行都有注释(用英文写的,Z来国际化^_^)





Bill Hsu 2008-08-06 20:19 发表评论
]]>
我的VC++ RPG游戏紫日2037源代?/title><link>http://www.shnenglu.com/billhsu/archive/2008/07/23/56974.html</link><dc:creator>Bill Hsu</dc:creator><author>Bill Hsu</author><pubDate>Wed, 23 Jul 2008 11:04:00 GMT</pubDate><guid>http://www.shnenglu.com/billhsu/archive/2008/07/23/56974.html</guid><wfw:comment>http://www.shnenglu.com/billhsu/comments/56974.html</wfw:comment><comments>http://www.shnenglu.com/billhsu/archive/2008/07/23/56974.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.shnenglu.com/billhsu/comments/commentRss/56974.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/billhsu/services/trackbacks/56974.html</trackback:ping><description><![CDATA[<img alt="" src="http://www.shnenglu.com/images/cppblog_com/billhsu/7643/o_2037.JPG"><br> ?span>刚学游戏~程时写的程序,对初学者可能有用,希望大家喜欢 :-)<br><br>执行文g下蝲Q?br><a target="_blank" href="http://www.shnenglu.com/Files/billhsu/2037.rar">http://www.shnenglu.com/Files/billhsu/2037.rar</a><br><br>源代码下载:<br><a target="_blank" href="http://www.shnenglu.com/Files/billhsu/Source_2037.rar">http://www.shnenglu.com/Files/billhsu/Source_2037.rar</a><br></span><br> <img src ="http://www.shnenglu.com/billhsu/aggbug/56974.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/billhsu/" target="_blank">Bill Hsu</a> 2008-07-23 19:04 <a href="http://www.shnenglu.com/billhsu/archive/2008/07/23/56974.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.guhm.cn" target="_blank">vĻþ</a>| <a href="http://www.hzyzhongyuan.cn" target="_blank">99ƷþþƷһ</a>| <a href="http://www.magifts.cn" target="_blank">þòӰ</a>| <a href="http://www.dsifhjh1.cn" target="_blank">AVݺɫۺϾþ </a>| <a href="http://www.51083114.cn" target="_blank">AVպƷþþþ</a>| <a href="http://www.zzc40.cn" target="_blank">޾Ʒþþwww</a>| <a href="http://www.j19785.cn" target="_blank">ɫۺϾþ</a>| <a href="http://www.hunxueer.cn" target="_blank">þ99þóѲ</a>| <a href="http://www.yaojikeji.cn" target="_blank">þù</a>| <a href="http://www.huacai0019.cn" target="_blank">ľƷþþþ</a>| <a href="http://www.nxxq5.cn" target="_blank">þþþþþòҰ¸߳</a>| <a href="http://www.tomp3.cn" target="_blank">99þҹɫƷվ</a>| <a href="http://www.51yueda.cn" target="_blank">ɫۺϾþþþۺһ</a>| <a href="http://www.pochai.cn" target="_blank">99þþþƷ</a>| <a href="http://www.zjslzy.com.cn" target="_blank">ƷۺϾþþþþ88С˵</a>| <a href="http://www.baifeng.net.cn" target="_blank">ŷƷһþ</a>| <a href="http://www.zjfinancial.cn" target="_blank">˾þþƷһ</a>| <a href="http://www.zjjunyao.cn" target="_blank">þþþþþþƷɫ</a>| <a href="http://www.jlauyh.cn" target="_blank">þݺҹҹվ </a>| <a href="http://www.2jg.com.cn" target="_blank">þ޾Ʒϵַ </a>| <a href="http://www.yz10.cn" target="_blank">ھƷ˾þþþվ</a>| <a href="http://www.the-music-cable.cn" target="_blank">ݺݾƷþþĻ</a>| <a href="http://www.pvzj.cn" target="_blank">պþþþƷӰԺҳ</a>| <a href="http://www.jijijian.cn" target="_blank">þɬۺ</a>| <a href="http://www.amgtm.cn" target="_blank">þ99Ʒþþþþþò</a>| <a href="http://www.seese.cn" target="_blank">Ѹþ</a>| <a href="http://www.262833.cn" target="_blank">þŮcc98cm</a>| <a href="http://www.v4169.cn" target="_blank">þҹɫƷ</a>| <a href="http://www.ccjump.cn" target="_blank">ƷۺϾþ </a>| <a href="http://www.zhangjiaying.cn" target="_blank">þþþƷ鶹</a>| <a href="http://www.vtkh.cn" target="_blank">ȾþֻоƷ</a>| <a href="http://www.shzkyz.cn" target="_blank">ŷ˾þô߽ۺ</a>| <a href="http://www.zfbwgd.cn" target="_blank">þþƷһ </a>| <a href="http://www.kanqiuwang.cn" target="_blank">þѴƬ</a>| <a href="http://www.988o.cn" target="_blank">Ʒ޾þþþþ888</a>| <a href="http://www.w-sh.cn" target="_blank">ŷպƷþ</a>| <a href="http://www.zazhui.cn" target="_blank">þٸ۲AVר</a>| <a href="http://www.fengbiaochem.com.cn" target="_blank">99ȾþֻоƷ68</a>| <a href="http://www.7-go.cn" target="_blank">þþ</a>| <a href="http://www.hdtnet.cn" target="_blank">þþþһƷ޹ۺAV </a>| <a href="http://www.taobaomaiba.cn" target="_blank">þˬˬ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>