PDA

View Full Version : Procedural Model Editor



Jimmy Valavanis
12-11-2017, 06:55 AM
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/delphidoom-procedural-modeler/files/DD_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):



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:

https://s20.postimg.org/qxbsrh7jh/Screen4.png

https://s20.postimg.org/ra36xnadp/Screen1.png

https://s20.postimg.org/wli3id465/Screen2.png

https://s20.postimg.org/vvzb5zo71/Screen3.png

drezgames
13-11-2017, 06:14 PM
Wow, nice. Respect!

laggyluk
13-11-2017, 08:18 PM
so what does it do exactly? :P
Or rather what's the the use case

Jimmy Valavanis
15-11-2017, 05:58 AM
so what does it do exactly? :P
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).

Thyandyr
15-11-2017, 08:21 AM
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.

Ñuño Martínez
15-11-2017, 12:57 PM
Cool. I have a similar problem than Thyandyr. Should keep an eye on this.