It looks like you're new here. If you want to get involved, click one of these buttons!
-- Create a new mesh object local mesh = Mesh.new() -- set 3 vertices with one function call mesh:setVertices(1, 100, 100, 2, 150, 100, 3, 100, 150) -- set the first 3 indices as 10, 11 and 12. mesh:setIndices(1, 10, 2, 11, 3, 12) -- set the first 3 colors as (0xff0000, 0.5), (0x00ff00, 0.7) and (0x0000ff, 1.0). mesh:setColors(0xff0000, 0.5, 0x00ff00, 0.7, 0x0000ff, 1.0) -- Position mesh mesh:setPosition(300, 300) -- Add to stage stage:addChild(mesh) |
Dislikes: mehmetuysal
Comments
Now I need to go out but when I come back, I'll explain what is vertex and what is index. And after that everything will become much more clear.
@atilim
Thank you for the answer, I'm waiting for your test files & explanations of how all the mesh API works (vertex, index).
Is that possible to :
@dasowl No. First, I've implemented the function Mesh:setPrimitiveType but then I removed it because Adobe stage3d doesn't support triangle fans and strips (and lines and points). I don't know which platforms we will support in the future but I just want to be on the safe side.
Would it make the API too messy?
-----------
Meshes in Gideros are simply a set of triangles and (at least) both vertex and index buffers should be set to specify a mesh.
Assume that you want to draw a mesh shown in the attached image. It has 8 vertices and consists of 6 triangles. Each set of three indices identifies a triangle and therefore 6 * 3 indices should be specified:
Where in the roadmap do those last suggestions fit?
I believe those requests would be enough to let us explore this new feature.
Most probably with the next release.
Likes: Mells
Mesh scaling with a tween shows a strange behavior, as if the anchorPoint was moving during the scaling.
I don't know how to make a better report, this sample seems pretty simple.
Here is the { Test file } if needed.
Code :
You need to change setVertices as:
I see, the anchor point is at (0, 0) so it's better to construct the mesh around that anchor before positioning if there is a plan for rotation/scaling etc... later.
In a 3d software, when you add polygons to an object the center of the object is automatically modified (based on its bounding box).
Is something like this achievable so we could add triangles to the mesh based on user input and still have the possibility to rotate and scale that new object from its center?
@hnim please provide a test file and I'll see how it works on my side.
On Windows 7 32bit Gideros player
As a side note, I always think that glColor4f and GL_COLOR_ARRAY doesn't effect each other. But according to this http://lwjgl.org/forum/index.php?topic=2424.0;wap2 GL_COLOR_ARRAY effects the last value of glColor4f. It seems for some OpenGL drivers, GL_COLOR_ARRAY effects glColor4f and for some drivers it doesn't.
This is the bug. Thank you for reporting.
I rewrite my comment here so it's not lost :
I see, the anchor point is at (0, 0) so it's better to construct the mesh around that anchor before positioning if there is a plan for rotation/scaling etc... later.
In a 3d software, when you add polygons to an object the center of the object is automatically modified (based on its bounding box).
{ ? } Is something like this achievable so we could add triangles to the mesh based on user input and still have the possibility to rotate and scale that new object from its center?
@hnim your file works fine on my Macbook Air.
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive