MonoGame / MonoGame

One framework for creating powerful cross-platform games.

Home Page:http://www.monogame.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TestFailure: TestMergePositionsMultipleGeometries - Index was outside the bounds of the array.

SimonDarksideJ opened this issue · comments

Prerequisites

  • I have verified this issue is present in the develop branch
  • I have searched open and closed issues to ensure it has not already been reported.

MonoGame Version

Develop

Which MonoGame platform are you using?

N/A

Operating System

ALl

Description

The function MeshHelper.CalculateNormals has an issue in generating the Normals for models, resulting in a failed Unit Test in the MonoGame.Tools solution.

image

The issue relates in to the creation of a VertextChannel array for the Geometry normals (Line 130 - MeshHelper)

Steps to Reproduce

  • Clone the MonoGame repository - develop
  • Open the MonoGame.Tools. solution
  • Run the Unit Tests
  • Observe the failure of the TestMergePositionsMultipleGeometries test
    (Run in Bebug to see the specific failure)

Minimal Example Repo

No response

Expected Behavior

MeshHelper.CalculateNormals should complete successfully

Resulting Behavior

TestMergePositionsMultipleGeometries test failure

Files

No response

You can test further by updating the MathHelper.CalculateTangentFrames and changing the Normals check from a Return (skip processing missing normals) to the commented-out line MeshHelper.CalculateNormals(geom, true); (Generate missing normals)

//MeshHelper.CalculateNormals(geom, true);

This is then tested by the newer MissingNormalsTestCustom test, which has a model that includes Normals and is missing normals on some geometry.

public void MissingNormalsTestCustom()

The test fails if you attempt to use the CalculateNormals method to regenerate the missing ones.