Make slipstream fade in smoothly
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7797 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ab619e93a5
commit
a92e888fbb
@ -252,6 +252,25 @@ void SlipStream::setIntensity(float f, const Kart *kart)
|
||||
// For real testing in game: this needs some tuning!
|
||||
m_node->setVisible(f!=0);
|
||||
MovingTexture::setSpeed(f, 0);
|
||||
|
||||
|
||||
int c = f*255;
|
||||
if (c > 255) c = 255;
|
||||
|
||||
const unsigned int bcount = m_node->getMesh()->getMeshBufferCount();
|
||||
for (unsigned int b=0; b<bcount; b++)
|
||||
{
|
||||
scene::IMeshBuffer* mb = m_node->getMesh()->getMeshBuffer(b);
|
||||
irr::video::S3DVertex* vertices = (video::S3DVertex*)mb->getVertices();
|
||||
for (unsigned int i=0; i<mb->getVertexCount(); i++)
|
||||
{
|
||||
const int color = c*(vertices[i].Color.getAlpha()/255.0f);
|
||||
vertices[i].Color.setRed( color );
|
||||
vertices[i].Color.setGreen( color );
|
||||
vertices[i].Color.setBlue( color );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
// For debugging: make the slip stream effect visible all the time
|
||||
m_node->setVisible(true);
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
Kart *m_kart;
|
||||
|
||||
/** The scene node. */
|
||||
scene::ISceneNode *m_node;
|
||||
scene::IMeshSceneNode *m_node;
|
||||
|
||||
/** The actual mesh. */
|
||||
scene::IMesh *m_mesh;
|
||||
|
Loading…
Reference in New Issue
Block a user