Results 1 to 6 of 6

Thread: Procedural Model Editor

Threaded View

Previous Post Previous Post   Next Post Next Post
  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.

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
  •