¸Þ¸ðÀå_¹°¸®

@ 2004-11-23 @

  °ÔÀÓ¿¡¼­ÀÇ ¹°¸®ÇÐ (±è¼º¿Ï »ù °¨»ç^^)
1 Çϵå¿þ¾î °¡¼Ó
2 °ÔÀÓ¿¡¼­ÀÇ ¹°¸®ÇÐ
2.1 Euler's Method
2.2 Hook's law
2.3 Verlet Intergrator
3 Chaos
4 Jump ±âº»·ÎÁ÷
{_r} ¸Þ¸ðÀåÀ¸·Î °¡±â

* Ãæµ¹Âü°í
http://www.peroxide.dk/tuts_c.shtml

1 Çϵå¿þ¾î °¡¼Ó #

#.PPU(¹°¸®¿¬»ê ÇÁ·Î¼¼½º À¯´Ö) ; CPU°¡ ´ã´çÇÏ´Â À̹ÌÁö Àç»ý°ú °ü·ÃµÈ ¹°¸® ¿¬»êÀ» Àü´ãÇÏ´Â ÁÖº¯±â±â
/ ÄÜ¼Ö °ÔÀÓÇÁ·Î¼¼½Ì ó¸® °³³ä = CPU + GPU + PPU

#.GPU (Graphics Processing Unit)´Â
Áß¾Óó¸®ÀåÄ¡ÀÎ CPU¸¸À¸·Î °íÁ¤¹ÐµµÀÇ ±×·¡ÇÈÀ» ´Üµ¶À¸·Î ó¸®Çϱ⿡ ¹«¸®°¡ Àֱ⠶§¹®¿¡, À̸¦ º¸Á¶Çϱâ À§ÇÏ¿© 3D±×·¡ÇÈ ¿¬»ê Àü¿ëÀÇ ÇÁ·Î¼¼¼­ GPU°¡ °³¹ß µÇ¾ú½À´Ï´Ù.

GPU¶ó´Â ¿ë¾î´Â ¿£ºñµð¾Æ(NVIDIA)»ç¿¡¼­ 1999³â¿¡ ¡®ÁöÆ÷½º(GeForce)¡¯¶ó´Â À̸§ÀÇ »õ·Î¿î ±×·¡ÇÈ ÄÁÆ®·Ñ·¯(Graphics Controller: ±×·¡ÇÈÄ«µå¿ë Ĩ)À» ³»³õÀ¸¸ç óÀ½ Á¦Ã¢ÇÑ °ÍÀÌ´Ù. ÁöÆ÷½º´Â CPUÀÇ µµ¿ò ¾øÀÌ ÀÚüÀûÀ¸·Î Æú¸®°ï(Polygon: 3D ±×·¡ÇÈÀ» ±¸¼ºÇÏ´Â µµÇü)ÀÇ º¯Çü(Transform) ¹× ±¤¿ø(Lighting)È¿°ú¸¦ ±¸»çÇÏ´Â ±â´É, À̸¥¹Ù ¡®Çϵå¿þ¾î(Hardware) T&L¡¯À» °®Ãß°í ÀÖ¾ú´Ù. ÀÌ´Â ÀÌÀü±îÁö »ç¿ëÇß´ø ±×·¡ÇÈ ÄÁÆ®·Ñ·¯¿Í´Â È®¿¬È÷ ´Ù¸¥ °³³äÀ̾ú±â ¶§¹®¿¡ À̸¦ ±¸ºÐÇÏ°íÀÚ GPU¶ó´Â À̸§ÀÌ ºÙ°Ô µÇ¾ú´Ù. ±×¸®°í ÁöÆ÷½ºÀÇ Ãâ½Ã ÈÄ 1³âÀÌ Áö³­ 2000³â, ATi(ÇöÀçÀÇ AMD)»ç¿¡¼­ ¡®¶óµ¥¿Â(Radeon)¡¯À̶ó´Â GPU¸¦ Ãâ½ÃÇÏ°Ô µÇ¸é¼­ ¾ç»çÀÇ °æÀïÀÌ º»°ÝÈ­ µÈ´Ù.

#.ÀÎÅÚ > Havok - ¹°¸® °è»êÀ» CPU¿¡¼­ º¸Á¶ ¿ªÇÒÀ» ´ã´ç


-. Çï°ÔÀÌÆ®´Â Á¤»óÀûÀÎ °æ¿ì, ½Ì±Û ÇÁ·Î¼¼½º·Î ÀÛµ¿À» ÇÏÁö¸¸
¹è°æ ¼³Á¤À̳ª ÀÌÆåÆ® µî¿¡ ¹°¸®(ÇϺ¹) ¿¬»êÀÌ ÁøÇàµÉ ¶§, ´Ù¸¥ ÇÁ·Î¼¼½º°¡ ÀÛµ¿
--> ½ÉÇÒ °æ¿ì, ¹°¸® °è»êÀÌ ³¡³¯ ¶§±îÁö È­¸éÀÌ ¸ØÃß´Â Çö»ó ¹ß»ý

#.NVIDIA > (AGEIA) PhysX - ¹°¸® °è»êÀ» ±×·¡ÇÈÄ«µå¿¡¼­ º¸Á¶ ¿ªÇÒÀ» ´ã´ç


2 °ÔÀÓ¿¡¼­ÀÇ ¹°¸®ÇÐ #

2.1 Euler's Method #

2.2 Hook's law #

2.3 Verlet Intergrator #

3 Chaos #

4 Jump ±âº»·ÎÁ÷ #


const float JumpGHIGHTRAVITY 1800.0f
const float SAFEHEIGHT = 2.0f;
const float STARTJUMP  = 100.0f;
static float fUp = 0.0f;	

// Á¡ÇÁ ¿©ºÎ
if( !Á¡ÇÁÁß && ÇöÀç ¾Ö´Ï¸ÞÀ̼ÇÀÌ Á¡ÇÁÀΰ¡? )
{
  m_bJumpstart = true;
  m_bJump = true;
  fUp = STARTJUMP;
  m_fGravity = 0.0f;
}

if( m_bJump )  // »ó½Â ºÎºÐ
{
  m_fGravity += (JumpGHIGHTRAVITY * (fDelta*fDelta)*0.5f );
  fUp -= m_fGravity;

  if( fUp < 0.0f )
  {
    m_fGravity = 0.0f;
    m_bJump = false;
  }
  else
  {
    oldTrans.z += fUp;		
  }
}
else	// ³«ÇÏ ¿©ºÎ
{
  if( (oldTrans.z - kNewTrans.z) > SAFEHEIGHT )
  {
    m_fGravity += (JumpGHIGHTRAVITY * (fDelta*fDelta)*0.5f );
    oldTrans.z -= m_fGravity;
  }
  else
  {
    oldTrans = kNewTrans;
    m_fGravity = 0.0f;
    m_bJumpstart = false;
  }
}


class className
{
public:
  void StartJump();	

private:
  Point3	m_vSavePosition;
  bool	m_bJump02;	// Á¡ÇÁ À̺¥Æ®¸¦ ¹Þ¾Æ¼­ ij¸¯ÅÍ°¡ ÇöÀç »ó½Â ÁßÀÎÁö¸¦ Ç¥½Ã	
  bool 	m_bJumpstart;	// Á¡ÇÁ¸¦ ÇÒ ¼ö ÀÖ´Â »óÅ ÀÎÁö¸¦ Ç¥½Ã

  float 	m_fGravity;
  float 	m_fHightPos;
  float	m_fJumpStartTime;
  float 	m_fJumpTime;
  float	m_fJumpTimeMAX;
}
-----------------------------------------------------------------------------------
const float DEF_JumpGHIGHTRAVITY = 1600.0f;
const float DEF_JumpRAD = PI * 0.5;	// 90µµ
const float DEF_JumpMAX = 12.0f;	// jump½Ã ÃÖ°í Á¤Á¡ÀÇ ³ôÀÌ

void className::StartJump()	
{ 
  if( m_bJumpstart == true )	
    return;

  CPlayer * pkPlayer = GetPlayer();
  _TKASSERT( pkPlayer );
  
  m_pSavePosition = pkPlayer->GetWorldTranslate();

  ControllerSequence* pkSequence = pkPlayer->GetSequence(Animation_jump);
  m_fJumpTimeMAX = pkSequence->GetLength() * 1.1f;
  m_fJumpTime = m_fJumpTimeMAX * 0.5f;
  m_fJumpStartTime = GetCurTime();

  m_bJumpstart = true;
  m_bJump02 = true;
}

bool className::UpDate()
{
  ...
  // Á¡ÇÁ ¹× ³«ÇÏ ºÎºÐ - Sin°î¼±À» µû¶ó¼­ »ó½Â ÈÄ Á¤Á¡¿¡¼­ ÇÔ¼ö »ç¿ëÇؼ­ ³«ÇÏ
  //=========================================================================================
  float fjumptime = GetCurTime() - m_fJumpStartTime;

  if( m_bJump02 )	  // Á¡ÇÁ½Ã »ó½Â ±¸°£
  {
    float fjumpRAD = (fjumptime/m_fJumpTime) * DEF_JumpRAD;

    if( fjumptime < m_fJumpTime )	// »ó½Â Áß
    {
      m_fHightPos = Sin(fjumpRAD) * DEF_JumpMAX;
      m_fHightPos += m_vSavePosition.z;
    }
    else		// ÃÖ°í Á¤Á¡ºÎºÐ
    {
      m_fHightPos = m_vSavePosition.z + DEF_JumpMAX;
      m_bJump02 = false;
    }		
  }
  else  //Á¡ÇÁ°¡ ¾Æ´Ò¶§ ³«ÇÏ
  {
    if((oldTrans.z - kNewTrans.z) < 2.0f)
    {
      m_fHightPos = kNewTrans.z;
      oldTrans = kNewTrans;
    }

    if(m_fHightPos > kNewTrans.z)
    {
      m_fGravity += (DEF_JumpGHIGHTRAVITY * ((fDelta*fDelta)*0.5));
      m_fHightPos  -= m_fGravity;
    }
    else	// if(m_fHightPos <= kNewTrans.z)
    {
      m_fHightPos = kNewTrans.z;
      m_fGravity = 0.0f;
      m_bJumpstart = false;
      m_bJump02 = false;
    }
  }

  oldTrans.z = m_fHightPos;
}




{_r} ¸Þ¸ðÀåÀ¸·Î °¡±â