: most recent version: http://twolivesleft.com/Codea/Talk/discussion/comment/29145#Comment_29145
Recently sby complained about not finding a simple tool for creating 2d meshes. I thought it would be fun to make a quick one. Here is the video:
Here is the code:
The video is self explnatory. The mesh is in the Mesh tab that you can copy after you have made your drawing. This tool is very basic and not optimized, but it works. If you want to save the mesh without seeing the triangles, just tap the button to hide triangles before tapping on save (WYSIWYG). Enjoy!
PS: in this version you can always view the saved mesh, but not reload it for modifications.
PPS: the detection zone for each triangle (for color, split, delete) is in the middle of the triangle. I should have drawn a spot there, but i forgot.
That is brilliant, @Jmv38.
Nice job… Now, to add textures!
Nice job! This is really good! Now the only thing missing is textures
Version 2 is available. Much more functions (23), cleaner code. Now you can really use it to draw something, see:
You can get it from my web repo:
Now that’s awesome, @Jmv38. Are you planning to add a menu to select any sprite we want to the mesh?
Thanks @Saurabh. Can you explain more what your question means? I am not sure to understand.
Did you mean ‘select a picture to make it the mesh texture’?
If so, it is not so easy to do it correctly. Because the texCoords have to be specified for each triangle. How should they be placed? How should they be moved when you modify the triangle? 2 possiblities make sense: move them, or dont move them. So it is not so clear what to do…
Yeah maybe just getting the right shape is good enough. Too much of parameters to add a texture to a mesh, you’re right.
Maybe just 2 global options are enough: texture static / texture follows the mesh distortions. But i cant see what it would be used for. What is the point of adding a feature that does not correspond to a need? If you can describe a real life situation where you need this texture with a flat mesh, i will think of it.
Oh maybe you want a mesh shape that fits the contour of an object drawn in the picture?
No no let it be, cause usually in 2D i use meshes with textures so just in case that was possible, but its too complicated. I noticed one thing that all the vertices are vec3 whereas its a 2D mesh maker. Are you planning it to make it 3D, or its just some coincidence? And one more doubt how have you ordered the meshes, vertically horizontally, top to bottom, bottom to top i guess you should add numbers at the bottom of the meshes
Vec3 : half a coincidence : when i read ms:vertex(i) the result is a vec3, even if i entered a vec2. Since it worked fine i didnt notice nor corrected for it. But vec3 can be usefull too.
memory slot order: i wanted Mesh1 to be on top left, then left to right (usual reading order in western countries). I should mention it in the comment, or add the mesh name below each mesh, you are right.
Here is a small update:
i have replaced all the letter icons by drawn icons, you can see some of them:
It is not much, but the use and feel become more intuitive.
I created and embeded the icons with pixelArt tool of @Saurabh (the version i have modified)
I think i will probably add a texture to the mesh: then it will be possible to ajust the mesh to a part of the texture. This could be useful.
I also think i could make the mesh more compact by saving it with @ignatz compression tool. But then it wont be easy to read any more…