Tanoda
TriLibCore.Samples.AssetViewer Class Reference

Represents a TriLib sample which allows the user to load models and HDR skyboxes from the local file-system. More...

Inheritance diagram for TriLibCore.Samples.AssetViewer:
TriLibCore.Samples.AssetViewerBase

Public Member Functions

void LoadModelFromFile ()
 Shows the file picker for loading a model from the local file-system. More...
 
void LoadSkyboxFromFile ()
 Shows the file picker for loading a skybox from the local file-system. More...
 
void ClearSkybox ()
 Removes the skybox texture. More...
 
void ResetModelScale ()
 
override void PlayAnimation ()
 Plays the selected animation. More...
 
override void StopAnimation ()
 Stop playing the selected animation. More...
 
override void PlaybackAnimationChanged (int index)
 Switches to the animation selected on the Dropdown. More...
 
override void PlaybackSliderChanged (float value)
 Event triggered when the Animation slider value has been changed by the user. More...
 
void OnSkyboxExposureChanged (float exposure)
 Event triggered when the skybox exposure Slider has changed. More...
 
- Public Member Functions inherited from TriLibCore.Samples.AssetViewerBase
void ShowHelp ()
 Shows the help box. More...
 
void HideHelp ()
 Hides the help box. More...
 
void ShowModelUrlDialog ()
 Shows the model URL dialog. More...
 
void HideModelUrlDialog ()
 Hides the model URL dialog. More...
 
void LoadModelFromURLWithDialogValues ()
 Shows the URL selector for loading a model from network. More...
 
virtual void PlayAnimation ()
 Plays the selected animation. More...
 
virtual void StopAnimation ()
 Stops playing the selected animation. More...
 
virtual void PlaybackAnimationChanged (int index)
 Switches to the animation selected on the Dropdown. More...
 
virtual void PlaybackSliderChanged (float value)
 Event triggered when the animation slider value has been changed by the user. More...
 

Protected Member Functions

override void Start ()
 Initializes the base-class and clears the skybox Texture. More...
 
virtual void ProcessInput ()
 Handles the input and moves the Camera accordingly. More...
 
override void OnBeginLoadModel (bool hasFiles)
 Event triggered when the user selects a file or cancels the Model selection dialog. More...
 
override void OnLoad (AssetLoaderContext assetLoaderContext)
 Event triggered when the Model Meshes and hierarchy are loaded. More...
 
virtual void ModelTransformChanged ()
 Changes the camera placement when the Model has changed. More...
 
override void OnError (IContextualizedError contextualizedError)
 Event is triggered when any error occurs. More...
 
override void OnMaterialsLoad (AssetLoaderContext assetLoaderContext)
 Event is triggered when the Model (including Textures and Materials) has been fully loaded. More...
 
- Protected Member Functions inherited from TriLibCore.Samples.AssetViewerBase
void UpdateCamera ()
 Updates the Camera based on mouse Input. More...
 
void LoadModelFromFile (GameObject wrapperGameObject=null, Action< AssetLoaderContext > onMaterialsLoad=null)
 Shows the file picker for loading a model from local file-system. More...
 
void LoadModelFromURL (UnityWebRequest request, string fileExtension, GameObject wrapperGameObject=null, object customData=null, Action< AssetLoaderContext > onMaterialsLoad=null)
 Loads a model from a URL. More...
 
virtual void OnBeginLoadModel (bool hasFiles)
 Event triggered when the user selects a file or cancels the Model selection dialog. More...
 
void SetLoading (bool value)
 Enables/disables the loading flag. More...
 
virtual void Start ()
 Checks if the Dispatcher instance exists and stores this class instance as the Singleton. More...
 
virtual void OnProgress (AssetLoaderContext assetLoaderContext, float value)
 Event is triggered when the Model loading progress changes. More...
 
virtual void OnError (IContextualizedError contextualizedError)
 Event is triggered when any error occurs. More...
 
virtual void OnLoad (AssetLoaderContext assetLoaderContext)
 Event is triggered when the Model Meshes and hierarchy are loaded. More...
 
virtual void OnMaterialsLoad (AssetLoaderContext assetLoaderContext)
 Event is triggered when the Model (including Textures and Materials) has been fully loaded. More...
 

Protected Attributes

GameObject Skybox
 Skybox game object. More...
 
float CameraDistance = 1f
 Current camera distance. More...
 
Vector3 CameraPivot
 Current camera pivot position. More...
 
float InputMultiplier = 1f
 Input multiplier based on loaded model bounds. More...
 
- Protected Attributes inherited from TriLibCore.Samples.AssetViewerBase
Slider PlaybackSlider
 Animation playback slider. More...
 
Text PlaybackTime
 Animation playback time. More...
 
Dropdown PlaybackAnimation
 Animation selector. More...
 
Selectable Play
 Play button. More...
 
Selectable Stop
 Stop button. More...
 
AssetLoaderOptions AssetLoaderOptions
 Options used in this sample. More...
 

Static Protected Attributes

const float CameraDistanceRatio = 2f
 Camera distance ratio based on model bounds. More...
 
const float MinCameraDistance = 0.01f
 minimum camera distance. More...
 
const float SkyboxScale = 100f
 Skybox scale based on model bounds. More...
 
- Static Protected Attributes inherited from TriLibCore.Samples.AssetViewerBase
const float InputMultiplierRatio = 0.1f
 Mouse input multiplier. Higher values will make the mouse movement more sensible. More...
 
const float MaxPitch = 80f
 Maximum camera pitch and light pitch (rotation around local X-axis). More...
 

Additional Inherited Members

- Public Attributes inherited from TriLibCore.Samples.AssetViewerBase
Vector2 CameraAngle
 Current camera pitch and yaw angles. More...
 
- Properties inherited from TriLibCore.Samples.AssetViewerBase
static AssetViewerBase Instance [get]
 Gets the Asset Viewer Singleton instance. More...
 
GameObject RootGameObject [get, protected set]
 Loaded game object. More...
 

Detailed Description

Represents a TriLib sample which allows the user to load models and HDR skyboxes from the local file-system.

Definition at line 17 of file AssetViewer.cs.

Member Function Documentation

◆ ClearSkybox()

void TriLibCore.Samples.AssetViewer.ClearSkybox ( )

Removes the skybox texture.

Definition at line 147 of file AssetViewer.cs.

◆ LoadModelFromFile()

void TriLibCore.Samples.AssetViewer.LoadModelFromFile ( )

Shows the file picker for loading a model from the local file-system.

Definition at line 125 of file AssetViewer.cs.

◆ LoadSkyboxFromFile()

void TriLibCore.Samples.AssetViewer.LoadSkyboxFromFile ( )

Shows the file picker for loading a skybox from the local file-system.

Definition at line 133 of file AssetViewer.cs.

◆ ModelTransformChanged()

virtual void TriLibCore.Samples.AssetViewer.ModelTransformChanged ( )
protectedvirtual

Changes the camera placement when the Model has changed.

Definition at line 412 of file AssetViewer.cs.

◆ OnBeginLoadModel()

override void TriLibCore.Samples.AssetViewer.OnBeginLoadModel ( bool  hasFiles)
protectedvirtual

Event triggered when the user selects a file or cancels the Model selection dialog.

Parameters
hasFilesIf any file has been selected, this value is true, otherwise it is false.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 358 of file AssetViewer.cs.

◆ OnError()

override void TriLibCore.Samples.AssetViewer.OnError ( IContextualizedError  contextualizedError)
protectedvirtual

Event is triggered when any error occurs.

Parameters
contextualizedErrorThe Contextualized Error that has occurred.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 430 of file AssetViewer.cs.

◆ OnLoad()

override void TriLibCore.Samples.AssetViewer.OnLoad ( AssetLoaderContext  assetLoaderContext)
protectedvirtual

Event triggered when the Model Meshes and hierarchy are loaded.

Parameters
assetLoaderContextThe Asset Loader Context reference. Asset Loader Context contains the Model loading data.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 369 of file AssetViewer.cs.

◆ OnMaterialsLoad()

override void TriLibCore.Samples.AssetViewer.OnMaterialsLoad ( AssetLoaderContext  assetLoaderContext)
protectedvirtual

Event is triggered when the Model (including Textures and Materials) has been fully loaded.

Parameters
assetLoaderContextThe Asset Loader Context reference. Asset Loader Context contains the Model loading data.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 437 of file AssetViewer.cs.

◆ OnSkyboxExposureChanged()

void TriLibCore.Samples.AssetViewer.OnSkyboxExposureChanged ( float  exposure)

Event triggered when the skybox exposure Slider has changed.

Parameters
exposureThe new exposure value.

Definition at line 259 of file AssetViewer.cs.

◆ PlayAnimation()

override void TriLibCore.Samples.AssetViewer.PlayAnimation ( )
virtual

Plays the selected animation.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 163 of file AssetViewer.cs.

◆ PlaybackAnimationChanged()

override void TriLibCore.Samples.AssetViewer.PlaybackAnimationChanged ( int  index)
virtual

Switches to the animation selected on the Dropdown.

Parameters
indexThe selected Animation index.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 182 of file AssetViewer.cs.

◆ PlaybackSliderChanged()

override void TriLibCore.Samples.AssetViewer.PlaybackSliderChanged ( float  value)
virtual

Event triggered when the Animation slider value has been changed by the user.

Parameters
valueThe Animation playback normalized position.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 189 of file AssetViewer.cs.

◆ ProcessInput()

virtual void TriLibCore.Samples.AssetViewer.ProcessInput ( )
protectedvirtual

Handles the input and moves the Camera accordingly.

Definition at line 285 of file AssetViewer.cs.

◆ ResetModelScale()

void TriLibCore.Samples.AssetViewer.ResetModelScale ( )

Definition at line 155 of file AssetViewer.cs.

◆ Start()

override void TriLibCore.Samples.AssetViewer.Start ( )
protectedvirtual

Initializes the base-class and clears the skybox Texture.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 269 of file AssetViewer.cs.

◆ StopAnimation()

override void TriLibCore.Samples.AssetViewer.StopAnimation ( )
virtual

Stop playing the selected animation.

Reimplemented from TriLibCore.Samples.AssetViewerBase.

Definition at line 172 of file AssetViewer.cs.

Member Data Documentation

◆ CameraDistance

float TriLibCore.Samples.AssetViewer.CameraDistance = 1f
protected

Current camera distance.

Definition at line 72 of file AssetViewer.cs.

◆ CameraDistanceRatio

const float TriLibCore.Samples.AssetViewer.CameraDistanceRatio = 2f
staticprotected

Camera distance ratio based on model bounds.

Definition at line 27 of file AssetViewer.cs.

◆ CameraPivot

Vector3 TriLibCore.Samples.AssetViewer.CameraPivot
protected

Current camera pivot position.

Definition at line 77 of file AssetViewer.cs.

◆ InputMultiplier

float TriLibCore.Samples.AssetViewer.InputMultiplier = 1f
protected

Input multiplier based on loaded model bounds.

Definition at line 87 of file AssetViewer.cs.

◆ MinCameraDistance

const float TriLibCore.Samples.AssetViewer.MinCameraDistance = 0.01f
staticprotected

minimum camera distance.

Definition at line 32 of file AssetViewer.cs.

◆ Skybox

GameObject TriLibCore.Samples.AssetViewer.Skybox
protected

Skybox game object.

Definition at line 42 of file AssetViewer.cs.

◆ SkyboxScale

const float TriLibCore.Samples.AssetViewer.SkyboxScale = 100f
staticprotected

Skybox scale based on model bounds.

Definition at line 37 of file AssetViewer.cs.


The documentation for this class was generated from the following file: