From 9d7bdc0196ed8744e1de280c6ba48c41b73635c2 Mon Sep 17 00:00:00 2001 From: bloeys Date: Fri, 12 Apr 2024 22:40:08 +0400 Subject: [PATCH] Improve error messages --- main.go | 1 + meshes/mesh.go | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index bd5be06..0292369 100755 --- a/main.go +++ b/main.go @@ -33,6 +33,7 @@ import ( - HDR - Cascaded shadow mapping - Skeletal animations + - Proper model loading (i.e. load model by reading all its meshes, textures, and so on together) - Create VAO struct independent from VBO to support multi-VBO use cases (e.g. instancing) - Renderer batching - Scene graph diff --git a/meshes/mesh.go b/meshes/mesh.go index 19dbdfc..b66e2c3 100755 --- a/meshes/mesh.go +++ b/meshes/mesh.go @@ -62,14 +62,11 @@ func NewMesh(name, modelPath string, postProcessFlags asig.PostProcess) (*Mesh, mesh.Buf.SetLayout(layoutToUse...) } else { - // @NOTE: Require that all submeshes have the same vertex buffer layout firstSubmeshLayout := mesh.Buf.GetLayout() - assert.T(len(firstSubmeshLayout) == len(layoutToUse), fmt.Sprintf("Vertex layout of submesh %d does not equal vertex layout of the first submesh. Original layout: %v; This layout: %v", i, firstSubmeshLayout, layoutToUse)) + assert.T(len(firstSubmeshLayout) == len(layoutToUse), "Vertex layout of submesh '%d' of mesh '%s' at path '%s' does not equal vertex layout of the first submesh. Original layout: %v; This layout: %v", i, name, modelPath, firstSubmeshLayout, layoutToUse) for i := 0; i < len(firstSubmeshLayout); i++ { - if firstSubmeshLayout[i].ElementType != layoutToUse[i].ElementType { - panic(fmt.Sprintf("Vertex layout of submesh %d does not equal vertex layout of the first submesh. Original layout: %v; This layout: %v", i, firstSubmeshLayout, layoutToUse)) - } + assert.T(firstSubmeshLayout[i].ElementType == layoutToUse[i].ElementType, "Vertex layout of submesh '%d' of mesh '%s' at path '%s' does not equal vertex layout of the first submesh. Original layout: %v; This layout: %v", i, name, modelPath, firstSubmeshLayout, layoutToUse) } } @@ -119,9 +116,9 @@ type arrToInterleave struct { func (a *arrToInterleave) get(i int) []float32 { - assert.T(len(a.V2s) == 0 || len(a.V3s) == 0, "One array should be set in arrToInterleave, but both arrays are set") - assert.T(len(a.V2s) == 0 || len(a.V4s) == 0, "One array should be set in arrToInterleave, but both arrays are set") - assert.T(len(a.V3s) == 0 || len(a.V4s) == 0, "One array should be set in arrToInterleave, but both arrays are set") + assert.T(len(a.V2s) == 0 || len(a.V3s) == 0, "One array should be set in arrToInterleave, but multiple arrays are set") + assert.T(len(a.V2s) == 0 || len(a.V4s) == 0, "One array should be set in arrToInterleave, but multiple arrays are set") + assert.T(len(a.V3s) == 0 || len(a.V4s) == 0, "One array should be set in arrToInterleave, but multiple arrays are set") if len(a.V2s) > 0 { return a.V2s[i].Data[:]