Running
Running
It's possible to run the viewer by double-clicking its program icon, and to then drag and drop scene and mesh files on the program window to load them.
However, it's much more common to run the viewer from a command line so that options can be specified. This method is detailed below.
Command Line Options
The general form for running the viewer is: OgreMaxViewer.exe options FileName where the case-insensitive options are optional and FileName is the name of your scene or mesh file.
Options
- -LockViewCamera - Locks the main view camera to the currently selected camera. This will be used when viewing a scene with animated cameras. Note that if you adjust the view camera in any way (by moving the mouse, keyboard or gamepad) the locking is turned off. See controls for details on turning view camera locking on and off at runtime.
- -zUp - Indicates that the scene up axis should be the z axis. This is only used if a mesh file is being viewed. By default, the y up axis is used.
- -ResourcesConfigFile or -r - Specifies the path to the resources configuration file. By default, OgreMaxViewerResources.cfg is used.
- -Zip or -z - Specifies the path to a zip file resource location.
- -OutputDirectory, -ODir, or -o - Specifies the path to a directory where any output files are written.
- -Directory, -Dir, or -d - Specifies the path to a directory resource location.
- -RDirectory, -RDir, or -rd - Specifies the path to a directory resource location that is searched recursively.
- -PluginsConfigFile or -p - Specifies the path to the plugins configuration file. By default, OgreMaxViewerPlugins.cfg is used. This option is ignored if the viewer has been compiled with the static Ogre libraries.
- -Width - Specifies the width of the render window. By default, the width is 800.
- -Height - Specifies the height of the render window. By default, the height is 600.
- -FullScreen - Indicates that the viewer should be run in full screen mode. By default, the viewer runs in windowed mode.
- -Direct3D or -D3D - Indicates that the Direct3D rendering system should be used. This is the default on Windows.
- -OpenGL or -OGL - Indicates that the OpenGL rendering system should be used. This is the default on non-Windows platforms.
- -VSync - Indicates vertical synchronization should be enabled. By default, vertical sync is disabled.
- -ScreenshotBaseName - Indicates base name that screenshot files will have. By default, the base name is Screenshot.
- -ScreenshotExtension - Indicates the file extension that screenshot files will have. The extension's leading '.' character is optional. By default, the file extension is .jpg.
- -WriteUserControlsFile - Indicates that the UserControls.xml file should be written when the viewer exits. This file is used to configure the viewer controls. By default, the UserControls.xml file is not written. Note that if this file is present it will always be read.
- -KeepLogFile - Indicates that the log file should not be deleted when the viewer exits. By default, the log file is deleted.
- -NVPerfHUD - Enables the NVidia performance heads-up display. By default, the heads-up display is not shown. Note that when using the NVidia PerfHUD tool, you must not resize the viewer window since it may cause a program crash. Also, for best results, use the newest version of the PerfHUD tool.
File Name
The viewer will always check the file system to see if the scene file exists.
- If the scene file exists, it will be loaded and the directory containing the file will be used as a resource location, in addition to any other resource locations that are contained in the file.
- If the scene file doesn't exist, and the file name was specified with a directory component, the viewer will generate an error. Otherwise, if no directory component is specified, the file will be loaded from one of the configured resource locations.
Example Usage
OgreMaxViewer.exe -Width 800 -Height 600 -FullScreen -VSync -D3D -LockViewCamera -ScreenshotBaseName MyScreenshot -ScreenshotExtension .bmp "c:\My Directory\My Scene.scene"
Scripting
You may write a Lua script file to control the viewer. Such a file is typically in the same directory as the viewed file, and must be named FileName.lua, where FileName is the file name (including the extension) passed into the viewer on startup. If present, this file will automatically be loaded. The following script functions will be called if they are defined:
- function Activating(scene) - Called once, when the scene is loaded.
- function Deactivating(scene) - Called once, when the scene is unloaded.
- function Update(scene, elapsedTime) - Called once per frame.
For a working demonstration of how to use a Lua scene script file see the MeshAnimation sample.
Drag-and-Drop
When running in windowed mode, the OgreMax Viewer supports drag and drop of files.
- Scene files - For the dropped scene file to load successfully, the scene needs to have been exported with the OgreMax Scene Exporter (version 1.5.2 or greater), and all resource locations must have been specified in the Ogre tab of the Scene Settings dialog within 3DS Max.
- Mesh files - For mesh files to load successfully, all the necessary resources need to be in the same directory.