Outerra forum
Anteworld  Outerra Game => Modding: Importer, Tools & Utilities => JavaScript development => Topic started by: SteelRat on January 16, 2016, 11:26:49 am

Hi cameni!
var Randomizer = function (val) {
this.v = val  100;
};
Randomizer.prototype = {
constructor: Randomizer,
get: function () {return Math.round(Math.random()*this.v);}
};
var rnd_1 = new Randomizer();
var rnd_2 = new Randomizer(10000000);
rnd_1.get();
rnd_2.get();
RU: Каждый новый экземпляр объекта Randomizer содержит ссылку на метод get() в объекте Randomizer, или каждый новый экземпляр объекта Randomizer получает свой экземпляр метода get() ?
Translate: Each new instance of Randomizer contains a link to get() method in the object Randomizer, or each new instance of Randomizer gets a copy of the method get() ?

Hi cameni!
ERROR: vehicle::init_chassis: C:/Users/Eduard/Outerra/packages/SteelRat/Test_deform/Ptm/Three/math/Matrix4.js(16): ReferenceError: Float32Array is not defined
How to create an object Float32Array? If this is possible, or is there an alternative?

I'm not sure if it was supported in Chromium 27 (the version in OT), but maybe it had a different syntax.
https://developer.mozilla.org/enUS/docs/Web/JavaScript/Reference/Global_Objects/Float32Array

Hi Cameni!
I'm a little confused).
It will be right?
Transformation Matrix
[
/*axle_X*/ 1, 0, 0, 0,
/*axle_Y*/ 0, 1, 0, 0,
/*axle_Z*/ 0, 0, 1, 0,
/*pos*/ 0, 0, 0, 1
]
or
[
/*axle_X*/ /*axle_Y*/ /*axle_Z*/ /*pos*/
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
]

Right for what?

I believe he asks which format for transformation matrix is correct. Not sure if this is the exact term though...

Yes but it's just a javascript array, it would depend on the math library used.
Our temporary vector math lib doesn't have matrices. If you are trying to use three.js then it's a question for them ...

Yes but it's just a javascript array, it would depend on the math library used.
Our temporary vector math lib doesn't have matrices. If you are trying to use three.js then it's a question for them ...
I read books about the matrix. And I realized that in a math and programming applies a different format of the matrix organization. However, different sources I met both options described above with respect to programming. That's me and confused).
RU:
Я почитал литературу про матрицы. И понял что в матиматике и программировании применяется разный формат организации матрицы. Но в разных источниках я встретил оба варианта, описанных выше, применительно к программированию. Именно это меня и запутало).

I believe he asks which format for transformation matrix is correct. Not sure if this is the exact term though...
Thank you! You're right.

Memory layout is implementation specific. OpenGL uses columnmajor format (sequence of values go by columns), but math libraries may have a different convention. Rowmajor is more consistent with how we usually write matrices (by rows), but as I can see, three.js uses columnmajor as well.

Memory layout is implementation specific. OpenGL uses columnmajor format (sequence of values go by columns), but math libraries may have a different convention. Rowmajor is more consistent with how we usually write matrices (by rows), but as I can see, three.js uses columnmajor as well.
Thank you!
"Three.js" I used as a temporary solution.
Over time, I will write the library. I need more experience.)