Merging r5975 through r6036 from trunk to ogl-es branch.
GLES drivers adapted, but only did make compile-tests. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6038 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
57
source/Irrlicht/CParticleScaleAffector.cpp
Normal file
57
source/Irrlicht/CParticleScaleAffector.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2010-2012 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "CParticleScaleAffector.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_PARTICLES_
|
||||
|
||||
#include "IAttributes.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
CParticleScaleAffector::CParticleScaleAffector(const core::dimension2df& scaleTo)
|
||||
: ScaleTo(scaleTo)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CParticleScaleAffector");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CParticleScaleAffector::affect (u32 now, SParticle *particlearray, u32 count)
|
||||
{
|
||||
for(u32 i=0;i<count;i++)
|
||||
{
|
||||
const u32 maxdiff = particlearray[i].endTime - particlearray[i].startTime;
|
||||
const u32 curdiff = now - particlearray[i].startTime;
|
||||
const f32 newscale = (f32)curdiff/maxdiff;
|
||||
particlearray[i].size = particlearray[i].startSize+ScaleTo*newscale;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CParticleScaleAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
|
||||
{
|
||||
out->addFloat("ScaleToWidth", ScaleTo.Width);
|
||||
out->addFloat("ScaleToHeight", ScaleTo.Height);
|
||||
}
|
||||
|
||||
|
||||
void CParticleScaleAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
|
||||
{
|
||||
ScaleTo.Width = in->getAttributeAsFloat("ScaleToWidth");
|
||||
ScaleTo.Height = in->getAttributeAsFloat("ScaleToHeight");
|
||||
}
|
||||
|
||||
|
||||
E_PARTICLE_AFFECTOR_TYPE CParticleScaleAffector::getType() const
|
||||
{
|
||||
return scene::EPAT_SCALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_PARTICLES_
|
Reference in New Issue
Block a user