mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13036 from fusijie/fix_12505
fix shader-basic testcase 'center' uniform error.
This commit is contained in:
commit
3cc039b063
|
@ -111,7 +111,10 @@ void ShaderNode::setPosition(const Vec2 &newPosition)
|
|||
{
|
||||
Node::setPosition(newPosition);
|
||||
auto position = getPosition();
|
||||
_center = Vec2(position.x * CC_CONTENT_SCALE_FACTOR(), position.y * CC_CONTENT_SCALE_FACTOR());
|
||||
auto frameSize = Director::getInstance()->getOpenGLView()->getFrameSize();
|
||||
auto visibleSize = Director::getInstance()->getVisibleSize();
|
||||
auto retinaFactor = Director::getInstance()->getOpenGLView()->getRetinaFactor();
|
||||
_center = Vec2(position.x * frameSize.width / visibleSize.width * retinaFactor, position.y * frameSize.height / visibleSize.height * retinaFactor);
|
||||
getGLProgramState()->setUniformVec2("center", _center);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue