forked from TrenchBroom/TrenchBroom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2898: Don't crash when ASE file is missing UV data (TrenchBroom#2967)
* 2898: Add test case (this does not always fail, it will just access garbage) * 2898: Check vertex and UV indices and report out of bounds errors * 2898: Add test case for missing UVs * 2898: Set UV to zero if ASE model does not contain UV data at all
- Loading branch information
Showing
5 changed files
with
247 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
common/test/fixture/IO/Ase/index_out_of_bounds/wedge_45.ase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
*3DSMAX_ASCIIEXPORT 200 | ||
*MATERIAL_LIST { | ||
*MATERIAL_COUNT 2 | ||
*MATERIAL 0 { | ||
*MATERIAL_NAME "textures/radiant_regression_tests/tile_model" | ||
*MATERIAL_CLASS "Standard" | ||
*MATERIAL_DIFFUSE 1.000000 1.000000 0.833333 | ||
*MATERIAL_SHADING Phong | ||
*MAP_DIFFUSE { | ||
*MAP_NAME "textures/radiant_regression_tests/tile_model" | ||
*MAP_CLASS "Bitmap" | ||
*MAP_SUBNO 1 | ||
*MAP_AMOUNT 1.0 | ||
*MAP_TYPE Screen | ||
*BITMAP "..\textures\radiant_regression_tests\tile_model.tga" | ||
*BITMAP_FILTER Pyramidal | ||
} | ||
} | ||
*MATERIAL 1 { | ||
*MATERIAL_NAME "noshader" | ||
*MATERIAL_CLASS "Standard" | ||
*MATERIAL_DIFFUSE 1.000000 1.000000 1.000000 | ||
*MATERIAL_SHADING Phong | ||
*MAP_DIFFUSE { | ||
*MAP_NAME "noshader" | ||
*MAP_CLASS "Bitmap" | ||
*MAP_SUBNO 1 | ||
*MAP_AMOUNT 1.0 | ||
*MAP_TYPE Screen | ||
*BITMAP "..\noshader.tga" | ||
*BITMAP_FILTER Pyramidal | ||
} | ||
} | ||
} | ||
*GEOMOBJECT { | ||
*NODE_NAME "mat0model0surf0" | ||
*NODE_TM { | ||
*NODE_NAME "mat0model0surf0" | ||
*INHERIT_POS 0 0 0 | ||
*INHERIT_ROT 0 0 0 | ||
*INHERIT_SCL 0 0 0 | ||
*TM_ROW0 1.0 0 0 | ||
*TM_ROW1 0 1.0 0 | ||
*TM_ROW2 0 0 1.0 | ||
*TM_ROW3 0 0 0 | ||
*TM_POS 0.000000 0.000000 0.000000 | ||
} | ||
*MESH { | ||
*TIMEVALUE 0 | ||
*MESH_NUMVERTEX 4 | ||
*MESH_NUMFACES 2 | ||
*COMMENT "SURFACETYPE MST_PLANAR" | ||
*MESH_VERTEX_LIST { | ||
*MESH_VERTEX 0 128.000000 0.000000 0.000000 | ||
*MESH_VERTEX 1 64.000000 0.000000 64.000000 | ||
*MESH_VERTEX 2 128.000000 128.000000 0.000000 | ||
*MESH_VERTEX 3 64.000000 128.000000 64.000000 | ||
} | ||
*MESH_NORMALS { | ||
*MESH_FACENORMAL 0 0.707107 0.000000 0.707107 | ||
*MESH_FACENORMAL 1 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 0 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 1 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 2 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 3 0.707107 0.000000 0.707107 | ||
} | ||
*MESH_FACE_LIST { | ||
*MESH_FACE 0 A: 0 B: 2 C: 1 AB: 1 BC: 1 CA: 1 *MESH_SMOOTHING 0 *MESH_MTLID 0 | ||
*MESH_FACE 1 A: 5 B: 3 C: 1 AB: 1 BC: 1 CA: 1 *MESH_SMOOTHING 0 *MESH_MTLID 0 | ||
} | ||
*MESH_NUMTVERTEX 4 | ||
*MESH_TVERTLIST { | ||
*MESH_TVERT 0 1.000000 -1.000000 1.000000 | ||
*MESH_TVERT 1 -1.000000 -1.000000 1.000000 | ||
*MESH_TVERT 2 1.000000 3.000000 1.000000 | ||
*MESH_TVERT 3 -1.000000 3.000000 1.000000 | ||
} | ||
*MESH_NUMTVFACES 2 | ||
*MESH_TFACELIST { | ||
*MESH_TFACE 0 0 2 1 | ||
*MESH_TFACE 1 2 3 1 | ||
} | ||
} | ||
*PROP_MOTIONBLUR 0 | ||
*PROP_CASTSHADOW 1 | ||
*PROP_RECVSHADOW 1 | ||
*MATERIAL_REF 0 | ||
} |
76 changes: 76 additions & 0 deletions
76
common/test/fixture/IO/Ase/index_out_of_bounds/wedge_45_no_uv.ase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
*3DSMAX_ASCIIEXPORT 200 | ||
*MATERIAL_LIST { | ||
*MATERIAL_COUNT 2 | ||
*MATERIAL 0 { | ||
*MATERIAL_NAME "textures/radiant_regression_tests/tile_model" | ||
*MATERIAL_CLASS "Standard" | ||
*MATERIAL_DIFFUSE 1.000000 1.000000 0.833333 | ||
*MATERIAL_SHADING Phong | ||
*MAP_DIFFUSE { | ||
*MAP_NAME "textures/radiant_regression_tests/tile_model" | ||
*MAP_CLASS "Bitmap" | ||
*MAP_SUBNO 1 | ||
*MAP_AMOUNT 1.0 | ||
*MAP_TYPE Screen | ||
*BITMAP "..\textures\radiant_regression_tests\tile_model.tga" | ||
*BITMAP_FILTER Pyramidal | ||
} | ||
} | ||
*MATERIAL 1 { | ||
*MATERIAL_NAME "noshader" | ||
*MATERIAL_CLASS "Standard" | ||
*MATERIAL_DIFFUSE 1.000000 1.000000 1.000000 | ||
*MATERIAL_SHADING Phong | ||
*MAP_DIFFUSE { | ||
*MAP_NAME "noshader" | ||
*MAP_CLASS "Bitmap" | ||
*MAP_SUBNO 1 | ||
*MAP_AMOUNT 1.0 | ||
*MAP_TYPE Screen | ||
*BITMAP "..\noshader.tga" | ||
*BITMAP_FILTER Pyramidal | ||
} | ||
} | ||
} | ||
*GEOMOBJECT { | ||
*NODE_NAME "mat0model0surf0" | ||
*NODE_TM { | ||
*NODE_NAME "mat0model0surf0" | ||
*INHERIT_POS 0 0 0 | ||
*INHERIT_ROT 0 0 0 | ||
*INHERIT_SCL 0 0 0 | ||
*TM_ROW0 1.0 0 0 | ||
*TM_ROW1 0 1.0 0 | ||
*TM_ROW2 0 0 1.0 | ||
*TM_ROW3 0 0 0 | ||
*TM_POS 0.000000 0.000000 0.000000 | ||
} | ||
*MESH { | ||
*TIMEVALUE 0 | ||
*MESH_NUMVERTEX 4 | ||
*MESH_NUMFACES 2 | ||
*COMMENT "SURFACETYPE MST_PLANAR" | ||
*MESH_VERTEX_LIST { | ||
*MESH_VERTEX 0 128.000000 0.000000 0.000000 | ||
*MESH_VERTEX 1 64.000000 0.000000 64.000000 | ||
*MESH_VERTEX 2 128.000000 128.000000 0.000000 | ||
*MESH_VERTEX 3 64.000000 128.000000 64.000000 | ||
} | ||
*MESH_NORMALS { | ||
*MESH_FACENORMAL 0 0.707107 0.000000 0.707107 | ||
*MESH_FACENORMAL 1 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 0 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 1 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 2 0.707107 0.000000 0.707107 | ||
*MESH_VERTEXNORMAL 3 0.707107 0.000000 0.707107 | ||
} | ||
*MESH_FACE_LIST { | ||
*MESH_FACE 0 A: 0 B: 2 C: 1 AB: 1 BC: 1 CA: 1 *MESH_SMOOTHING 0 *MESH_MTLID 0 | ||
*MESH_FACE 1 A: 5 B: 3 C: 1 AB: 1 BC: 1 CA: 1 *MESH_SMOOTHING 0 *MESH_MTLID 0 | ||
} | ||
} | ||
*PROP_MOTIONBLUR 0 | ||
*PROP_CASTSHADOW 1 | ||
*PROP_RECVSHADOW 1 | ||
*MATERIAL_REF 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters