/*! \page pagesampleassetviewer SampleAssetViewer

The windows-specific <b>bin</b> subfolders contain the application SampleAssetViewer.exe.

This application can load model file sets that are generated by the \ref pageimporter or \ref pageauthoring tools.  A valid file set for this sample is one of the following:

-# An ExtPxAsset file and a graphics file:
  - .blast file: contains the Nv::Blast::ExtPxAsset which stores collision hulls in addition to Blast data.  Here you must use the --px option in when exporting from \ref pageimporter or \ref pageauthoring.
  - .obj or .fbx file: stores the graphics data.
-# An NvBlastAsset or TkAsset file, and a graphics + collision file:
  - .blast file: contains an NvBlastAsset or Nv::Blast::TkAsset (use the --ll or --tk option, respectively, when exporting from \ref pageimporter or \ref pageauthoring).
  - .fbx file: stores the graphics data along with embedded collision data.  Here you must use the --fbxcollision option when exporting from \ref pageimporter or \ref pageauthoring to embed collision information.

\section assetviewer_file_load Loading a Destructible Model

To load a specific file set, make sure the all files in the file set (described above) have the same name (except for extension).  Then use the commandline options

\verbatim
-t PATHNAME -n ASSETNAME -p "X Y Z" -r "AX AY AZ ANGLE"
\endverbatim

Here, PATHNAME is the path to the directory containing the {.blast, .obj} or {.blast, .fbx} file set (described above).  ASSETNAME is the common name of those files.
(X, Y, Z) is the translation to give to the actor that is created.  (AX, AY, AZ, ANGLE) is the rotation axis and angle (in degrees) to apply to the actor.

\section assetviewer_multifile_load Loading Multiple Destructible Models

To load multiple destructible models, use a config file.  The viewer reads .xml config files, which you can select using the command line argument

\verbatim
-x FILENAME
\endverbatim

Running the application with no commandline arguments, the viewer will load <b>samples/resources/configs/assets.xml</b> by default.  This file references
the models in the subdirectories of <b>samples/resources/models</b>.

\section using_assetviewer Using SampleAssetViewer

Upon startup, the viewer will instance its first asset in its assets list.  Using the default assets.xml, this is a brick wall.

The menu is displayed using an overlay on the left side of the screen.  It is divided into many submenus, which are described below.

In any scene, you may press <b>'F'</b> to fire a box into the scene in the direction the camera is pointing.

You may also press <b>SPACE</b> to toggle between damage and drag mode.  (The mode is shown at the top of the screen.)  In drag mode, dynamic objects can be manipulated by
placing the mouse cursor over them, and using <b>Left Mouse / Drag</b> to pull on the object.  In damage mode, <b>left-clicking</b> a destructible actor will apply damage to it.

You may select between three different damage tools using the <b>1, 2, and 3</b> keys.  Each will color the damage sphere (shown at the mouse hit location) a different color:

- (1) White - falloff damage.  Damage is applied everywhere within the sphere.
- (2) Blue - cutter damage.  Damage is applied only near the surface of the sphere.
- (3) Green - hierarchical damage.  Damage is passed down the chunk hierarchy with every damage application, sometimes leading to smaller chunks from an initial damage application.

You may change the size of the damage sphere using the center mouse wheel, or the \ref viewer_damage_tool menu (see below).

Right mouse button-drag to rotate the camera, and move using W, S, A, and D for forward, back, left, and right, respectively.  Q and E move the camera down and up, relative to the current orientation.

Pressing 'R' will reset the scene.  Pressing 'P' toggles physical simulation.

\section viewermenuitems Menu Items

\subsection viewer_scene Scene

Here you can select which assets to add to the scene, set the material damage properties, and enable a stress solver.

In Replace mode (the default, set by radio button), selecting assets in the Assets list will remove all destructible actors from the scene and insert the selected one.
In Append mode (the other radio button), selecting a new asset will insert its actor into the scene while keeping the others as well.

You may also select actors in the Scene Actors list,  and remove (or reload) the actor using the buttons below the list.  Reloading an actor will restore it to its
unfractured state.

Note, in addition to destructible actors, the Scene Actors list shows the boxes that were fired into the scene using the 'F' key.  Holding down the 'F' key "charges"
the throw, increasing the cube's speed the longer you hold down the key.  You may remove the cubes using the scene controls.  All cubes will be removed when the scene
is reset.

The Blast Material properties are used by the various damage tools available.

- Health = the value which damage must exceed to break a bond or chunk
- Min Damage Threshold = a fraction of Health, below which damage has no effect
- Max Damage Threshold = a fraction of Health, equal to the maximum damage that can be applied per damage event

A stress solver may be enabled by selcting the Stress Solver Enabled checkbox.  When enabled, you will be presented with several options.  
NOTE: you must then select the Stress Damage Enabled checkbox in order to allow stress to do damage to the actors in the scene.<br>
Bond Iterations Per Frame - is max amount of bonds allowed to be processed in one frame. The higher this value, the better quality of stress solver, but the time taken by it is increased linearly. 9You can 
check this timing in \a Stats submenu.) Using this value stress solver takes a fixed amount of CPU time on assets of any size. So the more complex an asset is (the more bonds it has) the less total iterations (on all bonds) are made.<br>
Use graph reduction level param to simplify stress graph for large assets. You can look at stress graph by using the \a Debug Render submenu.
Stress linear and angular factors are corresponded to the amount of damage to be applied on bonds from linear and angular momentum of stress on every bond.

Replay control section allows to control recording and replaying Blast&tm; events. It demonstrates the usage of \ref ExtSync extension. You may start/stop recording of Blast&tm; events (damage, split). 
If you toggle to sync initial actors, once recording starts, the full Blast&tm; state is saved.

\subsection viewer_blast Blast

Here you may disable or enable impact damage, using the Impact Damage checkbox (on by default).

The Fragility setting is a multiplier that turns impact forces into damage amounts.

You can toggle to pass impact damage to stress solver instead of just applying it with simple damage shader. Impact impulse will be passed to stress graph and damage will be applied
according to stress solver settings mentioned above.

When dragging static actors (with mouse dragging tool) stress impulse is also applied on stress graph. Use Dragging To Stress Factor to tune the amount.

You can limit rigid body count with next setting, all the actors created above this count will be ignored.

\subsection viewer_damage_tool Damage Tool

Here you may set the effect of the damage caused by the damage tool (left mouse click)

- Compressive Damage = the amount of damage that will be applied to bonds using the normal component
- Explosive Impulse = the radial impulse given to the fractured pieces
- Damage Radius = the size of the damage tool (also settable using the mouse wheel)
- Damage Profile = the damage function to use (equivalent to pressing the '1', '2', or '3' keys, see the section \ref using_assetviewer)

\subsection viewer_stats Stats

Here you will find various timers, counts, and sizes.  A running graph shows the frame time in ms.

The "Last X" times shown at the end of this list record the time spent during the last damage or split calls.  These are broken down
into sections, each contributing to the parent time.  "Child" function times are denoted by indentation.

\subsection viewer_application Application

Here you may pause the physics simulation (the same as pressing 'P') and reload shaders.

\subsection viewer_debugrender Debug Render

Here you may select wireframe rendering, which is useful for the various debug render options given.

You may select the debug render options from the Blast Debug Render Mode dropdown.  Note: pressing 'I' will cycle through this menu:

- Disabled = no debug rendering
- Health Graph = draws bonds with color based upon bond health.  Green = full health, red = low health.
- Centroids = draws a line segment starting at each bond centroid, pointing in the direction of the bond normal.  Also draws a square
centered at the bond centroid, with the area of the bond.
- Health Graph + Centroids = the two options above, combined.
- Stress Graph = draws bonds with color based upon stress values.  Green = low stress, red = high stress.
- Stress Graph + Nodes Impulse = same as Stress Graph plus a line segment indicating the impulse applied to each graph node.  The length of the segment is scaled by the Blast Debug Render Scale control.
The green segments show the linear impulse, the red segments the rotational impulse.
- Stress Graph + Bonds Impulse = same as Stress Graph plus a line segment indicating the impulse applied to each bond.  The length of the segment is scaled by the Blast Debug Render Scale control.
The green segments show the linear impulse, the red segments the rotational impulse.

\subsection viewer_physx PhysX

This menu controls PhysX&tm; simulation parameters.  Here you may choose to use fixed time steps (off by default), and set the time step (if Use Fixed Timestep is checked) with the Fixed Timestep control.

If a suitable GPU is available, GPU Physics may be enabled using the Use GPU Physics control.

\subsection viewer_renderer Renderer

Here you may change the lighting, shadow, and ambient occlusion (HBAO) options.

\subsection viewer_hints_help Hints / Help

Gives selected keyboard shortcuts.


<br>
See \ref pagecopyrights for license information regarding third-party software used by the samples.

<br>
*/
