You could send a relative path to your textures (such as textures\mytex.jpg instead of c:\bla\blubb\myprojects\delphi\megaman\textures\mytex.jpg).
If you have to send absolute paths, you can derive them from the starting folder of your application by using ParamStr(0) and concatenating your file names.
Registriert: Do Sep 25, 2003 15:56 Beiträge: 7810 Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
Where can I set the texture-Path?? The best way would be, saving the Textures in .3DS . But...
It would be cool if there was a property like:
TAll3DSMesh.texturepath
So it would be possible to set an explicite searchpath for every Mesh...
_________________ Blog: kevin-fleischer.de und fbaingermany.com
Registriert: Do Sep 25, 2003 15:56 Beiträge: 7810 Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
I think i have an idea, why my code don' work... What must I write by tAll3DSMesh(-?????-). If I whant to use "self" there...where have I to do this (in which procedure?)?
PS: Ohhhhhh real brute force english.... 8)
_________________ Blog: kevin-fleischer.de und fbaingermany.com
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
I think I've found another bug. When you mirror an object, it isn't rendered correct anymore with your loader. Although better than Lischke's loader, that didn't render mirrored objects at all, your loader seems to mirror the object wrongly (didn't yet took a look at the source where mirroring is taken into account).
Take a look at this small model I put together, left is how it looks rendered with gl3Ds.pas and right shows it in 3DS :
It seems that the right half of the brain is also (wrongly) mirrored on the Z-axis. But I don't know how 3DS stores mirrored vertices when exporting to .3DS, so it may be a fault within 3DS-export itself.
Registriert: Do Sep 25, 2003 15:56 Beiträge: 7810 Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
I have two neg. points to say.
1. You need so many librarys for your library! I think it would be coul, if you put all those Functions you need (from any library you use) in one library (gl3DS_helpers). This would even be an advantage when your library is spread over the whole inet.
2. It don't work! Ok, I think it's not a real problem, but i put your library to my uses part and tried to compile. I get 3 Faults. Always "Not enough Parameters". All those Errors depend to Loadtexture(); . This Function needs 3 Parameters, but you give only 2. As I see, you forget to give a Boolean-var to the Function. So what should I write in there? A Boolean with a Value of true or false?
PS: The Error occoure in Line 2232, 2234 and 2450.
_________________ Blog: kevin-fleischer.de und fbaingermany.com
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Thanks for all the feedback.
Some short answers:
-I was not aware of mirrored 3ds meshes.
-The texture part is a work in progres and i changed the texture unit recently and i will do that again. I must have missed some calls to it.
-with create just use nil. Or if you use a form use the form there that way on closing the form the mesh will be destroyed also.
- 3DS files dont store paths to textures, they just store the texture filename (as far as i know). 3D apps search the textures on texture paths e.g. pointing to texture libraries. That is what the texturepath property is for. You better set the texturepath on tall3dsmesh even if the textures are in the same dir as where the 3ds file is. On loading the 3ds files all texture files should be loaded automaticaly.
-I am using many units for now, once i am happy with things that will be replaced. But not for now.
-Try using a tlist structure in stead of an array. Do use new(mesh) where mesh is a PAll3DSMesh structure.
-Do test the 3ds mesh loading directly into a tall3dsmesh directly if it is not working if it does not work there either that 3ds mesh is not supported yet.
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
I'm right now working on a gameproject where I use fairly complex scenery and on of the scenes I'm using shows a prehistorical forestscene. And for the foliage of the trees, I'm using planes but since planes in 3DS only have one side, parts of them get culled as soon as you enable back-face culling (which is a must cause it gains you a good amount of performance) so that the foliage isn't displayed correctly :
(Left : No two-sided materials, Right : Correct display with two-sided materials)
To get around this, you need to load a chunk called MAT_TWO_SIDED that contains nothing, but if it's present for a material, it's a two-sided material. If you have such a material, you'll just have to turn back-face-culling off :
MAT_TWO_SIDED : This is very usefull if you're using backface culling (which gives you a nice performanceboost) and use planes for things like foliage. Since those planes normally would get backfaceculled some parts may not be visible and that may lead to a wrong display of things like trees and so on. So you just need to say 3DS that the material for such things is two-sided and then disable culling for all faces using that material.
Loading :
Code:
MAT_TWO_SIDE :begin
// This chunk contains nothing but the header. If it's present,
// the current material is two-sided and won't get backface-culled
_Material[mcount-1].TwoSided:=True;
end;
Applying :
Code:
if TwoSided then
glDisable(GL_CULL_FACE)
else
glEnable(GL_CULL_FACE);
P.S. : To get two-sided materials in 3DS, you'll have to check this in the material editor :
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
I was just building a scenery for my current project, where I had some transparent objects in, and since your gl3DS now just draws mesh after mesh, I got some problems with that : Just create an object that's transparent and create a second object in it that's not transparent. Since your unit draws mesh 0 first, you'll only see the transparent object (cause you have to do sorting for transparent objects).
So I enhanched the loader so that it first draws all non-transparent objects and then at last the transparent objects. So that transparency works in most cases (as long as there aren't two transparent objects overlapping).
First thing I do now is to check if a mesh has at least one face that has a transparent material assigned, to make it easy, I do this in the calcvnormals-procedure as that get's called after all meshes are loaded and therefore is the best place for that :
Code:
for m:=0to _NumMeshes-1do
begin
...
with _Mesh[m]do
begin
f :=0;
_hastranspfaces :=False;
while f < _numindices-1do
begin
if MatID[f div3]in[Low(_Material)..High(_Material)]then
if _Material[MatID[f div3]]._transparency < 1then
begin
_hastranspfaces :=True;
break;
end;
inc(f,3);
end;
end;
end;
...
After that it's easy to render all transparent objects last :
Code:
procedure TAll3DSMesh.render;
var
m:longword;
begin
// Nicht transparente Meshes zuerst
for m :=0to _NumMeshes-1do
ifnot _Mesh[m]._hastranspfaces then
_Mesh[m].UseTangents:= UseTangents;
// Am Schluss transparente Meshes
for m :=0to _NumMeshes-1do
if _Mesh[m]._hastranspfaces then
_Mesh[m].render;
end;
It's an easy to implement feature, but especially in scenes that have transparent objects in them, it's necessary.
Registriert: Do Sep 25, 2003 15:56 Beiträge: 7810 Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
I've downloaded Version 2.4a from your homepage.
Is it posible that you packed a wrong Version of the Logger.pas to the Zip?
The Compiler don't know a methode named "Writeln()" (line 337 / .LoadTexture()).
Its no great thing to fix it myself but, its bether you know about it.
_________________ Blog: kevin-fleischer.de und fbaingermany.com
Mitglieder in diesem Forum: 0 Mitglieder und 8 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.