You absolute bloody legend!!! Thankyou. It was the commands I was using!!!
Ive changed it to this:
------------------------------------------------------------------------------------------------------------
local ctr = 0
function geom:makeMesh( goname, indices, verts, uvs, normals )
if(#indices <= 0) then
print("[Error] Invalid indices count.")
return
end
-- local mesh = resource.load("/assets/gotemplate/temp.mesh")
pprint(goname)
local res = resource.get_buffer(go.get(goname, "vertices"))
-- create a cloned buffer resource from another resource buffer
local newres = resource.create_buffer("/testbuffer_"..string.format("%d", ctr)..".bufferc", { buffer = res })
ctr = ctr + 1
pprint(newres)
local iverts = #indices
local meshdata = {}
-- positions are required (should assert or something)
tinsert(meshdata, { name = hash("position"), type=buffer.VALUE_TYPE_FLOAT32, count = 3 } )
if(normals) then tinsert(meshdata, { name = hash("normal"), type=buffer.VALUE_TYPE_FLOAT32, count = 3 } ) end
if(uvs) then tinsert(meshdata, { name = hash("texcoord0"), type=buffer.VALUE_TYPE_FLOAT32, count = 2 } ) end
--{ name = hash("color0"), type=buffer.VALUE_TYPE_FLOAT32, count = 4 }
local meshbuf = buffer.create(iverts, meshdata)
geomextension.setbufferbytesfromtable( meshbuf, "position", indices, verts )
if(normals) then geomextension.setbufferbytesfromtable( meshbuf, "normal", indices, normals ) end
if(uvs) then geomextension.setbufferbytesfromtable( meshbuf, "texcoord0", indices, uvs ) end
-- set the buffer with the vertices on the mesh
resource.set_buffer(newres, meshbuf)
go.set(goname, "vertices", newres)
end
------------------------------------------------------------------------------------------------------------
And it is mostly working - need to obviously change the ctr naming. Will do some testing, I will need to pump up the buffer and mesh limits now too. Thankyou for helping, I was really struggling with how you could possibly have done it without a resource!
Thanks again. And I really appreciate the patience and help.
Also, I apologize for not realizing the code I was using was different. Very sorry. Thankyou again.