-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
I didn't find examples how to use avalon::graphics::DynamicLight and I created empty project with HelloWorld::init method like this.
So, I don't see dynamic lighting and/or shadows from sprite baba.png
bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
auto bg = Sprite::create("HelloWorld.png");
// position the sprite on the center of the screen
bg->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
bg->setScale(2, 2);
// add the sprite as a child to this layer
this->addChild(bg);
auto baba = Sprite::create("baba.png");
baba->cocos2d::Node::setPosition({visibleSize.width/2, visibleSize.height/2});
this->addChild(baba);
auto dynamicLight = avalon::graphics::DynamicLight::create();
dynamicLight->debugDrawEnabled = true;
dynamicLight->setShadowCasters(*baba);
dynamicLight->setPosition({visibleSize.width/2 + 40, visibleSize.height/2});
this->addChild(dynamicLight);
return true;
}Main question is. What do I wrong?
And another ones about signature of method:
void DynamicLight::setShadowCasters(Node& casters) Why casters is reference? Do we really need in copying here? And why casters are plural (may be list of Nodes expected here)?
Metadata
Metadata
Assignees
Labels
No labels