Allow meshes without UVs

This commit is contained in:
bloeys
2022-10-01 06:52:47 +04:00
parent 271b1c0cea
commit d550767cb6

View File

@ -31,7 +31,11 @@ func NewMesh(name, modelPath string, postProcessFlags asig.PostProcess) (*Mesh,
sceneMesh := scene.Meshes[0]
mesh.Buf = buffers.NewBuffer()
assert.T(len(sceneMesh.TexCoords[0]) > 0, "Mesh has no UV0")
// assert.T(len(sceneMesh.TexCoords[0]) > 0, "Mesh has no UV0")
if len(sceneMesh.TexCoords[0]) == 0 {
sceneMesh.TexCoords[0] = make([]gglm.Vec3, len(sceneMesh.Vertices))
}
layoutToUse := []buffers.Element{{ElementType: buffers.DataTypeVec3}, {ElementType: buffers.DataTypeVec3}, {ElementType: buffers.DataTypeVec2}}
if len(sceneMesh.ColorSets) > 0 && len(sceneMesh.ColorSets[0]) > 0 {