Author Topic: add triangle with normal  (Read 2720 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
add triangle with normal
« on: April 14, 2012, 10:11:41 pm »
Please, could you add method for set normals? Something like this:

Code: [Select]
addTriangle(SimpleVector vert1, SimpleVector norm1,  float u,  float v,
      SimpleVector vert2, SimpleVector norm2, float u2, float v2,
      SimpleVector vert3, SimpleVector norm3, float u3,  float v3);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: add triangle with normal
« Reply #1 on: April 14, 2012, 11:18:20 pm »
No. If you want to change the normals that the engine has calculated (why do you want to do that?), you have to implement an IVertexController that do it that way.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: add triangle with normal
« Reply #2 on: April 14, 2012, 11:41:54 pm »
Particle system contains hundreds of particles, every particle has same normals and just one triangle. Calculation of normals and triangle strip is unnecessary and causes delay of loading process...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: add triangle with normal
« Reply #3 on: April 15, 2012, 08:13:16 pm »
Calculation of normals and triangle strip is unnecessary and causes delay of loading process...
You are really nano-optimizing here...creating a single polygon Object3D, adding one triangle + build() takes 1.6ms on my Nexus S. Even if you create 500 particles, it'll finish in under a second. Thinking about this "problem" takes more time than all of your users will ever spend waiting for this to happen. If you are really concerned about this, you can create one particle and create the others by doing a cloneObject() (that's not memory friendly anyway). That will bring down the time it takes to create on particle to around 0.5ms on my device. With that, you can also share the compiled data with the blue print, so that you save compilation time and gpu memory in addition.

The triangle strip isn't calculated. The object is just checked, if it is one and that's part of the compilation process. Printing the log message takes more time than the actual process. If you don't want this, do a Config.glTriangleStrips=false and the check won't be done.