LDView 4.2 Released


RE: LDView 4.2 Released
#27
(2017-10-22, 20:52)Michael Horvath Wrote:
(2017-10-22, 4:16)Travis Cobbs Wrote: LDLCamera::rotate should in fact take the Euler angles, but a transformation matrix has a lot more in it than just that. If you have a rotation-only transformation matrix, then what you're doing is probably fine.

Will this create the correct type of matrix?

Code:
        TCFloat identity[16] =
        {
            1.0, 0.0, 0.0, 0.0,
            0.0, 1.0, 0.0, 0.0,
            0.0, 0.0, 1.0, 0.0,
            0.0, 0.0, 0.0, 1.0
        };
        TCVector::calcRotationMatrix(cameraXRotate, cameraYRotate, identity);

I believe it will. That function rotates around X and then rotates around Y by the given amounts. Side note: you don't have to initialize the array of floats that you pass in; that's a purely out parameter.

(2017-10-22, 20:52)Michael Horvath Wrote: Also, I have written a matrix to euler converter in Lua for another project. Could someone explain how to convert it to C++?

The array of floats has indices that go from 0 to 15. I can't remember if it is horizontal first, or vertical first. If it is horizontal first, the mapping would be:

r00 = matrix[0];
r01 = matrix[1];
r02 = matrix[2];
r10 = matrix[4];
r11 = matrix[5];
r12 = matrix[6];
r20 = matrix[8];
r21 = matrix[9];
r22 = matrix[10];

(Note that the 4th column is skipped, because the rotation portion is a 3x3 matrix, but the data in LDView is a 4x4 matrix.)

If it vertical first, the mapping would be:

r00 = matrix[0];
r00 = matrix[4];
r02 = matrix[8];
r10 = matrix[1];
r11 = matrix[5];
r12 = matrix[9];
r20 = matrix[2];
r21 = matrix[6];
r22 = matrix[10];
Reply
« Next Oldest | Next Newest »



Messages In This Thread
LDView 4.2 Released - by Travis Cobbs - 2016-07-11, 21:59
RE: LDView 4.2 Released - by Trevor Sandy - 2016-07-15, 11:44
RE: LDView 4.2 Released - by Travis Cobbs - 2016-07-15, 17:00
RE: LDView 4.2 Released - by Trevor Sandy - 2016-07-15, 17:15
RE: LDView 4.2 Released - by Michael Horvath - 2016-07-28, 11:23
RE: LDView 4.2 Released - by David Manley - 2016-09-14, 21:05
RE: LDView 4.2 Released - by Travis Cobbs - 2016-09-14, 22:06
RE: LDView 4.2 Released - by Michael Horvath - 2016-10-23, 20:24
RE: LDView 4.2 Released - by Travis Cobbs - 2016-10-24, 2:35
RE: LDView 4.2 Released - by Michael Horvath - 2016-10-24, 14:32
RE: LDView 4.2 Released - by Travis Cobbs - 2016-10-24, 17:22
RE: LDView 4.2 Released - by Michael Horvath - 2017-10-07, 20:17
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-07, 21:28
RE: LDView 4.2 Released - by Michael Horvath - 2017-10-20, 12:06
RE: LDView 4.2 Released - by Roland Melkert - 2017-10-20, 19:43
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-21, 3:32
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-21, 20:33
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-22, 4:16
RE: LDView 4.2 Released - by Michael Horvath - 2017-10-22, 20:52
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-23, 4:05
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-24, 4:34
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-24, 4:42
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-25, 5:25
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-25, 5:32
RE: LDView 4.2 Released - by Travis Cobbs - 2017-10-27, 5:46

Forum Jump:


Users browsing this thread: 1 Guest(s)