I’m figuring out how to create a ribbon path similar to this:
So I know I need to do a custom mesh.
As it’s my first time doing this I’m a bit lost even after reading the documentation.
Also I get the impression that there is some other mesh I could build upon to do this or at least use as reference.
So I looked at the Cylinder shape and there are a lot of variables I don’t understand in the updateGeometry (this is where everything happens right? ):
1. What are samples? There are axisSamples and radialSamples, how does this affect the shape?
2. What is the logic behind creating the normals like this [java] int vertCount = axisSamples * (radialSamples + 1) + (closed ? 2 : 0);
// Normals
setBuffer(Type.Normal, 3, createVector3Buffer(getFloatBuffer(Type.Normal), vertCount));[/java]
3. Where are createVector3Buffer() and createVector2Buffer() methods declared? I can't find it in Mesh or Cylinder and don't understand what they do.
4. What is the math behind [java]int triCount = ((closed ? 2 : 0) + 2 * (axisSamples - 1)) * radialSamples;[/java]
I have more but I think is a lot already so I'll stop.
2. this is just creating the buffer for normals, the first line is just for counting the number of vertices.
3. Ctrl + left mouse button click would have been a faster way to get an answer on this one. I can’t check right now but from the look of it creates a VertexBuffer from a FloatBuffer.
4. I don’t really know what the “closed” boolean means but i guess you can toggle it on or off the have the cylinder closed at the top and at the bottom.
@nehon could you explain a little more the difference between radial and axis?
After some research I think the best way to make a ribbon path is using a NURB surface.
It seems a bit tricky to understand though. Could someone clarify:
5. How to build the knot vector.
6. For a very long line should I make several overlapping segments and then do GeometryBatchFactory over some or just a very long one?
7. Is there any good document that explains this concepts? I have read two (one by Philippe Lavoie and other by John Peterson) but still don’t really get it.