Show: Delphi C++
Importing a 3D Model in a FireMonkey Application
From RAD Studio XE3
This tutorial shows, step by step, how to import a 3D model.
Create a FireMonkey HD or 3D Application and Add Components
- Select File > New > Other > Delphi Projects > HD FireMonkey Application:
- Creating a Delphi HD Application
- Creating a C++ HD Application
- Note that a 3D model can also be imported using 3D FireMonkey Application.
- Add a TViewport3D component to your form.
If you are using a 3D FireMonkey Application, skip this step; a 3D form already contains a TViewport3D component.
- Add a TLight as a child of the TViewport3D component. Add TLight as follows:
- Add a TModel3D as follows:
- Add TModel3D as a child of the TViewport3D component if you are using a HD FireMonkey Application.
- Add TModel3D as a form child if you are using 3D FireMonkey Application.
Import a 3D Model Using the Mesh Collection Editor
- Select the added TModel3D in the Structure View.
- In the Object Inspector, open the Mesh Collection Editor by clicking the ellipsis [...] in the MeshCollection field on the Properties page:
- Load a 3D format file by pressing the Load button on the Mesh Collection Editor and navigating to a 3D file (.ase, .dae, .obj).
- After the model is loaded and displayed in the Mesh Collection Editor, you can scale the model using the trackbar on the right side of the Mesh Collection Editor. You can also rotate the model by clicking the model and dragging it in the opposite direction of the desired rotation. When the model is in position and is correctly scaled, click OK on the Mesh Collection Editor to display the model on the form:
- Run the project: