Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: 3DS, wavefront obj and milkshape ascii loader for delphi

  1. #21

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    Ok i modified that when looking up the class for the file extension lower case is used even if the filename extension is not in lower case.
    http://3das.noeska.com - create adventure games without programming

  2. #22

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    Quote Originally Posted by noeska
    The changes for TBaseModel are in the svn now. It did not even have an custom create.

    E.g. now you can do:
    [pascal]
    Model1 := TBaseModel.Create(nil);
    Model1.LoadFromFile('models\tulip.3ds');
    Model1.SaveToFile('tulip.txt');
    Model1.Free;
    [/pascal]

    If you need advice on how to write your own descendant from TBaseModel let me know.
    Hi noeska,
    I'm attempting to use your model load as a bridge between my format and the popular ones (.3ds, etc.)...

    Anyhow when I try to use the LoadFromFile() method of the TBaseModel class, my program crashes because the variable FileFormats is Nil at that point

    [pascal]procedure TBaseModel.LoadFromFile(AFilename: string);
    var
    Ext: string;
    GraphicClass: TBaseModelClass;
    begin
    Ext := ExtractFileExt(AFilename);
    Delete(Ext, 1, 1);
    GraphicClass := FileFormats.FindExt(Ext); <----BLOWS UP HERE, FileFormats is Nil!!!
    LoadFromFile(GraphicClass, AFilename);

    //Check if model is loaded

    Calculatesize; //calculate min and max size
    CalculateRenderOrder; //set transparency order...

    //Needs to be called here and not before or else...
    InitSkin;
    end;
    [/pascal]

    My code is basically this:

    [pascal]
    Uses
    Model;

    Var
    Model : TBaseModel;
    Begin
    Model := TBaseModel.Create(Nil);
    Try
    Model.LoadFromFile(<some filename>);
    ....
    Finally
    Model.Free;
    End;
    End;[/pascal]

    Any ideas?
    cheers,
    Paul

  3. #23

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    I have it working now

    I added these lines before using the BaseModel.LoadFromFile()

    [pascal] RegisterModelFormat('obj' ,'Wavefront Obj files',TObjModel);
    RegisterModelFormat('3ds' ,'3ds max files',T3dsModel);
    RegisterModelFormat('ms3d','Milkshape 3d files' ,TMsaModel);
    RegisterModelFormat('x' ,'DirectX 3d files' ,TDXModel);
    [/pascal]

    I do have another question...are all the faces in the basemodel triangles only?
    It seems so from the source code and example you posted here...

    cheers,
    Paul

  4. #24

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    What delphi version are you using?

    E.g. including glmodel.pas in your uses should be enough to load .obj meshes

    As
    [pascal]
    initialization
    RegisterModelFormat('obj', 'Alias Wavefront Obj Model', TObjModel);

    finalization
    UnRegisterModelClass(TObjModel);
    [/pascal]

    is at the end of glmodel.pas Or is that delphi2005 and above only?
    http://3das.noeska.com - create adventure games without programming

  5. #25

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    Quote Originally Posted by noeska
    What delphi version are you using?

    E.g. including glmodel.pas in your uses should be enough to load .obj meshes

    As
    [pascal]
    initialization
    RegisterModelFormat('obj', 'Alias Wavefront Obj Model', TObjModel);

    finalization
    UnRegisterModelClass(TObjModel);
    [/pascal]

    is at the end of glmodel.pas Or is that delphi2005 and above only?
    I'm using D2007 WIn32...

    BTW, should I be using the zip file or the SVN version of the code?

    cheers,
    Paul

  6. #26

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    If you want to use the 'latest features' use svn. I try to keep it in working order. That is not always possible so you better not use the .x reader.
    http://3das.noeska.com - create adventure games without programming

  7. #27

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    Quote Originally Posted by noeska
    What delphi version are you using?

    E.g. including glmodel.pas in your uses should be enough to load .obj meshes

    As
    [pascal]
    initialization
    RegisterModelFormat('obj', 'Alias Wavefront Obj Model', TObjModel);

    finalization
    UnRegisterModelClass(TObjModel);
    [/pascal]

    is at the end of glmodel.pas Or is that delphi2005 and above only?
    Could my problem have been because I am using your code inside a DLL?

    Maybe the initialization part isn't called then?

    cheers,
    Paul

  8. #28

    Re: 3DS, wavefront obj and milkshape ascii loader for delphi

    There is new release for glmodel. Now it is at version 3.5a bringing a new vbo render target.
    You can get i from svn or download it as an zip file from: http://www.noeska.net/downloads/glModel-3.5.0a.zip .
    http://3das.noeska.com - create adventure games without programming

Page 3 of 3 FirstFirst 123

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
  •