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.
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
Hi noeska,Originally Posted by 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
Games:
Seafox
Pages:
Syntax Error Software itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
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
Games:
Seafox
Pages:
Syntax Error Software itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
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
I'm using D2007 WIn32...Originally Posted by noeska
BTW, should I be using the zip file or the SVN version of the code?
cheers,
Paul
Games:
Seafox
Pages:
Syntax Error Software itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
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
Could my problem have been because I am using your code inside a DLL?Originally Posted by noeska
Maybe the initialization part isn't called then?
cheers,
Paul
Games:
Seafox
Pages:
Syntax Error Software itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
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
Bookmarks