# HG changeset patch # User Sam # Date 1695481833 -25200 # Node ID 2fb719f13a98a742227bc75f5d09cc2f30bdb361 # Parent 72913d68c07b284c54bf6bc02faaf2ca17228a3f allow more openArrays, better debug output, better default exports diff -r 72913d68c07b -r 2fb719f13a98 src/semicongine.nim --- a/src/semicongine.nim Thu Sep 21 23:34:38 2023 +0700 +++ b/src/semicongine.nim Sat Sep 23 22:10:33 2023 +0700 @@ -1,3 +1,6 @@ +import std/tables +export tables # necessary to use some features without weird compilation error + import semicongine/core export core diff -r 72913d68c07b -r 2fb719f13a98 src/semicongine/core/dynamic_arrays.nim --- a/src/semicongine/core/dynamic_arrays.nim Thu Sep 21 23:34:38 2023 +0700 +++ b/src/semicongine/core/dynamic_arrays.nim Sat Sep 23 22:10:33 2023 +0700 @@ -208,9 +208,9 @@ if len > 0: result.setLen(len) -proc newDataList*[T: GPUType](data: seq[T]): DataList = +proc newDataList*[T: GPUType](data: openArray[T]): DataList = result = newDataList(getDataType[T]()) - result.setValues(data) + result.setValues(@data) proc toGPUValue*[T: GPUType](value: seq[T]): DataList = result = newDataList[T](value.len) diff -r 72913d68c07b -r 2fb719f13a98 src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Thu Sep 21 23:34:38 2023 +0700 +++ b/src/semicongine/renderer.nim Sat Sep 23 22:10:33 2023 +0700 @@ -114,9 +114,9 @@ if input.name == TRANSFORMATTRIBUTE: # will be populated automatically continue if not (input.name in mesh[].attributes): - return (true, &"Shader input '{input.name}' is not available for mesh '{mesh}'") + return (true, &"Shader input '{input.name}' is not available for mesh") if input.theType != mesh[].attributeType(input.name): - return (true, &"Shader input '{input.name}' expects type {input.theType}, but mesh '{mesh}' has {mesh[].attributeType(input.name)}") + return (true, &"Shader input '{input.name}' expects type {input.theType}, but mesh has {mesh[].attributeType(input.name)}") if not input.perInstance and not mesh[].vertexAttributes.contains(input.name): return (true, &"Shader input '{input.name}' expected to be vertex attribute, but mesh has no such vertex attribute (available are: {mesh[].vertexAttributes})") if input.perInstance and not mesh[].instanceAttributes.contains(input.name): @@ -179,7 +179,6 @@ for texture in getValues[Texture](value)[]: scenedata.textures[name].add renderer.device.uploadTexture(texture) - # find all meshes, populate missing attribute values for shader for mesh in scene.meshes.mitems: for inputAttr in inputs: diff -r 72913d68c07b -r 2fb719f13a98 src/semicongine/scene.nim --- a/src/semicongine/scene.nim Thu Sep 21 23:34:38 2023 +0700 +++ b/src/semicongine/scene.nim Sat Sep 23 22:10:33 2023 +0700 @@ -28,7 +28,7 @@ setValues(scene.shaderGlobals[name], @[data]) scene.dirtyShaderGlobals.add name -proc addShaderGlobalArray*[T](scene: var Scene, name: string, data: seq[T]) = +proc addShaderGlobalArray*[T](scene: var Scene, name: string, data: openArray[T]) = scene.shaderGlobals[name] = newDataList(data) scene.dirtyShaderGlobals.add name