Make segment vertices unsigned

This commit is contained in:
Kp 2017-02-19 19:33:37 +00:00
parent 3e51705de6
commit 0f00cf51b0
10 changed files with 18 additions and 17 deletions

View file

@ -353,7 +353,7 @@ void assign_default_uvs_to_side(vsegptridx_t segp, int side);
void med_assign_uvs_to_side(vsegptridx_t con_seg, int con_common_side, vsegptr_t base_seg, int base_common_side, int abs_id1, int abs_id2);
// Create coordinate axes in orientation of specified segment, stores vertices at *vp.
void create_coordinate_axes_from_segment(vsegptr_t sp,array<int, 16> &vertnums);
void create_coordinate_axes_from_segment(vsegptr_t sp, array<unsigned, 16> &vertnums);
// Set Vertex_active to number of occurrences of each vertex.
// Set Num_vertices.

View file

@ -52,7 +52,7 @@ struct side_vertnum_list_t : array<int, 4> {};
struct vertex_array_list_t : array<int, 6> {};
struct vertex_vertnum_pair
{
int vertex, vertnum;
unsigned vertex, vertnum;
};
using vertex_vertnum_array_list = array<vertex_vertnum_pair, 6>;
}

View file

@ -115,10 +115,10 @@ void render_start_frame(void);
// Given a list of point numbers, rotate any that haven't been rotated
// this frame
g3s_codes rotate_list(std::size_t nv, const int *pointnumlist);
g3s_codes rotate_list(std::size_t nv, const unsigned *pointnumlist);
template <typename T, std::size_t N>
static inline g3s_codes rotate_list(const array<T, N> &a)
template <std::size_t N>
static inline g3s_codes rotate_list(const array<unsigned, N> &a)
{
return rotate_list(a.size(), &a[0]);
}

View file

@ -169,7 +169,7 @@ struct segment {
#if defined(DXX_BUILD_DESCENT_II)
uint8_t slide_textures;
#endif
array<int, MAX_VERTICES_PER_SEGMENT> verts; // vertex ids of 4 front and 4 back vertices
array<unsigned, MAX_VERTICES_PER_SEGMENT> verts; // vertex ids of 4 front and 4 back vertices
ubyte special; // what type of center this is
sbyte matcen_num; // which center segment is associated with.
#if defined(DXX_BUILD_DESCENT_I)

View file

@ -683,7 +683,7 @@ static void free_vert(int vert_num)
// -----------------------------------------------------------------------------
static void draw_coordinate_axes(void)
{
array<int, 16> Axes_verts;
array<unsigned, 16> Axes_verts;
vms_vector tvec;
range_for (auto &i, Axes_verts)

View file

@ -1492,7 +1492,7 @@ void init_all_vertices(void)
// -----------------------------------------------------------------------------
// Create coordinate axes in orientation of specified segment, stores vertices at *vp.
void create_coordinate_axes_from_segment(const vsegptr_t sp,array<int, 16> &vertnums)
void create_coordinate_axes_from_segment(const vsegptr_t sp, array<unsigned, 16> &vertnums)
{
vms_matrix rotmat;
vms_vector t;

View file

@ -104,7 +104,7 @@ namespace {
struct Edge_info
{
array<int, 2> verts; // 8 bytes
array<unsigned, 2> verts; // 8 bytes
array<uint8_t, 4> sides; // 4 bytes
array<segnum_t, 4> segnum; // 16 bytes // This might not need to be stored... If you can access the normals of a side.
ubyte flags; // 1 bytes // See the EF_??? defines above.

View file

@ -58,14 +58,14 @@ namespace {
class abs_vertex_lists_predicate
{
const array<int, MAX_VERTICES_PER_SEGMENT> &m_vp;
const array<unsigned, MAX_VERTICES_PER_SEGMENT> &m_vp;
const array<unsigned, 4> &m_sv;
public:
abs_vertex_lists_predicate(const vcsegptr_t segp, uint_fast32_t sidenum) :
m_vp(segp->verts), m_sv(Side_to_verts_int[sidenum])
{
}
int operator()(const uint_fast32_t vv) const
unsigned operator()(const uint_fast32_t vv) const
{
return m_vp[m_sv[vv]];
}
@ -80,7 +80,7 @@ public:
}
vertex_vertnum_pair operator()(const uint_fast32_t vv) const
{
return {this->abs_vertex_lists_predicate::operator()(vv), static_cast<int>(vv)};
return {this->abs_vertex_lists_predicate::operator()(vv), static_cast<unsigned>(vv)};
}
};

View file

@ -508,7 +508,8 @@ void set_dynamic_light(render_state_t &rstate)
auto &vp = Segments[segnum].verts;
range_for (const auto vnum, vp)
{
if (vnum<0 || vnum>Highest_vertex_index) {
if (vnum > Highest_vertex_index)
{
Int3(); //invalid vertex number
continue; //ignore it, and go on to next one
}

View file

@ -712,7 +712,7 @@ void render_start_frame()
}
//Given a lit of point numbers, rotate any that haven't been rotated this frame
g3s_codes rotate_list(std::size_t nv,const int *pointnumlist)
g3s_codes rotate_list(const std::size_t nv, const unsigned *const pointnumlist)
{
g3s_codes cc;
const auto current_generation = s_current_generation;
@ -746,7 +746,7 @@ g3s_codes rotate_list(std::size_t nv,const int *pointnumlist)
}
//Given a lit of point numbers, project any that haven't been projected
static void project_list(const array<int, 8> &pointnumlist)
static void project_list(const array<unsigned, 8> &pointnumlist)
{
range_for (const auto pnum, pointnumlist)
{
@ -893,7 +893,7 @@ constexpr array<
//given an edge, tell what side is on that edge
__attribute_warn_unused_result
static int find_seg_side(const vcsegptr_t seg,const array<int, 2> &verts,unsigned notside)
static int find_seg_side(const vcsegptr_t seg, const array<unsigned, 2> &verts, const unsigned notside)
{
if (notside >= MAX_SIDES_PER_SEGMENT)
throw std::logic_error("invalid notside");
@ -963,7 +963,7 @@ static bool compare_children(const vcsegptridx_t seg, sidenum_fast_t s0, sidenum
if (Side_opposite[s0] == s1)
return false;
//find normals of adjoining sides
const array<int, 2> edge_verts = {
const array<unsigned, 2> edge_verts = {
{seg->verts[Two_sides_to_edge[s0][s1][0]], seg->verts[Two_sides_to_edge[s0][s1][1]]}
};
if (edge_verts[0] == -1 || edge_verts[1] == -1)