1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
|
package io.github.moulberry.notenoughupdates.dungeons;
import com.google.common.collect.Iterables;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.util.NEUResourceManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.block.material.MapColor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.Shader;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.*;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.List;
public class DungeonMap {
private static final ResourceLocation GREEN_CHECK = new ResourceLocation("notenoughupdates:dungeon_map/green_check.png");
private static final ResourceLocation WHITE_CHECK = new ResourceLocation("notenoughupdates:dungeon_map/white_check.png");
private static final ResourceLocation QUESTION = new ResourceLocation("notenoughupdates:dungeon_map/question.png");
private static final ResourceLocation CROSS = new ResourceLocation("notenoughupdates:dungeon_map/cross.png");
private static final ResourceLocation ROOM_RED = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/red_room.png");
private static final ResourceLocation ROOM_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/brown_room.png");
private static final ResourceLocation ROOM_GRAY = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/gray_room.png");
private static final ResourceLocation ROOM_GREEN = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/green_room.png");
private static final ResourceLocation ROOM_PINK = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/pink_room.png");
private static final ResourceLocation ROOM_PURPLE = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/purple_room.png");
private static final ResourceLocation ROOM_YELLOW = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/yellow_room.png");
private static final ResourceLocation ROOM_ORANGE = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/orange_room.png");
private static final ResourceLocation CORRIDOR_RED = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/red_corridor.png");
private static final ResourceLocation CORRIDOR_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/brown_corridor.png");
private static final ResourceLocation CORRIDOR_GRAY = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/gray_corridor.png");
private static final ResourceLocation CORRIDOR_GREEN = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/green_corridor.png");
private static final ResourceLocation CORRIDOR_PINK = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/pink_corridor.png");
private static final ResourceLocation CORRIDOR_PURPLE = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/purple_corridor.png");
private static final ResourceLocation CORRIDOR_YELLOW = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/yellow_corridor.png");
private static final ResourceLocation CORRIDOR_ORANGE = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/orange_corridor.png");
private static final ResourceLocation DIVIDER_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/dividers_default/brown_divider.png");
private static final ResourceLocation CORNER_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/corners_default/brown_corner.png");
private final HashMap<RoomOffset, Room> roomMap = new HashMap<>();
private Color[][] colourMap = new Color[128][128];
private int startRoomX = -1;
private int startRoomY = -1;
private int connectorSize = 5;
private int roomSize = 0;
//private final List<MapDecoration> decorations = new ArrayList<>();
//private final List<MapDecoration> lastDecorations = new ArrayList<>();
private long lastDecorationsMillis = -1;
private long lastLastDecorationsMillis = -1;
private Map<String, MapPosition> playerEntityMapPositions = new HashMap<>();
private Map<String, MapPosition> playerMarkerMapPositions = new HashMap<>();
private Set<MapPosition> rawPlayerMarkerMapPositions = new HashSet<>();
private Map<String, MapPosition> playerMarkerMapPositionsLast = new HashMap<>();
private Map<String, ResourceLocation> playerSkinMap = new HashMap<>();
private class RoomOffset {
int x;
int y;
public RoomOffset(int x, int y) {
this.x = x;
this.y = y;
}
public RoomOffset left() {
return new RoomOffset(x-1, y);
}
public RoomOffset right() {
return new RoomOffset(x+1, y);
}
public RoomOffset up() {
return new RoomOffset(x, y-1);
}
public RoomOffset down() {
return new RoomOffset(x, y+1);
}
public RoomOffset[] getNeighbors() {
return new RoomOffset[]{left(), right(), up(), down()};
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RoomOffset that = (RoomOffset) o;
return x == that.x && y == that.y;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
}
private enum RoomConnectionType {
NONE, WALL, CORRIDOR, ROOM_DIVIDER
}
private class RoomConnection {
RoomConnectionType type;
Color colour;
public RoomConnection(RoomConnectionType type, Color colour) {
this.type = type;
this.colour = colour;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RoomConnection that = (RoomConnection) o;
return type == that.type &&
Objects.equals(colour, that.colour);
}
@Override
public int hashCode() {
return Objects.hash(type, colour);
}
}
private class Room {
Color colour = new Color(0, 0, 0, 0);
int tickColour = 0;
boolean fillCorner = false;
RoomConnection left = new RoomConnection(RoomConnectionType.NONE, new Color(0, true));
RoomConnection up = new RoomConnection(RoomConnectionType.NONE, new Color(0, true));
RoomConnection right = new RoomConnection(RoomConnectionType.NONE, new Color(0, true));
RoomConnection down = new RoomConnection(RoomConnectionType.NONE, new Color(0, true));
public void renderNoRotate(int roomSize, int connectorSize, int rotation) {
if(tickColour != 0) {
Color tick = new Color(tickColour, true);
ResourceLocation indicatorTex = null;
if(tick.getRed() == 255 && tick.getGreen() == 255 && tick.getBlue() == 255) {
indicatorTex = WHITE_CHECK;
} else if(tick.getRed() == 0 && tick.getGreen() == 124 && tick.getBlue() == 0) {
indicatorTex = GREEN_CHECK;
} else if(tick.getRed() == 13 && tick.getGreen() == 13 && tick.getBlue() == 13) {
indicatorTex = QUESTION;
} else if(tick.getRed() == 255 && tick.getGreen() == 0 && tick.getBlue() == 0) {
indicatorTex = CROSS;
}
if(indicatorTex != null) {
Minecraft.getMinecraft().getTextureManager().bindTexture(indicatorTex);
float x = 0;
float y = 0;
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterCheck) {
if(fillCorner) {
x += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation-45))*1.414f;
y += (roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation-45))*1.414;
}
if(down.type == RoomConnectionType.ROOM_DIVIDER && right.type != RoomConnectionType.ROOM_DIVIDER) {
x += -(roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation));
y += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation));
} else if(down.type != RoomConnectionType.ROOM_DIVIDER && right.type == RoomConnectionType.ROOM_DIVIDER) {
x += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation));
y += (roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation));
}
}
GlStateManager.translate(x, y, 0);
if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmOrientCheck) {
GlStateManager.rotate(-rotation+180, 0, 0, 1);
}
GlStateManager.pushMatrix();
GlStateManager.scale(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale,
NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale, 1);
Utils.drawTexturedRect(-5, -5, 10, 10, GL11.GL_NEAREST);
GlStateManager.popMatrix();
if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmOrientCheck) {
GlStateManager.rotate(rotation-180, 0, 0, 1);
}
GlStateManager.translate(-x, -y, 0);
}
}
}
public void render(int roomSize, int connectorSize) {
ResourceLocation roomTex = null;
if(colour.getRed() == 114 && colour.getGreen() == 67 && colour.getBlue() == 27) {
roomTex = ROOM_BROWN;
} else if(colour.getRed() == 65 && colour.getGreen() == 65 && colour.getBlue() == 65) {
roomTex = ROOM_GRAY;
} else if(colour.getRed() == 0 && colour.getGreen() == 124 && colour.getBlue() == 0) {
roomTex = ROOM_GREEN;
} else if(colour.getRed() == 242 && colour.getGreen() == 127 && colour.getBlue() == 165) {
roomTex = ROOM_PINK;
} else if(colour.getRed() == 178 && colour.getGreen() == 76 && colour.getBlue() == 216) {
roomTex = ROOM_PURPLE;
} else if(colour.getRed() == 255 && colour.getGreen() == 0 && colour.getBlue() == 0) {
roomTex = ROOM_RED;
} else if(colour.getRed() == 229 && colour.getGreen() == 229 && colour.getBlue() == 51) {
roomTex = ROOM_YELLOW;
} else if(colour.getRed() == 216 && colour.getGreen() == 127 && colour.getBlue() == 51) {
roomTex = ROOM_ORANGE;
}
if(roomTex != null) {
Minecraft.getMinecraft().getTextureManager().bindTexture(roomTex);
GlStateManager.color(1, 1, 1, 1);
Utils.drawTexturedRect(0, 0, roomSize, roomSize, GL11.GL_LINEAR);
} else {
Gui.drawRect(0, 0, roomSize, roomSize, colour.getRGB());
}
if(fillCorner) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(CORNER_BROWN);
Utils.drawTexturedRect(roomSize, roomSize, connectorSize, connectorSize, GL11.GL_NEAREST);
}
for(int k=0; k<2; k++) {
RoomConnection connection = down;
if(k == 1) connection = right;
if(connection.type == RoomConnectionType.NONE || connection.type == RoomConnectionType.WALL) continue;
ResourceLocation corridorTex = null;
if(connection.colour.getRed() == 114 && connection.colour.getGreen() == 67 && connection.colour.getBlue() == 27) {
corridorTex = connection.type == RoomConnectionType.CORRIDOR ? CORRIDOR_BROWN : DIVIDER_BROWN;
} else if(connection.colour.getRed() == 65 && connection.colour.getGreen() == 65 && connection.colour.getBlue() == 65) {
corridorTex = CORRIDOR_GRAY;
} else if(connection.colour.getRed() == 0 && connection.colour.getGreen() == 124 && connection.colour.getBlue() == 0) {
corridorTex = CORRIDOR_GREEN;
} else if(connection.colour.getRed() == 242 && connection.colour.getGreen() == 127 && connection.colour.getBlue() == 165) {
corridorTex = CORRIDOR_PINK;
} else if(connection.colour.getRed() == 178 && connection.colour.getGreen() == 76 && connection.colour.getBlue() == 216) {
corridorTex = CORRIDOR_PURPLE;
} else if(connection.colour.getRed() == 255 && connection.colour.getGreen() == 0 && connection.colour.getBlue() == 0) {
corridorTex = CORRIDOR_RED;
} else if(connection.colour.getRed() == 229 && connection.colour.getGreen() == 229 && connection.colour.getBlue() == 51) {
corridorTex = CORRIDOR_YELLOW;
} else if(connection.colour.getRed() == 216 && connection.colour.getGreen() == 127 && connection.colour.getBlue() == 51) {
corridorTex = CORRIDOR_ORANGE;
}
if(corridorTex == null) {
int xOffset = 0;
int yOffset = 0;
int width = 0;
int height = 0;
if(connection == right) {
xOffset = roomSize;
width = connectorSize;
height = roomSize;
if(connection.type == RoomConnectionType.CORRIDOR) {
height = 8;
yOffset += 4;
}
} else if(connection == down) {
yOffset = roomSize;
width = roomSize;
height = connectorSize;
if(connection.type == RoomConnectionType.CORRIDOR) {
width = 8;
xOffset += 4;
}
}
Gui.drawRect(xOffset, yOffset, xOffset+width, yOffset+height, connection.colour.getRGB());
} else {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(corridorTex);
GlStateManager.pushMatrix();
if(connection==right) {
GlStateManager.translate(roomSize/2f, roomSize/2f, 0);
GlStateManager.rotate(-90, 0, 0, 1);
GlStateManager.translate(-roomSize/2f, -roomSize/2f, 0);
}
Utils.drawTexturedRect(0, roomSize, roomSize, connectorSize, GL11.GL_NEAREST);
GlStateManager.popMatrix();
}
}
}
}
private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png");
public static Framebuffer mapFramebuffer1 = null;
public static Framebuffer mapFramebuffer2 = null;
public static Matrix4f projectionMatrix = null;
public static Shader mapShader = null;
private static Framebuffer checkFramebufferSizes(Framebuffer framebuffer, int width, int height) {
if(framebuffer == null || framebuffer.framebufferWidth != width || framebuffer.framebufferHeight != height) {
if(framebuffer == null) {
framebuffer = new Framebuffer(width, height, true);
} else {
framebuffer.createBindFramebuffer(width, height);
}
framebuffer.setFramebufferFilter(GL11.GL_NEAREST);
}
return framebuffer;
}
private static void upload(Shader shader, int width, int height, int scale, float radiusSq) {
if(shader == null) return;
shader.getShaderManager().getShaderUniformOrDefault("ProjMat").set(projectionMatrix);
shader.getShaderManager().getShaderUniformOrDefault("InSize").set(width*scale, height*scale);
shader.getShaderManager().getShaderUniformOrDefault("OutSize").set(width, height);
shader.getShaderManager().getShaderUniformOrDefault("ScreenSize").set((float)width, (float)height);
shader.getShaderManager().getShaderUniformOrDefault("radiusSq").set(radiusSq);
}
public int getRenderRoomSize() {
double roomSizeOption = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmRoomSize;
if(roomSizeOption <= 0) return 12;
return 12 + (int)Math.round(roomSizeOption*4);
}
public int getRenderConnSize() {
int roomSizeOption = (int)Math.round(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmRoomSize);
if(roomSizeOption <= 0) return 3;
return 3 + roomSizeOption;
}
private HashMap<Integer, Float> borderRadiusCache = new HashMap<>();
public float getBorderRadius() {
int borderSizeOption = Math.round(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize);
String sizeId = borderSizeOption == 0 ? "small" : borderSizeOption == 2 ? "large" : "medium";
int style = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderStyle;
if(borderRadiusCache.containsKey(style)) {
return borderRadiusCache.get(style);
}
try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+style+".json")).getInputStream(), StandardCharsets.UTF_8))) {
JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class);
float radiusSq = json.get("radiusSq").getAsFloat();
borderRadiusCache.put(style, radiusSq);
return radiusSq;
} catch(Exception ignored) { }
borderRadiusCache.put(style, 1f);
return 1f;
}
public void render(int centerX, int centerY) {
boolean useFb = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCompat <= 1 && OpenGlHelper.isFramebufferEnabled();
boolean useShd = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCompat <= 0 && OpenGlHelper.areShadersSupported();
/*if((useFb && !OpenGlHelper.isFramebufferEnabled()) || (useShd && !OpenGlHelper.areShadersSupported())) {
Utils.drawStringCentered(EnumChatFormatting.RED+"NEU Dungeon Map requires framebuffers & shaders",
Minecraft.getMinecraft().fontRendererObj, centerX, centerY-10, true, 0);
Utils.drawStringCentered(EnumChatFormatting.RED+"Turn off Optifine Fast Render",
Minecraft.getMinecraft().fontRendererObj, centerX, centerY, true, 0);
Utils.drawStringCentered(EnumChatFormatting.RED+"If that doesn't work, join NEU discord for support",
Minecraft.getMinecraft().fontRendererObj, centerX, centerY+10, true, 0);
return;
}*/
ScaledResolution scaledResolution = Utils.pushGuiScale(2);
int minRoomX = 999;
int minRoomY = 999;
int maxRoomX = -999;
int maxRoomY = -999;
for(RoomOffset offset : roomMap.keySet()) {
minRoomX = Math.min(offset.x, minRoomX);
minRoomY = Math.min(offset.y, minRoomY);
maxRoomX = Math.max(offset.x, maxRoomX);
maxRoomY = Math.max(offset.y, maxRoomY);
}
int borderSizeOption = Math.round(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize);
int renderRoomSize = getRenderRoomSize();
int renderConnSize = getRenderConnSize();
MapPosition playerPos = null;
if(playerEntityMapPositions.containsKey(Minecraft.getMinecraft().thePlayer.getName())) {
playerPos = playerEntityMapPositions.get(Minecraft.getMinecraft().thePlayer.getName());
} else if(playerMarkerMapPositions.containsKey(Minecraft.getMinecraft().thePlayer.getName())) {
playerPos = playerMarkerMapPositions.get(Minecraft.getMinecraft().thePlayer.getName());
}
int rotation = 180;
if(playerPos != null && NotEnoughUpdates.INSTANCE.config.dungeonMap.dmRotatePlayer) {
rotation = (int)playerPos.rotation;
}
int mapSizeX;
int mapSizeY;
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderStyle <= 1) {
mapSizeX = 80 + Math.round(40*NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize);
} else {
mapSizeX = borderSizeOption == 0 ? 90 : borderSizeOption == 1 ? 120 : borderSizeOption == 2 ? 160 : 240;
}
mapSizeY = mapSizeX;
int roomsSizeX = (maxRoomX-minRoomX)*(renderRoomSize+renderConnSize)+renderRoomSize;
int roomsSizeY = (maxRoomY-minRoomY)*(renderRoomSize+renderConnSize)+renderRoomSize;
int mapCenterX = mapSizeX/2;
int mapCenterY = mapSizeY/2;
int scaleFactor = 8;
projectionMatrix = Utils.createProjectionMatrix(mapSizeX*scaleFactor, mapSizeY*scaleFactor);
mapFramebuffer1 = checkFramebufferSizes(mapFramebuffer1, mapSizeX*scaleFactor, mapSizeY*scaleFactor);
mapFramebuffer2 = checkFramebufferSizes(mapFramebuffer2, mapSizeX*scaleFactor, mapSizeY*scaleFactor);
mapFramebuffer1.framebufferColor[1] = 0;
mapFramebuffer1.framebufferColor[2] = 0;
try {
if(mapShader == null) {
mapShader = new Shader(new NEUResourceManager(Minecraft.getMinecraft().getResourceManager()),
"dungeonmap", mapFramebuffer1, mapFramebuffer2);
}
} catch(Exception e) {
e.printStackTrace();
Utils.pushGuiScale(-1);
return;
}
int backgroundColour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundColour);
mapFramebuffer1.framebufferColor[0] = ((backgroundColour >> 16) & 0xFF)/255f;
mapFramebuffer1.framebufferColor[1] = ((backgroundColour >> 8) & 0xFF)/255f;
mapFramebuffer1.framebufferColor[2] = (backgroundColour & 0xFF)/255f;
mapFramebuffer2.framebufferColor[0] = ((backgroundColour >> 16) & 0xFF)/255f;
mapFramebuffer2.framebufferColor[1] = ((backgroundColour >> 8) & 0xFF)/255f;
mapFramebuffer2.framebufferColor[2] = (backgroundColour & 0xFF)/255f;
try {
if(useFb) {
mapFramebuffer1.framebufferClear();
mapFramebuffer2.framebufferClear();
}
GlStateManager.pushMatrix(); {
if(useFb) {
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, mapSizeX*scaleFactor, mapSizeY*scaleFactor, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.scale(scaleFactor, scaleFactor, 1);
mapFramebuffer1.bindFramebuffer(true);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
} else {
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor((centerX-mapSizeX/2)*2, Minecraft.getMinecraft().displayHeight-(centerY+mapSizeY/2)*2, mapSizeX*2, mapSizeY*2);
GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 100);
}
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
GlStateManager.translate(-centerX+mapSizeX/2, -centerY+mapSizeY/2, 0);
BackgroundBlur.renderBlurredBackground(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur,
scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
centerX-mapSizeX/2, centerY-mapSizeY/2, mapSizeX, mapSizeY);
BackgroundBlur.markDirty();
GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 0);
}
GlStateManager.translate(mapCenterX, mapCenterY, 10);
if(!useFb || NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
Utils.drawRectNoBlend(-mapCenterX, -mapCenterY, mapCenterX, mapCenterY, backgroundColour);
GlStateManager.rotate(-rotation+180, 0, 0, 1);
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterPlayer && playerPos != null) {
float x = playerPos.getRenderX();
float y = playerPos.getRenderY();
x -= minRoomX*(renderRoomSize+renderConnSize);
y -= minRoomY*(renderRoomSize+renderConnSize);
GlStateManager.translate(-x, -y, 0);
} else {
GlStateManager.translate(-roomsSizeX/2, -roomsSizeY/2, 0);
}
for(Map.Entry<RoomOffset, Room> entry : roomMap.entrySet()) {
RoomOffset roomOffset = entry.getKey();
Room room = entry.getValue();
int x = (roomOffset.x-minRoomX)*(renderRoomSize+renderConnSize);
int y = (roomOffset.y-minRoomY)*(renderRoomSize+renderConnSize);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
room.render(renderRoomSize, renderConnSize);
GlStateManager.translate(-x, -y, 0);
GlStateManager.popMatrix();
}
GlStateManager.translate(-mapCenterX+roomsSizeX/2f, -mapCenterY+roomsSizeY/2f, 0);
GlStateManager.translate(mapCenterX, mapCenterY, 0);
GlStateManager.rotate(rotation-180, 0, 0, 1);
GlStateManager.translate(-mapCenterX, -mapCenterY, 0);
GlStateManager.translate(mapCenterX, mapCenterY, 0);
for(Map.Entry<RoomOffset, Room> entry : roomMap.entrySet()) {
RoomOffset roomOffset = entry.getKey();
Room room = entry.getValue();
float x = (roomOffset.x-minRoomX)*(renderRoomSize+renderConnSize)-roomsSizeX/2f+renderRoomSize/2f;
float y = (roomOffset.y-minRoomY)*(renderRoomSize+renderConnSize)-roomsSizeY/2f+renderRoomSize/2f;
float x2 = (float)(-x*Math.cos(Math.toRadians(-rotation)) + y*Math.sin(Math.toRadians(-rotation)));
float y2 = (float)(-x*Math.sin(Math.toRadians(-rotation)) - y*Math.cos(Math.toRadians(-rotation)));
GlStateManager.pushMatrix();
GlStateManager.translate(x2, y2, 0);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
room.renderNoRotate(renderRoomSize, renderConnSize, rotation);
GlStateManager.translate(-x2, -y2, 0);
GlStateManager.popMatrix();
}
GlStateManager.translate(-mapCenterX, -mapCenterY, 0);
GlStateManager.translate(mapCenterX, mapCenterY, 0);
GlStateManager.rotate(-rotation+180, 0, 0, 1);
GlStateManager.translate(-mapCenterX, -mapCenterY, 0);
GlStateManager.translate(mapCenterX-roomsSizeX/2f, mapCenterY-roomsSizeY/2f, 0);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
int k = 0;
for(Map.Entry<String, MapPosition> entry : playerMarkerMapPositions.entrySet()) {
String name = entry.getKey();
MapPosition pos = entry.getValue();
float x = pos.getRenderX();
float y = pos.getRenderY();
float angle = pos.rotation;
boolean doInterp = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerInterp;
if(!isFloorOne && playerEntityMapPositions.containsKey(name)) {
MapPosition entityPos = playerEntityMapPositions.get(name);
angle = entityPos.rotation;
float deltaX = entityPos.getRenderX() - pos.getRenderX();
float deltaY = entityPos.getRenderY() - pos.getRenderY();
/*if(deltaX > (renderRoomSize + renderConnSize)/2) {
deltaX -= (renderRoomSize + renderConnSize);
} else if(deltaX < -(renderRoomSize + renderConnSize)/2) {
deltaX += (renderRoomSize + renderConnSize);
}
if(deltaY > (renderRoomSize + renderConnSize)/2) {
deltaY -= (renderRoomSize + renderConnSize);
} else if(deltaY < -(renderRoomSize + renderConnSize)/2) {
deltaY += (renderRoomSize + renderConnSize);
}*/
x += deltaX;
y += deltaY;
doInterp = false;
}
float minU = 3/4f;
float minV = 0;
if(name.equals(Minecraft.getMinecraft().thePlayer.getName())) {
minU = 1/4f;
}
float maxU = minU + 1/4f;
float maxV = minV + 1/4f;
if(doInterp && playerMarkerMapPositionsLast.containsKey(name)) {
MapPosition last = playerMarkerMapPositionsLast.get(name);
float xLast = last.getRenderX();
float yLast = last.getRenderY();
float distSq = (x-xLast) * (x-xLast) + (y-yLast) * (y-yLast);
if (distSq < renderRoomSize*renderRoomSize/4f) {
float angleLast = last.rotation;
if (angle > 180 && angleLast < 180) angleLast += 360;
if (angleLast > 180 && angle < 180) angle += 360;
float interpFactor = Math.round((System.currentTimeMillis() - lastDecorationsMillis) * 100f) / 100f / (lastDecorationsMillis - lastLastDecorationsMillis);
interpFactor = Math.max(0, Math.min(1, interpFactor));
x = xLast + (x - xLast) * interpFactor;
y = yLast + (y - yLast) * interpFactor;
angle = angleLast + (angle - angleLast) * interpFactor;
angle %= 360;
}
}
boolean blackBorder = false;
boolean headLayer = false;
int pixelWidth = 8;
int pixelHeight = 8;
if(renderRoomSize >= 24) {
pixelWidth = pixelHeight = 12;
}
GlStateManager.color(1, 1, 1, 1);
if((!NotEnoughUpdates.INSTANCE.config.dungeonMapOpen.showOwnHeadAsMarker ||
playerMarkerMapPositions.size() <= 1 || minU != 1/4f) &&
NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerHeads >= 1 &&
playerSkinMap.containsKey(entry.getKey())) {
Minecraft.getMinecraft().getTextureManager().bindTexture(playerSkinMap.get(entry.getKey()));
minU = 8/64f;
minV = 8/64f;
maxU = 16/64f;
maxV = 16/64f;
headLayer = true;
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerHeads >= 2) {
blackBorder = true;
}
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons);
}
x -= minRoomX*(renderRoomSize+renderConnSize);
y -= minRoomY*(renderRoomSize+renderConnSize);
GlStateManager.pushMatrix();
GlStateManager.disableDepth();
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.translate(x, y, -0.02F);
GlStateManager.scale(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale,
NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale, 1);
GlStateManager.rotate(angle, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(-0.5F, 0.5F, 0.0F);
if(blackBorder) {
Gui.drawRect(-pixelWidth/2-1,-pixelHeight/2-1, pixelWidth/2+1, pixelHeight/2+1, 0xff111111);
GlStateManager.color(1, 1, 1, 1);
}
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)).tex(minU, minV).endVertex();
worldrenderer.pos(pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)).tex(maxU, minV).endVertex();
worldrenderer.pos(pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)).tex(maxU, maxV).endVertex();
worldrenderer.pos(-pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)).tex(minU, maxV).endVertex();
tessellator.draw();
if(headLayer) {
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(minU+0.5f, minV).endVertex();
worldrenderer.pos(pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(maxU+0.5f, minV).endVertex();
worldrenderer.pos(pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(maxU+0.5f, maxV).endVertex();
worldrenderer.pos(-pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(minU+0.5f, maxV).endVertex();
tessellator.draw();
}
GlStateManager.popMatrix();
k--;
}
if(useFb) {
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
} else {
GL11.glDisable(GL11.GL_SCISSOR_TEST);
}
} GlStateManager.popMatrix();
if(useFb) {
Framebuffer renderFromBuffer = mapFramebuffer1;
if(useShd) {
GlStateManager.pushMatrix(); {
try {
upload(mapShader, mapSizeX, mapSizeY, scaleFactor, getBorderRadius());
mapShader.setProjectionMatrix(projectionMatrix);
mapShader.loadShader(0);
renderFromBuffer = mapFramebuffer2;
} catch(Exception e) {
}
} GlStateManager.popMatrix();
}
Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
Utils.pushGuiScale(2);
GlStateManager.translate(centerX, centerY, 100);
renderFromBuffer.bindFramebufferTexture();
Utils.drawTexturedRect(-mapSizeX/2, -mapSizeY/2, mapSizeX, mapSizeY,
0, 1, 1, 0, GL11.GL_NEAREST);
GlStateManager.bindTexture(0);
GlStateManager.translate(-centerX, -centerY, -100);
Utils.pushGuiScale(-1);
}
GlStateManager.translate(centerX, centerY, 100);
if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmChromaBorder) {
int colour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour);
Gui.drawRect(-mapCenterX-2, -mapCenterY-2, -mapCenterX, -mapCenterY,
colour); //topleft
Gui.drawRect(-mapCenterX-2, mapCenterY+2, -mapCenterX, mapCenterY,
SpecialColour.rotateHue(colour, -180)); //bottomleft
Gui.drawRect(mapCenterX, -mapCenterY-2, mapCenterX+2, mapCenterY,
SpecialColour.rotateHue(colour, -180)); //topright
Gui.drawRect(mapCenterX, mapCenterY, mapCenterX+2, mapCenterY+2,
colour); //bottomright
for(int i=0; i<20; i++) {
int start1 = SpecialColour.rotateHue(colour, -9*i);
int start2 = SpecialColour.rotateHue(colour, -9*i-9);
int end1 = SpecialColour.rotateHue(colour, -180-9*i);
int end2 = SpecialColour.rotateHue(colour, -180-9*i-9);
Utils.drawGradientRect(-mapCenterX-2, -mapCenterY+(int)(mapSizeY*(i/20f)), -mapCenterX,
-mapCenterY+(int)(mapSizeY*((i+1)/20f)), start1, start2); //left
Utils.drawGradientRect(mapCenterX, -mapCenterY+(int)(mapSizeX*(i/20f)), mapCenterX+2,
-mapCenterY+(int)(mapSizeX*((i+1)/20f)),
end1, end2); //right
Utils.drawGradientRectHorz(-mapCenterX+(int)(mapSizeX*(i/20f)), -mapCenterY-2,
-mapCenterX+(int)(mapSizeX*((i+1)/20f)), -mapCenterY, start1, start2); //top
Utils.drawGradientRectHorz(-mapCenterX+(int)(mapSizeX*(i/20f)),
mapCenterY, -mapCenterX+(int)(mapSizeX*((i+1)/20f)), mapCenterY+2,
end1, end2); //bottom
}
} else {
Gui.drawRect(-mapCenterX-2, -mapCenterY, -mapCenterX, mapCenterY,
SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //left
Gui.drawRect(mapCenterX, -mapCenterY, mapCenterX+2, mapCenterY,
SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //right
Gui.drawRect(-mapCenterX-2, -mapCenterY-2, mapCenterX+2, -mapCenterY,
SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //top
Gui.drawRect(-mapCenterX-2, mapCenterY, mapCenterX+2, mapCenterY+2,
SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //bottom
}
String sizeId = borderSizeOption == 0 ? "small" : borderSizeOption == 2 ? "large" : "medium";
ResourceLocation rl = new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+
NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderStyle+".png");
if(Minecraft.getMinecraft().getTextureManager().getTexture(rl) != TextureUtil.missingTexture) {
Minecraft.getMinecraft().getTextureManager().bindTexture(rl);
GlStateManager.color(1, 1, 1, 1);
int size = borderSizeOption == 0 ? 165 : borderSizeOption == 1 ? 220 : borderSizeOption == 2 ? 300 : 440;
Utils.drawTexturedRect(-size/2, -size/2, size, size, GL11.GL_NEAREST);
}
GlStateManager.translate(-centerX, -centerY, -100);
} catch(Exception e) {
e.printStackTrace();
Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
Minecraft.getMinecraft().entityRenderer.setupOverlayRendering();
}
Utils.pushGuiScale(-1);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.enableDepth();
}
public void updateRoomConnections(RoomOffset roomOffset) {
if(roomMap.containsKey(roomOffset)) {
Room room = roomMap.get(roomOffset);
int otherPixelFilled = 0;
int otherPixelColour = 0;
for(int xOff=0; xOff<roomSize; xOff++) {
for(int yOff=0; yOff<roomSize; yOff++) {
int x = startRoomX + roomOffset.x*(roomSize+connectorSize) + xOff;
int y = startRoomY + roomOffset.y*(roomSize+connectorSize) + yOff;
if(x > 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) {
Color c = colourMap[x][y];
if(!c.equals(room.colour)) {
if(otherPixelColour == c.getRGB()) {
otherPixelFilled++;
} else {
otherPixelFilled--;
if(otherPixelFilled <= 0) {
otherPixelFilled = 1;
otherPixelColour = c.getRGB();
}
}
}
}
}
}
room.tickColour = 0;
if((float)otherPixelFilled/roomSize/connectorSize > 0.05) {
room.tickColour = otherPixelColour;
}
for(int k=0; k<4; k++) {
Color colour = null;
int totalFilled = 0;
for(int i=0; i<roomSize; i++) {
for(int j=1; j<=connectorSize; j++) {
int x = startRoomX + roomOffset.x*(roomSize+connectorSize);
int y = startRoomY + roomOffset.y*(roomSize+connectorSize);
if(k == 0) {
x += i;
y -= j;
} else if(k == 1) {
x += roomSize+j-1;
y += i;
} else if(k == 2) {
x += i;
y += roomSize+j-1;
} else {
x -= j;
y += i;
}
if(x > 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) {
Color pixel = colourMap[x][y];
if(pixel.getAlpha() > 40) {
if(colour == null) {
colour = pixel;
totalFilled = 1;
} else {
if(colour.equals(pixel)) {
totalFilled++;
} else {
totalFilled--;
if(totalFilled <= 0) {
colour = pixel;
totalFilled = 1;
}
}
}
}
}
}
}
float proportionFilled = (float)totalFilled/roomSize/connectorSize;
RoomConnectionType type = RoomConnectionType.WALL;
if(proportionFilled > 0.8) {
type = RoomConnectionType.ROOM_DIVIDER;
} else if(proportionFilled > 0.1) {
type = RoomConnectionType.CORRIDOR;
}
if(k == 0) {
room.up = new RoomConnection(type, colour);
} else if(k == 1) {
room.right = new RoomConnection(type, colour);
} else if(k == 2) {
room.down = new RoomConnection(type, colour);
} else {
room.left = new RoomConnection(type, colour);
}
}
int x = startRoomX + roomOffset.x*(roomSize+connectorSize) + roomSize + connectorSize/2;
int y = startRoomY + roomOffset.y*(roomSize+connectorSize) + roomSize + connectorSize/2;
room.fillCorner = false;
if(x > 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) {
Color pixel = colourMap[x][y];
if(pixel.equals(room.colour)) {
room.fillCorner = true;
}
}
}
}
public void loadNeighbors(RoomOffset room) {
if(!roomMap.containsKey(room)) {
roomMap.put(room, new Room());
}
for(RoomOffset neighbor : room.getNeighbors()) {
if(!roomMap.containsKey(neighbor)) {
int x = startRoomX + neighbor.x*(roomSize+connectorSize);
int y = startRoomY + neighbor.y*(roomSize+connectorSize);
if(x >= 0 && y >= 0 && x+roomSize < colourMap.length && y+roomSize < colourMap[x].length) {
if(colourMap[x][y].getAlpha() > 100) {
roomMap.put(neighbor, new Room());
loadNeighbors(neighbor);
}
}
}
}
}
public void updateRoomColours() {
for(Map.Entry<RoomOffset, Room> entry : roomMap.entrySet()) {
int x = startRoomX + entry.getKey().x*(roomSize+connectorSize);
int y = startRoomY + entry.getKey().y*(roomSize+connectorSize);
try {
entry.getValue().colour = colourMap[x][y];
} catch(Exception e) {}
}
}
private class MapPosition {
public float roomOffsetX;
public float connOffsetX;
public float roomOffsetY;
public float connOffsetY;
public float rotation;
public MapPosition(float roomOffsetX, float connOffsetX, float roomOffsetY, float connOffsetY) {
this.roomOffsetX = roomOffsetX;
this.connOffsetX = connOffsetX;
this.roomOffsetY = roomOffsetY;
this.connOffsetY = connOffsetY;
}
public float getRenderX() {
return roomOffsetX*getRenderRoomSize() + connOffsetX*getRenderConnSize();
}
public float getRenderY() {
return roomOffsetY*getRenderRoomSize() + connOffsetY*getRenderConnSize();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MapPosition that = (MapPosition) o;
return Float.compare(that.roomOffsetX, roomOffsetX) == 0 &&
Float.compare(that.connOffsetX, connOffsetX) == 0 &&
Float.compare(that.roomOffsetY, roomOffsetY) == 0 &&
Float.compare(that.connOffsetY, connOffsetY) == 0 &&
Float.compare(that.rotation, rotation) == 0;
}
@Override
public int hashCode() {
return Objects.hash(roomOffsetX, connOffsetX, roomOffsetY, connOffsetY, rotation);
}
}
private boolean isFloorOne = false;
private boolean failMap = false;
private long lastClearCache = 0;
public void renderMap(int centerX, int centerY, Color[][] colourMap, Map<String, Vec4b> mapDecorations,
int roomSizeBlocks, Set<String> actualPlayers, boolean usePlayerPositions, float partialTicks) {
if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable) return;
if(colourMap == null) return;
if(colourMap.length != 128) return;
if(colourMap[0].length != 128) return;
this.colourMap = colourMap;
if(System.currentTimeMillis() - lastClearCache > 1000) {
roomMap.clear();
startRoomX = -1;
startRoomY = -1;
connectorSize = -1;
roomSize = -1;
borderRadiusCache.clear();
failMap = false;
lastClearCache = System.currentTimeMillis();
isFloorOne = false;
Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard();
ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
List<Score> scores = new ArrayList<>(scoreboard.getSortedScores(sidebarObjective));
for(int i=scores.size()-1; i>=0; i--) {
Score score = scores.get(i);
ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score.getPlayerName());
String line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.getPlayerName());
line = Utils.cleanColour(line);
if(line.contains("(F1)") || line.contains("(E)")) {
isFloorOne = true;
break;
}
}
}
if(failMap) {
return;
}
int alphaPixels = 0;
for(int x=0; x<128; x++) {
for(int y=0; y<128; y++) {
Color c = colourMap[x][y];
if(c == null) {
return;
} else if(c.getAlpha() < 50) {
alphaPixels++;
}
}
}
if(alphaPixels < 128*128/10) {
failMap = true;
return;
}
if(startRoomX < 0 || startRoomY < 0 || roomSize <= 0) {
for(int x=0; x<colourMap.length; x++) {
for(int y=0; y<colourMap[x].length; y++) {
Color c = colourMap[x][y];
if(c.getAlpha() > 80) {
if(startRoomX < 0 && startRoomY < 0 && c.getRed() == 0 && c.getGreen() == 124 && c.getBlue() == 0) {
roomSize = 0;
out:
for(int xd=0; xd<=20; xd++) {
for(int yd=0; yd<=20; yd++) {
if(x+xd >= colourMap.length || y+yd >= colourMap[x+xd].length) continue;
Color c2 = colourMap[x+xd][y+yd];
if(c2.getGreen() != 124 || c2.getAlpha() <= 80) {
if(xd < 10 && yd < 10) {
break out;
}
} else {
roomSize = Math.max(roomSize, Math.min(xd+1, yd+1));
}
if(xd == 20 && yd == 20) {
if(roomSize == 0) roomSize = 20;
startRoomX = x;
startRoomY = y;
}
}
}
}
}
}
}
}
if(startRoomX < 0 || startRoomY < 0) {
failMap = true;
return;
}
if(connectorSize <= 0) {
for(int i=0; i<roomSize; i++) {
for(int k=0; k<4; k++) {
for(int j=1; j<8; j++) {
int x;
int y;
if(k == 0) {
x = startRoomX+i;
y = startRoomY-j;
} else if(k == 1) {
x = startRoomX+roomSize+j-1;
y = startRoomY+i;
} else if(k == 2) {
x = startRoomX+i;
y = startRoomY+roomSize+j-1;
} else {
x = startRoomX-j;
y = startRoomY+i;
}
if(x > 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) {
if(colourMap[x][y].getAlpha() > 80) {
if(j == 1) {
break;
}
connectorSize = Math.min(connectorSize, j-1);
}
}
}
}
}
if(connectorSize <= 0) {
connectorSize = 4;
}
}
for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
if(player instanceof AbstractClientPlayer && actualPlayers.contains(player.getName())) {
AbstractClientPlayer aplayer = (AbstractClientPlayer) player;
ResourceLocation skin = aplayer.getLocationSkin();
if(skin != DefaultPlayerSkin.getDefaultSkin(aplayer.getUniqueID())) {
playerSkinMap.put(player.getName(), skin);
}
}
}
playerEntityMapPositions.clear();
if(usePlayerPositions) {
for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
if(actualPlayers.contains(player.getName())) {
float roomX = (float)player.posX / (roomSizeBlocks+1);
float roomY = (float)player.posZ / (roomSizeBlocks+1);
float playerRoomOffsetX = (float) Math.floor(roomX);
float playerConnOffsetX = (float) Math.floor(roomX);
float playerRoomOffsetY = (float) Math.floor(roomY);
float playerConnOffsetY = (float) Math.floor(roomY);
float roomXInBlocks = (float)player.posX % (roomSizeBlocks+1);
if(roomXInBlocks < 2) { //0,1
playerConnOffsetX -= 2/5f-roomXInBlocks/5f;
} else if(roomXInBlocks > roomSizeBlocks-2) { //31,30,29
playerRoomOffsetX++;
playerConnOffsetX += (roomXInBlocks - (roomSizeBlocks-2))/5f;
} else {
playerRoomOffsetX += (roomXInBlocks-2) / (roomSizeBlocks-4);
}
float roomYInBlocks = (float)player.posZ % (roomSizeBlocks+1);
if(roomYInBlocks < 2) { //0,1
playerConnOffsetY -= 2/5f-roomYInBlocks/5f;
} else if(roomYInBlocks > roomSizeBlocks-2) { //31,30,29
playerRoomOffsetY++;
playerConnOffsetY += (roomYInBlocks - (roomSizeBlocks-2))/5f;
} else {
playerRoomOffsetY += (roomYInBlocks-2) / (roomSizeBlocks-4);
}
playerRoomOffsetX -= startRoomX/(roomSize+connectorSize);
playerRoomOffsetY -= startRoomY/(roomSize+connectorSize);
playerConnOffsetX -= startRoomX/(roomSize+connectorSize);
playerConnOffsetY -= startRoomY/(roomSize+connectorSize);
MapPosition pos = new MapPosition(playerRoomOffsetX, playerConnOffsetX, playerRoomOffsetY, playerConnOffsetY);
pos.rotation = (player.prevRotationYawHead + (player.rotationYawHead-player.prevRotationYawHead)*partialTicks) % 360;
if(pos.rotation < 0) pos.rotation += 360;
playerEntityMapPositions.put(player.getName(), pos);
}
}
}
loadNeighbors(new RoomOffset(0, 0));
updateRoomColours();
for(RoomOffset offset : roomMap.keySet()) {
updateRoomConnections(offset);
}
if(roomMap.isEmpty()) {
failMap = true;
return;
}
if(mapDecorations != null && mapDecorations.size() > 0) {
List<MapPosition> positions = new ArrayList<>();
int decorations = 0;
for (Vec4b vec4b : mapDecorations.values()) {
byte id = vec4b.func_176110_a();
if(id != 1 && id != 3) continue;
float x = (float) vec4b.func_176112_b() / 2.0F + 64.0F;
float y = (float) vec4b.func_176113_c() / 2.0F + 64.0F;
if(x < 0 || y < 0 || x > 128 || y > 128) {
continue;
}
float deltaX = x - startRoomX;
float deltaY = y - startRoomY;
float roomsOffsetX = (int) Math.floor(deltaX / (roomSize + connectorSize));
float connOffsetX = (int) Math.floor(deltaX / (roomSize + connectorSize));
float xRemainder = deltaX % (roomSize + connectorSize);
if (Math.abs(xRemainder) > roomSize) {
roomsOffsetX += Math.copySign(1, xRemainder);
connOffsetX += Math.copySign(1, xRemainder) * (Math.abs(xRemainder) - roomSize) / connectorSize;
} else {
roomsOffsetX += xRemainder / roomSize;
}
if (deltaX < 0 && xRemainder != 0) {
roomsOffsetX++;
connOffsetX++;
}
float roomsOffsetY = (int) Math.floor(deltaY / (roomSize + connectorSize));
float connOffsetY = (int) Math.floor(deltaY / (roomSize + connectorSize));
float yRemainder = deltaY % (roomSize + connectorSize);
if (Math.abs(yRemainder) > roomSize) {
roomsOffsetY += Math.copySign(1, yRemainder);
connOffsetY += Math.copySign(1, yRemainder) * (Math.abs(yRemainder) - roomSize) / connectorSize;
} else {
roomsOffsetY += yRemainder / roomSize;
}
if (deltaY < 0 && yRemainder != 0) {
roomsOffsetY++;
connOffsetY++;
}
float angle = (float) (vec4b.func_176111_d() * 360) / 16.0F;
MapPosition pos = new MapPosition(roomsOffsetX, connOffsetX, roomsOffsetY, connOffsetY);
pos.rotation = angle % 360;
if(pos.rotation < 0) pos.rotation += 360;
if(decorations++ <= 6) {
positions.add(pos);
}
rawPlayerMarkerMapPositions.add(pos);
}
boolean different = playerMarkerMapPositions.size() != positions.size();
if (!different) {
for (MapPosition pos : playerMarkerMapPositions.values()) {
if (!positions.contains(pos)) {
different = true;
break;
}
}
}
if(different && positions.size() > 0) {
lastLastDecorationsMillis = lastDecorationsMillis;
lastDecorationsMillis = System.currentTimeMillis();
playerMarkerMapPositionsLast.clear();
for (Map.Entry<String, MapPosition> entry : playerMarkerMapPositions.entrySet()) {
playerMarkerMapPositionsLast.put(entry.getKey(), entry.getValue());
}
playerMarkerMapPositions.clear();
Set<String> foundPlayers = new HashSet<>();
for (Map.Entry<String, MapPosition> entry : playerEntityMapPositions.entrySet()) {
playerMarkerMapPositions.put(entry.getKey(), entry.getValue());
playerMarkerMapPositionsLast.put(entry.getKey(), entry.getValue());
foundPlayers.add(entry.getKey());
}
HashMap<String, HashMap<Integer, Float>> distanceMap = new HashMap<>();
for (Map.Entry<String, MapPosition> entry : playerMarkerMapPositionsLast.entrySet()) {
HashMap<Integer, Float> deltaDists = new HashMap<>();
for (int i = 0; i < positions.size(); i++) {
float dx = entry.getValue().getRenderX() - positions.get(i).getRenderX();
float dy = entry.getValue().getRenderY() - positions.get(i).getRenderY();
deltaDists.put(i, dx * dx + dy * dy);
}
distanceMap.put(entry.getKey(), deltaDists);
}
List<String> playerList = new ArrayList<>(playerMarkerMapPositionsLast.keySet());
List<List<String>> playerPermutations = permutations(playerList);
List<Integer> finalUsedIndexes = new ArrayList<>();
if (playerPermutations.size() > 0) {
HashMap<String, Integer> smallestPermutation = null;
float smallestTotalDistance = 0;
for (List<String> permutation : playerPermutations) {
HashMap<String, Integer> usedIndexes = new HashMap<>();
float totalDistance = 0;
for (String player : permutation) {
int smallestIndex = -1;
float smallestDist = 0;
for (Map.Entry<Integer, Float> entry : distanceMap.get(player).entrySet()) {
if (!usedIndexes.containsValue(entry.getKey())) {
if (smallestIndex == -1 || entry.getValue() < smallestDist) {
smallestIndex = entry.getKey();
smallestDist = entry.getValue();
}
}
}
if (smallestIndex != -1) {
usedIndexes.put(player, smallestIndex);
totalDistance += smallestDist;
}
}
if (smallestPermutation == null || totalDistance < smallestTotalDistance) {
smallestPermutation = usedIndexes;
smallestTotalDistance = totalDistance;
}
}
//System.out.println("--- PERM START ---");
for (Map.Entry<String, Integer> entry : smallestPermutation.entrySet()) {
//System.out.println(entry.getKey() + ":" + entry.getValue() + " : Total dist: " + smallestTotalDistance);
finalUsedIndexes.add(entry.getValue());
playerMarkerMapPositions.put(entry.getKey(), positions.get(entry.getValue()));
}
}
List<Integer> nonUsedIndexes = new ArrayList<>();
for(int i=0; i<positions.size(); i++) {
if(!finalUsedIndexes.contains(i)) {
nonUsedIndexes.add(i);
}
}
for(String missingPlayer : actualPlayers) {
if(!playerList.contains(missingPlayer)) {
if(nonUsedIndexes.isEmpty()) break;
playerMarkerMapPositions.put(missingPlayer, positions.get(nonUsedIndexes.get(0)));
nonUsedIndexes.remove(0);
}
}
}
} else if(mapDecorations == null) {
playerMarkerMapPositions.clear();
playerMarkerMapPositionsLast.clear();
for (Map.Entry<String, MapPosition> entry : playerEntityMapPositions.entrySet()) {
playerMarkerMapPositions.put(entry.getKey(), entry.getValue());
}
}
if(!roomMap.isEmpty() && startRoomX >= 0 && startRoomY >= 0) {
render(centerX, centerY);
}
this.colourMap = colourMap;
}
@SubscribeEvent
public void onWorldChange(WorldEvent.Load event) {
colourMap = null;
}
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event) {
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable) return;
if(Minecraft.getMinecraft().gameSettings.showDebugInfo ||
(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.isKeyDown() &&
(!Minecraft.getMinecraft().isIntegratedServerRunning() ||
Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap().size() > 1))) {
return;
}
ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.mainInventory[8];
boolean holdingBow = stack != null && stack.getItem() == Items.arrow && colourMap != null;
if(holdingBow || (stack != null && stack.getItem() instanceof ItemMap)) {
Map<String, Vec4b> decorations = null;
Color[][] colourMap = new Color[128][128];
if(holdingBow) {
for(int x=0; x<128; x++) {
for(int y=0; y<128; y++) {
if(this.colourMap[x][y] != null) {
colourMap[x][y] = this.colourMap[x][y];
} else {
colourMap[x][y] = new Color(0, true);
}
}
}
} else {
ItemMap map = (ItemMap) stack.getItem();
MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld);
if(mapData == null) return;
decorations = mapData.mapDecorations;
for (int i = 0; i < 16384; ++i) {
int x = i % 128;
int y = i / 128;
int j = mapData.colors[i] & 255;
Color c;
if (j / 4 == 0) {
c = new Color((i + i / 128 & 1) * 8 + 16 << 24, true);
} else {
c = new Color(MapColor.mapColorArray[j / 4].getMapColor(j & 3), true);
}
colourMap[x][y] = c;
}
}
int roomSizeBlocks = 31;
/*List<Integer> dists = new ArrayList<>();
int currentBlockCount = 0;
for(int i=0; i<300; i++) {
IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(0, 99, i));
if(state == null || state.getBlock() == Blocks.air) {
if(currentBlockCount > 0) dists.add(currentBlockCount);
currentBlockCount = 0;
} else {
currentBlockCount++;
}
}
currentBlockCount = 0;
for(int i=0; i<300; i++) {
IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(i, 99, 0));
if(state == null || state.getBlock() == Blocks.air) {
if(currentBlockCount > 0) dists.add(currentBlockCount);
currentBlockCount = 0;
} else {
currentBlockCount++;
}
}
int count = 0;
int mostCommonDist = -1;
for(int dist : dists) {
if(dist == mostCommonDist) {
count++;
} else {
if(--count < 0) {
count = 1;
mostCommonDist = dist;
}
}
}
if(mostCommonDist > 31) roomSizeBlocks = mostCommonDist;*/
Set<String> actualPlayers = new HashSet<>();
/*for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
if(player.getUniqueID().toString().charAt(14) == '4') {
actualPlayers.add(player.getName());
System.out.println(player.getName());
}
}*/
int players = 0;
for(ScorePlayerTeam team : Minecraft.getMinecraft().thePlayer.getWorldScoreboard().getTeams()) {
if(team.getTeamName().startsWith("a") && team.getMembershipCollection().size() == 1) {
String playerName = Iterables.get(team.getMembershipCollection(), 0);
boolean foundPlayer = false;
for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
if(player.getName().equals(playerName) && (player == Minecraft.getMinecraft().thePlayer || !player.isPlayerSleeping())) {
actualPlayers.add(playerName);
foundPlayer = true;
break;
}
}
if(!foundPlayer) actualPlayers.add(playerName);
if(++players >= 6) break;
}
}
Position pos = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition;
int size = 80 + Math.round(40*NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize);
ScaledResolution scaledResolution = Utils.pushGuiScale(2);
renderMap(pos.getAbsX(scaledResolution, size/2)+size/2, pos.getAbsY(scaledResolution, size/2)+size/2,
colourMap, decorations, roomSizeBlocks, actualPlayers, true, event.partialTicks);
Utils.pushGuiScale(-1);
}
}
}
public List<List<String>> permutations(List<String> values) {
List<List<String>> permutations = new ArrayList<>();
if(values.size() == 1) {
permutations.add(values);
return permutations;
}
for(String first : values) {
List<String> newList = new ArrayList<>();
for(String val : values) {
if(!val.equals(first)) {
newList.add(val);
}
}
for(List<String> list2 : permutations(newList)) {
List<String> perm = new ArrayList<>();
perm.add(first);
perm.addAll(list2);
permutations.add(perm);
}
}
return permutations;
}
Shader blurShaderHorz = null;
Framebuffer blurOutputHorz = null;
Shader blurShaderVert = null;
Framebuffer blurOutputVert = null;
/**
* Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate
* space [-1 -> 1; 1 -> -1] (Note: flipped y-axis).
*
* This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to
* apply scales and translations manually.
*/
private Matrix4f createProjectionMatrix(int width, int height) {
Matrix4f projMatrix = new Matrix4f();
projMatrix.setIdentity();
projMatrix.m00 = 2.0F / (float)width;
projMatrix.m11 = 2.0F / (float)(-height);
projMatrix.m22 = -0.0020001999F;
projMatrix.m33 = 1.0F;
projMatrix.m03 = -1.0F;
projMatrix.m13 = 1.0F;
projMatrix.m23 = -1.0001999F;
return projMatrix;
}
}
|