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


C++ TransformNode::setLocalTransform方法代码示例

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


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

示例1: FontFamily


//.........这里部分代码省略.........
	light.setDirection(-light.getPosition().normalized());
	light.setCutoff(std::cos(math::radians<float>(30.0f)));
	light.setExponent(20.0f);

	plight.setColor(light.getColor());
	plight.setPosition(light.getPosition());
	plight.setAttenuation(light.getAttenuation());

	sun.setColor({1.0f, 1.0f, 1.0f});
	sun.setDirection(Vector<3, float>(0.75f, -0.5f, -1.0f).normalized());

	// Add lights to scene
	//scene.addChild(new SpotlightNode(&light));
	scene.addChild(new DirectionalLightNode(&sun));
	//scene.addChild(new PointLightNode(&plight));
	
	// Add geometry to scene
	scene.addChild(new GeometryNode(floor));

	GeometryNode* objectNode = nullptr;
	if (object->getSkeleton() && object->getSkeleton()->isLoaded())
	{
		// Pose
		const Skeleton* skeleton = object->getSkeleton().get();
		pose = new SkeletonPose(skeleton);
		objectNode = new RiggedGeometryNode(object, pose);
	}
	else
	{
		objectNode = new GeometryNode(object);
	}

	float objectHeight = (object->getAABB().getMax() - object->getAABB().getMin()).y;
	Vector<3, float> objectPosition = (object->getAABB().getMin() + object->getAABB().getMax()) * -0.5f;
	objectPosition.y += objectHeight * 0.5f;

	/*
	FogNode* fogNode = new FogNode();
	fogNode->setFogMode(FogMode::EXPONENTIAL_SQUARED);
	fogNode->setFogColor({1.0f, 1.0f, 1.0f});
	fogNode->setFogDensity(0.25f);
	scene.addChild(fogNode);
	*/

	SharedImage skyboxCubeMap = resourceContext->getImageManager()->load(
		"data/textures/cubemap_positive_x.tga",
		"data/textures/cubemap_negative_x.tga",
		"data/textures/cubemap_positive_y.tga",
		"data/textures/cubemap_negative_y.tga",
		"data/textures/cubemap_positive_z.tga",
		"data/textures/cubemap_negative_z.tga",
		true);
	SkyboxNode* skyboxNode = new SkyboxNode(skyboxCubeMap);
	scene.addChild(skyboxNode);

	camera.lookAt(
		{0.0f, objectHeight * 0.5f, 3.0f},
		{0.0f, objectHeight * 0.5f, 0.0f},
		{0.0f, 1.0f, 0.0f});
	camera.update();

	TransformNode* transform = new TransformNode();
	transform->setLocalTransform(
		Transform<float>(
			{objectPosition},
			{0, 0, 0, 1},
			{1.0f, 1.0f, 1.0f}));
	transform->addChild(objectNode);
	scene.addChild(transform);

	BillboardNode* billboardNode = new BillboardNode();
	billboardNode->setAlignment(BillboardAlignment::SCREEN);
	billboardNode->addChild(new GeometryNode(lightMesh));

	transform = new TransformNode();
	transform->setLocalTransform(
		Transform<float>(
			light.getPosition(),
			{0.0f, 0.0f, 0.0f, 1.0f},
			{1.0f, 1.0f, 1.0f}));
	transform->addChild(billboardNode);
	scene.addChild(transform);
	
	// Setup controls
	Keyboard* keyboard = getInputManager()->getKeyboard(0);
	moveForward = new KeyboardAction(keyboard, KeyCode::W);
	moveBack = new KeyboardAction(keyboard, KeyCode::S);
	strafeLeft = new KeyboardAction(keyboard, KeyCode::A);
	strafeRight = new KeyboardAction(keyboard, KeyCode::D);
	rollCW = new KeyboardAction(keyboard, KeyCode::E);
	rollCCW = new KeyboardAction(keyboard, KeyCode::Q);
	increaseAction = new KeyboardAction(keyboard, KeyCode::EQUALS);
	decreaseAction = new KeyboardAction(keyboard, KeyCode::MINUS);

	up = {0.0f, 1.0f, 0.0f};

	//graphicsContext->setClearColor({0.145f, 0.145f, 0.145f, 0.0f});
	
	getInputManager()->getMouse(0)->addObserver(this);
}
开发者ID:cjhoward,项目名称:ogf,代码行数:101,代码来源:basic-scene-example.cpp


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