Exemplo n.º 1
0
void UnitTrackingMarker::RenderTrackingFighters(VertexShape_3f_4f_1f* vertices)
{
	if (!_meleeTarget && !_missileTarget)
	{
		bool isBlue = _unit->GetTeam() == _battleView->GetCommander()->GetTeam();
		glm::vec4 color = isBlue ? glm::vec4(0, 0, 255, 16) / 255.0f : glm::vec4(255, 0, 0, 16) / 255.0f;

		glm::vec2 destination = DestinationXXX();
		//glm::vec2 orientation = _missileTarget ? _missileTarget->state.center : _orientation;

		BattleObjects::Formation formation = _unit->GetFormation();
		formation.SetDirection(GetFacing());

		glm::vec2 frontLeft = formation.GetFrontLeft(destination);

		int count = _unit->GetFighterCount();
		for (int index = 0; index < count; ++index)
		{
			BattleObjects::FighterAssignment assignment = _unit->GetFighterAssignment(index);
			glm::vec2 offsetRight = formation.towardRight * (float)assignment.file;
			glm::vec2 offsetBack = formation.towardBack * (float)assignment.rank;
			glm::vec3 p = _battleView->GetBattleSimulator()->GetBattleMap()->GetHeightMap()->GetPosition(frontLeft + offsetRight + offsetBack, 0.5);
			vertices->AddVertex(Vertex_3f_4f_1f(p, color, 3.0));
		}
	}
}
Exemplo n.º 2
0
void UnitTrackingMarker::RenderTrackingFighters(VertexShape_3f_4f_1f* vertices)
{
	if (!_meleeTarget && !_missileTarget)
	{
		bool isBlue = _unit->commander->GetTeam() == _battleView->GetCommander()->GetTeam();
		glm::vec4 color = isBlue ? glm::vec4(0, 0, 255, 16) / 255.0f : glm::vec4(255, 0, 0, 16) / 255.0f;

		glm::vec2 destination = DestinationXXX();
		//glm::vec2 orientation = _missileTarget ? _missileTarget->state.center : _orientation;

		Formation formation = _unit->formation;
		formation.SetDirection(GetFacing());

		glm::vec2 frontLeft = formation.GetFrontLeft(destination);

		for (Fighter* fighter = _unit->fighters, * end = fighter + _unit->fightersCount; fighter != end; ++fighter)
		{
			glm::vec2 offsetRight = formation.towardRight * (float)Unit::GetFighterFile(fighter);
			glm::vec2 offsetBack = formation.towardBack * (float)Unit::GetFighterRank(fighter);
			glm::vec3 p = _battleView->GetSimulator()->GetBattleMap()->GetHeightMap()->GetPosition(frontLeft + offsetRight + offsetBack, 0.5);
			vertices->AddVertex(Vertex_3f_4f_1f(p, color, 3.0));
		}
	}
}