Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/graphics/CinemaManager.cpp
/* Copyright (C) 2022 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||
* This file is part of 0!A.D. | * This file is part of 0!A.D. | ||||
* | * | ||||
* 0!A.D. is free software: you can redistribute it and/or modify | * 0!A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0!A.D. is distributed in the hope that it will be useful, | * 0!A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | void CCinemaManager::DrawSpline(const RNSpline& spline, const CColor& splineColor, int smoothness) const | ||||
for (int i = 0; i <= smoothness; ++i) | for (int i = 0; i <= smoothness; ++i) | ||||
{ | { | ||||
const float time = start * i / spline.MaxDistance.ToFloat(); | const float time = start * i / spline.MaxDistance.ToFloat(); | ||||
line.emplace_back(spline.GetPosition(time)); | line.emplace_back(spline.GetPosition(time)); | ||||
} | } | ||||
g_Renderer.GetDebugRenderer().DrawLine(line, splineColor, 0.2f, false); | g_Renderer.GetDebugRenderer().DrawLine(line, splineColor, 0.2f, false); | ||||
// Height indicator | // Height indicator | ||||
if (g_Game && g_Game->GetWorld() && g_Game->GetWorld()->GetTerrain()) | if (g_Game && g_Game->GetWorld()) | ||||
{ | { | ||||
for (int i = 0; i <= smoothness; ++i) | for (int i = 0; i <= smoothness; ++i) | ||||
{ | { | ||||
const float time = start * i / spline.MaxDistance.ToFloat(); | const float time = start * i / spline.MaxDistance.ToFloat(); | ||||
const CVector3D tmp = spline.GetPosition(time); | const CVector3D tmp = spline.GetPosition(time); | ||||
const float groundY = g_Game->GetWorld()->GetTerrain()->GetExactGroundLevel(tmp.X, tmp.Z); | const float groundY = g_Game->GetWorld()->GetTerrain().GetExactGroundLevel(tmp.X, tmp.Z); | ||||
g_Renderer.GetDebugRenderer().DrawLine(tmp, CVector3D(tmp.X, groundY, tmp.Z), splineColor, 0.1f, false); | g_Renderer.GetDebugRenderer().DrawLine(tmp, CVector3D(tmp.X, groundY, tmp.Z), splineColor, 0.1f, false); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void CCinemaManager::DrawNodes(const RNSpline& spline, const CColor& nodeColor) const | void CCinemaManager::DrawNodes(const RNSpline& spline, const CColor& nodeColor) const | ||||
{ | { | ||||
for (const SplineData& node : spline.GetAllNodes()) | for (const SplineData& node : spline.GetAllNodes()) | ||||
Show All 27 Lines |
Wildfire Games · Phabricator