Fix another culling BS

This commit is contained in:
Miloslav Ciz 2025-03-29 17:24:26 +01:00
parent 252bf57e41
commit 8fe4f6b6aa
2 changed files with 64 additions and 17 deletions

66
data
View file

@ -11,26 +11,38 @@ overall structure
:-031 :fa19 :<031 :fa11 :<039I :fa11 :<621I- :f411 start roof
:A&0hI| :f171 :v&7h| :^Z7hI :f211 :^@6hJ- :xZ1h :m371 big gate
:=500 :fA16 :f51k
:=500 :fz16 :f51k
:=D01 :fp16
:=X07 :f41f
:_X07 :-X02 :f41m
:=X0u :f51q
:=00y :f51p
:=00W :fW14
:=30W :fT14
:=U0T :f414
:=W0S :f414 :=W0X :=T0V
:^a05- :ft11
:^X1l :f411 :^Y1uI :f311 jump ramps
:<X1n :f411 :<Y1uI :f311 :=X0n :f411 :'X0m :f411 jump ramps
bottom section
:=a05 :fu21 :^a25I :fu11 :'v03J :f112 :'s15L :'t15J
:,q242- :;q233 :-n03 :f812 :mh53
:,q242- :;q233 :-n03 :f812 :-q041 :f311 :-n031 :f211 :mh53
:;41ZJ :fR21 long wall top
:;91WL :fJ21 long wall top bottom
:xr1V :fa37
:n31W :f121 :=31X :f123 :=01W :f321 corner top left
diagonal corner top left
:=30U :f413 :=70V :=50T
:A50S :f131 :A60T :f131
:A70U :f131 :A80V :f131
:A41SI :f121 :A51TI :f121
:A61UI :f121 :A71VI :f121
:\81WJ| :f121
top section
:\w1ZL :f131 :\x1YI| :f131L
@ -43,11 +55,35 @@ top section
small house top
:-J3Y :f411 :~L1Y1 :<J3ZI :f411 :,K1Z2J :f211
:-J3Y :f411 :<J3ZI :f411 :,K1Z2J :f211 :^J0ZI :f311
:=M1Z2 :f121 :=J0Y1 :m443 :=I0X2 :=J0Y3
:x514 :f426
:=D06 :fk21 :nD06I :f121 :=D01 :fp21 :nD11I walls bottom
:=W06 :f12b :=&01 :f12g
top right corners
:AV0ZL :f131 :AW0YL :f131 :AX0XL :f131
:AY0WL :f131 :AZ0VL :f131 :A@0UL :f131
:A&0TL :f131 :AV1YJ :f121 :AW1XJ :f121
:AX1WJ :f121 :AY1VJ :f121 :AZ1UJ :f121
:A@1TJ :f121 :AS0VJ :f131 :AT0UJ :f131
:AU0TJ :f131 :AV0SJ :f131 :AW0RJ :f131
:AT1VL :f121 :AU1UL :f121 :AV1TL :f121
:AW1SL :f121 :AX1RL :f121
:=U1Z :f121 :\S1WL :f121
:=X0C2 :f13f :f21f :=&0C2 :f13h :=@0C2 :f11f right walls
left section
:=01P :f127 :=41P :f123 :\01O|L :f121 :\41OJ :f121
:\22L|I :m111 :\42G|I :m111 :\22C|I :m111
:~31I2 :~11G2
:=50y :f212 :A00yJ :A50AL :A60zL :A70yL
bowl
:'60rJ :f117 :^70rL- :f117 :^71rJ :f117 :|72rJ- :f117
:|82rL :f117 :|81rL- :f117 :'50rL :f117 :m437
@ -60,10 +96,14 @@ details
:=410 :f222
:]X1uL :f118
:]&1uJ :f118x\
#RLC1;00LC1;8bd6e314 0000622:01a1:0159:0031:0139:00b1:0143:0031:0069:0041:0093:0021:0069:0011:0085:0051:00e9:0071:0133:02c2:0038:001c:0162:0033:0141:0053:0021:00f3:0021:0139:0041:00a9:0051:0073:0041:00a9:0031:00d9:0021:01b5:0041:02d3:00d1:0043:0031:0033:0081:00a3:0041:02e9:0011:0145:0031:01d9:0021:00a3:0031:0079:0021
#BLC1;
#RLCtiny5;00LCtiny5;5c14d8b6 0000359:0128:0060:0118:01a0:0081:00a9:0051:0063:0061:0049:00e1:0029:0061:0063:0051:0093:0051:0129:0041:0043:0151:0033:0061:00f9:0041:0083:0021:0063:0071:0033:0041:0033:0081:0093:0041:0083:0021:00e5:0031:0023:0111:0049:0071:0033:0071:0010
#BLCtiny5;
#RLCtiny5;00LCtiny5;5c14d8b6 0000359:0128:0060:0118:01a0:0081:00a9:0051:0063:0061:0049:00e1:0029:0061:0063:0051:0093:0051:0129:0041:0043:0151:0033:0061:00f9:0041:0083:0021:0063:0071:0033:0041:0033:0081:0093:0041:0083:0021:00e5:0031:0023:0111:0049:0071:0033:0071:0010
#RLCtiny5;00LCtiny5;5c14d8b6 0000278:0011:00b3:0051:0089:0031:0079:00b1:0069:0061:0059:0021:0123:0031:0099:0021:0013:0151:0023:00b1:0099:0081:0093:0041:00b3:00b1:0053:0041:0033:0061:0033:0041:0165:0031:0123:0051:0089:0021:0043:0031:0049
:]&1uJ :f118
:>F01 :f316
:>00D :f513
:=b0W3 :fa14
:'W02L :f114
:=60I2 :f236 :^62IJ :f116 :^73IJ :f116 spectator seats
:|01z2L :f11e border left

View file

@ -519,8 +519,8 @@ S3L_Index _LCR_rendererAddMapVert(S3L_Unit x, S3L_Unit y, S3L_Unit z)
return LCR_renderer.mapModel.vertexCount - 1;
}
LCR_LOG0("couldn't add map vertex");
return 0;
LCR_LOG1("couldn't add vertex");
return 0;
}
void _LCR_rendererAddMapTri(S3L_Index a, S3L_Index b, S3L_Index c, uint8_t mat)
@ -538,6 +538,10 @@ void _LCR_rendererAddMapTri(S3L_Index a, S3L_Index b, S3L_Index c, uint8_t mat)
LCR_renderer.mapModel.triangleCount++;
}
else
{
LCR_LOG1("couldn't add triangle");
}
}
void _LCR_rendererSwapMapTris(unsigned int index1, unsigned int index2)
@ -894,8 +898,7 @@ uint8_t _LCR_buildMapModel(void)
for (int j = 0; j < LCR_currentMap.blockCount; ++j)
{
if (((j + 1) % LCR_SETTING_CULLING_PERIOD == 0) ||
(LCR_renderer.mapModel.triangleCount == LCR_SETTING_MAX_MAP_TRIANGLES))
if (((j + 1) % LCR_SETTING_CULLING_PERIOD == 0))
_LCR_cullHiddenMapTris();
S3L_Unit originOffset = -1 * LCR_MAP_SIZE_BLOCKS / 2 * LCR_RENDERER_UNIT;
@ -947,6 +950,10 @@ uint8_t _LCR_buildMapModel(void)
vi++;
else // 3 indices => create and add triangle
{
if (LCR_renderer.mapModel.triangleCount >=
LCR_SETTING_MAX_MAP_TRIANGLES)
_LCR_cullHiddenMapTris();
// don't add triangles completely at the boundary of the map
if (!edgeBits)
{