2012 auto s = Director::getInstance()->getWinSize();
2015 std::string fileName =
"Sprite3DTest/ball.c3b";
2016 auto sprite = Sprite3D::create(fileName);
2017 sprite->setRotation3D(Vec3(0.0f, 180.0f, 0.0f));
2018 sprite->setScale(3);
2019 sprite->setPosition(Vec2(s.width / 2.f, s.height / 3.f));
2020 sprite->setTexture(
"Sprite3DTest/teapot.png");
2022 auto light1 = PointLight::create(Vec3(s.width * 0.2f, s.height * 0.8f, 100.0f), Color3B(200, 200, 200), 10000.0f);
2024 auto light2 = AmbientLight::create(Color3B(100, 100, 100));
2027 auto animation = Animation3D::create(fileName);
2030 auto animate = Animate3D::create(animation);
2031 auto act = RepeatForever::create(animate);
2033 sprite->runAction(act);
2039 fileName =
"Sprite3DTest/orc_jump.c3t";
2040 sprite = Sprite3D::create(fileName);
2041 sprite->setRotation3D(Vec3(0.0f, 180.0f, 0.0f));
2042 sprite->setScale(3);
2043 sprite->setPosition(Vec2(s.width / 2.f, s.height / 3.f));
2044 sprite->setVisible(
false);
2045 animation = Animation3D::create(fileName);
2048 auto animate = Animate3D::create(animation);
2049 auto act = RepeatForever::create(animate);
2051 sprite->runAction(act);