static affine2 billboard_texcoords(int x, int y, bool flip) { float x0 = 0.125f * x; float x1 = x0 + 0.125f; float y0 = 0.125f * y; float y1 = y0 + 0.125f; return flip ? affine2(glm::vec2(x1, y0), glm::vec2(x0, y1)) : affine2(glm::vec2(x0, y0), glm::vec2(x1, y1)); }
void UnitTrackingMarker::RenderTrackingShadow(BillboardTextureShape* renderer) { glm::vec2 destination = DestinationXXX(); glm::vec3 position = _battleView->GetBattleSimulator()->GetBattleMap()->GetHeightMap()->GetPosition(destination, 0); renderer->AddBillboard(position, 32, affine2(glm::vec2(0, 0), glm::vec2(1, 1))); }
void UnitTrackingMarker::RenderTrackingMarker(BillboardTextureShape* renderer) { if (_meleeTarget == nullptr) { glm::vec2 destination = DestinationXXX(); glm::vec3 position = _battleView->GetBattleSimulator()->GetBattleMap()->GetHeightMap()->GetPosition(destination, 0); glm::vec2 texsize(0.1875, 0.1875); // 48 / 256 glm::vec2 texcoord = texsize * glm::vec2(_unit->GetTeam() == _battleView->GetCommander()->GetTeam() ? 2 : 0, 2); renderer->AddBillboard(position, 32, affine2(texcoord, texcoord + texsize)); } }