Пример #1
0
bool CSpaceRestrictionBridge::on_border					(const Fvector &position) const
{
	START_PROFILE("Restricted Object/Bridge/On Border");
	
	VERIFY					(ai().level_graph().valid_vertex_position(position));

	CLevelGraph::CPosition	pos = ai().level_graph().vertex_position(position);

	xr_vector<u32>::const_iterator E = object().border().end();
	xr_vector<u32>::const_iterator I = std::lower_bound	(
		object().border().begin(),
		object().border().end(),
		pos.xz(),
		CFindByXZ_predicate()
	);

	if ((I == E) || (ai().level_graph().vertex(*I)->position().xz() != pos.xz()))
		return			(false);

	for (I ; I != E; ++I) {
		if (ai().level_graph().vertex(*I)->position().xz() != pos.xz())
			break;

		if (_abs(ai().level_graph().vertex_plane_y(*I) - position.y) < 2.f)
			return	(true);
	}	

	return				(false);

	STOP_PROFILE;
}
Пример #2
0
IC	const Fvector vertex_position(const CLevelGraph::CPosition &Psrc, const Fbox &bb, const SAIParams &params)
{
	Fvector				Pdest;
	int	x,z, row_length;
	row_length			= iFloor((bb.max.z - bb.min.z)/params.fPatchSize + EPS_L + 1.5f);
	x					= Psrc.xz() / row_length;
	z					= Psrc.xz() % row_length;
	Pdest.x =			float(x)*params.fPatchSize + bb.min.x;
	Pdest.y =			(float(Psrc.y())/65535)*(bb.max.y-bb.min.y) + bb.min.y;
	Pdest.z =			float(z)*params.fPatchSize + bb.min.z;
	return				(Pdest);
}