Finally got a usage for the Mesh component in my new project. And immediately having an issue.
Setting up vertex buffer with go.set() works, but setting up a texture doesn’t. In the docs there is “tex0” property, but using it gives a runtime error. When using “texture0” instead, I can get the default texture and setting it doesn’t produce a runtime error, but the texture doesn’t change on the screen.
go.property('other_texture', resource.texture())
function init(self)
go.set('#component', 'texture0', self.other_texture)
end
After go.set(), go.get() correctly returns the new texture reference. I tried changing tex0 to texture0 in the shader, but without success.
I have no obvious explanation. Looking through the code it seems correct.
If you wouldn’t mind create a small example for me I can try out, I can help out faster
Trying to create a Patch-9 scalable object based on the mesh component and it’s a bit annoying to have so many duplicate vertices. A single point inside a Patch-9 object consists of 6 duplicate vertices (4 quads around the point = 8 triangles minus 2 outside ones).
I would rather much appreciate indexed vertices. Do you plan on adding this option for buffers?
There’s currently no plan. Simply because we haven’t really thought much more than putting the feature out there to see what requests we get. Your suggestion is a good one.
If you wouldn’t mind, please add a feature request in the repo!
I’ve been trying to make a gameobject, that generates a vertex buffer on init. That works fine. The problem is, whenever I create another another instance of the go (either through factory or just plonking more in in the collection editor), the previous ones get the same vertices. I’m guessing it’s because all the meshes have the same .buffer file, and it’s that that is getting updated. Is it possible to create instances of a go with different vertex buffers at runtime somehow?
I believe the short answer is, “No”.
But the long answer is, you need to decide how many buffers you will need, max, and create a buffer file for each one in the editor, and load each one—either with a mesh component or a script property.
So I found a bug today: If you spawn a mesh, then try to set the same buffer that is already set on it, it stops rendering. I’ll validate this tomorrow and open an issue about it.