Commit Graph

864 Commits

Author SHA1 Message Date
Garux 7993cc8a1f std::vector<int> bspDrawIndexes 2021-09-26 22:10:46 +03:00
Garux c58bd839da std::vector<bspDrawVert_t> bspDrawVerts 2021-09-26 21:41:46 +03:00
Garux 560060a908 std::vector<byte> bspVisBytes 2021-09-26 20:34:41 +03:00
Garux 28dfbaa5ab std::vector<bspGridPoint_t> bspGridPoints 2021-09-26 20:01:26 +03:00
Garux e4d6e63e91 std::vector<byte> bspLightBytes 2021-09-25 19:16:25 +03:00
Garux f5c1a11a66 std::vector<bspBrushSide_t> bspBrushSides 2021-09-25 10:17:51 +03:00
Garux 9f63742fda std::vector<std::uint8_t> opaqueBrushes 2021-09-24 17:35:58 +03:00
Garux 260dc59d4a std::vector<bspBrush_t> bspBrushes 2021-09-24 17:05:00 +03:00
Garux a20717c364 std::vector<int> bspLeafBrushes 2021-09-24 16:27:10 +03:00
Garux 6066fe2cc2 std::vector<int> bspLeafSurfaces 2021-09-24 16:16:02 +03:00
Garux b1f32e6faa std::vector<bspNode_t> bspNodes 2021-09-24 16:06:34 +03:00
Garux bccd3bafd7 std::vector<bspPlane_t> bspPlanes 2021-09-24 15:43:24 +03:00
Garux 76d2b565b3 std::vector<bspLeaf_t> bspLeafs 2021-09-24 15:25:58 +03:00
Garux 6267f1d0af std::vector<char> bspEntData 2021-09-24 13:57:17 +03:00
Garux 58911934e0 std::vector<bspShader_t> bspShaders 2021-09-24 13:39:04 +03:00
Garux 6e2fc92576 std::vector<bspModel_t> bspModels 2021-09-24 12:11:11 +03:00
Garux 0e0a295330 * new: bsp export/import in json format; Usage: q3map2 -json <-unpack|-pack> [-v] <mapname> 2021-09-23 03:11:43 +03:00
Garux 29ba8c4876 refactor command line arguments parsing 2021-09-19 11:58:00 +03:00
Garux 02a3b9c026 use ostream_write( CopiedString ) 2021-09-18 15:30:11 +03:00
Garux b78513f9f8 refactor InitPaths()
get rid of MAX_OS_PATH
2021-09-17 19:50:36 +03:00
Garux e22e6169c9 * -fs_basegame gamename: Overrides default game directory name (e.g. Q3A uses 'baseq3', OpenArena 'baseoa', so -game quake3 -fs_basegame baseoa for OA ) 2021-09-16 15:26:55 +03:00
Garux 97ad9bf5c5 separate path manipulating functions
unlimit VFS_MAXDIRS
2021-09-15 08:07:05 +03:00
Garux e1186dd734 subdivide files 2021-09-13 22:29:44 +03:00
Garux dbeb2d0718 rename game -> g_game 2021-09-13 18:49:09 +03:00
Garux 5c5f698c28 use standard [[ noreturn ]] attribute
add ENSURE macro
2021-09-13 18:22:44 +03:00
Garux ef635cd95c remove direct uses of MAIN_C macro 2021-09-13 16:33:29 +03:00
Garux 68b8d7d5dc refactor game configs: using class inheritance to avoid massive duplication 2021-09-13 16:11:01 +03:00
Garux 34fc3d0a5d minor tweaks 2021-09-08 20:03:15 +03:00
Garux 18c741a960 remove unused side_t field 2021-09-08 19:45:04 +03:00
Garux 77f2e39af5 minor tweaks 2021-09-08 19:40:09 +03:00
Garux f3321cef5f * auto fog direction: try all sides, not just axial; default to none, if no visible sides
* q3map_fogDir: pick best matching side, not strict match only; ignore invisible 'bevel' sides
2021-09-08 19:22:18 +03:00
Garux 23d82aa9ef * prioritize +Z fog visible side in ambiguous case (= -Z fog direction), as in fogged pit 2021-09-08 10:11:49 +03:00
Garux 204c3138e2 emit warning on expected practical engine fog limit overflow 2021-09-07 08:14:04 +03:00
Garux 43b5148447 remove -metaMaxBBoxDistance
with current 'pre weld' strategy it's not optimization anymore, also wont work as option to merge non welded triangles with adjusted meta score
2021-09-05 14:45:01 +03:00
Garux 191d489d62 * hasten MergeMetaTriangles and SmoothMetaTriangles to perform typically in 0 seconds
* improve quality of metasurfaces and reduce their count in general case
2021-09-05 11:37:00 +03:00
Garux bafb339c09 MergeMetaTriangles: epsilon compare st, improves merging imprecise sts, e.g. for nonplanar surfaces after q3map_tcgen or just brush face texture projection 2021-09-03 06:23:40 +03:00
Garux d113eed245 improve MergeMetaTriangles out surfaces quality and reduce count 2021-09-03 06:19:41 +03:00
Garux 7f8e548c2f * hasten MergeMetaTriangles greatly (around 30 times in worst case)
this has negative impact on surfaces count in certain scenario (big axial surface of easily mergable triangles)
it wins predecessor once we rotate such surface
so may be consider choosing sorting plane per lump or mergables
algorithm itself is dependent on test data ordering, thus best option would be tweaking it, not prerequisites
`redundant indexes suppressed` count is always worse with this due to sorting nature, sorting per axial plane helps
assuming this optimization is not important and case dependent
2021-09-01 20:16:57 +03:00
Garux f067b5d6c3 tweak -meta 2021-08-28 18:37:22 +03:00
Garux 0ad3d89d4a use spatially sorted indices during search of coincident vertices in AddMetaVertToSurface 2021-08-28 10:56:50 +03:00
Garux e780b45696 enfasten -meta for nonplanar by doing cheap check 1st 2021-08-27 17:13:26 +03:00
Garux 160c1d33db remove -texrange business (assuming it's not relevant for decades)
optimize -meta (shave off 1/3 in worst case)
2021-08-27 12:18:56 +03:00
Garux 3129fd0bce refactor model clipping code 2021-08-20 22:32:33 +03:00
Garux d82996d684 mbspc: fix q3 entities being loaded twice 2021-08-15 18:54:28 +03:00
Garux 1372ea440b more move semantics 2021-08-15 15:15:30 +03:00
Garux bb1931b745 * sort pk3s, so content of later (zzz) overrides earlier, like in radiant and engine
* fix strong performance penalty with large amount of files in pk3s
store pak file path once per pk3, not per each file inside
2021-08-13 03:20:07 +03:00
Garux 4beae3d362 * support entries with .shader extension in shaderlist.txt
vfsListShaderFiles (empty shaderlist = load all shaders, -pk3, -repack):
	only list pk3 .shaders from scripts/ folder
	support non scripts/ shaderPath (e.g. jka)
unlimit shader files count
case insensitive shaderlist entries, so duplicates aren't loaded twice
2021-08-12 11:23:59 +03:00
Garux aa5de2fee9 wrap winding_next logic
prevent crash in AddWindingToConvexHull()
2021-08-11 18:18:38 +03:00
Garux f492ab27eb more c++ in q3map2 2021-08-10 22:41:43 +03:00
Garux 99f4a4a767 minor tweaks 2021-08-03 20:54:21 +03:00
Garux 357f67f237 remove Q_EXTERN int numLights
remove /* potential pre-setup  */ :
1. it seems to never actually be the case
2. it is called from threaded functions, while SetupEnvelopes() itself is not thread safe
2021-08-03 18:26:47 +03:00
Garux f49639c697 std::list<light_t> lights 2021-08-03 07:28:53 +03:00
Garux a743668e44 prevent overflow in gridsize adjustment 2021-08-02 12:03:22 +03:00
Garux 15b391cdb3 minor tweaks 2021-08-02 00:47:18 +03:00
Garux e8996d0857 using facelist_t = std::forward_list<face_t> 2021-08-01 22:50:35 +03:00
Garux c3041cc2f8 using winding_t = std::vector<Vector3> 2021-07-31 18:28:38 +03:00
Garux dbfb22e273 using winding_accu_t = std::vector<DoubleVector3>; 2021-07-30 12:20:56 +03:00
Garux ffa1a4340c std::vector<plane_t> mapplanes 2021-07-29 22:21:36 +03:00
Garux ee92bdd801 minor tweaks 2021-07-27 22:16:05 +03:00
Garux 89b7bcdf53 * read .map brush plane points and store brush planes for windings calculation in double precision (fixes cracks between brush faces) 2021-07-27 20:04:35 +03:00
Garux 3c17f8fbc5 add MST_PLANAR and MST_TRIANGLE_SOUP counts to -info report 2021-07-22 17:32:58 +03:00
Garux 44907db895 Add KTX and ETC1 texture support by @Triang3l
https://github.com/xonotic/netradiant/pull/1
https://gitlab.com/xonotic/netradiant/-/issues/5

This pull request adds support for Khronos Textures to NetRadiant and Q3Map2, with OpenGL ES 2.0 formats, Ericsson Texture Compression version 1, and BGR/BGRA.

The patent-free Ericsson Texture Compression format will be used in the next version of Warsow to significantly reduce VRAM usage on mobile GPUs and the integrated GPU of Intel Broadwell.
2021-07-18 16:18:49 +03:00
Garux 0e4a4fdcf6 * fix _castShadows > 1: cast on world, as advertised 2021-07-02 16:50:01 +03:00
Garux 4697d7940c fix new gcc build error: ‘N’ is not a constant expression, while using offsetof 2021-06-22 20:49:42 +03:00
Garux 5b33fae202 fix clang error: variable-sized object may not be initialized 2021-06-21 17:07:03 +03:00
germangar 3b9b05d40e Undo changing to unsigned int for maxLMSurfaceVerts, maxSurfaceVerts and maxSurfaceIndexes. Restore qfusion.h long value 2021-06-03 22:28:29 +02:00
germangar 451f88efd7 Fix: Do not ignore game descriptor value for maxLMSurfaceVerts and keepLights
Use unsigned int for maxLMSurfaceVerts, maxSurfaceVerts and maxSurfaceIndexes
Fix: Out of bounds value at qfusion.h
2021-06-02 12:16:44 +02:00
Garux 6c00419653 fix spelling 2021-05-24 20:23:09 +03:00
Garux 5efe29d863 * use dynamic maxSurfaceVerts (user preference/game define) in 'force meta process for a surface' decision (was hardcoded) 2021-05-20 17:10:31 +03:00
Garux 31e7829e2b * support negative misc_model scale 2021-05-11 19:05:54 +03:00
Garux 427ef0874b * improve ase export compatibility
write normals after faces
write vertex normals right after their face normal
2021-05-08 14:15:17 +03:00
Garux 9eefda4fc5 * fix texturing, when origin key of group entity is set 2021-05-07 14:50:43 +03:00
Garux 75c7c09903 * replace model loaders by assimp library (40+ formats)
* auto split big model meshes to <= maxSurfaceVerts chunks (avoids excess meta process for vertexlit ones)
2021-05-07 14:47:39 +03:00
Garux 2222100316 indent classes, align by spaces 2021-03-24 00:25:15 +03:00
Garux c7fedadcd1 use std::vector for flagging in SmoothNormals()
functions run about 10% faster due to cheaper access to a flag
2021-03-13 11:16:07 +03:00
Garux 1d4424f4c6 minor tweaks 2021-03-12 01:17:01 +03:00
Garux 09c78ec0dc return Vector3 from vectorForKey() 2021-03-11 20:16:52 +03:00
Garux 1144be0881 add BasicVector3 uniform constructor 2021-03-11 19:14:07 +03:00
Garux 98f9023cdc minor tweaks 2021-03-11 10:57:17 +03:00
Garux 0cff77e30d consider "textures/system/" jka common folder during map decompilation 2021-03-09 20:13:42 +03:00
Garux 0737e962de use std::sort instead of qsort 2021-03-09 20:09:08 +03:00
Garux 52ef1c838a make sure to do VectorNormalize in double 2021-03-08 15:36:46 +03:00
Garux 858ec974f7 * -saturation light switch, default = 1, affects lightmaps and vertex color; > 1 = saturate, 0 = grayscale, < 0 = complementary colors 2021-03-08 13:34:58 +03:00
Garux ac1dd904f1 * print available games on wrong -game and -format args 2021-03-08 13:32:16 +03:00
Garux 293fab0ffb manage color-to-byte conversions 2021-03-05 13:37:56 +03:00
Garux bee749118f unify WindingExtendBounds logic 2021-03-05 06:15:48 +03:00
Garux 902fb46938 random tweaks 2021-03-04 16:11:00 +03:00
Garux b68cbfd78b clean ShiftBSPMain 2021-03-03 19:16:53 +03:00
Garux ce93fb3be8 * -help -game lists available games
std::size for help arrays
2021-03-03 17:30:55 +03:00
Garux 39c22acbae * case insensitive command line arguments 2021-03-03 07:54:16 +03:00
Garux 39f5a2d060 use MinMax functions instead of raw math 2021-03-03 07:01:28 +03:00
Garux f9a424b6c8 more c++ 2021-03-02 22:01:09 +03:00
Garux 9446aeca8e fix introduced problems 2021-02-28 12:04:52 +03:00
Garux 9857bb955b more c++ math 2021-02-26 01:10:51 +03:00
Garux 4ce944444d rewrite q3map2 math in c++ 2021-02-25 19:41:43 +03:00
Garux 820dd5e21f bump MAX_IMAGES, MAX_MODELS 2021-02-10 00:20:32 +03:00
Garux ba497e4139 SafeOpenWrite, SafeOpenRead funcs use 2021-02-09 18:05:06 +03:00
Garux 37c11990cb del struct StrBuf; CopiedString for mapShaderFile; 2021-02-09 13:03:48 +03:00
Garux b013f9954c simplify unlimited bsp entities code 2021-02-08 04:36:57 +03:00
Garux d5f55e7c35 safe strings in OnlyEnts() 2021-02-08 02:53:57 +03:00
Garux 92b2487875 fix string warnings 2021-02-08 01:33:36 +03:00
Garux ca34e8f38f enum class EFloodEntities 2021-02-07 07:34:57 +03:00
Garux a17bf05f5c more information in "StrList overflow" error 2021-02-07 07:23:46 +03:00
Garux 54f7daa887 more PathExtensionless use 2021-02-07 07:18:10 +03:00
Garux 5fd7b340df * discard excess portals in the void (great optimization for maps with void areas in between of playable areas and non rectangular maps)
(excess portals there are effect of _blocksize)
	* optimize FloodPortals() (also fix stack depth crash in debug mode due to recursive calls)
	* fix xml_Select() of leaked entity (was selecting last map entity always)
	* xml_Select() leaked entity exactly in the beginning of leak line
2021-02-06 22:22:59 +03:00
Garux e729f7b898 prevent stack overflow 2021-02-02 00:26:21 +03:00
Garux 2bf53ef643 fix overlook introduced in 36b63e1d2c 2021-01-30 16:50:40 +03:00
Garux 99a5ef0416 refactor entity key values routines 2021-01-30 16:23:31 +03:00
Garux 8425ce3c3e refactor foliage_t 2021-01-29 22:40:09 +03:00
Garux 762699287e refactor surfaceModel_t 2021-01-29 21:11:56 +03:00
Garux 276d1f5875 safe string in indexMap_t 2021-01-29 20:46:06 +03:00
Garux 40ab7fa26c remove excess string overflow checks, fix warnings 2021-01-29 05:14:33 +03:00
Garux b9d5f091e0 use fold expression, forwarding reference 2021-01-29 05:12:20 +03:00
Garux abc666ab7f use std::uint32_t in md4 2021-01-28 05:11:59 +03:00
Garux 623163ae9c remove unused markers 2021-01-28 02:12:15 +03:00
Garux e11aede11a refactor surfaceType_t enum 2021-01-27 19:43:53 +03:00
Garux 1efff8cdfe refactor enum vstatus_t 2021-01-27 11:53:32 +03:00
Garux 62a0ae5623 prevent string overflows 2021-01-26 22:31:19 +03:00
Garux 3ff224cbdf fix texture projection decompilation
in C this check was equal to
abs((int)dist) >= distanceEpsilon
comparing float dist to distanceEpsilon is not sufficient, as points are not precise enough, plus they are snapped
2021-01-25 08:36:16 +03:00
Garux d0dcce342b use LightFlags::FastActual shortcut 2021-01-25 07:29:46 +03:00
Garux bdfd864670 refactor enums
credits for class BitFlags go to Jelvan <3
2021-01-25 01:33:56 +03:00
Garux 7297e8758b remove unused light_shadows.cpp 2021-01-25 01:11:26 +03:00
Garux 20b908e31b remove excess typedef struct declarations 2021-01-23 19:26:50 +03:00
Garux 54c38610bf use std::list<epair_t> 2021-01-23 17:25:47 +03:00
Garux 36b63e1d2c turn entities array to std::vector<entity_t> 2021-01-23 15:39:42 +03:00
Garux b0e62198ba use safe strings more 2021-01-21 18:41:16 +03:00
Garux 0ab896b84a remove MAC_STATIC hack 2021-01-21 16:17:23 +03:00
Garux f3c26c791f use safe strings more 2021-01-21 16:08:53 +03:00
Garux 8b204ac054 add and use class PathExtensionless 2021-01-21 15:15:07 +03:00
Garux 7fc079c658 merge duplicated path_ functions
handle backslashes, which is out of convention, but safer, as practically paths may contain them in many spots
2021-01-21 08:53:34 +03:00
Garux 15e4b8e850 manage model shaders remapping 2021-01-21 07:19:15 +03:00
Garux fe5c0879b4 remove -tmpin & -tmpout switches, as at best they were prepending tmp/ to absolute path 2021-01-20 12:48:10 +03:00
Garux 3b39a5754d prevent filename overflow in model .skin loader
strip model extension during filename construction
add variadic template operator to StringOutputStream for inline strings creation
2021-01-20 11:59:16 +03:00
Garux cfa502df6e safe string for globalCelShader 2021-01-19 22:40:58 +03:00
Garux cbeccc7e3a use safe string in GetIndexedShader
fix custom shader overflow check
2021-01-19 22:12:53 +03:00
Garux c3437b7833 use safe strings in shaderInfo_s
turn ImageLoad() to expect extensionless path as input
2021-01-19 18:58:18 +03:00
Garux 9590d602d3 use String64 for shaderInfo_s::skyParmsImageBase
add variadic template operator to StringFixedSize for inline strings creation
2021-01-19 17:21:54 +03:00
Garux da3b05728c use safe string for shaderInfo_t.shader 2021-01-19 01:24:21 +03:00
Garux 3578370061 fix the build 2021-01-16 17:52:33 +03:00
Garux 13524d59ef fix the build 2021-01-16 15:10:59 +03:00
Garux fafa271a46 turn quake3 tools to cpp 2021-01-15 01:37:23 +03:00
Garux b2bc2077e5 prevent division by zero, which spreads darkness during bounces
source of the problem is located somewhere else
2021-01-05 01:34:55 +03:00
Garux e62c6f4bb3 fix warnings 2021-01-03 06:24:58 +03:00
Garux 3cbe922765 fix UB: fwrite with buffer = NULL 2021-01-01 17:42:08 +03:00
Garux d074634463 SetupGrid() after _ambient key read 2021-01-01 17:41:11 +03:00
Garux 97f0e61ccc initialize rawGridPoints.ambient correctly 2021-01-01 17:40:06 +03:00
Garux e1f3b25bc6 consider _decal in leak detection
point entities recognition is malformed in general
leak is about point entities, detection by origin key presence is weak, because there may exist entity w/o this key at 0 0 0
group entities may have origin too
detection by primitives presence haven't been working for _decal, as its primitive gets freed at this point
2020-12-14 08:36:55 +03:00
Garux db07c3459d * packer, repacker: handle nodraw patches correctly; warn on visible surface, having shader w/o maps (typically watercaulk) 2020-12-08 03:03:42 +03:00
Garux 5cedd26c75 * -repack -analyze switch: only analyze bsps and exit (to dump bsp resource calls) 2020-12-08 02:45:48 +03:00
Garux dd3db2f147 bump -repack bsp list size 2020-12-08 02:34:55 +03:00