Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found it. Thanks to everyone.</p> <p>The game is using N3Terrain :)</p> <pre><code>float CN3Terrain::GetHeight(float x, float z) </code></pre> <p>{ int ix, iz; ix = ((int)x) / TILE_SIZE; iz = ((int)z) / TILE_SIZE;</p> <pre><code>if(ix&lt;0 || ix&gt;(m_ti_MapSize-2)) return -FLT_MAX; if(iz&lt;0 || iz&gt;(m_ti_MapSize-2)) return -FLT_MAX; float dX, dZ; dX = (x - (ix*TILE_SIZE)) / TILE_SIZE; dZ = (z - (iz*TILE_SIZE)) / TILE_SIZE; float y; float h1, h2, h3, h12, h13; if((ix+iz)%2==0) //»ç°¢ÇüÀÌ / ¸ð¾ç.. { h1 = m_pMapData[ix*m_ti_MapSize + iz].fHeight; h3 = m_pMapData[(ix+1)*m_ti_MapSize + (iz+1)].fHeight; if (dZ &gt; dX) //À­ÂÊ »ï°¢Çü.. { h2 = m_pMapData[ix*m_ti_MapSize + (iz+1)].fHeight; h12 = h1 + (h2-h1) * dZ; // h1°ú h2»çÀÌÀÇ ³ôÀ̰ª h13 = h1 + (h3-h1) * dZ; // h1°ú h3»çÀÌÀÇ ³ôÀ̰ª y = h12 + ((h13-h12) * (dX/dZ)); // ã°íÀÚ ÇÏ´Â ³ôÀ̰ª return y; } else //¾Æ·¡ÂÊ »ï°¢Çü.. { if(dX==0.0f) return h1; h2 = m_pMapData[(ix+1)*m_ti_MapSize + iz].fHeight; h12 = h1 + (h2-h1) * dX; // h1°ú h2»çÀÌÀÇ ³ôÀ̰ª h13 = h1 + (h3-h1) * dX; // h1°ú h3»çÀÌÀÇ ³ôÀ̰ª y = h12 + ((h13-h12) * (dZ/dX)); // ã°íÀÚ ÇÏ´Â ³ôÀ̰ª return y; } } else if ((ix+iz)%2==1) //»ç°¢ÇüÀÌ ¿ª½½·¹½¬ ¸ð¾ç.. { h1 = m_pMapData[(ix+1)*m_ti_MapSize + iz].fHeight; h3 = m_pMapData[ix*m_ti_MapSize + (iz+1)].fHeight; if ((dX+dZ) &gt; 1.0f) //À­ÂÊ »ï°¢Çü.. { if(dZ==0.0f) return h1; h2 = m_pMapData[(ix+1)*m_ti_MapSize + (iz+1)].fHeight; h12 = h1 + (h2-h1) * dZ; h13 = h1 + (h3-h1) * dZ; y = h12 + ((h13-h12) * ((1.0f-dX)/dZ)); return y; } else //¾Æ·¡ÂÊ »ï°¢Çü.. { if(dX==1.0f) return h1; h2 = m_pMapData[ix*m_ti_MapSize + iz].fHeight; h12 = h2+(h1-h2)*dX; // h1°ú h2»çÀÌÀÇ ³ôÀ̰ª h13 = h3+(h1-h3)*dX; // h1°ú h3»çÀÌÀÇ ³ôÀ̰ª y = h12 + ((h13-h12) * (dZ/(1.0f-dX))); return y; } } return -FLT_MAX; </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload