GXS.SceneRegister.pas 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747
  1. //
  2. // The graphics GaLaXy Engine. The unit of GXScene
  3. //
  4. unit GXS.SceneRegister;
  5. (*
  6. Registration unit for library components, property editors and
  7. IDE experts.
  8. *)
  9. interface
  10. {$I Stage.Defines.inc}
  11. uses
  12. Winapi.Windows,
  13. System.Classes,
  14. System.SysUtils,
  15. System.TypInfo,
  16. FMX.Forms,
  17. FMX.Dialogs,
  18. FMX.Controls,
  19. FMX.StdCtrls,
  20. FMX.Graphics,
  21. { TODO : F1026 Files not found: 'VCLEditors' etc.}
  22. (*need to create instead a custom PropertyEditor like it described in -> *)
  23. (*ms-help://embarcadero.rs_xe7/rad/Creating_a_Component_Editor_and_a_Property_Editor_for_FireMonkey_Components.html*)
  24. (*
  25. VCLEditors,
  26. ToolsAPI,
  27. *)
  28. /// ToDo DesignTime
  29. (*
  30. DesignIntf,
  31. DesignEditors,
  32. DesignMenus,
  33. *)
  34. Stage.Strings,
  35. Stage.Utils,
  36. GXS.Scene,
  37. GXS.Context,
  38. GXS.Color,
  39. GXS.SceneViewer,
  40. GXS.ObjectManager;
  41. type
  42. TgxLibMaterialNameProperty = class(TStringProperty)
  43. public
  44. function GetAttributes: TPropertyAttributes; override;
  45. procedure Edit; override;
  46. end;
  47. TgxSceneViewerEditor = class(TComponentEditor)
  48. public
  49. procedure ExecuteVerb(Index: Integer); override;
  50. function GetVerb(Index: Integer): string; override;
  51. function GetVerbCount: Integer; override;
  52. end;
  53. TgxSceneEditor = class(TComponentEditor)
  54. public
  55. procedure Edit; override;
  56. procedure ExecuteVerb(Index: Integer); override;
  57. function GetVerb(Index: Integer): string; override;
  58. function GetVerbCount: Integer; override;
  59. end;
  60. TgxResolutionProperty = class(TPropertyEditor)
  61. public
  62. function GetAttributes: TPropertyAttributes; override;
  63. function GetValue: string; override;
  64. procedure GetValues(Proc: TGetStrProc); override;
  65. procedure SetValue(const Value: string); override;
  66. end;
  67. TgxTextureProperty = class(TClassProperty)
  68. public
  69. function GetAttributes: TPropertyAttributes; override;
  70. end;
  71. TgxTextureImageProperty = class(TClassProperty)
  72. public
  73. function GetAttributes: TPropertyAttributes; override;
  74. procedure Edit; override;
  75. end;
  76. TgxImageClassProperty = class(TClassProperty)
  77. public
  78. function GetAttributes: TPropertyAttributes; override;
  79. procedure GetValues(Proc: TGetStrProc); override;
  80. function GetValue: string; override;
  81. procedure SetValue(const Value: string); override;
  82. end;
  83. TgxColorProperty = class(TClassProperty
  84. // , ICustomPropertyDrawing,
  85. // ICustomPropertyListDrawing
  86. )
  87. protected
  88. function ColorToBorderColor(aColor: TgxColorVector;
  89. selected: Boolean): TgxColor;
  90. public
  91. function GetAttributes: TPropertyAttributes; override;
  92. procedure GetValues(Proc: TGetStrProc); override;
  93. procedure Edit; override;
  94. // ICustomPropertyListDrawing stuff
  95. procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas;
  96. var AHeight: Integer);
  97. procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas;
  98. var AWidth: Integer);
  99. procedure ListDrawValue(const Value: string; ACanvas: TCanvas;
  100. const ARect: TRect; ASelected: Boolean);
  101. // CustomPropertyDrawing
  102. procedure PropDrawName(ACanvas: TCanvas; const ARect: TRect;
  103. ASelected: Boolean);
  104. procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect;
  105. ASelected: Boolean);
  106. function GetValue: string; override;
  107. procedure SetValue(const Value: string); override;
  108. end;
  109. TgxSoundFileProperty = class(TClassProperty)
  110. public
  111. function GetAttributes: TPropertyAttributes; override;
  112. function GetValue: string; override;
  113. procedure Edit; override;
  114. end;
  115. TgxSoundNameProperty = class(TStringProperty)
  116. public
  117. function GetAttributes: TPropertyAttributes; override;
  118. procedure GetValues(Proc: TGetStrProc); override;
  119. end;
  120. TgxCoordinatesProperty = class(TClassProperty)
  121. public
  122. function GetAttributes: TPropertyAttributes; override;
  123. procedure Edit; override;
  124. end;
  125. TgxMaterialProperty = class(TClassProperty)
  126. public
  127. function GetAttributes: TPropertyAttributes; override;
  128. procedure Edit; override;
  129. end;
  130. TgxGUILayoutEditor = class(TComponentEditor)
  131. public
  132. procedure Edit; override;
  133. procedure ExecuteVerb(Index: Integer); override;
  134. function GetVerb(Index: Integer): string; override;
  135. function GetVerbCount: Integer; override;
  136. end;
  137. (* Editor copied from DsgnIntf.
  138. Could have been avoided, if only that guy at Borland didn't chose to
  139. publish only half of the stuff (and that's not the only class with
  140. that problem, most of the subitems handling code in TgxSceneBaseObject is
  141. here for the same reason...), the "protected" wasn't meant just to lure
  142. programmers into code they can't reuse... Arrr! Grrr... *)
  143. TgxReuseableDefaultEditor = class(TComponentEditor, IDefaultEditor)
  144. protected
  145. FFirst: IProperty;
  146. FBest: IProperty;
  147. FContinue: Boolean;
  148. procedure CheckEdit(const Prop: IProperty);
  149. procedure EditProperty(const Prop: IProperty;
  150. var Continue: Boolean); virtual;
  151. public
  152. procedure Edit; override;
  153. end;
  154. // Editor for material library.
  155. TgxMaterialLibraryEditor = class(TgxReuseableDefaultEditor, IDefaultEditor)
  156. protected
  157. procedure EditProperty(const Prop: IProperty;
  158. var Continue: Boolean); override;
  159. public
  160. procedure ExecuteVerb(Index: Integer); override;
  161. function GetVerb(Index: Integer): string; override;
  162. function GetVerbCount: Integer; override;
  163. end;
  164. TgxAnimationNameProperty = class(TStringProperty)
  165. public
  166. function GetAttributes: TPropertyAttributes; override;
  167. procedure GetValues(Proc: TGetStrProc); override;
  168. end;
  169. (* Selection editor for TgxSoundLibrary.
  170. Allows units to be added to the uses clause automatically when
  171. sound files are loaded into a TgxSoundLibrary at design-time. *)
  172. TgxSoundLibrarySelectionEditor = class(TSelectionEditor)
  173. public
  174. procedure RequiresUnits(Proc: TGetStrProc); override;
  175. end;
  176. (* Selection editor for TgxBaseSceneObject.
  177. Allows units to be added to the uses clause automatically when
  178. behaviours/effects are added to a TgxBaseSceneObject at design-time. *)
  179. TgxBaseSceneObjectSelectionEditor = class(TSelectionEditor)
  180. public
  181. procedure RequiresUnits(Proc: TGetStrProc); override;
  182. end;
  183. // Editor for Archive Manager.
  184. TgxSArchiveManagerEditor = class(TgxReuseableDefaultEditor, IDefaultEditor)
  185. protected
  186. procedure EditProperty(const Prop: IProperty;
  187. var Continue: Boolean); override;
  188. public
  189. procedure ExecuteVerb(Index: Integer); override;
  190. function GetVerb(Index: Integer): string; override;
  191. function GetVerbCount: Integer; override;
  192. end;
  193. TgxMaterialComponentNameProperty = class(TStringProperty)
  194. public
  195. function GetAttributes: TPropertyAttributes; override;
  196. procedure Edit; override;
  197. end;
  198. TgxLibTextureNameProperty = class(TgxMaterialComponentNameProperty)
  199. public
  200. procedure GetValues(Proc: TGetStrProc); override;
  201. end;
  202. TgxLibSamplerNameProperty = class(TgxMaterialComponentNameProperty)
  203. public
  204. procedure GetValues(Proc: TGetStrProc); override;
  205. end;
  206. TgxLibCombinerNameProperty = class(TgxMaterialComponentNameProperty)
  207. public
  208. procedure GetValues(Proc: TGetStrProc); override;
  209. end;
  210. TgxLibShaderNameProperty = class(TgxMaterialComponentNameProperty)
  211. public
  212. procedure GetValues(Proc: TGetStrProc); override;
  213. end;
  214. TgxLibAttachmentNameProperty = class(TgxMaterialComponentNameProperty)
  215. public
  216. procedure GetValues(Proc: TGetStrProc); override;
  217. end;
  218. TgxLibAsmProgNameProperty = class(TgxMaterialComponentNameProperty)
  219. public
  220. procedure GetValues(Proc: TGetStrProc); override;
  221. end;
  222. TPictureFileProperty = class(TStringProperty)
  223. public
  224. function GetAttributes: TPropertyAttributes; override;
  225. procedure Edit; override;
  226. end;
  227. TShaderFileProperty = class(TStringProperty)
  228. public
  229. function GetAttributes: TPropertyAttributes; override;
  230. procedure Edit; override;
  231. end;
  232. TAsmProgFileProperty = class(TStringProperty)
  233. public
  234. function GetAttributes: TPropertyAttributes; override;
  235. procedure Edit; override;
  236. end;
  237. TUniformAutoSetProperty = class(TPropertyEditor)
  238. private
  239. procedure PassUniform(const S: string);
  240. public
  241. function GetAttributes: TPropertyAttributes; override;
  242. procedure Edit; override;
  243. end;
  244. TgxShaderEditorProperty = class(TClassProperty)
  245. protected
  246. function GetStrings: TStrings;
  247. procedure SetStrings(const Value: TStrings);
  248. procedure OnShaderCheck(Sender: TObject);
  249. public
  250. function GetAttributes: TPropertyAttributes; override;
  251. procedure Edit; override;
  252. end;
  253. procedure Register;
  254. // Auto-create for object manager
  255. function ObjectManager: TgxObjectManager;
  256. // ------------------------------------------------------------------
  257. implementation
  258. // ------------------------------------------------------------------
  259. uses
  260. // FLibMaterialPicker,
  261. // FGUILayoutEditor,
  262. // FMaterialEditorForm,
  263. // FShaderMemo,
  264. // FShaderUniformEditor,
  265. // FVectorEditor,
  266. // FSceneEditor,
  267. GXS.BaseClasses,
  268. Stage.VectorTypesExt,
  269. Stage.VectorTypes,
  270. Stage.VectorGeometry,
  271. GXS.ApplicationFileIO,
  272. GLXL.AsmShader,
  273. GXS.AsyncHDS,
  274. GXS.AsyncTimer,
  275. GXS.Atmosphere,
  276. GXS.AVIRecorder,
  277. GXS.AnimatedSprite,
  278. GXS.BitmapFont,
  279. GXS.Blur,
  280. GXS.BumpmapHDS,
  281. GLXL.BumpShaders,
  282. GXS.Cadencer,
  283. GXS.CameraController,
  284. GXS.CelShader,
  285. GXS.Collision,
  286. GXS.CompositeImage,
  287. GXS.Console,
  288. GXS.Coordinates,
  289. GXS.DCE,
  290. GXS.DynamicTexture,
  291. GXS.EParticleMasksManager,
  292. GXS.ExplosionFx,
  293. GXS.Extrusion,
  294. GXS.FBORenderer,
  295. GXS.Feedback,
  296. GXS.FireFX,
  297. GXS.FPSMovement,
  298. GXS.GameMenu,
  299. GXS.GeomObjects,
  300. GXS.Gizmo,
  301. GXS.Graph,
  302. GXS.Graphics,
  303. GXS.Gui,
  304. GXS.HeightData,
  305. GXS.HeightTileFileHDS,
  306. GXS.HiddenLineShader,
  307. GXS.HUDObjects,
  308. GXS.Imposter,
  309. GXS.LensFlare,
  310. GXS.LinePFX,
  311. GXS.Material,
  312. GXS.MaterialMultiProxy,
  313. GXS.MaterialScript,
  314. GXS.Mesh,
  315. GXS.Mirror,
  316. GXS.MultiMaterialShader,
  317. GXS.MultiPolygon,
  318. GXS.MultiProxy,
  319. GXS.Navigator,
  320. GXS.Nodes,
  321. GXS.Objects,
  322. GXS.OutlineShader,
  323. GXS.ParticleFX,
  324. GXS.Particles,
  325. GXS.Perlin,
  326. GXS.PerlinPFX,
  327. GLXL.PhongShader,
  328. GXS.Portal,
  329. GXS.ProjectedTextures,
  330. GXS.ProxyObjects,
  331. GXS.RenderContextInfo,
  332. GXS.ArchiveManager,
  333. GXS.Screen,
  334. GXS.ScriptBase,
  335. GXS.ShadowHDS,
  336. GXS.ShadowPlane,
  337. GXS.ShadowVolume,
  338. GXS.SimpleNavigation,
  339. GXS.Skydome,
  340. GXS.SmoothNavigator,
  341. GLXL.ShaderCombiner,
  342. GLXL.DiffuseSpecularShader,
  343. GLXL.PostEffects,
  344. GLXL.PostShaders,
  345. GLXL.ProjectedTextures,
  346. GLXL.Shader,
  347. GLXL.TextureShaders,
  348. GLXL.UserShader,
  349. Soundx.WaveOut,
  350. GXS.State,
  351. GXS.TerrainRenderer,
  352. GXS.TexCombineShader,
  353. GXS.TexLensFlare,
  354. GXS.Texture,
  355. GXS.TexturedHDS,
  356. GXS.TextureImageEditors,
  357. GXS.ThorFX,
  358. GXS.TilePlane,
  359. GXS.TimeEventsMgr,
  360. GXS.Trail,
  361. GXS.Tree,
  362. GXS.FileTIN,
  363. GXS.Utils,
  364. GXS.VectorFileObjects,
  365. GXS.WaterPlane,
  366. GXS.Windows,
  367. GXS.WindowsFont,
  368. GXS.zBuffer,
  369. // Image file formats
  370. GXS.FileDDS,
  371. GXS.FileTGA,
  372. // Vector file formats
  373. GXS.File3DS,
  374. GXS.FileASE,
  375. GXS.FileB3D,
  376. GXS.FileGL2,
  377. GXS.FileGTS,
  378. GXS.FileLMTS,
  379. GXS.FileLWO,
  380. GXS.FileMD2,
  381. GXS.FileMD3,
  382. GXS.FileMD5,
  383. GXS.FileMDC,
  384. GXS.FileMS3D,
  385. GXS.FileNMF,
  386. GXS.FileNurbs,
  387. GXS.FileObj,
  388. GXS.FileOCT,
  389. GXS.FilePLY,
  390. GXS.FileQ3BSP,
  391. GXS.FileSMD,
  392. GXS.FileSTL,
  393. GXS.FileVRML,
  394. // Sound file formats
  395. GXS.FileWAV,
  396. GXS.FileMP3,
  397. // Raster file format
  398. GXS.FileDDS,
  399. GXS.FileO3TC,
  400. GXS.FileHDR,
  401. GXS.FileJPEG,
  402. GXS.FilePNG,
  403. GXS.FileBMP,
  404. GXS.FileTGA,
  405. GXS.Sound,
  406. GXS.SoundFileObjects,
  407. GXS.SpaceText,
  408. GXS.Joystick,
  409. GXS.ScreenSaver,
  410. GXS.FullScreenViewer;
  411. var
  412. vObjectManager: TgxObjectManager;
  413. function ObjectManager: TgxObjectManager;
  414. begin
  415. if not Assigned(vObjectManager) then
  416. vObjectManager := TgxObjectManager.Create(nil);
  417. Result := vObjectManager;
  418. end;
  419. procedure TgxSceneViewerEditor.ExecuteVerb(Index: Integer);
  420. var
  421. source: TgxSceneViewer;
  422. begin
  423. source := Component as TgxSceneViewer;
  424. case Index of
  425. 0:
  426. source.Buffer.ShowInfo;
  427. end;
  428. end;
  429. function TgxSceneViewerEditor.GetVerb(Index: Integer): string;
  430. begin
  431. case Index of
  432. 0:
  433. Result := 'Show context info';
  434. end;
  435. end;
  436. function TgxSceneViewerEditor.GetVerbCount: Integer;
  437. begin
  438. Result := 1;
  439. end;
  440. procedure TgxSceneEditor.Edit;
  441. begin
  442. with GLXceneEditorForm do
  443. begin
  444. SetScene(Self.Component as TgxScene, Self.Designer);
  445. Show;
  446. end;
  447. end;
  448. procedure TgxSceneEditor.ExecuteVerb(Index: Integer);
  449. begin
  450. case Index of
  451. 0:
  452. Edit;
  453. end;
  454. end;
  455. function TgxSceneEditor.GetVerb(Index: Integer): string;
  456. begin
  457. case Index of
  458. 0:
  459. Result := 'Show Scene Editor';
  460. end;
  461. end;
  462. function TgxSceneEditor.GetVerbCount: Integer;
  463. begin
  464. Result := 1;
  465. end;
  466. function TgxResolutionProperty.GetAttributes: TPropertyAttributes;
  467. begin
  468. Result := [paValueList];
  469. end;
  470. function TgxResolutionProperty.GetValue: string;
  471. begin
  472. Result := vVideoModes[GetOrdValue].Description;
  473. end;
  474. procedure TgxResolutionProperty.GetValues(Proc: TGetStrProc);
  475. var
  476. i: Integer;
  477. begin
  478. for i := 0 to vNumberVideoModes - 1 do
  479. Proc(vVideoModes[i].Description);
  480. end;
  481. procedure TgxResolutionProperty.SetValue(const Value: string);
  482. const
  483. Nums = ['0' .. '9'];
  484. var
  485. XRes, YRes, BPP: Integer;
  486. Pos, SLength: Integer;
  487. TempStr: string;
  488. begin
  489. if CompareText(Value, 'default') <> 0 then
  490. begin
  491. // initialize scanning
  492. TempStr := Trim(Value) + '|'; // ensure at least one delimiter
  493. SLength := Length(TempStr);
  494. XRes := 0;
  495. YRes := 0;
  496. BPP := 0;
  497. // contains the string something?
  498. if SLength > 1 then
  499. begin
  500. // determine first number
  501. for Pos := 1 to SLength do
  502. if not(AnsiChar(TempStr[Pos]) in Nums) then
  503. Break;
  504. if Pos <= SLength then
  505. begin
  506. // found a number?
  507. XRes := StrToInt(Copy(TempStr, 1, Pos - 1));
  508. // search for following non-numerics
  509. for Pos := Pos to SLength do
  510. if AnsiChar(TempStr[Pos]) in Nums then
  511. Break;
  512. Delete(TempStr, 1, Pos - 1); // take it out of the String
  513. SLength := Length(TempStr); // rest length of String
  514. if SLength > 1 then // something to scan?
  515. begin
  516. // determine second number
  517. for Pos := 1 to SLength do
  518. if not(AnsiChar(TempStr[Pos]) in Nums) then
  519. Break;
  520. if Pos <= SLength then
  521. begin
  522. YRes := StrToInt(Copy(TempStr, 1, Pos - 1));
  523. // search for following non-numerics
  524. for Pos := Pos to SLength do
  525. if AnsiChar(TempStr[Pos]) in Nums then
  526. Break;
  527. Delete(TempStr, 1, Pos - 1); // take it out of the String
  528. SLength := Length(TempStr); // rest length of String
  529. if SLength > 1 then
  530. begin
  531. for Pos := 1 to SLength do
  532. if not(AnsiChar(TempStr[Pos]) in Nums) then
  533. Break;
  534. if Pos <= SLength then
  535. BPP := StrToInt(Copy(TempStr, 1, Pos - 1));
  536. end;
  537. end;
  538. end;
  539. end;
  540. end;
  541. SetOrdValue(GetIndexFromResolution(XRes, YRes, BPP));
  542. end
  543. else
  544. SetOrdValue(0);
  545. end;
  546. function TgxTextureProperty.GetAttributes: TPropertyAttributes;
  547. begin
  548. Result := [paSubProperties];
  549. end;
  550. function TgxTextureImageProperty.GetAttributes: TPropertyAttributes;
  551. begin
  552. Result := [paDialog];
  553. end;
  554. procedure TgxTextureImageProperty.Edit;
  555. begin
  556. if EditTextureImage(TgxTextureImage(GetOrdValue)) then
  557. Designer.Modified;
  558. end;
  559. //---------------------------
  560. // TgxImageClassProperty
  561. //---------------------------
  562. function TgxImageClassProperty.GetAttributes: TPropertyAttributes;
  563. begin
  564. Result := [paValueList];
  565. end;
  566. procedure TgxImageClassProperty.GetValues(Proc: TGetStrProc);
  567. var
  568. i: Integer;
  569. sl: TStrings;
  570. begin
  571. sl := GetTextureImageClassesAsStrings;
  572. try
  573. for i := 0 to sl.Count - 1 do
  574. Proc(sl[i]);
  575. finally
  576. sl.Free;
  577. end;
  578. end;
  579. function TgxImageClassProperty.GetValue: string;
  580. begin
  581. Result := FindTextureImageClass(GetStrValue).FriendlyName;
  582. end;
  583. procedure TgxImageClassProperty.SetValue(const Value: string);
  584. var
  585. tic: TgxTextureImageClass;
  586. begin
  587. tic := FindTextureImageClassByFriendlyName(Value);
  588. if Assigned(tic) then
  589. SetStrValue(tic.ClassName)
  590. else
  591. SetStrValue('');
  592. Modified;
  593. end;
  594. procedure TgxColorProperty.Edit;
  595. var
  596. colorDialog: TColorDialog;
  597. GXS.Color: TgxColor;
  598. begin
  599. colorDialog := TColorDialog.Create(nil);
  600. try
  601. GXS.Color := TgxColor(GetOrdValue);
  602. {$IFDEF WIN32}
  603. colorDialog.Options := [cdFullOpen];
  604. {$ENDIF}
  605. colorDialog.Color := ConvertColorVector(GXS.Color.Color);
  606. if colorDialog.Execute then
  607. begin
  608. GXS.Color.Color := ConvertWinColor(colorDialog.Color);
  609. Modified;
  610. end;
  611. finally
  612. colorDialog.Free;
  613. end;
  614. end;
  615. function TgxColorProperty.GetAttributes: TPropertyAttributes;
  616. begin
  617. Result := [paSubProperties, paValueList, paDialog];
  618. end;
  619. procedure TgxColorProperty.GetValues(Proc: TGetStrProc);
  620. begin
  621. ColorManager.EnumColors(Proc);
  622. end;
  623. function TgxColorProperty.GetValue: string;
  624. begin
  625. Result := ColorManager.GetColorName(TgxColor(GetOrdValue).Color);
  626. end;
  627. procedure TgxColorProperty.SetValue(const Value: string);
  628. begin
  629. TgxColor(GetOrdValue).Color := ColorManager.GetColor(Value);
  630. Modified;
  631. end;
  632. function TgxColorProperty.ColorToBorderColor(aColor: TgxColorVector;
  633. selected: Boolean): TColor;
  634. begin
  635. if (aColor.X > 0.75) or (aColor.Y > 0.75) or (aColor.Z > 0.75) then
  636. Result := clBlack
  637. else if selected then
  638. Result := clWhite
  639. else
  640. Result := ConvertColorVector(aColor);
  641. end;
  642. procedure TgxColorProperty.PropDrawValue(ACanvas: TCanvas; const ARect: TRect;
  643. ASelected: Boolean);
  644. begin
  645. if GetVisualValue <> '' then
  646. ListDrawValue(GetVisualValue, ACanvas, ARect, True)
  647. else
  648. DefaultPropertyDrawValue(Self, ACanvas, ARect);
  649. end;
  650. procedure TgxColorProperty.ListDrawValue(const Value: string; ACanvas: TCanvas;
  651. const ARect: TRect; ASelected: Boolean);
  652. var
  653. vRight: Integer;
  654. vOldPenColor, vOldBrushColor: TColor;
  655. Color: TgxColorVector;
  656. begin
  657. vRight := (ARect.Bottom - ARect.Top) + ARect.Left;
  658. with ACanvas do
  659. try
  660. vOldPenColor := Pen.Color;
  661. vOldBrushColor := Brush.Color;
  662. Pen.Color := Brush.Color;
  663. Rectangle(ARect.Left, ARect.Top, vRight, ARect.Bottom);
  664. Color := ColorManager.GetColor(Value);
  665. Brush.Color := ConvertColorVector(Color);
  666. Pen.Color := ColorToBorderColor(Color, ASelected);
  667. Rectangle(ARect.Left + 1, ARect.Top + 1, vRight - 1, ARect.Bottom - 1);
  668. Brush.Color := vOldBrushColor;
  669. Pen.Color := vOldPenColor;
  670. finally
  671. DefaultPropertyListDrawValue(Value, ACanvas,
  672. Rect(vRight, ARect.Top, ARect.Right, ARect.Bottom), ASelected);
  673. end;
  674. end;
  675. procedure TgxColorProperty.ListMeasureWidth(const Value: string;
  676. ACanvas: TCanvas; var AWidth: Integer);
  677. begin
  678. AWidth := AWidth + ACanvas.TextHeight('M');
  679. end;
  680. procedure TgxColorProperty.ListMeasureHeight(const Value: string;
  681. ACanvas: TCanvas; var AHeight: Integer);
  682. begin
  683. // Nothing
  684. end;
  685. procedure TgxColorProperty.PropDrawName(ACanvas: TCanvas; const ARect: TRect;
  686. ASelected: Boolean);
  687. begin
  688. DefaultPropertyDrawName(Self, ACanvas, ARect);
  689. end;
  690. function TgxSoundFileProperty.GetAttributes: TPropertyAttributes;
  691. begin
  692. Result := [paDialog];
  693. end;
  694. function TgxSoundFileProperty.GetValue: string;
  695. var
  696. sample: TgxSoundSample;
  697. begin
  698. sample := GetComponent(0) as TgxSoundSample;
  699. if sample.Data <> nil then
  700. Result := '(' + sample.Data.ClassName + ')'
  701. else
  702. Result := '(empty)';
  703. end;
  704. procedure TgxSoundFileProperty.Edit;
  705. var
  706. ODialog: TOpenDialog;
  707. sample: TgxSoundSample;
  708. Desc, F: string;
  709. begin
  710. sample := GetComponent(0) as TgxSoundSample;
  711. ODialog := TOpenDialog.Create(nil);
  712. try
  713. GetGLSoundFileFormats.BuildFilterStrings(TgxSoundFile, Desc, F);
  714. ODialog.Filter := Desc;
  715. if ODialog.Execute then
  716. begin
  717. sample.LoadFromFile(ODialog.FileName);
  718. Modified;
  719. end;
  720. finally
  721. ODialog.Free;
  722. end;
  723. end;
  724. //---------------------------------------------------------
  725. function TgxSoundNameProperty.GetAttributes: TPropertyAttributes;
  726. begin
  727. Result := [paValueList];
  728. end;
  729. procedure TgxSoundNameProperty.GetValues(Proc: TGetStrProc);
  730. var
  731. i: Integer;
  732. source: TgxBaseSoundSource;
  733. begin
  734. source := (GetComponent(0) as TgxBaseSoundSource);
  735. if Assigned(source.SoundLibrary) then
  736. with source.SoundLibrary do
  737. for i := 0 to Samples.Count - 1 do
  738. Proc(Samples[i].Name);
  739. end;
  740. //---------------------------------------------------------
  741. { TgxCoordinatesProperty }
  742. //--------------------------------------------------------
  743. function TgxCoordinatesProperty.GetAttributes: TPropertyAttributes;
  744. begin
  745. Result := [paDialog, paSubProperties];
  746. end;
  747. procedure TgxCoordinatesProperty.Edit;
  748. var
  749. glc: TgxCoordinates;
  750. x, y, z: Single;
  751. begin
  752. glc := TgxCoordinates(GetOrdValue);
  753. x := glc.x;
  754. y := glc.y;
  755. z := glc.z;
  756. if VectorEditorForm.Execute(x, y, z) then
  757. begin
  758. glc.AsVector := VectorMake(x, y, z);
  759. Modified;
  760. end;
  761. end;
  762. //--------------------------------------------------------
  763. function TgxMaterialProperty.GetAttributes: TPropertyAttributes;
  764. begin
  765. Result := [paDialog, paSubProperties];
  766. end;
  767. procedure TgxMaterialProperty.Edit;
  768. begin
  769. if FMaterialEditorForm.MaterialEditorForm.Execute(TgxMaterial(GetOrdValue))
  770. then
  771. Modified;
  772. end;
  773. procedure TgxGUILayoutEditor.Edit;
  774. begin
  775. GUILayoutEditorForm.Execute(TgxGuiLayout(Self.Component));
  776. end;
  777. procedure TgxGUILayoutEditor.ExecuteVerb(Index: Integer);
  778. begin
  779. case Index of
  780. 0: Edit;
  781. end;
  782. end;
  783. function TgxGUILayoutEditor.GetVerb(Index: Integer): string;
  784. begin
  785. case Index of
  786. 0: Result := 'Show Layout Editor';
  787. end;
  788. end;
  789. function TgxGUILayoutEditor.GetVerbCount: Integer;
  790. begin
  791. Result := 1;
  792. end;
  793. procedure TgxReuseableDefaultEditor.CheckEdit(const Prop: IProperty);
  794. begin
  795. if FContinue then
  796. EditProperty(Prop, FContinue);
  797. end;
  798. procedure TgxReuseableDefaultEditor.EditProperty(const Prop: IProperty;
  799. var Continue: Boolean);
  800. var
  801. PropName: string;
  802. BestName: string;
  803. MethodProperty: IMethodProperty;
  804. procedure ReplaceBest;
  805. begin
  806. FBest := Prop;
  807. if FFirst = FBest then
  808. FFirst := nil;
  809. end;
  810. begin
  811. if not Assigned(FFirst) and Supports(Prop, IMethodProperty, MethodProperty)
  812. then
  813. FFirst := Prop;
  814. PropName := Prop.GetName;
  815. BestName := '';
  816. if Assigned(FBest) then
  817. BestName := FBest.GetName;
  818. if CompareText(PropName, 'ONCREATE') = 0 then
  819. ReplaceBest
  820. else if CompareText(BestName, 'ONCREATE') <> 0 then
  821. if CompareText(PropName, 'ONCHANGE') = 0 then
  822. ReplaceBest
  823. else if CompareText(BestName, 'ONCHANGE') <> 0 then
  824. if CompareText(PropName, 'ONCLICK') = 0 then
  825. ReplaceBest;
  826. end;
  827. procedure TgxReuseableDefaultEditor.Edit;
  828. var
  829. Components: IDesignerSelections;
  830. begin
  831. Components := TDesignerSelections.Create;
  832. FContinue := True;
  833. Components.Add(Component);
  834. FFirst := nil;
  835. FBest := nil;
  836. try
  837. GetComponentProperties(Components, tkAny, Designer, CheckEdit);
  838. if FContinue then
  839. if Assigned(FBest) then
  840. FBest.Edit
  841. else if Assigned(FFirst) then
  842. FFirst.Edit;
  843. finally
  844. FFirst := nil;
  845. FBest := nil;
  846. end;
  847. end;
  848. procedure TgxMaterialLibraryEditor.EditProperty(const Prop: IProperty;
  849. var Continue: Boolean);
  850. begin
  851. if CompareText(Prop.GetName, 'MATERIALS') = 0 then
  852. begin
  853. FBest := Prop;
  854. end;
  855. end;
  856. procedure TgxMaterialLibraryEditor.ExecuteVerb(Index: Integer);
  857. begin
  858. case Index of
  859. 0: Edit;
  860. end;
  861. end;
  862. function TgxMaterialLibraryEditor.GetVerb(Index: Integer): string;
  863. begin
  864. case Index of
  865. 0:
  866. Result := 'Show Material Library Editor';
  867. end;
  868. end;
  869. function TgxMaterialLibraryEditor.GetVerbCount: Integer;
  870. begin
  871. Result := 1
  872. end;
  873. function TgxLibMaterialNameProperty.GetAttributes: TPropertyAttributes;
  874. begin
  875. Result := [paDialog];
  876. end;
  877. procedure TgxLibMaterialNameProperty.Edit;
  878. var
  879. buf: string;
  880. ml: TgxAbstractMaterialLibrary;
  881. obj: TPersistent;
  882. Int: IGLMaterialLibrarySupported;
  883. begin
  884. buf := GetStrValue;
  885. obj := GetComponent(0);
  886. if Supports(obj, IGLMaterialLibrarySupported, Int) then
  887. ml := Int.GetMaterialLibrary
  888. else
  889. begin
  890. ml := nil;
  891. Assert(False, 'oops, unsupported...');
  892. end;
  893. if not Assigned(ml) then
  894. ShowMessage('Select the material library first.')
  895. else if LibMaterialPicker.Execute(buf, ml) then
  896. SetStrValue(buf);
  897. end;
  898. function TgxAnimationNameProperty.GetAttributes: TPropertyAttributes;
  899. begin
  900. Result := [paValueList];
  901. end;
  902. procedure TgxAnimationNameProperty.GetValues(Proc: TGetStrProc);
  903. var
  904. i: Integer;
  905. animControler: TgxAnimationControler;
  906. actor: TgxActor;
  907. begin
  908. animControler := (GetComponent(0) as TgxAnimationControler);
  909. if Assigned(animControler) then
  910. begin
  911. actor := animControler.actor;
  912. if Assigned(actor) then
  913. with actor.Animations do
  914. begin
  915. for i := 0 to Count - 1 do
  916. Proc(Items[i].Name);
  917. end;
  918. end;
  919. end;
  920. procedure TgxBaseSceneObjectSelectionEditor.RequiresUnits(Proc: TGetStrProc);
  921. var
  922. i, j: Integer;
  923. comp: TgxBaseSceneObject;
  924. begin
  925. if (Designer = nil) or (Designer.Root = nil) then
  926. Exit;
  927. for i := 0 to Designer.Root.ComponentCount - 1 do
  928. begin
  929. if (Designer.Root.Components[i] is TgxBaseSceneObject) then
  930. begin
  931. comp := TgxBaseSceneObject(Designer.Root.Components[i]);
  932. for j := 0 to comp.Behaviours.Count - 1 do
  933. Proc(FindUnitName(comp.Behaviours[j]));
  934. for j := 0 to comp.Effects.Count - 1 do
  935. Proc(FindUnitName(comp.Effects[j]));
  936. end;
  937. end;
  938. end;
  939. procedure TgxSoundLibrarySelectionEditor.RequiresUnits(Proc: TGetStrProc);
  940. var
  941. i, j: Integer;
  942. comp: TgxSoundLibrary;
  943. begin
  944. if (Designer = nil) or (Designer.Root = nil) then
  945. Exit;
  946. for i := 0 to Designer.Root.ComponentCount - 1 do
  947. begin
  948. if (Designer.Root.Components[i] is TgxSoundLibrary) then
  949. begin
  950. comp := TgxSoundLibrary(Designer.Root.Components[i]);
  951. for j := 0 to comp.Samples.Count - 1 do
  952. if Assigned(comp.Samples[j].Data) then
  953. Proc(FindUnitName(comp.Samples[j].Data));
  954. end;
  955. end;
  956. end;
  957. procedure TgxSArchiveManagerEditor.EditProperty(const Prop: IProperty;
  958. var Continue: Boolean);
  959. begin
  960. if CompareText(Prop.GetName, 'ARCHIVES') = 0 then
  961. begin
  962. FBest := Prop;
  963. end;
  964. end;
  965. procedure TgxSArchiveManagerEditor.ExecuteVerb(Index: Integer);
  966. begin
  967. case Index of
  968. 0:
  969. Edit;
  970. end;
  971. end;
  972. function TgxSArchiveManagerEditor.GetVerb(Index: Integer): string;
  973. begin
  974. case Index of
  975. 0: Result := 'Show Archive Manager Editor';
  976. end;
  977. end;
  978. function TgxSArchiveManagerEditor.GetVerbCount: Integer;
  979. begin
  980. Result := 1
  981. end;
  982. procedure TgxMaterialComponentNameProperty.Edit;
  983. var
  984. LOwner: IGLMaterialLibrarySupported;
  985. LItem: TgxBaseMaterialCollectionItem;
  986. begin
  987. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  988. begin
  989. LItem := TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  990. .Components.GetItemByName(GetStrValue);
  991. if Assigned(LItem) then
  992. Designer.SelectComponent(LItem);
  993. Modified;
  994. end;
  995. end;
  996. function TgxMaterialComponentNameProperty.GetAttributes: TPropertyAttributes;
  997. begin
  998. Result := [paValueList];
  999. end;
  1000. procedure TgxLibTextureNameProperty.GetValues(Proc: TGetStrProc);
  1001. var
  1002. LOwner: IGLMaterialLibrarySupported;
  1003. begin
  1004. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  1005. begin
  1006. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  1007. .GetNames(Proc, TgxTextureImageEx);
  1008. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  1009. .GetNames(Proc, TgxFrameBufferAttachment);
  1010. end;
  1011. end;
  1012. procedure TgxLibSamplerNameProperty.GetValues(Proc: TGetStrProc);
  1013. var
  1014. LOwner: IGLMaterialLibrarySupported;
  1015. begin
  1016. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  1017. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  1018. .GetNames(Proc, TgxTextureSampler);
  1019. end;
  1020. procedure TgxLibCombinerNameProperty.GetValues(Proc: TGetStrProc);
  1021. var
  1022. LOwner: IGLMaterialLibrarySupported;
  1023. begin
  1024. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  1025. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  1026. .GetNames(Proc, TgxTextureCombiner);
  1027. end;
  1028. procedure TgxLibShaderNameProperty.GetValues(Proc: TGetStrProc);
  1029. var
  1030. LOwner: IGLMaterialLibrarySupported;
  1031. begin
  1032. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  1033. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary).GetNames(Proc, TgxShaderEx);
  1034. end;
  1035. procedure TgxLibAttachmentNameProperty.GetValues(Proc: TGetStrProc);
  1036. var
  1037. LOwner: IGLMaterialLibrarySupported;
  1038. begin
  1039. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  1040. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  1041. .GetNames(Proc, TgxFrameBufferAttachment);
  1042. end;
  1043. procedure TgxLibAsmProgNameProperty.GetValues(Proc: TGetStrProc);
  1044. var
  1045. LOwner: IGLMaterialLibrarySupported;
  1046. begin
  1047. if Supports(GetComponent(0), IGLMaterialLibrarySupported, LOwner) then
  1048. TgxMaterialLibraryEx(LOwner.GetMaterialLibrary)
  1049. .GetNames(Proc, TgxASMVertexProgram);
  1050. end;
  1051. function TPictureFileProperty.GetAttributes: TPropertyAttributes;
  1052. begin
  1053. Result := [paDialog];
  1054. end;
  1055. procedure TPictureFileProperty.Edit;
  1056. var
  1057. LFileName: string;
  1058. begin
  1059. if OpenPictureDialog(LFileName) then
  1060. begin
  1061. SetStrValue(RelativePath(LFileName));
  1062. end;
  1063. Modified;
  1064. end;
  1065. procedure TShaderFileProperty.Edit;
  1066. var
  1067. ODialog: TOpenDialog;
  1068. begin
  1069. ODialog := TOpenDialog.Create(nil);
  1070. try
  1071. ODialog.Filter := '*.glsl';
  1072. if ODialog.Execute then
  1073. begin
  1074. SetStrValue(RelativePath(ODialog.FileName));
  1075. Modified;
  1076. end;
  1077. finally
  1078. ODialog.Free;
  1079. end;
  1080. end;
  1081. function TShaderFileProperty.GetAttributes: TPropertyAttributes;
  1082. begin
  1083. Result := [paDialog];
  1084. end;
  1085. procedure TAsmProgFileProperty.Edit;
  1086. var
  1087. ODialog: TOpenDialog;
  1088. begin
  1089. ODialog := TOpenDialog.Create(nil);
  1090. try
  1091. ODialog.Filter := '*.asm';
  1092. if ODialog.Execute then
  1093. begin
  1094. SetStrValue(RelativePath(ODialog.FileName));
  1095. Modified;
  1096. end;
  1097. finally
  1098. ODialog.Free;
  1099. end;
  1100. end;
  1101. function TAsmProgFileProperty.GetAttributes: TPropertyAttributes;
  1102. begin
  1103. Result := [paDialog];
  1104. end;
  1105. { TUniformAutoSetProperty }
  1106. function TUniformAutoSetProperty.GetAttributes: TPropertyAttributes;
  1107. begin
  1108. Result := [paDialog, paFullWidthName];
  1109. end;
  1110. procedure TUniformAutoSetProperty.PassUniform(const S: string);
  1111. begin
  1112. ShaderUniformEditor.AddUniform(TgxBaseShaderModel(GetComponent(0))
  1113. .Uniforms[S]);
  1114. end;
  1115. procedure TUniformAutoSetProperty.Edit;
  1116. var
  1117. LOwner: TgxBaseShaderModel;
  1118. begin
  1119. LOwner := TgxBaseShaderModel(GetComponent(0));
  1120. if LOwner.Enabled and LOwner.IsValid then
  1121. begin
  1122. with ShaderUniformEditor do
  1123. begin
  1124. Clear;
  1125. LOwner.MaterialLibrary.GetNames(AddTextureName, TgxTextureImageEx);
  1126. LOwner.MaterialLibrary.GetNames(AddTextureName, TgxFrameBufferAttachment);
  1127. LOwner.MaterialLibrary.GetNames(AddSamplerName, TgxTextureSampler);
  1128. LOwner.GetUniformNames(PassUniform);
  1129. Execute;
  1130. end;
  1131. end;
  1132. end;
  1133. function TgxShaderEditorProperty.GetAttributes: TPropertyAttributes;
  1134. begin
  1135. Result := inherited GetAttributes + [paDialog] - [paSubProperties];
  1136. end;
  1137. function TgxShaderEditorProperty.GetStrings: TStrings;
  1138. begin
  1139. Result := TStrings(GetOrdValue);
  1140. end;
  1141. procedure TgxShaderEditorProperty.OnShaderCheck(Sender: TObject);
  1142. var
  1143. LShader: TgxShaderEx;
  1144. LContext: TgxContext;
  1145. begin
  1146. SetStrings(GLShaderEditorForm.GLSLMemo.Lines);
  1147. LShader := TgxShaderEx(GetComponent(0));
  1148. LContext := LShader.Handle.RenderingContext;
  1149. if Assigned(LContext) then
  1150. begin
  1151. LContext.Activate;
  1152. try
  1153. LShader.DoOnPrepare(LContext);
  1154. GLShaderEditorForm.CompilatorLog.Lines.Add(LShader.InfoLog);
  1155. finally
  1156. LContext.Deactivate;
  1157. end;
  1158. end
  1159. else
  1160. GLShaderEditorForm.CompilatorLog.Lines.Add
  1161. ('There is no any rendering context for work with OpenGL');
  1162. end;
  1163. procedure TgxShaderEditorProperty.SetStrings(const Value: TStrings);
  1164. begin
  1165. SetOrdValue(Longint(Value));
  1166. end;
  1167. procedure TgxShaderEditorProperty.Edit;
  1168. begin
  1169. with GLShaderEditorForm do
  1170. begin
  1171. OnCheck := OnShaderCheck;
  1172. GLSLMemo.Lines.Assign(GetStrings);
  1173. GLSLMemo.CurX := 0;
  1174. GLSLMemo.CurY := 0;
  1175. if ShowModal = mrOk then
  1176. begin
  1177. SetStrings(GLSLMemo.Lines);
  1178. Modified;
  1179. end;
  1180. end;
  1181. end;
  1182. // ******************************************************************************
  1183. procedure RegisterPropertiesInCategories;
  1184. begin
  1185. // GXS.SceneViewer
  1186. {$IFDEF WIN32}
  1187. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxCamera), TypeInfo(TgxSceneBuffer),
  1188. TypeInfo(TVSyncMode), TypeInfo(TgxScreenDepth)]);
  1189. {$ENDIF}
  1190. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxSceneViewer, ['*Render']);
  1191. // GXS.Scene
  1192. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(Tgxx.ObjectsSorting), TypeInfo(TgxProgressEvent),
  1193. TypeInfo(TgxBehaviours), TypeInfo(TgxEffects), TypeInfo(TDirectRenderEvent), TypeInfo(TgxCameraStyle),
  1194. TypeInfo(TgxOnCustomPerspective), TypeInfo(TgxScene)]);
  1195. RegisterPropertiesInCategory(sLayoutCategoryName, [TypeInfo(Tgxx.ObjectsSorting), TypeInfo(TgxNormalDirection)]);
  1196. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TgxVisibilityCulling), TypeInfo(TLightStyle),
  1197. TypeInfo(TgxColor), TypeInfo(TgxNormalDirection), TypeInfo(TgxCameraStyle)]);
  1198. RegisterPropertiesInCategory(sVisualCategoryName, TgxBaseSceneObject,
  1199. ['Rotation', 'Direction', 'Position', 'Up', 'Scale', '*Angle', 'ShowAxes', 'FocalLength']);
  1200. RegisterPropertiesInCategory(sVisualCategoryName, TgxSceneObject, ['Parts']);
  1201. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxDirectOpenVX, ['UseBuildList']);
  1202. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxProxyObjectOptions)]);
  1203. RegisterPropertiesInCategory(sVisualCategoryName, TgxLightSource, ['*Attenuation', 'Shining', 'Spot*']);
  1204. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxCamera, ['TargetObject']);
  1205. RegisterPropertiesInCategory(sVisualCategoryName, TgxCamera, ['DepthOfView', 'SceneScale']);
  1206. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxNonVisualViewer, ['*Render']);
  1207. // GXS.Objects
  1208. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxLinesNodes), TypeInfo(TLineNodesAspect),
  1209. TypeInfo(TgxLineSplineMode), TypeInfo(TgxLinesOptions)]);
  1210. {$IFDEF WIN32}
  1211. RegisterPropertiesInCategory(sLayoutCategoryName, [TypeInfo(TgxTextAdjust)]);
  1212. RegisterPropertiesInCategory(sLocalizableCategoryName, [TypeInfo(TSpaceTextCharRange)]);
  1213. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TgxLineSplineMode),
  1214. TypeInfo(TgxCapType), TypeInfo(TgxNormalSmoothing), TypeInfo(TgxArrowHeadStyle), TypeInfo(TgxTextAdjust)]);
  1215. {$ENDIF}
  1216. RegisterPropertiesInCategory(sLayoutCategoryName, TgxDummyCube, ['VisibleAtRunTime']);
  1217. RegisterPropertiesInCategory(sVisualCategoryName, TgxDummyCube, ['CubeSize', 'VisibleAtRunTime']);
  1218. RegisterPropertiesInCategory(sVisualCategoryName, TgxPlane, ['*Offset', '*Tiles']);
  1219. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxSprite, ['NoZWrite']);
  1220. RegisterPropertiesInCategory(sLayoutCategoryName, TgxSprite, ['NoZWrite']);
  1221. RegisterPropertiesInCategory(sVisualCategoryName, TgxSprite, ['AlphaChannel', 'Rotation']);
  1222. RegisterPropertiesInCategory(sVisualCategoryName, TgxNode, ['X', 'Y', 'Z']);
  1223. RegisterPropertiesInCategory(sVisualCategoryName, TgxLines, ['Antialiased', 'Division', 'Line*', 'NodeSize']);
  1224. RegisterPropertiesInCategory(sVisualCategoryName, TgxCube, ['Cube*']);
  1225. RegisterPropertiesInCategory(sVisualCategoryName, TgxFrustrum, ['ApexHeight', 'Base*']);
  1226. {$IFDEF WIN32}
  1227. RegisterPropertiesInCategory(sVisualCategoryName, TgxSpaceText, ['AllowedDeviation', 'AspectRatio', 'Extrusion', 'Oblique', 'TextHeight']);
  1228. {$ENDIF}
  1229. RegisterPropertiesInCategory(sVisualCategoryName, TgxSphere, ['Bottom', 'Radius', 'Slices', 'Stacks', 'Start', 'Stop']);
  1230. RegisterPropertiesInCategory(sVisualCategoryName, TgxDisk, ['*Radius', 'Loops', 'Slices']);
  1231. RegisterPropertiesInCategory(sVisualCategoryName, TgxCone, ['BottomRadius', 'Loops', 'Slices', 'Stacks']);
  1232. RegisterPropertiesInCategory(sVisualCategoryName, TgxCylinder, ['*Radius', 'Loops', 'Slices', 'Stacks']);
  1233. RegisterPropertiesInCategory(sVisualCategoryName, TgxCapsule, ['*Radius', 'Loops', 'Slices', 'Stacks']);
  1234. RegisterPropertiesInCategory(sVisualCategoryName, TgxAnnulus, ['Bottom*', 'Loops', 'Slices', 'Stacks', 'Top*']);
  1235. RegisterPropertiesInCategory(sVisualCategoryName, TgxTorus, ['*Radius', 'Rings', 'Sides']);
  1236. RegisterPropertiesInCategory(sVisualCategoryName, TgxArrowLine, ['Bottom*', 'Loops', 'Slices', 'Stacks', 'Top*']);
  1237. RegisterPropertiesInCategory(sVisualCategoryName, TgxPolygon, ['Division']);
  1238. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxContourNodes), TypeInfo(TgxContours)]);
  1239. RegisterPropertiesInCategory(sVisualCategoryName, TgxContour, ['Division']);
  1240. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TgxNodes), TypeInfo(TPipeNodesColorMode)]);
  1241. RegisterPropertiesInCategory(sVisualCategoryName, TgxRevolutionSolid, ['Division', 'Slices', 'YOffsetPerTurn']);
  1242. RegisterPropertiesInCategory(sVisualCategoryName, TgxExtrusionSolid, ['Stacks']);
  1243. RegisterPropertiesInCategory(sVisualCategoryName, TgxPipeNode, ['RadiusFactor']);
  1244. RegisterPropertiesInCategory(sVisualCategoryName, TgxPipe, ['Division', 'Radius', 'Slices']);
  1245. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxActorAnimationMode), TypeInfo(TgxActorAnimations),
  1246. TypeInfo(TMeshAutoCenterings), TypeInfo(TgxActorFrameInterpolation),
  1247. TypeInfo(TgxActorAnimationReference), TypeInfo(TgxActor)]);
  1248. RegisterPropertiesInCategory(sLayoutCategoryName, [TypeInfo(TgxMeshNormalsOrientation)]);
  1249. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TMeshAutoCenterings),
  1250. TypeInfo(TgxActorAnimationReference), TypeInfo(TgxMeshNormalsOrientation)]);
  1251. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxFreeForm, ['UseMeshmaterials']);
  1252. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxAnimationControler, ['AnimationName']);
  1253. RegisterPropertiesInCategory(sLinkageCategoryName, TgxAnimationControler, ['AnimationName']);
  1254. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxActorAnimation, ['*Frame']);
  1255. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxActor, ['*Frame*', 'Interval', 'OverlaySkeleton', 'UseMeshmaterials']);
  1256. RegisterPropertiesInCategory(sVisualCategoryName, TgxActor, ['OverlaySkeleton']);
  1257. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TMeshMode), TypeInfo(TVertexMode)]);
  1258. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxHeightFieldOptions)]);
  1259. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TgxHeightFieldColorMode),
  1260. TypeInfo(TgxSamplingScale), TypeInfo(TXYZGridLinesStyle), TypeInfo(TXYZGridParts)]);
  1261. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxXYZGrid, ['Antialiased']);
  1262. RegisterPropertiesInCategory(sVisualCategoryName, TgxXYZGrid, ['Antialiased', 'Line*']);
  1263. RegisterPropertiesInCategory(sLayoutCategoryName, TgxParticles, ['VisibleAtRunTime']);
  1264. RegisterPropertiesInCategory(sVisualCategoryName, TgxParticles, ['*Size', 'VisibleAtRunTime']);
  1265. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxSkyDomeBands), TypeInfo(TgxSkyDomeOptions), TypeInfo(TgxSkyDomeStars)]);
  1266. RegisterPropertiesInCategory(sVisualCategoryName, TgxSkyDomeBand, ['Slices', 'Stacks', '*Angle']);
  1267. RegisterPropertiesInCategory(sVisualCategoryName, TgxSkyDomeStar, ['Dec', 'Magnitude', 'RA']);
  1268. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxEarthSkyDome, ['Slices', 'Stacks', 'SunElevation', 'Turbidity']);
  1269. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TMirrorOptions), TypeInfo(TgxBaseSceneObject)]);
  1270. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TBlendingMode)]);
  1271. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TBlendingMode), TypeInfo(TPFXLifeColors), TypeInfo(TSpriteColorMode)]);
  1272. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxParticleFXRenderer, ['ZWrite']);
  1273. RegisterPropertiesInCategory(sVisualCategoryName, TgxParticleFXRenderer, ['ZWrite']);
  1274. RegisterPropertiesInCategory(sOpenGLCategoryName, TPFXLifeColor, ['LifeTime']);
  1275. RegisterPropertiesInCategory(sVisualCategoryName, TPFXLifeColor, ['LifeTime']);
  1276. RegisterPropertiesInCategory(sVisualCategoryName, TgxLifeColoredPFXManager, ['Acceleration', 'ParticleSize']);
  1277. RegisterPropertiesInCategory(sVisualCategoryName, TgxPolygonPFXManager, ['NbSides']);
  1278. RegisterPropertiesInCategory(sVisualCategoryName, TgxPointLightPFXManager, ['TexMapSize']);
  1279. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxHeightDataSource)]);
  1280. RegisterPropertiesInCategory(sVisualCategoryName, TgxTerrainRenderer, ['*CLOD*', 'QualityDistance', 'Tile*']);
  1281. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxMemoryViewer), TypeInfo(TgxSceneViewer), TypeInfo(TOptimise)]);
  1282. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TOptimise)]);
  1283. RegisterPropertiesInCategory(sVisualCategoryName, TgxZShadows, ['DepthFade', '*Shadow', 'Soft', 'Tolerance']);
  1284. RegisterPropertiesInCategory(sLayoutCategoryName, [TypeInfo(TTextLayout)]);
  1285. RegisterPropertiesInCategory(sVisualCategoryName, [TypeInfo(TgxBitmapFont), TypeInfo(TTextLayout)]);
  1286. RegisterPropertiesInCategory(sLocalizableCategoryName, [TypeInfo(TgxBitmapFont)]);
  1287. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxMaterial), TypeInfo(TgxMaterialLibrary),
  1288. TypeInfo(TgxLibMaterials), TypeInfo(TTextureNeededEvent)]);
  1289. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxLibMaterial, ['Texture2Name']);
  1290. RegisterPropertiesInCategory(sVisualCategoryName, TgxLibMaterial, ['TextureOffset', 'TextureScale']);
  1291. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxMaterialLibrary, ['TexturePaths']);
  1292. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxCadencer)]);
  1293. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TObjectCollisionEvent)]);
  1294. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxFireFXManager, ['MaxParticles', 'NoZWrite', 'Paused', 'UseInterval']);
  1295. RegisterPropertiesInCategory(sVisualCategoryName, TgxFireFXManager, ['Fire*', 'InitialDir', 'NoZWrite', 'Particle*', 'Paused']);
  1296. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TCalcPointEvent)]);
  1297. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxThorFXManager, ['Maxpoints', 'Paused']);
  1298. RegisterPropertiesInCategory(sVisualCategoryName, TgxThorFXManager, ['Core', 'Glow*', 'Paused', 'Target', 'Vibrate', 'Wildness']);
  1299. RegisterPropertiesInCategory(sOpenGLCategoryName, [TypeInfo(TgxMagFilter), TypeInfo(TgxMinFilter)]);
  1300. RegisterPropertiesInCategory(sLocalizableCategoryName, [TypeInfo(TgxBitmapFontRanges)]);
  1301. RegisterPropertiesInCategory(sLocalizableCategoryName, TgxBitmapFontRange, ['*ASCII']);
  1302. RegisterPropertiesInCategory(sLayoutCategoryName, TgxBitmapFont, ['Char*', '*Interval*', '*Space']);
  1303. RegisterPropertiesInCategory(sLocalizableCategoryName, TgxBitmapFont, ['Glyphs']);
  1304. RegisterPropertiesInCategory(sVisualCategoryName, TgxBitmapFont, ['Char*', '*Interval*', '*Space', 'Glyphs']);
  1305. RegisterPropertiesInCategory(sOpenGLCategoryName, TgxBitmapHDS, ['MaxPoolSize']);
  1306. RegisterPropertiesInCategory(sVisualCategoryName, TgxBitmapHDS, ['Picture']);
  1307. end;
  1308. procedure Register;
  1309. begin
  1310. RegisterComponents('GXScene', [TgxScene, TgxSceneViewer, TgxMemoryViewer,
  1311. TgxMaterialLibrary, TgxMaterialLibraryEx, TgxCadencer, TgxGuiLayout,
  1312. TgxBitmapFont, TgxWindowsBitmapFont, TgxScriptLibrary, TgxSoundLibrary,
  1313. TgxFullScreenViewer]);
  1314. RegisterComponents('GXScene PFX', [TgxCustomPFXManager, TgxPolygonPFXManager,
  1315. TgxPointLightPFXManager, TgxCustomSpritePFXManager, TgxPerlinPFXManager,
  1316. TgxLinePFXManager, TgxFireFXManager, TgxThorFXManager,
  1317. TgxEParticleMasksManager]);
  1318. RegisterComponents('GXScene Utils', [TgxAsyncTimer, TgxStaticImposterBuilder,
  1319. TgxCollisionManager, TgxAnimationControler, TgxAVIRecorder, TgxDCEManager,
  1320. TgxFPSMovementManager, TgxMaterialScripter, TgxUserInterface, TgxNavigator,
  1321. TgxSmoothNavigator, TgxSmoothUserInterface, TgxTimeEventsMGR,
  1322. TgxApplicationFileIO, TgxVfsPAK, TgxSimpleNavigation, TgxGizmo,
  1323. TgxCameraController, TgxSLanguage, TgxSLogger, TgxSArchiveManager,
  1324. TgxJoystick, TgxScreenSaver, TgxSSynHiMemo]);
  1325. RegisterComponents('GXScene Terrain', [TgxBitmapHDS, TgxCustomHDS,
  1326. TgxHeightTileFileHDS, TgxBumpmapHDS, TgxPerlinHDS, TgxTexturedHDS,
  1327. TgxAsyncHDS, TgxShadowHDS]);
  1328. RegisterComponents('GXScene Shaders', [TgxTexCombineShader, TgxPhongShader,
  1329. TgxUserShader, TgxHiddenLineShader, TgxCelShader, TgxOutlineShader,
  1330. TgxMultiMaterialShader, TgxBumpShader, TgxGLSLShader,
  1331. TgxSLDiffuseSpecularShader, TgxSLBumpShader, TgxAsmShader,
  1332. TgxShaderCombiner, TgxTextureSharingShader, TgxSLPostBlurShader]);
  1333. RegisterComponentEditor(TgxSceneViewer, TgxSceneViewerEditor);
  1334. RegisterComponentEditor(TgxScene, TgxSceneEditor);
  1335. RegisterComponentEditor(TgxMaterialLibrary, TgxMaterialLibraryEditor);
  1336. RegisterComponentEditor(TgxMaterialLibraryEx, TgxMaterialLibraryEditor);
  1337. RegisterComponentEditor(TgxSArchiveManager, TgxSArchiveManagerEditor);
  1338. RegisterPropertiesInCategories;
  1339. RegisterPropertyEditor(TypeInfo(TResolution), nil, '', TgxResolutionProperty);
  1340. RegisterPropertyEditor(TypeInfo(TgxTexture), TgxMaterial, '',
  1341. TgxTextureProperty);
  1342. RegisterPropertyEditor(TypeInfo(TgxTextureImage), TgxTexture, '',
  1343. TgxTextureImageProperty);
  1344. RegisterPropertyEditor(TypeInfo(string), TgxTexture, 'ImageClassName',
  1345. TgxImageClassProperty);
  1346. RegisterPropertyEditor(TypeInfo(TgxSoundFile), TgxSoundSample, '',
  1347. TgxSoundFileProperty);
  1348. RegisterPropertyEditor(TypeInfo(string), TgxBaseSoundSource, 'SoundName',
  1349. TgxSoundNameProperty);
  1350. RegisterPropertyEditor(TypeInfo(TgxCoordinates), nil, '',
  1351. TgxCoordinatesProperty);
  1352. RegisterPropertyEditor(TypeInfo(TgxColor), nil, '', TgxColorProperty);
  1353. RegisterPropertyEditor(TypeInfo(TgxMaterial), nil, '', TgxMaterialProperty);
  1354. RegisterComponentEditor(TgxGuiLayout, TgxGUILayoutEditor);
  1355. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxMaterial, '',
  1356. TgxLibMaterialNameProperty);
  1357. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxLibMaterial,
  1358. 'Texture2Name', TgxLibMaterialNameProperty);
  1359. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxSkyBox, '',
  1360. TgxLibMaterialNameProperty);
  1361. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxEParticleMask, '',
  1362. TgxLibMaterialNameProperty);
  1363. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxGameMenu, '',
  1364. TgxLibMaterialNameProperty);
  1365. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName),
  1366. TgxMaterialMultiProxyMaster, '', TgxLibMaterialNameProperty);
  1367. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxSLBumpShader, '',
  1368. TgxLibMaterialNameProperty);
  1369. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TSpriteAnimation, '',
  1370. TgxLibMaterialNameProperty);
  1371. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxMaterialProxy, '',
  1372. TgxLibMaterialNameProperty);
  1373. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxActorProxy, '',
  1374. TgxLibMaterialNameProperty);
  1375. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxFBORenderer, '',
  1376. TgxLibMaterialNameProperty);
  1377. RegisterPropertyEditor(TypeInfo(TgxActorAnimationName), TgxAnimationControler,
  1378. '', TgxAnimationNameProperty);
  1379. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName),
  1380. TgxTextureSharingShaderMaterial, 'LibMaterialName', TgxLibMaterialNameProperty);
  1381. RegisterSelectionEditor(TgxBaseSceneObject, TgxBaseSceneObjectSelectionEditor);
  1382. RegisterSelectionEditor(TgxSoundLibrary, TgxSoundLibrarySelectionEditor);
  1383. RegisterPropertyEditor(TypeInfo(TgxLibMaterialName), TgxLibMaterialProperty,
  1384. 'NextPass', TgxLibMaterialNameProperty);
  1385. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName),
  1386. TgxTextureProperties, 'LibTextureName', TgxLibTextureNameProperty);
  1387. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName),
  1388. TgxTextureProperties, 'LibSamplerName', TgxLibSamplerNameProperty);
  1389. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName),
  1390. TgxMultitexturingProperties, 'LibCombinerName', TgxLibCombinerNameProperty);
  1391. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName),
  1392. TgxMultitexturingProperties, 'LibAsmProgName', TgxLibAsmProgNameProperty);
  1393. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel3,
  1394. 'LibVertexShaderName', TgxLibShaderNameProperty);
  1395. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel3,
  1396. 'LibFragmentShaderName', TgxLibShaderNameProperty);
  1397. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel4,
  1398. 'LibVertexShaderName', TgxLibShaderNameProperty);
  1399. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel4,
  1400. 'LibFragmentShaderName', TgxLibShaderNameProperty);
  1401. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel4,
  1402. 'LibGeometryShaderName', TgxLibShaderNameProperty);
  1403. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel5,
  1404. 'LibVertexShaderName', TgxLibShaderNameProperty);
  1405. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel5,
  1406. 'LibFragmentShaderName', TgxLibShaderNameProperty);
  1407. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel5,
  1408. 'LibGeometryShaderName', TgxLibShaderNameProperty);
  1409. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel5,
  1410. 'LibTessControlShaderName', TgxLibShaderNameProperty);
  1411. RegisterPropertyEditor(TypeInfo(TgxMaterialComponentName), TgxShaderModel5,
  1412. 'LibTessEvalShaderName', TgxLibShaderNameProperty);
  1413. RegisterPropertyEditor(TypeInfo(string), TgxTextureImageEx, 'SourceFile', TPictureFileProperty);
  1414. RegisterPropertyEditor(TypeInfo(string), TgxShaderEx, 'SourceFile', TShaderFileProperty);
  1415. RegisterPropertyEditor(TypeInfo(string), TgxASMVertexProgram, 'SourceFile', TAsmProgFileProperty);
  1416. RegisterPropertyEditor(TypeInfo(Boolean), TgxBaseShaderModel, 'AutoFillOfUniforms', TUniformAutoSetProperty);
  1417. RegisterPropertyEditor(TypeInfo(TStringList), TgxShaderEx, 'Source', TgxShaderEditorProperty);
  1418. end;
  1419. function GetProjectTargetName: string;
  1420. var
  1421. Project: IOTAProject;
  1422. begin
  1423. Result := '';
  1424. Project := GetActiveProject;
  1425. if Assigned(Project) then
  1426. begin
  1427. Result := Project.ProjectOptions.TargetName;
  1428. if Length(Result) > 0 then
  1429. ForceDirectories(ExtractFilePath(Result));
  1430. end;
  1431. end;
  1432. // ------------------------------------------------------------------
  1433. initialization
  1434. // ------------------------------------------------------------------
  1435. SplashScreenServices.AddPluginBitmap(GetGLXceneVersion,
  1436. LoadBitmap(HInstance, 'TgxScene'), False, 'MPL 2 license', 'FMX version');
  1437. GXS.CrossPlatform.IsDesignTime := True;
  1438. GXS.CrossPlatform.vProjectTargetName := GetProjectTargetName;
  1439. GXS.Color.vUseDefaultColorSets := True;
  1440. GXS.Coordinates.vUseDefaultCoordinateSets := True;
  1441. ReadVideoModes;
  1442. with ObjectManager do
  1443. begin
  1444. CreateDefaultObjectIcons(HInstance);
  1445. RegisterSceneObject(TgxCamera, 'Camera', '', HInstance);
  1446. RegisterSceneObject(TgxLightSource, 'LightSource', '', HInstance);
  1447. RegisterSceneObject(TgxDummyCube, 'DummyCube', '', HInstance);
  1448. // Basic geometry
  1449. RegisterSceneObject(TgxSprite, 'Sprite', strOCBasicGeometry, HInstance);
  1450. RegisterSceneObject(TgxPoints, 'Points', strOCBasicGeometry, HInstance);
  1451. RegisterSceneObject(TgxLines, 'Lines', strOCBasicGeometry, HInstance);
  1452. RegisterSceneObject(TgxPlane, 'Plane', strOCBasicGeometry, HInstance);
  1453. RegisterSceneObject(TgxPolygon, 'Polygon', strOCBasicGeometry, HInstance);
  1454. RegisterSceneObject(TgxCube, 'Cube', strOCBasicGeometry, HInstance);
  1455. RegisterSceneObject(TgxFrustrum, 'Frustrum', strOCBasicGeometry, HInstance);
  1456. RegisterSceneObject(TgxSphere, 'Sphere', strOCBasicGeometry, HInstance);
  1457. RegisterSceneObject(TgxDisk, 'Disk', strOCBasicGeometry, HInstance);
  1458. RegisterSceneObject(TgxCone, 'Cone', strOCBasicGeometry, HInstance);
  1459. RegisterSceneObject(TgxCylinder, 'Cylinder', strOCBasicGeometry, HInstance);
  1460. RegisterSceneObject(TgxCapsule, 'Capsule', strOCBasicGeometry, HInstance);
  1461. RegisterSceneObject(TgxDodecahedron, 'Dodecahedron', strOCBasicGeometry, HInstance);
  1462. RegisterSceneObject(TgxIcosahedron, 'Icosahedron', strOCBasicGeometry, HInstance);
  1463. RegisterSceneObject(TgxOctahedron, 'Octahedron', strOCBasicGeometry, HInstance);
  1464. RegisterSceneObject(TgxTetrahedron, 'Tetrahedron', strOCBasicGeometry, HInstance);
  1465. RegisterSceneObject(TgxSuperellipsoid, 'Superellipsoid', strOCBasicGeometry, HInstance);
  1466. // Advanced geometry
  1467. RegisterSceneObject(TgxAnimatedSprite, 'Animated Sprite', strOCAdvancedGeometry, HInstance);
  1468. RegisterSceneObject(TgxArrowLine, 'ArrowLine', strOCAdvancedGeometry, HInstance);
  1469. RegisterSceneObject(TgxArrowArc, 'ArrowArc', strOCAdvancedGeometry, HInstance);
  1470. RegisterSceneObject(TgxAnnulus, 'Annulus', strOCAdvancedGeometry, HInstance);
  1471. RegisterSceneObject(TgxExtrusionSolid, 'ExtrusionSolid', strOCAdvancedGeometry, HInstance);
  1472. RegisterSceneObject(TgxMultiPolygon, 'MultiPolygon', strOCAdvancedGeometry, HInstance);
  1473. RegisterSceneObject(TgxPipe, 'Pipe', strOCAdvancedGeometry, HInstance);
  1474. RegisterSceneObject(TgxRevolutionSolid, 'RevolutionSolid', strOCAdvancedGeometry, HInstance);
  1475. RegisterSceneObject(TgxTorus, 'Torus', strOCAdvancedGeometry, HInstance);
  1476. // Mesh objects
  1477. RegisterSceneObject(TgxActor, 'Actor', strOCMeshObjects, HInstance);
  1478. RegisterSceneObject(TgxFreeForm, 'FreeForm', strOCMeshObjects, HInstance);
  1479. RegisterSceneObject(TgxMesh, 'Mesh', strOCMeshObjects, HInstance);
  1480. RegisterSceneObject(TgxTilePlane, 'TilePlane', strOCMeshObjects, HInstance);
  1481. RegisterSceneObject(TgxPortal, 'Portal', strOCMeshObjects, HInstance);
  1482. RegisterSceneObject(TgxTerrainRenderer, 'TerrainRenderer', strOCMeshObjects, HInstance);
  1483. // Graph-plotting objects
  1484. RegisterSceneObject(TgxFlatText, 'FlatText', strOCGraphPlottingObjects, HInstance);
  1485. RegisterSceneObject(TgxHeightField, 'HeightField', strOCGraphPlottingObjects, HInstance);
  1486. RegisterSceneObject(TgxXYZGrid, 'XYZGrid', strOCGraphPlottingObjects, HInstance);
  1487. // Particle systems
  1488. RegisterSceneObject(TgxParticles, 'Particles', strOCParticleSystems, HInstance);
  1489. RegisterSceneObject(TgxParticleFXRenderer, 'PFX Renderer', strOCParticleSystems, HInstance);
  1490. // Environment objects
  1491. RegisterSceneObject(TgxEarthSkyDome, 'EarthSkyDome', strOCEnvironmentObjects, HInstance);
  1492. RegisterSceneObject(TgxSkyDome, 'SkyDome', strOCEnvironmentObjects, HInstance);
  1493. RegisterSceneObject(TgxSkyBox, 'SkyBox', strOCEnvironmentObjects, HInstance);
  1494. RegisterSceneObject(TgxAtmosphere, 'Atmosphere', strOCEnvironmentObjects, HInstance);
  1495. // HUD objects.
  1496. RegisterSceneObject(TgxHUDSprite, 'HUD Sprite', strOCHUDObjects, HInstance);
  1497. RegisterSceneObject(TgxHUDText, 'HUD Text', strOCHUDObjects, HInstance);
  1498. RegisterSceneObject(TgxResolutionIndependantHUDText,
  1499. 'Resolution Independant HUD Text', strOCHUDObjects, HInstance);
  1500. RegisterSceneObject(TgxAbsoluteHUDText, 'Absolute HUD Text', strOCHUDObjects, HInstance);
  1501. RegisterSceneObject(TgxGameMenu, 'GameMenu', strOCHUDObjects, HInstance);
  1502. RegisterSceneObject(TgxConsole, 'Console', strOCHUDObjects, HInstance);
  1503. // GUI objects.
  1504. RegisterSceneObject(TgxBaseControl, 'Root Control', strOCGuiObjects, HInstance);
  1505. RegisterSceneObject(TgxPopupMenu, 'PopupMenu', strOCGuiObjects, HInstance);
  1506. RegisterSceneObject(TgxForm, 'Form', strOCGuiObjects, HInstance);
  1507. RegisterSceneObject(TgxPanel, 'Panel', strOCGuiObjects, HInstance);
  1508. RegisterSceneObject(TgxButton, 'Button', strOCGuiObjects, HInstance);
  1509. RegisterSceneObject(TgxCheckBox, 'CheckBox', strOCGuiObjects, HInstance);
  1510. RegisterSceneObject(TgxEdit, 'Edit', strOCGuiObjects, HInstance);
  1511. RegisterSceneObject(TgxLabel, 'Label', strOCGuiObjects, HInstance);
  1512. RegisterSceneObject(TgxAdvancedLabel, 'AdvancedLabel', strOCGuiObjects, HInstance);
  1513. RegisterSceneObject(TgxScrollbar, 'Scrollbar', strOCGuiObjects, HInstance);
  1514. RegisterSceneObject(StringGrid, 'StringGrid', strOCGuiObjects, HInstance);
  1515. RegisterSceneObject(TgxCustomControl, 'BitmapControl', strOCGuiObjects, HInstance);
  1516. // Special objects
  1517. RegisterSceneObject(TgxLensFlare, 'LensFlare', strOCSpecialObjects, HInstance);
  1518. RegisterSceneObject(TgxTextureLensFlare, 'TextureLensFlare', strOCSpecialObjects, HInstance);
  1519. RegisterSceneObject(TgxMirror, 'Mirror', strOCSpecialObjects, HInstance);
  1520. RegisterSceneObject(TgxShadowPlane, 'ShadowPlane', strOCSpecialObjects, HInstance);
  1521. RegisterSceneObject(TgxShadowVolume, 'ShadowVolume', strOCSpecialObjects, HInstance);
  1522. RegisterSceneObject(TgxZShadows, 'ZShadows', strOCSpecialObjects, HInstance);
  1523. RegisterSceneObject(TgxSLTextureEmitter, 'GLSL Texture Emitter', strOCSpecialObjects, HInstance);
  1524. RegisterSceneObject(TgxSLProjectedTextures, 'GLSL Projected Textures', strOCSpecialObjects, HInstance);
  1525. RegisterSceneObject(TgxTextureEmitter, 'Texture Emitter', strOCSpecialObjects, HInstance);
  1526. RegisterSceneObject(TgxProjectedTextures, 'Projected Textures', strOCSpecialObjects, HInstance);
  1527. RegisterSceneObject(TgxBlur, 'Blur', strOCSpecialObjects, HInstance);
  1528. RegisterSceneObject(TgxMotionBlur, 'MotionBlur', strOCSpecialObjects, HInstance);
  1529. RegisterSceneObject(TgxSpaceText, 'SpaceText', strOCDoodad, HInstance);
  1530. RegisterSceneObject(TgxTrail, 'Trail', strOCSpecialObjects, HInstance);
  1531. RegisterSceneObject(TgxPostEffect, 'PostEffect', strOCSpecialObjects, HInstance);
  1532. RegisterSceneObject(TgxPostShaderHolder, 'PostShaderHolder', strOCSpecialObjects, HInstance);
  1533. // Doodad objects.
  1534. RegisterSceneObject(TgxTeapot, 'Teapot', strOCDoodad, HInstance);
  1535. RegisterSceneObject(TgxTree, 'Tree', strOCDoodad, HInstance);
  1536. RegisterSceneObject(TgxWaterPlane, 'WaterPlane', strOCDoodad, HInstance);
  1537. // Proxy objects.
  1538. RegisterSceneObject(TgxProxyObject, 'ProxyObject', strOCProxyObjects, HInstance);
  1539. RegisterSceneObject(TgxColorProxy, 'ColorProxy', strOCProxyObjects, HInstance);
  1540. RegisterSceneObject(TgxFreeFormProxy, 'FreeFormProxy', strOCProxyObjects, HInstance);
  1541. RegisterSceneObject(TgxMaterialProxy, 'MaterialProxy', strOCProxyObjects, HInstance);
  1542. RegisterSceneObject(TgxActorProxy, 'ActorProxy', strOCProxyObjects, HInstance);
  1543. RegisterSceneObject(TgxMultiProxy, 'MultiProxy', strOCProxyObjects, HInstance);
  1544. RegisterSceneObject(TgxMaterialMultiProxy, 'MaterialMultiProxy', strOCProxyObjects, HInstance);
  1545. // Other objects.
  1546. RegisterSceneObject(TgxDirectOpenGL, 'Direct OpenGL', '', HInstance);
  1547. RegisterSceneObject(TgxDirectVulkan, 'Direct Vulkan', '', HInstance);
  1548. RegisterSceneObject(TgxRenderPoint, 'Render Point', '', HInstance);
  1549. RegisterSceneObject(TgxImposter, 'Imposter Sprite', '', HInstance);
  1550. RegisterSceneObject(TgxFeedback, 'OpenXR Feedback', '', HInstance);
  1551. RegisterSceneObject(TgxFBORenderer, 'OpenXR FrameBuffer', '', HInstance);
  1552. end;
  1553. //=================================================================
  1554. finalization
  1555. //=================================================================
  1556. ObjectManager.Free;
  1557. end.