LDraw.org Discussion Forums
LDView 4.2 Released - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: LDView 4.2 Released (/thread-21650.html)



LDView 4.2 Released - Travis Cobbs - 2016-07-11

At long last, LDView 4.2 is available. I'm going to be honest here, and warn that I gave up on getting it out the door with all the bugs fixed that I could fix. I decided that having it released was more important than fixing all the known problems. I believe that it is better than either 4.1 or 4.2 Beta 1. Having said that, if you have problems with this release, you'll probably have to go back to one of the earlier releases, because this is likely to be the last release I make. (Anyone who wants to take over is welcome to contact me.)

You can download this release from the LDView Downloads page.
The Change History is here.
The main LDView page is here.


RE: LDView 4.2 Released - Trevor Sandy - 2016-07-15

Thanks Travis!

I imagine the ability to generate PoVRay renderings from the command line was not addressed in this update ?

I would like to replace the L3P module in LPub3D because is it not open source and there is no way to maintain it. If I could generate PoVRay images from the command line using LDView, it would be possible to replace L3P.

If you care to describe an efficient approach to incorporating PoVRay image generation via the command line, I could take a look at building an LPub3D version of LDView with this capability.

Cheers,


RE: LDView 4.2 Released - Travis Cobbs - 2016-07-15

(2016-07-15, 11:44)Trevor Sandy Wrote: Thanks Travis!

I imagine the ability to generate PoVRay renderings from the command line was not addressed in this update ?

I would like to replace the L3P module in LPub3D because is it not open source and there is no way to maintain it. If I could generate PoVRay  images from the command line using LDView, it would be possible to replace L3P.

If you care to describe an efficient approach to incorporating PoVRay image generation via the command line, I could take a look at building an LPub3D version of LDView with this capability.

Cheers,

I assume by "PoVRay renderings", you actually mean .pov file generation, because actually calling out to POV from LDView doesn't seem like a good idea.

Command line access to the export commands was very high on my to-do list, but as I mentioned, it's unlikely I'll be doing any future releases at all, so that doesn't help you much.

If you want to implement it yourself, I wouldn't expect it to be too difficult. One problem is that it would be kicked off from platform-specific code. If you search the code tree for LDSnapshotTaker::doCommandLine, you'll find where the command line snapshot handling happens. Peter Bartfai has already indicated his willingness to continue to maintain the Qt port, so if you get Windows working, he can do Qt, and I can probably do the Mac part.

You would need to add code to recognize a new command line option to perform an export, and then either create a new class with a doCommandLine function to take care of performing the export, or add a function onto LDrawModelViewer. (The LDrawModelViewer object would definitely be necessary, since LDrawModelViewer::exportCurModel is what you're going to want to call to perform the export.) If you just have a new command equivalent to -SaveSnapshot, then you would have to determine the export type from the file extension. If you also want to have the equivalent of -SaveSnapshots, then you'd need a command line option to set the export type.

Please note that even though LDView is potentially abandoned, I moved its source tree (with full change history from the old CVS repository) to github:

https://github.com/tcobbs/ldview

SourceForge angered me with crap they pulled in the last few years, and I didn't want to leave it there. They claim they are now better, but I'm not sure I trust them not to stray again in the future. Additionally, CVS is becoming more and more difficult to install and use, so a switch to a more modern SCM was very much overdo.

If you're really interested, I'd be willing to give you push access to the new github tree. You'll have to let me know your github user ID for me to do that. (If you don't already have one, you'll have to create one.) Further details, plus any Q&A, would better be taken care of via email.


RE: LDView 4.2 Released - Trevor Sandy - 2016-07-15

Hello Travis.

Many thanks for the detailed response. As you suggest, I'll come back to you via email for further information.

Cheers,


LDView 4.2.1 for Mac Released - Travis Cobbs - 2016-07-19

I discovered that I was able to easily fix a crash that occurred when dismissing the export options dialog, so I updated the Mac version to 4.2.1 with that fix. It's available from the links above. This is a Mac-only fix to a Mac-only problem, so the Windows and Qt versions remain unaffected.

Orion, I think you reported on this a while ago with LDView 4.2 Beta 1.


RE: LDView 4.2 Released - Michael Horvath - 2016-07-28

Hrmm... I was hoping you would implement "Walk-through mode" before abandoning the project. Sad


RE: LDView 4.2 Released - Michael Horvath - 2016-09-14

Is it possible to view only a sub-model of an MPD? I am trying to do this in the Model Tree list, but the only option I see is to highlight the item. Thanks.


RE: LDView 4.2 Released - David Manley - 2016-09-14

(2016-09-14, 6:06)Michael Horvath Wrote: Is it possible to view only a sub-model of an MPD? I am trying to do this in the Model Tree list, but the only option I see is to highlight the item. Thanks.

Does the menu item "Tools/MPD Model Selection" provide the functionality you are after?

Regards,

David


RE: LDView 4.2 Released - Travis Cobbs - 2016-09-14

(2016-09-14, 6:06)Michael Horvath Wrote: Is it possible to view only a sub-model of an MPD? I am trying to do this in the Model Tree list, but the only option I see is to highlight the item. Thanks.

As David already suggested, Tools->MPD Model Selection does this. If you want to render a sub-model in a command line snapshot, use a colon, followed by the sub-model name, (like 8464.mpd:engine.ldr).


RE: LDView 4.2 Released - Michael Horvath - 2016-09-15

Awesome, thanks.


RE: LDView 4.2 Released - Michael Horvath - 2016-10-23

Will the source code compile with Visual Studio Express 2015? The 2005 version does not install on Windows 10.


RE: LDView 4.2 Released - Travis Cobbs - 2016-10-24

(2016-10-23, 20:24)Michael Horvath Wrote: Will the source code compile with Visual Studio Express 2015? The 2005 version does not install on Windows 10.

Do you mean that Visual Studio 2005 doesn't install on Windows 10, or LDView 4.2 doesn't install on Windows 10? Because my final development work was done (with Visual Studio 2005) in Windows 10, and it worked fine. Of course, Windows 10 isn't really Windows 10 any more; it's now Windows 10 with Anniversary Update, and that may as well be a whole new operating system given the huge swath of programs that Microsoft broke.

In any event, the 4.2 source tree won't build in Visual Studio 2015, but I migrated the source tree to GitHub and also updated it for Visual Studio 2015:

https://github.com/tcobbs/ldview

If you want to try to build it yourself, you are welcome to do so, and there's a decent chance that it will work, since I included pre-built VC2015 versions of the various libraries that LDView depends on in the GitHub source tree. And all my Visual Studio 2015 work was done with the free version of Visual Studio 2015.

Despite my claim that 4.2 would likely be the last release, there will in all likelihood be a 4.3 release at some point. I'm not going to make even rough estimates on when that might happen due to how bad I was with the 4.2 release.


RE: LDView 4.2 Released - Michael Horvath - 2016-10-24

(2016-10-24, 2:35)Travis Cobbs Wrote:
(2016-10-23, 20:24)Michael Horvath Wrote: Will the source code compile with Visual Studio Express 2015? The 2005 version does not install on Windows 10.

Do you mean that Visual Studio 2005 doesn't install on Windows 10, or LDView 4.2 doesn't install on Windows 10? Because my final development work was done (with Visual Studio 2005) in Windows 10, and it worked fine. Of course, Windows 10 isn't really Windows 10 any more; it's now Windows 10 with Anniversary Update, and that may as well be a whole new operating system given the huge swath of programs that Microsoft broke.

In any event, the 4.2 source tree won't build in Visual Studio 2015, but I migrated the source tree to GitHub and also updated it for Visual Studio 2015:

https://github.com/tcobbs/ldview

If you want to try to build it yourself, you are welcome to do so, and there's a decent chance that it will work, since I included pre-built VC2015 versions of the various libraries that LDView depends on in the GitHub source tree. And all my Visual Studio 2015 work was done with the free version of Visual Studio 2015.

Despite my claim that 4.2 would likely be the last release, there will in all likelihood be a 4.3 release at some point. I'm not going to make even rough estimates on when that might happen due to how bad I was with the 4.2 release.

I meant that Visual Studio 2005 won't install on Windows 10.

I will try compiling the github stuff, though I don't really know what I'm doing. Sad

Are the instructions in Build.txt up-to-date?


RE: LDView 4.2 Released - Travis Cobbs - 2016-10-24

(2016-10-24, 14:32)Michael Horvath Wrote: I meant that Visual Studio 2005 won't install on Windows 10.

I will try compiling the github stuff, though I don't really know what I'm doing. Sad

Are the instructions in Build.txt up-to-date?

The Build.txt instructions on GitHub are not up-to-date. Having said that, hopefully you can simply open the project, select the build target you want, and then build. Send me e-mail if it doesn't work or you have questions.


RE: LDView 4.2 Released - Michael Horvath - 2017-10-07

I am trying to find in the source code where the window title bar text is set. I'm trying to keep the version I've modified separate so I don't get the two confused. I've modified several strings in 'ModelWindow.cpp', and the title text is indeed changed *after you load a model*, but not when you initially start the program. Any advice?

Also, when redistributing source code, is it customary to include the entire project directory, or only a subset? (Visual Studio)


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-07

(2017-10-07, 20:17)Michael Horvath Wrote: I am trying to find in the source code where the window title bar text is set. I'm trying to keep the version I've modified separate so I don't get the two confused. I've modified several strings in 'ModelWindow.cpp', and the title text is indeed changed *after you load a model*, but not when you initially start the program. Any advice?

Also, when redistributing source code, is it customary to include the entire project directory, or only a subset? (Visual Studio)

In ModelLoader.cpp, the first argument to the LDViewWindow constructor is the window title. This comes from the TITLE #define near the top of that file. Note also that all three calls to setTitle in ModelWindow.cpp need to be updated if you're trying to consistently change the window title.

As for redistributing source, you can do it however you want, but I personally feel that distributing the whole thing would normally make more sense. Also, note that all recent development for LDView has been done on GitHub.


RE: LDView 4.2 Released - Michael Horvath - 2017-10-08

Awesome, thanks. I uploaded the project here:

http://www.mediafire.com/file/49hzmrffkfg7v00/LDView_v4.3_mjh_vsproject.zip

Quote:Adds a viewing mode called "FPS Mode" that alters lateral camera movement so that it is always level with the horizon, ignoring the angle of the camera above or below it (but not ignoring the angle around the vertical axis).

[Image: Q53QE0C.png]

You can merge it into your GitHub as you deem fit.


RE: LDView 4.2 Released - Michael Horvath - 2017-10-19

There is a bug/oversight. When FPS Mode is turned on, the camera should rotate around the universe's vertical axis no matter where the camera is pointing to. Instead, the camera is rotating around its own axis, and then auto-correcting so that its vertical axis points toward the universe's up direction. It's not a big deal, but I don't understand how I did not notice this until now. Sad


RE: LDView 4.2 Released - Michael Horvath - 2017-10-20

(2017-10-19, 1:26)Michael Horvath Wrote: There is a bug/oversight. When FPS Mode is turned on, the camera should rotate around the universe's vertical axis no matter where the camera is pointing to. Instead, the camera is rotating around its own axis, and then auto-correcting so that its vertical axis points toward the universe's up direction. It's not a big deal, but I don't understand how I did not notice this until now. Sad

I started a thread here.

https://gamedev.stackexchange.com/questions/149736/first-person-style-controls

As you can see, I am fumbling trying to find a solution.


RE: LDView 4.2 Released - Roland Melkert - 2017-10-20

(2017-10-20, 12:06)Michael Horvath Wrote:
(2017-10-19, 1:26)Michael Horvath Wrote: There is a bug/oversight. When FPS Mode is turned on, the camera should rotate around the universe's vertical axis no matter where the camera is pointing to. Instead, the camera is rotating around its own axis, and then auto-correcting so that its vertical axis points toward the universe's up direction. It's not a big deal, but I don't understand how I did not notice this until now. Sad

I started a thread here.

https://gamedev.stackexchange.com/questions/149736/first-person-style-controls

As you can see, I am fumbling trying to find a solution.

It would probably be much easier if you keep track of the 'eye' position in model space, and the abs left/right and up/down angles. then you can construct a model view matrix from those at any time by calculating the look at direction using the two angles and shift the scene so the eye is behind the 'screen' plane.


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-21

(2017-10-20, 12:06)Michael Horvath Wrote:
(2017-10-19, 1:26)Michael Horvath Wrote: There is a bug/oversight. When FPS Mode is turned on, the camera should rotate around the universe's vertical axis no matter where the camera is pointing to. Instead, the camera is rotating around its own axis, and then auto-correcting so that its vertical axis points toward the universe's up direction. It's not a big deal, but I don't understand how I did not notice this until now. Sad

I started a thread here.

https://gamedev.stackexchange.com/questions/149736/first-person-style-controls

As you can see, I am fumbling trying to find a solution.

I was working on a feature like this in the past, and apparently never got it working. If you set flags.keepRightSideUp to true in LDrawModelViewer, you will see what I had. Note that it sometimes twists the camera by 90 degrees briefly. I'm not sure why. It may be easier to look at what I already had and fix it than to implement it from scratch.


RE: LDView 4.2 Released - Michael Horvath - 2017-10-21

(2017-10-21, 3:32)Travis Cobbs Wrote:
(2017-10-20, 12:06)Michael Horvath Wrote: I started a thread here.

https://gamedev.stackexchange.com/questions/149736/first-person-style-controls

As you can see, I am fumbling trying to find a solution.

I was working on a feature like this in the past, and apparently never got it working. If you set flags.keepRightSideUp to true in LDrawModelViewer, you will see what I had. Note that it sometimes twists the camera by 90 degrees briefly. I'm not sure why. It may be easier to look at what I already had and fix it than to implement it from scratch.

Using flags.keepRightSideUp is not the same solution as FPS-style controls, like in a video game.

This article has a very general explanation of the solution. But I am having a hard time applying it to LDView. (I am very new to C++.)

https://gamedev.stackexchange.com/questions/136174/im-rotating-an-object-on-two-axes-so-why-does-it-keep-twisting-around-the-thir

[edit]

At the moment I am looking for a way to convert a matrix to something the camera can use. Is there documentation for the camera object?


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-21

(2017-10-21, 5:37)Michael Horvath Wrote:
(2017-10-21, 3:32)Travis Cobbs Wrote: I was working on a feature like this in the past, and apparently never got it working. If you set flags.keepRightSideUp to true in LDrawModelViewer, you will see what I had. Note that it sometimes twists the camera by 90 degrees briefly. I'm not sure why. It may be easier to look at what I already had and fix it than to implement it from scratch.

Using flags.keepRightSideUp is not the same solution as FPS-style controls, like in a video game.

This article has a very general explanation of the solution. But I am having a hard time applying it to LDView. (I am very new to C++.)

https://gamedev.stackexchange.com/questions/136174/im-rotating-an-object-on-two-axes-so-why-does-it-keep-twisting-around-the-thir

[edit]

At the moment I am looking for a way to convert a matrix to something the camera can use. Is there documentation for the camera object?

There's no way to convert a matrix into something the camera can use. The camera can be used to generate a matrix, but not vice-versa. The camera's facing member is an LDLFacing, and that class is fairly well documented (in LDLFacing.h). Given that LDLFacing is a quaternion, if you can find instructions for performing the rotation you want on a quaternion, it should be possible to do with LDLFacing (although it's possible that more member functions would have to be added there).


RE: LDView 4.2 Released - Michael Horvath - 2017-10-22

(2017-10-21, 20:33)Travis Cobbs Wrote: There's no way to convert a matrix into something the camera can use.

Could you explain this more? I thought that "camera.rotate" takes three Euler angles as input. Am I wrong? I have written a routine for another program that can convert a matrix to Euler angles, and could adapt that to here. Will that approach not work?


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-22

(2017-10-22, 0:24)Michael Horvath Wrote:
(2017-10-21, 20:33)Travis Cobbs Wrote: There's no way to convert a matrix into something the camera can use.

Could you explain this more? I thought that "camera.rotate" takes three Euler angles as input. Am I wrong? I have written a routine for another program that can convert a matrix to Euler angles, and could adapt that to here. Will that approach not work?

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.


RE: LDView 4.2 Released - Michael Horvath - 2017-10-22

(2017-10-22, 4:16)Travis Cobbs Wrote:
(2017-10-22, 0:24)Michael Horvath Wrote: Could you explain this more? I thought that "camera.rotate" takes three Euler angles as input. Am I wrong? I have written a routine for another program that can convert a matrix to Euler angles, and could adapt that to here. Will that approach not work?

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);

Also, I have written a matrix to euler converter in Lua for another project. Could someone explain how to convert it to C++?

Code:
-- Adapted from https://www.geometrictools.com/Documentation/EulerAngles.pdf, section 2.6
function MatrixToEuler(in_matrix)
    local r00 = in_matrix[9]
    local r01 = in_matrix[8]
    local r02 = in_matrix[7]
    local r10 = in_matrix[6]
    local r11 = in_matrix[5]
    local r12 = in_matrix[4]
    local r20 = in_matrix[3]
    local r21 = in_matrix[2]
    local r22 = in_matrix[1]
    local angleX = 0
    local angleY = 0
    local angleZ = 0
    if (r20 < 1) then
        if (r20 > -1) then
            angleX = atan2(r10, r00)
            angleY = asin(-r20)
            angleZ = atan2(r21, r22)
        else
            angleX = -atan2(-r12, r11)
            angleY = 90
            angleZ = 0
        end
    else
        angleX = atan2(-r12, r11)
        angleY = -90
        angleZ = 0
    end
    return {angleX, angleY, angleZ}
end



RE: LDView 4.2 Released - Travis Cobbs - 2017-10-23

(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];


RE: LDView 4.2 Released - Michael Horvath - 2017-10-23

(2017-10-23, 4:05)Travis Cobbs Wrote:
(2017-10-22, 20:52)Michael Horvath Wrote: 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.

One more question: does the calcRotationMatrix function rotate about the camera's axes or the universe's axes? It's supposed to rotate around the camera's x axis and the universe's y axis, according to the link I provided. Or does the function already take this into account?


RE: LDView 4.2 Released - Michael Horvath - 2017-10-23

(2017-10-23, 4:05)Travis Cobbs Wrote:
(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];

Should the function that does this be a member of TCVector?

Also, could you rewrite the function? I am not familiar with C++ syntax.


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-24

(2017-10-23, 4:43)Michael Horvath Wrote: One more question: does the calcRotationMatrix function rotate about the camera's axes or the universe's axes? It's supposed to rotate around the camera's x axis and the universe's y axis, according to the link I provided. Or does the function already take this into account?

Neither. The function creates a matrix that when applied to the matrix stack performs those rotations. It was written for latitude/longitude mode, where it is used to rotate the model about its center, but the matrix itself simply rotates about 0,0,0. For use rotating the model, my code first translates to the center, then applies the rotation.


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-24

(2017-10-23, 4:46)Michael Horvath Wrote: Should the function that does this be a member of TCVector?

Also, could you rewrite the function? I am not familiar with C++ syntax.

I just realized that you're converting angles to a matrix, and then trying to extract those same angles out of the matrix. This isn't going to help. Rotations are always in the local coordinate system, whatever that happens to be. (More specifically, all 3D transformations are relative to the currently active local coordinate system at the time the transformation is applied.) When you tell my camera to rotate, it does so in its own local coordinate system.

I'm not sure it will work, but try calculating how far you need to rotate around X for Y to point straight up. Store this in deltaY. Rotate around X by that amount, then rotate around Y by the desired X rotation amount, then rotate around X by -deltaY + the desired Y rotation amount.

Note that the X and Y rotations above are inverted intentionally. If you want to turn your head left or right (X rotation amount), you rotate around the Y axis. If you want to nod your head up and down (Y rotation amount), you rotate around the X axis.


RE: LDView 4.2 Released - Michael Horvath - 2017-10-24

(2017-10-24, 4:42)Travis Cobbs Wrote: I'm not sure it will work, but try calculating how far you need to rotate around X for Y to point straight up. Store this in deltaY. Rotate around X by that amount, then rotate around Y by the desired X rotation amount, then rotate around X by -deltaY + the desired Y rotation amount.

Note that the X and Y rotations above are inverted intentionally. If you want to turn your head left or right (X rotation amount), you rotate around the Y axis. If you want to nod your head up and down (Y rotation amount), you rotate around the X axis.

How do I determine the angle between the camera's orientation and the global "up" direction if the camera angles are always local? I'm assuming that "cameraXRotate" and "cameraYRotate" are just deltas and not cumulative amounts. I haven't figured out how to print or record the angles in VS yet for debugging purposes.


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-25

(2017-10-24, 9:17)Michael Horvath Wrote:
(2017-10-24, 4:42)Travis Cobbs Wrote: I'm not sure it will work, but try calculating how far you need to rotate around X for Y to point straight up. Store this in deltaY. Rotate around X by that amount, then rotate around Y by the desired X rotation amount, then rotate around X by -deltaY + the desired Y rotation amount.

Note that the X and Y rotations above are inverted intentionally. If you want to turn your head left or right (X rotation amount), you rotate around the Y axis. If you want to nod your head up and down (Y rotation amount), you rotate around the X axis.

How do I determine the angle between the camera's orientation and the global "up" direction if the camera angles are always local? I'm assuming that "cameraXRotate" and "cameraYRotate" are just deltas and not cumulative amounts. I haven't figured out how to print or record the angles in VS yet for debugging purposes.

If you look in LDrawModelViewer::rightSideUp, you will see that it calculates some stuff and stores it in tempVector. That tempVector is the rotated up vector for the camera. Its angle from global "up" should be acos(tempVector.dot(upVector). Yes, cameraXRotate cameraYRotate and deltas for the current frame.


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-25

(2017-10-24, 9:17)Michael Horvath Wrote: I haven't figured out how to print or record the angles in VS yet for debugging purposes.

When you run LDView in debug mode, it opens a console windows for stdout output. Since you're not a C++ programmer, you might want to use std::cout to output debug stuff, since lots of people don't like printf. (Don't forget to #include <iostream> before trying to use std::cout.) Example:

Code:
#include <iostream>

using namespace std;

... blah ... blah ... blah ...
cout << "cameraXRotate: " << cameraXRotate << endl;



RE: LDView 4.2 Released - Michael Horvath - 2017-10-27

(2017-10-25, 5:32)Travis Cobbs Wrote: When you run LDView in debug mode, it opens a console windows for stdout output. Since you're not a C++ programmer, you might want to use std::cout to output debug stuff, since lots of people don't like printf. (Don't forget to #include <iostream> before trying to use std::cout.) Example:

Code:
#include <iostream>

using namespace std;

... blah ... blah ... blah ...
cout << "cameraXRotate: " << cameraXRotate << endl;

Where is the output written to?


RE: LDView 4.2 Released - Travis Cobbs - 2017-10-27

(2017-10-27, 1:36)Michael Horvath Wrote:
(2017-10-25, 5:32)Travis Cobbs Wrote: When you run LDView in debug mode, it opens a console windows for stdout output. Since you're not a C++ programmer, you might want to use std::cout to output debug stuff, since lots of people don't like printf. (Don't forget to #include <iostream> before trying to use std::cout.) Example:

Code:
#include <iostream>

using namespace std;

... blah ... blah ... blah ...
cout << "cameraXRotate: " << cameraXRotate << endl;

Where is the output written to?

Output goes to the console window that LDView opens when a debug build is run. I mentioned that in my post.


RE: LDView 4.2 Released - Michael Horvath - 2017-11-01

(2017-10-27, 5:46)Travis Cobbs Wrote:
(2017-10-27, 1:36)Michael Horvath Wrote: Where is the output written to?

Output goes to the console window that LDView opens when a debug build is run. I mentioned that in my post.

Sorry, I got caught up in things. I will take a look at this at a later time.