mirror of https://github.com/axmolengine/axmol.git
issue #1310: Fixed a bug that 3d effect can't be displayed correctly in retina mode.
This commit is contained in:
parent
33ea7905a5
commit
bd535c3c1c
|
@ -357,12 +357,6 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
|
|
||||||
case kCCDirectorProjection3D:
|
case kCCDirectorProjection3D:
|
||||||
{
|
{
|
||||||
//TODO: // reset the viewport if 3d proj & retina display
|
|
||||||
// if( CC_CONTENT_SCALE_FACTOR() != 1.0f )
|
|
||||||
// {
|
|
||||||
// glViewport((GLint)-size.width/2, (GLint)-size.height/2, (GLsizei)(size.width * CC_CONTENT_SCALE_FACTOR()), (GLsizei)(size.height * CC_CONTENT_SCALE_FACTOR()) );
|
|
||||||
// }
|
|
||||||
|
|
||||||
float zeye = this->getZEye();
|
float zeye = this->getZEye();
|
||||||
|
|
||||||
kmMat4 matrixPerspective, matrixLookup;
|
kmMat4 matrixPerspective, matrixLookup;
|
||||||
|
@ -374,16 +368,6 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
|
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
|
||||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
||||||
|
|
||||||
//TODO: if (m_pobOpenGLView && m_pobOpenGLView->isIpad() && m_pobOpenGLView->getMainScreenScale() > 1.0f)
|
|
||||||
// {
|
|
||||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, zeye-size.height/2, zeye+size.height/2);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.5f, 1500);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
|
||||||
kmGLMultMatrix(&matrixPerspective);
|
kmGLMultMatrix(&matrixPerspective);
|
||||||
|
|
||||||
kmGLMatrixMode(KM_GL_MODELVIEW);
|
kmGLMatrixMode(KM_GL_MODELVIEW);
|
||||||
|
|
|
@ -134,7 +134,7 @@ bool CCFlipX3D::initWithSize(const ccGridSize& gridSize, float duration)
|
||||||
if (gridSize.x != 1 || gridSize.y != 1)
|
if (gridSize.x != 1 || gridSize.y != 1)
|
||||||
{
|
{
|
||||||
// Grid size must be (1,1)
|
// Grid size must be (1,1)
|
||||||
CCAssert(0, "");
|
CCAssert(0, "Grid size must be (1,1)");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -402,9 +402,6 @@ void CCLens3D::setPosition(const CCPoint& pos)
|
||||||
{
|
{
|
||||||
if( ! CCPoint::CCPointEqualToPoint(pos, m_position) ) {
|
if( ! CCPoint::CCPointEqualToPoint(pos, m_position) ) {
|
||||||
m_position = pos;
|
m_position = pos;
|
||||||
m_positionInPixels.x = pos.x * CC_CONTENT_SCALE_FACTOR();
|
|
||||||
m_positionInPixels.y = pos.y * CC_CONTENT_SCALE_FACTOR();
|
|
||||||
|
|
||||||
m_bDirty = true;
|
m_bDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +418,7 @@ void CCLens3D::update(float time)
|
||||||
for (j = 0; j < m_sGridSize.y + 1; ++j)
|
for (j = 0; j < m_sGridSize.y + 1; ++j)
|
||||||
{
|
{
|
||||||
ccVertex3F v = originalVertex(ccg(i, j));
|
ccVertex3F v = originalVertex(ccg(i, j));
|
||||||
CCPoint vect = ccpSub(m_positionInPixels, ccp(v.x, v.y));
|
CCPoint vect = ccpSub(m_position, ccp(v.x, v.y));
|
||||||
CCFloat r = ccpLength(vect);
|
CCFloat r = ccpLength(vect);
|
||||||
|
|
||||||
if (r < m_fRadius)
|
if (r < m_fRadius)
|
||||||
|
@ -492,8 +489,6 @@ bool CCRipple3D::initWithPosition(const CCPoint& pos, float r, int wav, float am
|
||||||
void CCRipple3D::setPosition(const CCPoint& position)
|
void CCRipple3D::setPosition(const CCPoint& position)
|
||||||
{
|
{
|
||||||
m_position = position;
|
m_position = position;
|
||||||
m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR();
|
|
||||||
m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
|
CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
|
||||||
|
@ -528,7 +523,7 @@ void CCRipple3D::update(float time)
|
||||||
for (j = 0; j < (m_sGridSize.y+1); ++j)
|
for (j = 0; j < (m_sGridSize.y+1); ++j)
|
||||||
{
|
{
|
||||||
ccVertex3F v = originalVertex(ccg(i, j));
|
ccVertex3F v = originalVertex(ccg(i, j));
|
||||||
CCPoint vect = ccpSub(m_positionInPixels, ccp(v.x,v.y));
|
CCPoint vect = ccpSub(m_position, ccp(v.x,v.y));
|
||||||
CCFloat r = ccpLength(vect);
|
CCFloat r = ccpLength(vect);
|
||||||
|
|
||||||
if (r < m_fRadius)
|
if (r < m_fRadius)
|
||||||
|
@ -820,8 +815,6 @@ bool CCTwirl::initWithPosition(const CCPoint& pos, int t, float amp, const ccGri
|
||||||
void CCTwirl::setPosition(const CCPoint& position)
|
void CCTwirl::setPosition(const CCPoint& position)
|
||||||
{
|
{
|
||||||
m_position = position;
|
m_position = position;
|
||||||
m_positionInPixels.x = position.x * CC_CONTENT_SCALE_FACTOR();
|
|
||||||
m_positionInPixels.y = position.y * CC_CONTENT_SCALE_FACTOR();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCObject* CCTwirl::copyWithZone(CCZone *pZone)
|
CCObject* CCTwirl::copyWithZone(CCZone *pZone)
|
||||||
|
@ -851,7 +844,7 @@ CCObject* CCTwirl::copyWithZone(CCZone *pZone)
|
||||||
void CCTwirl::update(float time)
|
void CCTwirl::update(float time)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
CCPoint c = m_positionInPixels;
|
CCPoint c = m_position;
|
||||||
|
|
||||||
for (i = 0; i < (m_sGridSize.x+1); ++i)
|
for (i = 0; i < (m_sGridSize.x+1); ++i)
|
||||||
{
|
{
|
||||||
|
@ -865,10 +858,9 @@ void CCTwirl::update(float time)
|
||||||
CCFloat amp = 0.1f * m_fAmplitude * m_fAmplitudeRate;
|
CCFloat amp = 0.1f * m_fAmplitude * m_fAmplitudeRate;
|
||||||
CCFloat a = r * cosf( (CCFloat)M_PI/2.0f + time * (CCFloat)M_PI * m_nTwirls * 2 ) * amp;
|
CCFloat a = r * cosf( (CCFloat)M_PI/2.0f + time * (CCFloat)M_PI * m_nTwirls * 2 ) * amp;
|
||||||
|
|
||||||
CCPoint d;
|
CCPoint d = ccp(
|
||||||
|
sinf(a) * (v.y-c.y) + cosf(a) * (v.x-c.x),
|
||||||
d.x = sinf(a) * (v.y-c.y) + cosf(a) * (v.x-c.x);
|
cosf(a) * (v.y-c.y) - sinf(a) * (v.x-c.x));
|
||||||
d.y = cosf(a) * (v.y-c.y) - sinf(a) * (v.x-c.x);
|
|
||||||
|
|
||||||
v.x = c.x + d.x;
|
v.x = c.x + d.x;
|
||||||
v.y = c.y + d.y;
|
v.y = c.y + d.y;
|
||||||
|
|
|
@ -110,9 +110,6 @@ protected:
|
||||||
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
|
/** lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect */
|
||||||
float m_fLensEffect;
|
float m_fLensEffect;
|
||||||
|
|
||||||
/* @since v0.99.5 */
|
|
||||||
// CCPoint m_lastPosition;
|
|
||||||
CCPoint m_positionInPixels;
|
|
||||||
bool m_bDirty;
|
bool m_bDirty;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,9 +145,6 @@ protected:
|
||||||
int m_nWaves;
|
int m_nWaves;
|
||||||
float m_fAmplitude;
|
float m_fAmplitude;
|
||||||
float m_fAmplitudeRate;
|
float m_fAmplitudeRate;
|
||||||
|
|
||||||
/*@since v0.99.5*/
|
|
||||||
CCPoint m_positionInPixels;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief CCShaky3D action */
|
/** @brief CCShaky3D action */
|
||||||
|
@ -255,9 +249,6 @@ protected:
|
||||||
int m_nTwirls;
|
int m_nTwirls;
|
||||||
float m_fAmplitude;
|
float m_fAmplitude;
|
||||||
float m_fAmplitudeRate;
|
float m_fAmplitudeRate;
|
||||||
|
|
||||||
/*@since v0.99.5 */
|
|
||||||
CCPoint m_positionInPixels;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -89,7 +89,7 @@ bool CCGridBase::initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture,
|
||||||
CC_SAFE_RETAIN(m_pTexture);
|
CC_SAFE_RETAIN(m_pTexture);
|
||||||
m_bIsTextureFlipped = bFlipped;
|
m_bIsTextureFlipped = bFlipped;
|
||||||
|
|
||||||
const CCSize& texSize = m_pTexture->getContentSizeInPixels();
|
const CCSize& texSize = m_pTexture->getContentSize();
|
||||||
m_obStep.x = texSize.width / m_sGridSize.x;
|
m_obStep.x = texSize.width / m_sGridSize.x;
|
||||||
m_obStep.y = texSize.height / m_sGridSize.y;
|
m_obStep.y = texSize.height / m_sGridSize.y;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue