View Issue Details

IDProjectCategoryView StatusLast Update
0005383DarkRadiantModelspublic05.02.2021 11:29
Reportergreebo Assigned Togreebo  
PrioritynormalSeveritynormalReproducibilityalways
Status closedResolutionfixed 
Product Version2.8.0 
Fixed in Version2.9.0 
Summary0005383: Reported Polycount for LWO models is one too high
DescriptionThe LWO PicoModel importer generates too many indices in the index array, it looks like this:

0 0 0 0 1 2 ...

The first three indices are all 0, forming a degenerate face, but it also misleads the RenderablePicoModelSurface::getNumTriangles() which is calculating the number of tris by dividing the length of the index array by 3.
Steps To ReproduceModel: tdm_models01.pk4\models\darkmod\mechanical\receiver_antenna.lwo is reported to have 61 polys, but it only has 60 (check it out in Blender)
TagsNo tags attached.
Attached Files
receiver_antenna_lwo.png (36,030 bytes)   
receiver_antenna_lwo.png (36,030 bytes)   

Activities

greebo

greebo

08.11.2020 05:56

administrator   ~0012868

The problem is that in pm_lwo.c:300 the polycount is upped a tad too early

/* We haven't discarded this polygon, so bump the surface polycount */
surfacePolyCount++;

Since this variable is used to calculate the array offset when storing the indices later. The array will auto-adjust, so no buffer overrun will occur, but the first three indices will remain at their initialised values: 0 0 0

Related Changesets

DarkRadiant: 2.9.0 2034a9de

08.11.2020 16:26

greebo


Details Diff
0005383: Add unit test asserting the LWO and ASE poly count after loading Affected Issues
0005383
mod - test/Makefile.am Diff File
add - test/Models.cpp Diff File
mod - tools/msvc/Tests/Tests.vcxproj Diff File
mod - tools/msvc/Tests/Tests.vcxproj.filters Diff File

DarkRadiant: 2.9.0 7f3d9aff

08.11.2020 16:27

greebo


Details Diff
0005383: Fix polygon counting in LWO loading code Affected Issues
0005383
mod - radiantcore/model/picomodel/lib/pm_lwo.c Diff File

Issue History

Date Modified Username Field Change
08.11.2020 05:30 greebo New Issue
08.11.2020 05:30 greebo File Added: receiver_antenna_lwo.png
08.11.2020 05:32 greebo Status new => confirmed
08.11.2020 05:56 greebo Note Added: 0012868
08.11.2020 16:26 greebo Assigned To => greebo
08.11.2020 16:26 greebo Status confirmed => assigned
08.11.2020 16:28 greebo Changeset attached => DarkRadiant 2.9.0 2034a9de
08.11.2020 16:28 greebo Changeset attached => DarkRadiant 2.9.0 7f3d9aff
08.11.2020 16:29 greebo Status assigned => resolved
08.11.2020 16:29 greebo Resolution open => fixed
08.11.2020 16:29 greebo Fixed in Version => 2.9.0
05.02.2021 11:29 greebo Status resolved => closed