Pass std::span to rotate_list

This commit is contained in:
Kp 2023-02-04 19:21:25 +00:00
parent a582b4ee82
commit 1f5e9808e5
2 changed files with 4 additions and 9 deletions

View file

@ -27,6 +27,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "dxxsconf.h"
#include "3d.h"
#include <span>
#include <vector>
#include "objnum.h"
#include "fwd-object.h"
@ -128,13 +129,7 @@ void render_start_frame(void);
// Given a list of point numbers, rotate any that haven't been rotated
// this frame
g3s_codes rotate_list(fvcvertptr &vcvertptr, std::size_t nv, const vertnum_t *pointnumlist);
template <std::size_t N>
static inline g3s_codes rotate_list(fvcvertptr &vcvertptr, const std::array<vertnum_t, N> &a)
{
return rotate_list(vcvertptr, a.size(), &a[0]);
}
g3s_codes rotate_list(fvcvertptr &vcvertptr, std::span<const vertnum_t> pointnumlist);
#ifdef dsx
namespace dsx {

View file

@ -701,7 +701,7 @@ void render_start_frame()
}
//Given a lit of point numbers, rotate any that haven't been rotated this frame
g3s_codes rotate_list(fvcvertptr &vcvertptr, const std::size_t nv, const vertnum_t *const pointnumlist)
g3s_codes rotate_list(fvcvertptr &vcvertptr, const std::span<const vertnum_t> pointnumlist)
{
g3s_codes cc;
const auto current_generation = s_current_generation;
@ -710,7 +710,7 @@ g3s_codes rotate_list(fvcvertptr &vcvertptr, const std::size_t nv, const vertnum
? 0.0f /* unused */
: 2.0f * (static_cast<float>(timer_query()) / F1_0);
range_for (const auto pnum, unchecked_partial_range(pointnumlist, nv))
for (const auto pnum : pointnumlist)
{
auto &pnt = Segment_points[pnum];
if (pnt.p3_last_generation != current_generation)