-실시간 폭파 효과 예제-
void explode(ITerrainSceneNode* terrain, s32 indexMid, u8 nbBarrels, s32 size)
{
//printf("desired impact (%.2f,%.2f)\n", X, Z);
//elevation around impact. This array can be stored as raw image:
static const char eai[25]={
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 1, 2, 1, 0, // <- impact point vertex will be lowered by -2 units
0, 1, 1, 1, 0,
0, 0, 0, 0, 0
};
//ok lets get terrain vertices
for (u8 n=0; n<nbBarrels; n++)
{
//apply the crater transformation
int cpt = 0;
for (u8 v=0; v<5; v++)
for (u8 u=0; u<5; u++)
{
s32 index = indexMid - 2 * size + v*size - 2 + u;
RaiseTerrainVertex(terrain, index, eai[cpt++], false);
}
// force terrain render buffer to reload
//terrain->setPosition(terrain->getPosition());
//emit particles...
}
//shaking...
//play sound...
}
{
//printf("desired impact (%.2f,%.2f)\n", X, Z);
//elevation around impact. This array can be stored as raw image:
static const char eai[25]={
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
0, 1, 2, 1, 0, // <- impact point vertex will be lowered by -2 units
0, 1, 1, 1, 0,
0, 0, 0, 0, 0
};
//ok lets get terrain vertices
for (u8 n=0; n<nbBarrels; n++)
{
//apply the crater transformation
int cpt = 0;
for (u8 v=0; v<5; v++)
for (u8 u=0; u<5; u++)
{
s32 index = indexMid - 2 * size + v*size - 2 + u;
RaiseTerrainVertex(terrain, index, eai[cpt++], false);
}
// force terrain render buffer to reload
//terrain->setPosition(terrain->getPosition());
//emit particles...
}
//shaking...
//play sound...
}
'etc > irrlicht' 카테고리의 다른 글
일리히트엔진 강좌(irrlicht 강좌) (1) | 2010.06.06 |
---|---|
일리히트 초간단 멥툴소스 (0) | 2010.05.01 |
동적 반사 데모입니다.(소스포함) (0) | 2010.01.03 |
굴절데모입니다.(소스포함) (0) | 2010.01.03 |
물반사데모입니다.(소스포함) (0) | 2010.01.03 |