This sample shows you how to use different FireMonkey classes that interact with 3D objects.
You can find the ViewPort3DTLightTexture3D sample project at:
- Start | Programs | Appmethod 1.16 | Samples and then navigate to:
CPP\Multi-Device Samples\User Interface\ViewPort3DTLightTexture3D
- Subversion Repository:
The ViewPort3DTLightTexture3D sample demonstrates how to use the TViewport3D, TColorMaterialSource and TLightMaterialSource classes. The sample uses TColorMaterialSource to link a TColorMaterial to a 3D object and TLightMaterialSource to link a TLightMaterial to a 3D object. Moreover, the sample attaches two different TFloatAnimations to two 3D objects.
|File in C++||Contains|
The project itself.
The main form where the components are located.
Used to define and implement the sample.
TForm4 is the main form that represents the main window of the sample. It contains the following components:
- A TColorMaterialSource object.
- A TLightMaterialSource object.
- A TPanel object that contains:
- A TCheckBox object.
- A TViewport3D object that contains the following components:
- The sample uses TColorMaterialSource to link a TColorMaterial to a 3D object. The link is made through the MaterialSource property of the 3D object.
- The sample uses TLightMaterialSource to link a TLightMaterial to a 3D object. The link is made through the MaterialSource property of the 3D object.
- The sample uses Tpanel to hold multiple controls for organizing purposes.
- The sample uses TCheckBox to enable or disable TFloatAnimation. Select the box to turn on the animation or clear it to turn off the animation.
- The sample uses TRectangle3D to implement a 3D shape under the form of a 3D rectangle that can be placed on a 3D FireMonkey form.
- The sample uses TSphere to implement a 3D sphere shape that can be placed on a 3D FireMonkey form.
- The sample uses TFloatAnimation attached to a 3D object in order to animate it.
When you run the application, you see two 3D objects: a sphere and a 3D rectangle. On the one hand, the sphere is linked to the TLightMaterialSource object with the Texture property set to a map of the Earth. Therefore, the sphere object looks like the Earth. On the other hand, the 3D rectangle is linked to the TColorMaterialSource with the Color property set to
Blue. The link of TColorMaterialSource and TRectangle3D is made through the MaterialShaftSource property, which set the color for the shaft sides of the 3D rectangle.
- Note: To set the color for the front and back sides of the 3D rectangle, use the MaterialSource and MaterialBackSource properties.
Moreover, each TFloatAnimation is attached to each 3D object. When you click on the TCheckBox, it enables both animations. The sphere is attached to the FloatAnimation1, which has the PropertyName set to
RotationAngle.Y, while the 3D rectangle is attached to the FloatAnimation2, which has the PropertyName set to
RotationAngle.Z. Finally, both animations have the Loop property set to
, so it repeats the animation until the TCheckBox is cleared.
- FireMonkey 3D
- Tutorial: Creating a FireMonkey 3D Application
- Tutorial: How to Use Cameras in a FireMonkey 3D Application