Results 1 to 6 of 6

Thread: Procedural Model Editor

  1. #1

    Procedural Model Editor

    This project started as part of my future plans to create a new model format to use with DelphiDoom.

    Basics:
    • The mesh is generated with script using opengl commands. The application uses (a slightly modified version of) RemObject's PascalScript as it's scripting engine.
    • Every model can have a number of Frames. A frame can call other frames (i.e. you can use a frame as a submodel). Special care has been taken to avoid dead ends when recursively calling frames.
    • The mesh can be decompiled to Pascal or C code, or exported in binary format.


    Downloads (ver. 1.0.2): https://sourceforge.net/projects/del...D_MODEL_1.0.2/ (Windows Executable & full source code)

    For Programmers:
    To bind into your project a mesh genetated by this tool, you have to include the mdl_model.pas unit to your project (and all it's dependencies). Then you can use the TDDModelLoader() class to load a model and render the frames. Use the member functions LoadFromScript & AppendFromScript for loading a model in script format and LoadFromFile & LoadFromStream for loading a model in binary format. Then use the RenderFrame() member function to draw the model (OpenGL).

    Example code (generates a spinning plane):

    Code:
    model model1;
    
    procedure MakePlane;
    begin
      glbegin(GL_QUADS);
        glTexCoord2f(0,1); glVertex3f(-0.5,-0.5, 0);
        glTexCoord2f(1,1); glVertex3f( 0.5,-0.5, 0);
        glTexCoord2f(1,0); glVertex3f( 0.5, 0.5, 0);
        glTexCoord2f(0,0); glVertex3f(-0.5, 0.5, 0);
      glEnd;
    end;
      
    var
      i: integer;
    begin
      SetFrame(0); // Set current frame to #0
      MakePlane; // Draw something
    
    // Spin it
      for i := 1 to 359 do 
      begin 
        SetFrame(i);  // Set current frame to "i"
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix;
        glRotatef(i , 0.0, 1.0, 0.0);
        CallFrame(0); // Call frame #0
        glPopMatrix;
      end;
    end.
    Screenshots:







    Last edited by Jimmy Valavanis; 12-11-2017 at 02:48 PM.

  2. #2
    Wow, nice. Respect!
    Jarrod Davis
    Proprietor @ 2drealms Entertainment
    Facebook / Twitter / YouTube

  3. #3
    so what does it do exactly?
    Or rather what's the the use case
    Last edited by laggyluk; 14-11-2017 at 02:56 AM.

  4. #4
    Quote Originally Posted by laggyluk View Post
    so what does it do exactly?
    Or rather what's the the use case
    It's a model editor that editing actions are performed with scipts.
    The application creates mesh geometry using OpenGL commands and stores them in binary format (DMX models). Future versions of DelphiDoom will support DMX models.
    Using the decompile feature you can import the mesh geometry directly into the executable (C and Pascal source decompile).

  5. #5
    Best regards from Japan.

    This makes perfect sense to me. I often use Povray to make 3d shapes because I find it easier to type as text what shape I want instead of trying to use some editor.

  6. #6
    Cool. I have a similar problem than Thyandyr. Should keep an eye on this.
    No signature provided yet.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •