Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: Object  (Read 9900 times)

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Object
« on: January 16, 2016, 11:26:49 am »

Hi cameni!

Code: [Select]
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() ?
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Float32Array
« Reply #1 on: June 01, 2016, 02:13:12 pm »

Hi cameni!

Code: [Select]
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?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Object
« Reply #2 on: June 02, 2016, 01:22:38 am »

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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Matrix
« Reply #3 on: June 25, 2016, 11:34:10 am »

Hi Cameni!

I'm a little confused).
It will be right?

Transformation Matrix

Code: [Select]
[
/*axle_X*/ 1, 0, 0, 0,
/*axle_Y*/ 0, 1, 0, 0,
/*axle_Z*/ 0, 0, 1, 0,
/*pos*/ 0, 0, 0, 1
]

or

Code: [Select]
[
        /*axle_X*/          /*axle_Y*/         /*axle_Z*/         /*pos*/
        1,                  0,                 0,                 0,
        0,                  1,                 0,                 0,
        0,                  0,                 1,                 0,
        0,                  0,                 0,                 1
]
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Object
« Reply #4 on: July 08, 2016, 01:25:07 am »

Right for what?
Logged

DenisJ

  • Full Member
  • ***
  • Posts: 194
  • Кусь
    • VK Community
Re: Object
« Reply #5 on: July 08, 2016, 01:28:34 am »

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

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Object
« Reply #6 on: July 08, 2016, 03:24:25 am »

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 ...
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Object
« Reply #7 on: July 08, 2016, 05:23:34 am »

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:
Я почитал литературу про матрицы. И понял что в матиматике и программировании применяется разный формат организации матрицы. Но в разных источниках я встретил оба варианта, описанных выше, применительно к программированию. Именно это меня и запутало).
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Object
« Reply #8 on: July 08, 2016, 05:24:32 am »

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.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Object
« Reply #9 on: July 09, 2016, 06:50:11 am »

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

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Object
« Reply #10 on: July 09, 2016, 09:41:00 am »

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

Thank you!

"Three.js" I used as a temporary solution.
Over time, I will write the library. I need more experience.)
Logged