115 auto listener = EventListenerTouchAllAtOnce::create();
118 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener,
this);
120 Size visibleSize = Director::getInstance()->getVisibleSize();
123 _camera = Camera::createPerspective(60,visibleSize.width/visibleSize.height,0.1f,200);
124 _camera->setCameraFlag(CameraFlag::USER1);
127 Terrain::DetailMap r(
"TerrainTest/dirt.jpg"),g(
"TerrainTest/Grass2.jpg",10),b(
"TerrainTest/road.jpg"),a(
"TerrainTest/GreenSkin.jpg",20);
129 Terrain::TerrainData data(
"TerrainTest/heightmap16.jpg",
"TerrainTest/alphamap.png",r,g,b,a,Size(32,32),40.0f,2);
130 _terrain = Terrain::create(data,Terrain::CrackFixedType::SKIRT);
136 _terrain->setLODDistance(64,128,192);
143 auto rootps = PUParticleSystem3D::create(
"Particle3D/scripts/mp_torch.pu");
144 rootps->setCameraMask((
unsigned short)CameraFlag::USER1);
145 rootps->setScale(30.0f);
146 rootps->startParticleSystem();
150 auto billboard = BillBoard::create(
"Images/btn-play-normal.png");
151 billboard->setPosition3D(Vec3(0,180,0));
152 billboard->setCameraMask((
unsigned short)CameraFlag::USER1);
155 auto animation = Animation3D::create(
"Sprite3DTest/girl.c3b",
"Take 001");
158 auto animate = Animate3D::create(animation);
159 _player->runAction(RepeatForever::create(animate));
163 _camera->setRotation3D(Vec3(-45,0,0));
Vec3 camera_offset(0, 45, 60)
static Player * create(const char *file, cocos2d::Camera *cam, cocos2d::Terrain *terrain)
void onTouchesEnd(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
cocos2d::Camera * _camera
cocos2d::Terrain * _terrain
void onTouchesBegan(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)