当前位置: 首页>>代码示例>>C++>>正文


C++ Sprite3D::getScaleX方法代码示例

本文整理汇总了C++中Sprite3D::getScaleX方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite3D::getScaleX方法的具体用法?C++ Sprite3D::getScaleX怎么用?C++ Sprite3D::getScaleX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sprite3D的用法示例。


在下文中一共展示了Sprite3D::getScaleX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eye

void WTest3D::showSprite3D()
{
	//the assets are from the OpenVR demo
	//get the visible size.
	Size size = Director::getInstance()->getVisibleSize();
	float zeye = Director::getInstance()->getZEye();
	Vec3 eye(size.width / 2, size.height / 2.0f, zeye),
		center(size.width / 2, size.height / 2, 0.0f),
		up(0.0f, 1.0f, 0.0f);
	_camera = Camera::createPerspective(60, size.width / size.height, 100, 3000);// zeye + size.height / 2.0f);
	_camera->setCameraFlag(CameraFlag::USER1);
	//_camera->setPosition3D(Vec3(0, 25, 15));
	_camera->setPosition3D(eye + Vec3(0, 60, 10));
	//_camera->lookAt(center, up);
	//_camera->setRotation3D(Vec3(-35, 0, 0));
	//auto LightMapScene = Sprite3D::create("Sprite3DTest/boss1.obj");
	//LightMapScene->setTexture("Sprite3DTest/boss.png");
	//auto LightMapScene = Sprite3D::create("Sprite3DTest/aaaa.c3b");
	addChild(_camera);
	setCameraMask(2);

	std::string fileName = "Sprite3DTest/orc.c3b";
	//std::string fileName = "Sprite3DTest/cccc.c3b";
	for (int i = 0; i < 14; ++i)
	{
		auto LightMapScene = Sprite3D::create(fileName);
		LightMapScene->setScale(8);
		addChild(LightMapScene, 100 + i, 100 + i);

		LightMapScene->setRotation3D(Vec3(0, 180, 0));
		auto sc = LightMapScene->getScale();
		auto sz = LightMapScene->getContentSize();
		auto curY = _terrain->getHeight(Vec2(250 + i*(sc*sz.width - 150), 10));
		LightMapScene->setPosition3D(Vec3(250 + i*(sc*sz.width - 150), curY, 10));
	}

	for (int i = 0; i < 14; ++i)
	{
		auto LightMapScene = Sprite3D::create(fileName);
		LightMapScene->setScale(8);
		addChild(LightMapScene, 200 + i, 200 + i);

		LightMapScene->setRotation3D(Vec3(0, 0, 0));
		auto sc = LightMapScene->getScale();
		auto sz = LightMapScene->getContentSize();
		auto curY = _terrain->getHeight(Vec2(250 + i*(sc*sz.width - 150), -1500));
		LightMapScene->setPosition3D(Vec3(250 + i*(sc*sz.width - 150), curY, -1500));
	}

	for (int i = 0; i < 14; ++i)
	{
		auto LightMapScene = Sprite3D::create(fileName);
		LightMapScene->setScale(8);
		addChild(LightMapScene, 300 + i, 300 + i);

		LightMapScene->setRotation3D(Vec3(0, 90, 0));
		auto sc = LightMapScene->getScale();
		auto sz = LightMapScene->getContentSize();
		auto curY = _terrain->getHeight(Vec2(20, -400 - i * 80));
		LightMapScene->setPosition3D(Vec3(20, curY, -400 - i * 80));
	}

	for (int i = 0; i < 14; ++i)
	{
		auto LightMapScene = Sprite3D::create(fileName);
		LightMapScene->setScale(8);
		addChild(LightMapScene, 400 + i, 400 + i);

		LightMapScene->setRotation3D(Vec3(0, 270, 0));
		auto sc = LightMapScene->getScale();
		auto sz = LightMapScene->getContentSize();
		auto curY = _terrain->getHeight(Vec2(1200, -400 - i * 80));
		LightMapScene->setPosition3D(Vec3(1200, curY, -400 - i * 80));
	}

	//for (int i = 0; i < 10; ++i)
	//{
	//	auto LightMapScene = Sprite3D::create(fileName);
	//	LightMapScene->setScale(8);
	//	addChild(LightMapScene, i, i);

	//	LightMapScene->setRotation3D(Vec3(90, 180, 0));
	//	auto sc = LightMapScene->getScale();
	//	auto sz = LightMapScene->getContentSize();
	//	CCLOG("getContentSize().width = %f, getContentSize().height = %f",
	//		getContentSize().width, getContentSize().height);
	//	LightMapScene->setPosition3D(Vec3(200 + i*(sc*sz.width - 150), 100, -300));
	//}

	Sprite3D* temp = (Sprite3D*)getChildByTag(100 + 13);
	CCLOG("getPositionX() = %f, getPositionY() = %f, getPositionZ = %f",
		temp->getPositionX(), temp->getPositionY(), temp->getPositionZ());
	CCLOG("getScaleX() = %f, getScaleX() = %f, getScaleZ = %f",
		temp->getScaleX(), temp->getScaleY(), temp->getScaleZ());
	CCLOG("getContentSize().width = %f, getContentSize().height = %f",
		temp->getContentSize().width, temp->getContentSize().height);
	CCLOG("getAnchorPoint().x = %f, getAnchorPoint().y = %f",
		temp->getAnchorPoint().x, temp->getAnchorPoint().y);

	//actions
//.........这里部分代码省略.........
开发者ID:FrankZX,项目名称:HelloWorld,代码行数:101,代码来源:Test3D.cpp


注:本文中的Sprite3D::getScaleX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。