Pack render side edges
This commit is contained in:
parent
1c064b8efb
commit
4ec010ec75
|
@ -981,26 +981,32 @@ short render_obj_list[MAX_RENDER_SEGS+N_EXTRA_OBJ_LISTS][OBJS_PER_SEG];
|
|||
|
||||
//Given two sides of segment, tell the two verts which form the
|
||||
//edge between them
|
||||
static const short Two_sides_to_edge[6][6][2] = {
|
||||
{ {-1,-1}, {3,7}, {-1,-1}, {2,6}, {6,7}, {2,3} },
|
||||
{ {3,7}, {-1,-1}, {0,4}, {-1,-1}, {4,7}, {0,3} },
|
||||
{ {-1,-1}, {0,4}, {-1,-1}, {1,5}, {4,5}, {0,1} },
|
||||
{ {2,6}, {-1,-1}, {1,5}, {-1,-1}, {5,6}, {1,2} },
|
||||
{ {6,7}, {4,7}, {4,5}, {5,6}, {-1,-1}, {-1,-1} },
|
||||
{ {2,3}, {0,3}, {0,1}, {1,2}, {-1,-1}, {-1,-1} }
|
||||
};
|
||||
typedef array<int_fast8_t, 2> se_array0;
|
||||
typedef array<se_array0, 6> se_array1;
|
||||
typedef array<se_array1, 6> se_array2;
|
||||
static const se_array2 Two_sides_to_edge = {{
|
||||
{{ {{-1,-1}}, {{3,7}}, {{-1,-1}}, {{2,6}}, {{6,7}}, {{2,3}} }},
|
||||
{{ {{3,7}}, {{-1,-1}}, {{0,4}}, {{-1,-1}}, {{4,7}}, {{0,3}} }},
|
||||
{{ {{-1,-1}}, {{0,4}}, {{-1,-1}}, {{1,5}}, {{4,5}}, {{0,1}} }},
|
||||
{{ {{2,6}}, {{-1,-1}}, {{1,5}}, {{-1,-1}}, {{5,6}}, {{1,2}} }},
|
||||
{{ {{6,7}}, {{4,7}}, {{4,5}}, {{5,6}}, {{-1,-1}}, {{-1,-1}} }},
|
||||
{{ {{2,3}}, {{0,3}}, {{0,1}}, {{1,2}}, {{-1,-1}}, {{-1,-1}} }}
|
||||
}};
|
||||
|
||||
//given an edge specified by two verts, give the two sides on that edge
|
||||
static const int Edge_to_sides[8][8][2] = {
|
||||
{ {-1,-1}, {2,5}, {-1,-1}, {1,5}, {1,2}, {-1,-1}, {-1,-1}, {-1,-1} },
|
||||
{ {2,5}, {-1,-1}, {3,5}, {-1,-1}, {-1,-1}, {2,3}, {-1,-1}, {-1,-1} },
|
||||
{ {-1,-1}, {3,5}, {-1,-1}, {0,5}, {-1,-1}, {-1,-1}, {0,3}, {-1,-1} },
|
||||
{ {1,5}, {-1,-1}, {0,5}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {0,1} },
|
||||
{ {1,2}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {2,4}, {-1,-1}, {1,4} },
|
||||
{ {-1,-1}, {2,3}, {-1,-1}, {-1,-1}, {2,4}, {-1,-1}, {3,4}, {-1,-1} },
|
||||
{ {-1,-1}, {-1,-1}, {0,3}, {-1,-1}, {-1,-1}, {3,4}, {-1,-1}, {0,4} },
|
||||
{ {-1,-1}, {-1,-1}, {-1,-1}, {0,1}, {1,4}, {-1,-1}, {0,4}, {-1,-1} },
|
||||
};
|
||||
typedef array<int_fast8_t, 2> es_array0;
|
||||
typedef array<es_array0, 8> es_array1;
|
||||
typedef array<es_array1, 8> es_array2;
|
||||
static const es_array2 Edge_to_sides = {{
|
||||
{{ {{-1,-1}}, {{2,5}}, {{-1,-1}}, {{1,5}}, {{1,2}}, {{-1,-1}}, {{-1,-1}}, {{-1,-1}} }},
|
||||
{{ {{2,5}}, {{-1,-1}}, {{3,5}}, {{-1,-1}}, {{-1,-1}}, {{2,3}}, {{-1,-1}}, {{-1,-1}} }},
|
||||
{{ {{-1,-1}}, {{3,5}}, {{-1,-1}}, {{0,5}}, {{-1,-1}}, {{-1,-1}}, {{0,3}}, {{-1,-1}} }},
|
||||
{{ {{1,5}}, {{-1,-1}}, {{0,5}}, {{-1,-1}}, {{-1,-1}}, {{-1,-1}}, {{-1,-1}}, {{0,1}} }},
|
||||
{{ {{1,2}}, {{-1,-1}}, {{-1,-1}}, {{-1,-1}}, {{-1,-1}}, {{2,4}}, {{-1,-1}}, {{1,4}} }},
|
||||
{{ {{-1,-1}}, {{2,3}}, {{-1,-1}}, {{-1,-1}}, {{2,4}}, {{-1,-1}}, {{3,4}}, {{-1,-1}} }},
|
||||
{{ {{-1,-1}}, {{-1,-1}}, {{0,3}}, {{-1,-1}}, {{-1,-1}}, {{3,4}}, {{-1,-1}}, {{0,4}} }},
|
||||
{{ {{-1,-1}}, {{-1,-1}}, {{-1,-1}}, {{0,1}}, {{1,4}}, {{-1,-1}}, {{0,4}}, {{-1,-1}} }},
|
||||
}};
|
||||
|
||||
//@@//perform simple check on tables
|
||||
//@@check_check()
|
||||
|
@ -1027,7 +1033,6 @@ static int find_seg_side(segment *seg,int *verts,int notside)
|
|||
int i;
|
||||
int vv0=-1,vv1=-1;
|
||||
int side0,side1;
|
||||
const int *eptr;
|
||||
int v0,v1;
|
||||
int *vp;
|
||||
|
||||
|
@ -1056,7 +1061,7 @@ static int find_seg_side(segment *seg,int *verts,int notside)
|
|||
if (vv0 == -1 || vv1 == -1)
|
||||
return -1;
|
||||
|
||||
eptr = Edge_to_sides[vv0][vv1];
|
||||
const auto &eptr = Edge_to_sides[vv0][vv1];
|
||||
|
||||
side0 = eptr[0];
|
||||
side1 = eptr[1];
|
||||
|
|
Loading…
Reference in a new issue