Class Model
Definition
- Assembly:
- Tizen.NUI.Scene3D.dll
Model is a Class to show 3D mesh objects. Model supports glTF 2.0 and DLI model formats. Physically Based Rendering with Image Based Lighting is also supported.
public class Model : View, INotifyPropertyChanged, IDisposable
- Inheritance
- Implements
-
System.ComponentModel.INotifyPropertyChangedSystem.IDisposable
Remarks
Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down. The Animations defined in the glTF or DLI are also loaded and can be retrieved by using GetAnimation(uint) and GetAnimation(string) methods. The number of animation is also retrieved by GetAnimationCount() method.
Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL). For the IBL, two cube map textures(diffuse and specular) are required. Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported.
The model and IBL textures start to be loaded asynchronously when the Model object is on Window. ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed. If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded. GetAnimation(uint) and GetAnimation(string) methods can be used after the model loading is finished.
By default, the loaded mesh has its own size and PivotPoint inferred from position of vertices. The PivotPoint can be modified after model loading is finished. If user set size property, the mesh will be scaled to the input size. Default value of ParentOrigin of the Model is Center.
Examples
Model model = new Model(modelUrl)
{
Size = new Size(width, height),
};
model.ResourcesLoaded += (s, e) =>
{
model.PivotPoint = new Vector3(0.5f, 0.5f, 0.5f); // Use center as a Pivot.
int animationCount = model.GetAnimationCount();
if(animationCount > 0)
{
// Play an Animation of index 0.
model.GetAnimation(0).Play();
}
};
model.SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
window.Add(model);
Constructors
View SourceModel(string, string)
Create an initialized Model.
Declaration
public Model(string modelUrl, string resourceDirectoryUrl = "")
Parameters
Type | Name | Description |
---|---|---|
string | modelUrl | model file url.(e.g. glTF, and DLI). |
string | resourceDirectoryUrl | The url to derectory containing resources: binary, image etc. |
Remarks
If resourceDirectoryUrl is empty, the parent directory url of modelUrl is used for resource url.
http://tizen.org/privilege/mediastorage for local files in media storage. http://tizen.org/privilege/externalstorage for local files in external storage.
Model(Model)
Copy constructor.
Declaration
public Model(Model model)
Parameters
Type | Name | Description |
---|---|---|
Model | model | Source object to copy. |
Remarks
Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down. The Animations defined in the glTF or DLI are also loaded and can be retrieved by using GetAnimation(uint) and GetAnimation(string) methods. The number of animation is also retrieved by GetAnimationCount() method.
Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL). For the IBL, two cube map textures(diffuse and specular) are required. Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported.
The model and IBL textures start to be loaded asynchronously when the Model object is on Window. ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed. If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded. GetAnimation(uint) and GetAnimation(string) methods can be used after the model loading is finished.
By default, the loaded mesh has its own size and PivotPoint inferred from position of vertices. The PivotPoint can be modified after model loading is finished. If user set size property, the mesh will be scaled to the input size. Default value of ParentOrigin of the Model is Center.
Methods
View SourceDispose(DisposeTypes)
To make transitionSet instance be disposed.
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
Type | Name | Description |
---|---|---|
DisposeTypes | type |
Overrides
Remarks
Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down. The Animations defined in the glTF or DLI are also loaded and can be retrieved by using GetAnimation(uint) and GetAnimation(string) methods. The number of animation is also retrieved by GetAnimationCount() method.
Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL). For the IBL, two cube map textures(diffuse and specular) are required. Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported.
The model and IBL textures start to be loaded asynchronously when the Model object is on Window. ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed. If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded. GetAnimation(uint) and GetAnimation(string) methods can be used after the model loading is finished.
By default, the loaded mesh has its own size and PivotPoint inferred from position of vertices. The PivotPoint can be modified after model loading is finished. If user set size property, the mesh will be scaled to the input size. Default value of ParentOrigin of the Model is Center.
GenerateMotionDataAnimation(MotionData)
Generate animation by MotionData. If there is no animatable item for MotionData, return null.
Declaration
public Animation GenerateMotionDataAnimation(MotionData motionData)
Parameters
Type | Name | Description |
---|---|---|
MotionData | motionData | Source motion data. |
Returns
Type | Description |
---|---|
Animation | Generated animation from then given motion data, or null if there is no animatable item in |
Remarks
Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down. The Animations defined in the glTF or DLI are also loaded and can be retrieved by using GetAnimation(uint) and GetAnimation(string) methods. The number of animation is also retrieved by GetAnimationCount() method.
Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL). For the IBL, two cube map textures(diffuse and specular) are required. Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported.
The model and IBL textures start to be loaded asynchronously when the Model object is on Window. ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed. If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded. GetAnimation(uint) and GetAnimation(string) methods can be used after the model loading is finished.
By default, the loaded mesh has its own size and PivotPoint inferred from position of vertices. The PivotPoint can be modified after model loading is finished. If user set size property, the mesh will be scaled to the input size. Default value of ParentOrigin of the Model is Center.
GetAnimation(string)
Retrieves animation with the given name. Note: This method should be called after Model load finished.
Declaration
public Animation GetAnimation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | String name of animation to be retrieved. |
Returns
Type | Description |
---|---|
Animation | Animation that has the given name. |
Remarks
Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down. The Animations defined in the glTF or DLI are also loaded and can be retrieved by using GetAnimation(uint) and GetAnimation(string) methods. The number of animation is also retrieved by GetAnimationCount() method.
Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL). For the IBL, two cube map textures(diffuse and specular) are required. Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported.
The model and IBL textures start to be loaded asynchronously when the Model object is on Window. ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed. If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded. GetAnimation(uint) and GetAnimation(string) methods can be used after the model loading is finished.
By default, the loaded mesh has its own size and PivotPoint inferred from position of vertices. The PivotPoint can be modified after model loading is finished. If user set size property, the mesh will be scaled to the input size. Default value of ParentOrigin of the Model is Center.
GetAnimation(uint)
Gets animation at the index.
Declaration
public Animation GetAnimation(uint index)
Parameters
Type | Name | Description |
---|---|---|
uint | index | Index of animation to be retrieved. |
Returns
Type | Description |
---|---|
Animation | Animation at the index. |
Remarks
This method should be called after Model load has been finished.
GetAnimationCount()
Gets number of animations that has been loaded from model file.
Declaration
public uint GetAnimationCount()
Returns
Type | Description |
---|---|
uint | The number of loaded animations. |
Remarks
This method should be called after Model load has been finished.
SetImageBasedLightSource(string, string, float)
Changes Image Based Light according to the given input textures.
Declaration
public void SetImageBasedLightSource(string diffuseUrl, string specularUrl, float scaleFactor = 1)
Parameters
Type | Name | Description |
---|---|---|
string | diffuseUrl | The path of Cube map image that will be used as a diffuse IBL source. |
string | specularUrl | The path of Cube map image that will be used as a specular IBL source. |
float | scaleFactor | Scale factor that controls light source intensity in [0.0f, 1.0f]. Default value is 1.0f. |
Remarks
http://tizen.org/privilege/mediastorage for local files in media storage. http://tizen.org/privilege/externalstorage for local files in external storage.
SetMotionData(MotionData)
Set values from MotionData. Note that this method doesn not apply KeyFrames animation. If you want to apply the animation, please use GenerateMotionDataAnimation(MotionData) and play the result.
Declaration
public void SetMotionData(MotionData motionData)
Parameters
Type | Name | Description |
---|---|---|
MotionData | motionData | Source motion data. |
Remarks
Since NUI uses a left-handed coordinate system, loaded models are transformed into a left-handed coordinate system with Y pointing down. The Animations defined in the glTF or DLI are also loaded and can be retrieved by using GetAnimation(uint) and GetAnimation(string) methods. The number of animation is also retrieved by GetAnimationCount() method.
Model also supports Physically Based Rendering(PBR) with Image Based Lighting(IBL). For the IBL, two cube map textures(diffuse and specular) are required. Model supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported.
The model and IBL textures start to be loaded asynchronously when the Model object is on Window. ResourcesLoaded signal notifies that the loading of the model and IBL resources have been completed. If Model or IBL is requested to be loaded before the other loading is completed, the ResourcesLoaded signal is called after all resources are loaded. GetAnimation(uint) and GetAnimation(string) methods can be used after the model loading is finished.
By default, the loaded mesh has its own size and PivotPoint inferred from position of vertices. The PivotPoint can be modified after model loading is finished. If user set size property, the mesh will be scaled to the input size. Default value of ParentOrigin of the Model is Center.