Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - naldo

Pages: [1]
1
Support / Re: [ASK] Object3D max triangles
« on: November 15, 2014, 08:46:15 am »
Here's the fixed version: http://jpct.de/download/beta/jpct_ae.jar

Oh right, the order in HashMap will be scrambled if the capacity is resized.
Maybe you can use LinkedHashMap (?)

Thanks for the quick fix.

2
Support / Re: [ASK] Object3D max triangles
« on: November 14, 2014, 05:02:27 pm »
Sry.
Can't really check now. I'm away from my computer that containing the code.
But I think it's from the Object3D (or Mesh?).
I remember that i had logged the vertices position days ago.
Sometimes the order is different, even though the add-order is always the same.
The last time I'm sure the order is changing is when I add the vertex attributes data, especially with color information.

Currently i'm using Object(float[] coordinates, float[] uvs, int[] indices, int textureId) to ensure the order.
And it works flawlessly.

Thanks.


3
Support / Re: [ASK] Object3D max triangles
« on: November 14, 2014, 10:59:52 am »
Once created, the vertex order doesn't change. I'm not sure what you mean by 'run'?! A new app start or a new attribute update?

sorry, what i mean with 'run' is start/launch the app.

4
Support / Re: [ASK] Object3D max triangles
« on: November 14, 2014, 10:20:13 am »
That index stuff is a bug. I'll fix it later and upload a new version. About the second question: I'm not sure what you mean by that... ???

Ok, thanks.

For my second question,
suppose i have these vertices  to make 4 quads.
Code: [Select]
b d f h j
a c e g i

I add it with:
Code: [Select]
addTriangle (a, c, b);
addTriangle (b, c, d);

addTriangle (c, e, d);
addTriangle (d, e, f);

addTriangle (e, g, f);
addTriangle (f, g, h);

addTriangle (g, i, h);
addTriangle (h, i, j);

What is the order of the vertex with vertex sharing enabled?
When i update my VertexAttributes data, the order of vertex sometimes becomes "ab-cd-ef-gh-ij", and sometimes in another run it becomes "ac-bd-eg-fh-ij".

Thanks

5
Support / Re: My texture is loaded but 3d model is still black why ?
« on: November 14, 2014, 09:50:55 am »

It's probably texture coordinates is okay. I deleted setEnvMapped() method (default is false). And my texture is loading properly (Drawable, and texture constructor has drawable variable). Also, I have no error in code and logcat. However my model is still black. I upload my model and texture. If you want, If it helps, i can upload a picture of modal in my phone...

NOTE: I convert hearse.3ds to .mtl, .obj file format, because when ı load .3ds model it will appear upright on the screen

Yep i already tested it (.3ds) and the model looks fine with the texture.
I think you could remove the "calcTextureWrap()" call in your code.

6
Support / Re: [ASK] Object3D max triangles
« on: November 14, 2014, 09:30:41 am »
To update a part of the attributes, you have an array with a fitting size. In your example, you are trying to stuff an array with the size of 420 into VAs with the size of 420, starting at index 6. It doesn't work that way. Your array should be 414 in size and the data has to start at index 0, not 6 in that array.

Does it mean 'start' parameter always has to be zero?
'start' parameter is the index for updatedData right?
With same vertex attribute data above (length 420),  I've tried:

Code: [Select]
float[] updatedData = { 1, 2, 3, 4 };
attribs.update(updatedData, 1);
with same Exception, Invalid size: 1/4.

Now, I'm just curious why it doesn't work when 'start' parameter has a value larger than zero.


And,
when I update VertexAttributes data, the order of the vertex is often change between each run.
Is this the expected behaviour when vertex sharing is enabled?

Thanks.

7
Support / Re: [ASK] Object3D max triangles
« on: November 13, 2014, 05:59:38 pm »
You can do such stuff with a VertexController, but the idea is a little different (and a bit hacky...). Basically, you create an Object3D, which is "big enough", move all unused vertices out of the view and update those that should be visible.

oh right.
With VertexController, i don't need to recreate the vertices nor the Object3D instances.
I just need to modify the vertices directly.

I will use this for my final program if my previous method starting to get "ugly" in the future.
Many thanks.


for the side question:
how to update only a fraction of data in VertexAttribute?
Say i just want to update data at index 100 to 200.
Does this do-able?

8
Support / Re: [ASK] Object3D max triangles
« on: November 13, 2014, 12:20:19 pm »
My program will calculate & display a path/route based on user inputs.
Kinda like gps software or google maps.
So the mesh will be different for each new route.



Side question:
how to use update(float[], int) on VertexAttributes to update only a fraction of data?

I've tried something like:
Code: [Select]
float[] data = new float[420];
VertexAttributes attribs = ....;
attribs.setDynamic(true);
....

// then somewhere in code
// modify data
data[6] = 0;
data[7] = 1;
attribs.update(data, 6);


And I got RuntimeException: ERROR: Invalid size: 6/420

But when i use 0 for the start parameter in update(float[] data, int start), i.e. attribs.update(data, 0),
it works fine.

Thanks.

9
Support / [ASK] Object3D max triangles
« on: November 13, 2014, 09:31:44 am »
I have been using this superb engine for a week.

So, noob question:
My program needs to generate a mesh dynamically.
Any way to change the max triangles of an Object3D at runtime?

If there isn't, which is recommended:
1. Set the 'maxTriangles' to huge number at the initialization time (Object3D constructor). Will this lower the performance?
2. Remove the old Object3D from the world and add the new Object3D (with new max triangles).

Thank you.

Pages: [1]