Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Manual 2d mesh creator (v2 update)

Jmv38Jmv38 Mod
edited September 2013 in General Posts: 3,297

[edit]: 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:
https://gist.github.com/JMV38/2559b70abc9ed33796c7
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.

Comments

  • SimeonSimeon Admin Mod
    Posts: 5,386

    That is brilliant, @Jmv38.

  • Posts: 666

    Nice job.. Now, to add textures!

  • Nice job! This is really good! Now the only thing missing is textures

  • Jmv38Jmv38 Mod
    Posts: 3,297

    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:
    http://jmv38.comze.com/CODEAbis/server.php

  • Jmv38Jmv38 Mod
    Posts: 3,297

    Really draw:
    img

  • Jmv38Jmv38 Mod
    Posts: 3,297
  • Posts: 372

    Now that's awesome, @Jmv38. Are you planning to add a menu to select any sprite we want to the mesh?

  • Jmv38Jmv38 Mod
    Posts: 3,297

    Thanks @Saurabh. Can you explain more what your question means? I am not sure to understand.

  • Jmv38Jmv38 Mod
    Posts: 3,297

    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...

  • Posts: 372

    Yeah maybe just getting the right shape is good enough. Too much of parameters to add a texture to a mesh, you're right.

  • Jmv38Jmv38 Mod
    Posts: 3,297

    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.

  • Jmv38Jmv38 Mod
    Posts: 3,297

    Oh maybe you want a mesh shape that fits the contour of an object drawn in the picture?

  • edited September 2013 Posts: 372

    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

  • Jmv38Jmv38 Mod
    Posts: 3,297

    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.

  • Posts: 2,820

    This is great! Nice job!

  • Jmv38Jmv38 Mod
    Posts: 3,297

    Here is a small update:
    https://gist.github.com/JMV38/6573843
    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.

  • Jmv38Jmv38 Mod
    Posts: 3,297

    I created and embeded the icons with pixelArt tool of @Saurabh (the version i have modified)

  • Jmv38Jmv38 Mod
    Posts: 3,297

    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...

Sign In or Register to comment.