Tutorial: Penrose triangle 3D model in Firemonkey XE5 (Delphi XE5)

Опубликовано: 09 Апрель 2026
на канале: Quark Cube
1,283
2

DISCLAIMER: This video is boring to the average YouTube viewer.

How to create a Penrose triangle? We build the usual view. Then we rotate the view. Is it good, then we take a picture.

Keys: TCube, TLayer3D, TViewport3D, Context.CopyToBitmap


FMX File:

object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 567
ClientWidth = 384
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [dkDesktop]
DesignerMobile = True
DesignerWidth = 384
DesignerHeight = 592
DesignerDeviceName = 'Google Nexus 4'
DesignerOrientation = 0
DesignerOSVersion = ''
object Viewport3D1: TViewport3D
Align = alClient
Color = claDeepskyblue
Height = 567.000000000000000000
Width = 384.000000000000000000
object Light1: TLight
Color = claWhite
LightType = ltDirectional
SpotCutOff = 180.000000000000000000
Position.X = -3.743673801422119000
Position.Y = -0.068357944488525390
RotationAngle.X = 324.286285400390600000
RotationAngle.Y = 27.404300689697270000
Width = 1.000000000000000000
Height = 1.000000000000000000
Depth = 1.000000000000000000
Quanternion =
'(-0.515536487102509,-0.061711311340332,-0.318584859371185,0.7930' +
'42778968811)'
end
object Dummy1: TDummy
Position.X = -0.001672476530075073
Position.Y = -1.525862693786621000
Scale.X = 0.500000000000000000
Scale.Y = 0.800000011920929000
Scale.Z = 0.500000000000000000
RotationAngle.X = 8.853599548339844000
RotationAngle.Y = 0.139160156250000000
Width = 1.000000000000000000
Height = 1.000000000000000000
Depth = 1.000000000000000000
Quanternion =
'(-0.243924766778946,0.331800758838654,-0.0491608902812004,-0.909' +
'940421581268)'
object Cube1: TCube
Position.Y = -3.000000000000000000
Width = 8.000000000000000000
Height = 1.000000000000000000
Depth = 1.000000000000000000
SubdivisionsDepth = 100
SubdivisionsHeight = 100
SubdivisionsWidth = 100
MaterialSource = LightMaterialSource1
object Cube3: TCube
Position.X = 3.500000000000000000
Position.Z = 3.500000000000000000
Width = 1.500000000000000000
Height = 1.000000000000000000
Depth = 8.000000000000000000
SubdivisionsDepth = 100
SubdivisionsHeight = 100
SubdivisionsWidth = 100
MaterialSource = LightMaterialSource1
end
object Cube2: TCube
Position.X = -3.599999904632568000
Position.Y = -1.600000023841858000
Width = 1.100000023841858000
Height = 4.250000000000000000
Depth = 1.000000000000000000
ZWrite = False
SubdivisionsDepth = 100
SubdivisionsHeight = 100
SubdivisionsWidth = 100
MaterialSource = LightMaterialSource1
end
end
end
object Layer3D1: TLayer3D
Fill.Color = claYellowgreen
Fill.Kind = bkSolid
Height = 150.000000000000000000
Position.X = 197.000000000000000000
Position.Y = 321.000000000000000000
Projection = pjScreen
Resolution = 50
Scale.X = -1.000000000000000000
StyleLookup = 'backgroundstyle'
Width = 200.000000000000000000
object Button1: TButton
Height = 44.000000000000000000
Position.X = 47.000000000000000000
Position.Y = 28.000000000000000000
TabOrder = 0
Text = 'Penrose'
Trimming = ttCharacter
Width = 114.000000000000000000
OnClick = Button1Click
end
end
end
object LightMaterialSource1: TLightMaterialSource
Diffuse = claWhite
Ambient = xFF202020
Emissive = claNull
Specular = xFF606060
Shininess = 30
Left = 176
Top = 352
end
end