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


C++ const_entity_handle::find_logic_transform方法代码示例

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


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

示例1: interpolation

std::optional<transformr> interpolation_system::find_interpolated(const const_entity_handle handle) const {
	const auto id = handle.get_id();

	auto result = [&]() -> std::optional<transformr> {
		if (enabled) {
			if (const auto cache = mapped_or_nullptr(per_entity_cache, id)) {
				return cache->interpolated_transform;
			}
		}

		return handle.find_logic_transform();
	}();

	/*
		Here, we integerize the transform of the viewed entity, (and later possibly of the vehicle that it drives)
		so that the rendered player does not shake when exactly followed by the camera,
		which is also integerized for pixel-perfect rendering.

		Ideally we shouldn't do it here because it introduces more state, but that's about the simplest solution
		that doesn't make a mess out of rendering scripts for this special case.	

		Additionally, if someone does not use interpolation (there should be no need to disable it, really)
		they will still suffer from the problem of shaky controlled player. We don't have time for now to handle it better.
	*/

	if (id == id_to_integerize) {
		if (result) {
			result->pos.discard_fract();
		}
	}

	return result;
}
开发者ID:TeamHypersomnia,项目名称:Augmentations,代码行数:33,代码来源:interpolation_system.cpp

示例2: standard_confirm_go_to

void standard_confirm_go_to(const const_entity_handle match, const bool has_ctrl, editor_view& view, editor_view_ids& view_ids) {
	/* Confirm selection with quick search */

	if (match) {
		if (has_ctrl) {
			view_ids.selected_entities.emplace(match);
		}
		else {
			view_ids.selected_entities = { match };
		}

		if (!view.panned_camera.has_value()) {
			view.panned_camera = camera_eye();
		}

		if (const auto transform = match.find_logic_transform()) {
			view.panned_camera->transform.pos = transform->pos;
		}
		else {
			LOG("WARNING: transform of %x could not be found.", match);
		}
	}
}
开发者ID:TeamHypersomnia,项目名称:Augmentations,代码行数:23,代码来源:editor_go_to_gui.cpp


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