mirror of https://github.com/axmolengine/axmol.git
commit
33b857c3f7
|
@ -367,6 +367,7 @@ bool CCLens3D::initWithDuration(float duration, const CCSize& gridSize, const CC
|
|||
setPosition(position);
|
||||
m_fRadius = radius;
|
||||
m_fLensEffect = 0.7f;
|
||||
m_bConcave = false;
|
||||
m_bDirty = true;
|
||||
|
||||
return true;
|
||||
|
@ -438,7 +439,7 @@ void CCLens3D::update(float time)
|
|||
{
|
||||
vect = ccpNormalize(vect);
|
||||
CCPoint new_vect = ccpMult(vect, new_r);
|
||||
v.z += ccpLength(new_vect) * m_fLensEffect;
|
||||
v.z += (m_bConcave ? -1.0f : 1.0f) * ccpLength(new_vect) * m_fLensEffect;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,9 @@ public:
|
|||
inline float getLensEffect(void) { return m_fLensEffect; }
|
||||
/** Set lens center position */
|
||||
inline void setLensEffect(float fLensEffect) { m_fLensEffect = fLensEffect; }
|
||||
|
||||
/** Set whether lens is concave */
|
||||
inline void setConcave(bool bConcave) { m_bConcave = bConcave; }
|
||||
|
||||
inline const CCPoint& getPosition(void) { return m_position; }
|
||||
void setPosition(const CCPoint& position);
|
||||
|
||||
|
@ -114,6 +116,8 @@ protected:
|
|||
float m_fRadius;
|
||||
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
|
||||
float m_fLensEffect;
|
||||
/** lens is concave. (true = concave, false = convex) default is convex i.e. false */
|
||||
bool m_bConcave;
|
||||
|
||||
bool m_bDirty;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue