Recent

Author Topic: I've made some fairly significant progress on JuhaManninen's port of DeleD...  (Read 44025 times)

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Checking in: I have not died/e.t.c.

I think I'll have the application at the point I want to get it to before uploading the codebase within about a week. The past few days I've been refactoring all things image and texture related a bit more, partially based on some of the suggestions in this thread, and also implementing the last "major" change that I wanted to make, which is moving the (completely broken) MDI windowing system over to AnchorDocking. As it stands, I would say it almost works, but there's still a few bugs I need to work out with loading and saving the layout from XML.

Also, just for fun, here's a re-textured 4K raytrace of the "Castle Siege" example scene that I did today (only took 20 minutes to render!)
http://i.imgur.com/KqwkKyk.jpg
« Last Edit: June 23, 2016, 06:09:06 pm by Akira1364 »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Sounds good Akira1364.
Is your solution cross-platform already?
In any case it will be easy to make cross-platform because the used components / libraries support it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
I'm not entirely sure. I suppose I need to fire up VMWare and find out.

Here's a screenshot of the application running with an anchor-docked layout, by the way:
http://i.imgur.com/RO3O1HJ.png
« Last Edit: June 23, 2016, 06:10:10 pm by Akira1364 »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Ping ...

I'm not entirely sure. I suppose I need to fire up VMWare and find out.

I am willing to test it under Linux once you publish the source code.
This is open source, why are you still incubating the code privately?
If you need help with revision control, just ask.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Ok, I felt like it was time to swing by the forums for another update.

Yes, it's been longer than a week (not that that wasn't an extremely rough estimate to begin with). Sorry! Things have been significantly busier at my real job than I expected, and wrangling AnchorDocking to work completely seamlessly with TOpenGLControl as well as the way Deled reads and writes to and from its INI file ended up being a little tricker than I thought. The biggest problem was that Deled needs the Viewport forms (meaning the ones that contain TOpenGLControls) to be freed completely when closed, but AnchorDocking only hides "dockable forms" by default and provides no easy built-in way to override that. Somewhat of a hassle, but I got it figured out eventually... Also, it occured to me that Deled is essentially useless if it can't at least export to file formats other than its own, so I've been working on a basic "native" OBJ exporter, which is about 85% done, I'd say.

This is open source, why are you still incubating the code privately?

Mostly because I'd rather leave the community with a codebase they can immediately start improving (i.e. adding new features), rather than wasting time fixing my bugs.
Also, as far as revision control, I'm fine, thanks.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Also, it occured to me that Deled is essentially useless if it can't at least export to file formats other than its own, so I've been working on a basic "native" OBJ exporter, which is about 85% done, I'd say.

So you are already doing new development and not only porting the existing code?
Please publish the code before you do that!

Quote
Mostly because I'd rather leave the community with a codebase they can immediately start improving (i.e. adding new features), rather than wasting time fixing my bugs.

People will not fix bugs if you tell them to wait and explain which parts you are working on.
Remember the open source motto: "Release early, release often".
Please release ASAP!

Last night it occurred to me that maybe there is no DeleD port from Akira. Maybe the pics were just mockups or rendered with the Delphi version.
Ok, maybe not... Just a thought late at night.

Quote
Also, as far as revision control, I'm fine, thanks.

Does it mean we see the changes divided into many meaningful commits?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
it occurred to me that maybe there is no DeleD port from Akira. Maybe the pics were just mockups or rendered with the Delphi version.

So I went out of my way to study the source code to the extent that I'm able to convincingly talk about it, made up a bunch of changes/feature additions that I hadn't actually made, and then went on an internet forum and posted about it in detail in some weirdly specific attempt to impress a bunch of people I've never met? The amount of effort that would take is far more than it is to actually work on the code.

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
it occurred to me that maybe there is no DeleD port from Akira. Maybe the pics were just mockups or rendered with the Delphi version.

So I went out of my way to study the source code to the extent that I'm able to convincingly talk about it, made up a bunch of changes/feature additions that I hadn't actually made, and then went on an internet forum and posted about it in detail in some weirdly specific attempt to impress a bunch of people I've never met? The amount of effort that would take is far more than it is to actually work on the code.

LOL. He said that to force you to upload the code... like right now.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
LOL. He said that to force you to upload the code... like right now.

Yeah, obviously. I don't know why he cares so much, though. No one had worked on the application at ALL in over three years, and if I hadn't decided to pick up the codebase myself it could have just as easily remained untouched until the end of time.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Yeah, obviously. I don't know why he cares so much, though. No one had worked on the application at ALL in over three years, and if I hadn't decided to pick up the codebase myself it could have just as easily remained untouched until the end of time.

Heh :)
I care, or at least I am interested because I did the initial port but then my skills in graphics programming were not enough to continue.
My motivation also went down when nobody else seemed to care about the Lazarus port.
I had honestly thought that some old DeleD developers would jump in with enthusiasm and improve my code. Their forum have threads about the project's future when Delphi has become so expensive and not everybody has access to it. Some people even suggested rewriting DeleD with C++ or Java (!). To me Lazarus seemed like a perfect match for their needs.
To my disappointment the project has no active developers now, even the original branch has no recent commits.
Anyway, I hoped your effort could change that. That's why I suggested that you commit your code in the same branch where I did. I understood DeleD has users, somebody will notice when there is a usable Lazarus port.

Whatever happens, DeleD has already benefited Lazarus project as a stress test for many open editor files which lead us to optimize code. The porting project also pushed me to implement 2 components, ValueListEditor and CoolBar which both have been improved by others since then.
« Last Edit: July 11, 2016, 02:36:34 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
I had honestly thought that some old DeleD developers would jump in with enthusiasm and improve my code. Their forum have threads about the project's future when Delphi has become so expensive and not everybody has access to it. Some people even suggested rewriting DeleD with C++ or Java (!). To me Lazarus seemed like a perfect match for their needs.
To my disappointment the project has no active developers now, even the original branch has no recent commits.

The original DeleD developers have a vested financial interest in NOT ever working on the open-source Object Pascal desktop version of DeleD again, as they're currently focused on a web-based (written in JavaScript or something) version of the application that's going to used a tiered subscription model (as in you're paying for more texture asset storage space at the higher levels) once it's out of beta.
« Last Edit: July 11, 2016, 04:40:20 am by Akira1364 »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
The original DeleD developers have a vested financial interest in NOT ever working on the open-source Object Pascal desktop version of DeleD again, as they're currently focused on a web-based (written in JavaScript or something) version of the application that's going to used a tiered subscription model (as in you're paying for more texture asset storage space at the higher levels) once it's out of beta.

That may complicate things.
On the other hand they created a SVN branch for Lazarus port and I even got some positive comments about the effort.

What is the best place to publish your code?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Akira1364

  • Hero Member
  • *****
  • Posts: 561
What is the best place to publish your code?

I'm not exactly picky. The SourceForge repository, as you suggested, would probably be the most logical place once I'm ready. In other news, I'm pleased to announce that I finished up the OBJ exporter today, and it's working perfectly! Here's a screenshot of the "Sanssouci" example scene running in Wings3D after being exported from Deled:
http://i.imgur.com/dqsVXQa.png

Additionally, just to ensure that the silly notion of this all being some bizarrely pointless hoax on my part has been fully dispelled, here's the complete source code of the OBJ exporter unit:
Code: Pascal  [Select][+][-]
  1. //Original Author: Akira1364
  2. //Last Modified: 09/10/16
  3.  
  4. unit unit_OBJSceneWriter;
  5.  
  6. {$mode Delphi}{$H+}
  7.  
  8. interface
  9.  
  10. uses
  11.   Classes, Dialogs, Forms, SysUtils, FileUtil, LazFileUtils, unit_Scene,
  12.   unit_Functions, unit_Primitives, unit_PrimitiveList;
  13.  
  14. type
  15.   TOBJSceneWriter = class(TObject)
  16.     OBJData: TStringList;
  17.     MaterialData: TStringList;
  18.     TextureList: TStringList;
  19.     ExportList: TPrimitiveList;
  20.   private
  21.     FScene: TScene;
  22.     FDecimalPrecision: string;
  23.     FSmoothingLevel: integer;
  24.   public
  25.     constructor Create(AScene: TScene; ADecimalPrecision: string; ASmoothingLevel: integer);
  26.     destructor Destroy; override;
  27.     procedure WriteToFile(OBJFileName: string);
  28.     property DecimalPrecision: string read FDecimalPrecision;
  29.     property SmoothingLevel: integer read FSmoothingLevel;
  30.   end;
  31.  
  32. implementation
  33.  
  34. constructor TOBJSceneWriter.Create(AScene: TScene; ADecimalPrecision: string; ASmoothingLevel: integer);
  35. begin
  36.   inherited Create;
  37.   FScene := AScene;
  38.   FDecimalPrecision := ADecimalPrecision;
  39.   FSmoothingLevel := ASmoothingLevel;
  40.   OBJData := TStringList.Create;
  41.   MaterialData := TStringList.Create;
  42.   TextureList := TStringList.Create;
  43.   ExportList := FScene.Primitives.Copy;
  44. end;
  45.  
  46. destructor TOBJSceneWriter.Destroy;
  47. begin
  48.   OBJData.Free;
  49.   MaterialData.Free;
  50.   TextureList.Free;
  51.   ExportList.Free;
  52.   inherited Destroy;
  53. end;
  54.  
  55. procedure TOBJSceneWriter.WriteToFile(OBJFileName: string);
  56. var
  57.   LastTextureUsed, PolyIndexString, PolyString, MaterialFileName, TextureSaveDirectory,
  58.   RelativeTextureFileName: string;
  59.   I, J, K, L: integer;
  60. begin
  61.   L := 0;
  62.   try
  63.     TextureSaveDirectory := ExtractFilePath(OBJFileName) + 'Textures';
  64.     CreateDirUTF8(TextureSaveDirectory);
  65.     MaterialFileName := ExtractFilePath(OBJFileName) + ExtractFileNameOnly(OBJFileName) + '.mtl';
  66.     OBJData.Append('# Created by DeleD 2.45 Lazarus Edition #');
  67.     OBJData.Append('mtllib ' + ExtractFileNameOnly(MaterialFileName) + '.mtl');
  68.     for I := 0 to ExportList.NumPrimitives - 1 do
  69.     begin
  70.       if ExportList[I].IsLightOrPathOrSkeletonPart = True then
  71.         Continue;
  72.       with ExportList[I] do
  73.       begin
  74.         InitializeNormals(SmoothingLevel);
  75.         OBJData.Append('');
  76.         OBJData.Append('o ' + Name);
  77.         OBJData.Append('# Vertices #');
  78.         for J := 0 to NumPolygons - 1 do
  79.         begin
  80.           for K := 0 to Polygons[J].NumVertices - 1 do
  81.           begin
  82.             with Polygons[J].VerticeList[K] do
  83.             begin
  84.               OBJData.Append('v ' + FormatFloat(DecimalPrecision, x) + ' ' +
  85.                 FormatFloat(DecimalPrecision, y) + ' ' + FormatFloat(DecimalPrecision, z));
  86.             end;
  87.           end;
  88.         end;
  89.         OBJData.Append('');
  90.         OBJData.Append('# Texture Coordinates #');
  91.         for J := 0 to NumPolygons - 1 do
  92.         begin
  93.           for K := 0 to Polygons[J].UVCoordinates[0].Count - 1 do
  94.           begin
  95.             with Polygons[J].UVCoordinates[0][K] do
  96.             begin
  97.               OBJData.Append('vt ' + FormatFloat(DecimalPrecision, u) + ' ' +
  98.                 FormatFloat(DecimalPrecision, -v));
  99.             end;
  100.           end;
  101.         end;
  102.         OBJData.Append('');
  103.         OBJData.Append('# Normals #');
  104.         for J := 0 to NumPolygons - 1 do
  105.         begin
  106.           for K := 0 to Polygons[J].NumVertexNormals - 1 do
  107.           begin
  108.             with Polygons[J].VertexNormals[K] do
  109.             begin
  110.               OBJData.Append('vn ' + FormatFloat(DecimalPrecision, x) + ' ' +
  111.                 FormatFloat(DecimalPrecision, y) + ' ' + FormatFloat(DecimalPrecision, z));
  112.             end;
  113.           end;
  114.         end;
  115.         OBJData.Append('');
  116.         OBJData.Append('# Polygons #');
  117.         for J := 0 to NumPolygons - 1 do
  118.         begin
  119.           with Polygons[J] do
  120.           begin
  121.             with Material.TextureLayers[0].Texture do
  122.             begin
  123.               if IsColorTexture = True then
  124.               begin
  125.                 if LastTextureUsed <> Material.Name then
  126.                   OBJData.Append('usemtl ' + Material.Name);
  127.                 LastTextureUsed := Material.Name;
  128.               end
  129.               else
  130.               begin
  131.                 RelativeTextureFileName :=
  132.                   'Textures' + DirectorySeparator + ExtractFileName(FileName);
  133.                 if LastTextureUsed <> RelativeTextureFileName then
  134.                   OBJData.Append('usemtl ' + RelativeTextureFileName);
  135.                 LastTextureUsed := RelativeTextureFileName;
  136.               end;
  137.             end;
  138.             PolyString := 'f';
  139.             for K := 0 to NumVertices - 1 do
  140.             begin
  141.               Inc(L);
  142.               PolyIndexString := IntToStr(L);
  143.               PolyString := PolyString + ' ' + PolyIndexString + '/' +
  144.                 PolyIndexString + '/' + PolyIndexString;
  145.             end;
  146.             OBJData.Append(PolyString);
  147.           end;
  148.         end;
  149.         for J := 0 to NumPolygons - 1 do
  150.         begin
  151.           with Polygons[J].Material.TextureLayers[0].Texture do
  152.           begin
  153.             if (FileName <> '') and (TextureList.IndexOf(FileName) = -1) and
  154.               (TextureList.IndexOf(Polygons[J].Material.Name) = -1) then
  155.             begin
  156.               if IsColorTexture = True then
  157.               begin
  158.                 MaterialData.Append('newmtl ' + Polygons[J].Material.Name);
  159.                 with ColorToRGB(Color) do
  160.                   MaterialData.Append('Kd ' + FormatFloat(DecimalPrecision, r) +
  161.                     ' ' + FormatFloat(DecimalPrecision, g) + ' ' +
  162.                     FormatFloat(DecimalPrecision, b));
  163.                 TextureList.Append(Polygons[J].Material.Name);
  164.               end
  165.               else
  166.               begin
  167.                 RelativeTextureFileName :=
  168.                   'Textures' + DirectorySeparator + ExtractFileName(FileName);
  169.                 MaterialData.Append('newmtl ' + RelativeTextureFileName);
  170.                 MaterialData.Append('map_Kd ' + RelativeTextureFileName);
  171.                 CopyFile(FileName, TextureSaveDirectory + DirectorySeparator +
  172.                   ExtractFileName(FileName), True);
  173.                 TextureList.Append(FileName);
  174.               end;
  175.             end;
  176.           end;
  177.         end;
  178.       end;
  179.     end;
  180.     OBJData.SaveToFile(OBJFileName);
  181.     MaterialData.SaveToFile(MaterialFileName);
  182.   except
  183.     ShowMessage('Export error.');
  184.   end;
  185. end;
  186.  
  187. end.
« Last Edit: September 11, 2016, 12:57:20 am by Akira1364 »

circular

  • Hero Member
  • *****
  • Posts: 4219
    • Personal webpage
Hi there!

That's a great job your doing Akira.

I never thought it was a hoax.

Note that if you don't want to make the code public yet, I would still suggest to make backups so that your work is safe.

It is great to have you around teasing us.  :)
Conscience is the debugger of the mind

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Hi there!

That's a great job your doing Akira.

I never thought it was a hoax.

Note that if you don't want to make the code public yet, I would still suggest to make backups so that your work is safe.

It is great to have you around teasing us.  :)

Thanks! As far as the backups go, don't worry, I wouldn't dream of working on an application as large as DeleD without them.

Here's a couple more screenshots for everyone showing off the significantly increased window layout possibilities that AnchorDocking adds to the application:
http://i.imgur.com/fnUN0G8.png
http://i.imgur.com/Y6y84sz.png

By the way, if anyone is wondering "How did he get that sky background in there!!??", it's just a set of skybox textures. DeleD has always had the ability to load them into the 3D viewport through the main options menu.

 

TinyPortal © 2005-2018