BrainPlug
Senior Newbie 
|
 |
«
Posted
2005-08-22 15:41:37 » |
|
Hello everybody, I have a geometry in a 3DS file that I want to load with the 3DS-Loaders from " www.newdawnsoftware.com". I want to import this scene and later adjust the positions of some of the 3d-objects. But I found out, that the names of the Shape3Ds that represent the objects, are empty Strings ( <Shape3D>.getName() ). I really need this names to determine wich Shape3D represents which 3D-object. Has anyone any suggestions ?? best regards Marc
|
|
|
|
|
kevglass
|
 |
«
Reply #1 - Posted
2005-08-22 16:41:16 » |
|
Eeep, you mailed me direct about this one too didn't you?
I'll try and take a look tonight unless anyone else has any initial suggestions (croft?)
Kev
|
|
|
|
croft
Junior Member  
Java, Java, Java
|
 |
«
Reply #2 - Posted
2005-08-22 20:07:54 » |
|
I'll try and take a look tonight unless anyone else has any initial suggestions (croft?)
Do you want to me to hold off on working on org.xith3d.loaders.tds while you address this issue? I can work on org.xith3d.loaders.md2 in the interim.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
kevglass
|
 |
«
Reply #3 - Posted
2005-08-23 01:48:02 » |
|
Na, its fine, I imagine this is a tiny patch. If only I hadn't spent all night playing about.
Kev
|
|
|
|
hawkwind
Junior Member  
Java games rock!
|
 |
«
Reply #4 - Posted
2005-08-23 02:30:15 » |
|
Croft
You obviously have been making some big strides in adding and extending some Xith capabilities. Do you have any plans on putting some of what you have done, the original stuff for the whoola browser, into xith. Behaviors for example?? Are there any other goodies in that tool?
|
|
|
|
|
croft
Junior Member  
Java, Java, Java
|
 |
«
Reply #5 - Posted
2005-08-23 20:16:35 » |
|
You obviously have been making some big strides in adding and extending some Xith capabilities. Do you have any plans on putting some of what you have done, the original stuff for the whoola browser, into xith. Behaviors for example?? Are there any other goodies in that tool?
Yes, eventually. I've got a Loader almost ready to contribute that delegates to one of the other New Dawn Software loaders which is chosen based on the filename extension such .obj, .md2, or .3ds. I was thinking about putting it in package org.xith3d.loaders and giving it a name such as MultiLoader or DefaultLoader or somesuch. Any suggestions for the name of this class?
|
|
|
|
kevglass
|
 |
«
Reply #6 - Posted
2005-08-23 20:36:01 » |
|
How about ModelLoader ?
Kev
|
|
|
|
|
|
hawkwind
Junior Member  
Java games rock!
|
 |
«
Reply #8 - Posted
2005-08-24 03:03:46 » |
|
I am assuming that you have tested the loaders accessing jar embedded files, accessed using a MyClass.class.getResource() type thing??
|
|
|
|
|
Niwak
|
 |
«
Reply #9 - Posted
2005-08-24 08:31:30 » |
|
There is actually an existing pattern in the Java API core for image IO (look for IIORegistry and ImageIO and the ServiceProviderInterface associated in the Java API reference).
It can be easily adapted to be used for model loading (that's what I do in my engine).
The benefit is that new loaders are automatically detected when a jar is added to the application class-path.
Another benefit is that you can use the same pattern for Models, Textures and Image loading and therefore everything looks easier.
Vincent
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
croft
Junior Member  
Java, Java, Java
|
 |
«
Reply #10 - Posted
2005-08-25 00:44:07 » |
|
I am assuming that you have tested the loaders accessing jar embedded files, accessed using a MyClass.class.getResource() type thing??
Yes, getClass().getClassLoader().getResource() works for both OBJLoader2 and MD2Loader2. Your message prompted me to do extensive testing today and everything worked fine.
|
|
|
|
croft
Junior Member  
Java, Java, Java
|
 |
«
Reply #11 - Posted
2005-08-25 00:48:48 » |
|
Another benefit is that you can use the same pattern for Models, Textures and Image loading and therefore everything looks easier.
Do you know if that design pattern has a name? I made the multi-loader extensible. You can now map additional filename extensions to additional loaders at runtime. What to call it, though? How about "ExtLoader" for extensible, filename extension loader? I'm also leaning toward "MultiLoader".
|
|
|
|
croft
Junior Member  
Java, Java, Java
|
 |
«
Reply #12 - Posted
2005-08-25 00:55:00 » |
|
Na, its fine, I imagine this is a tiny patch. If only I hadn't spent all night playing about.
Are you currently working on that? I am ready to start working on TDSLoader2 tomorrow but I want to make sure we are both not hacking on it at the same time.
|
|
|
|
kevglass
|
 |
«
Reply #13 - Posted
2005-08-25 09:50:12 » |
|
Go ahead and work on it. I'll take a look once you're done (I'll want to anyway  ). Kev
|
|
|
|
croft
Junior Member  
Java, Java, Java
|
 |
«
Reply #14 - Posted
2005-08-25 20:30:55 » |
|
Go ahead and work on it. I'll take a look once you're done (I'll want to anyway  ). I took a look. Looks kind of scary. It turns out I don't have a bunch of 3DS models lying around in the company archive so I my incentive to scratch this particular itch is diminished. I am going to postpone indefinitely on this one.
|
|
|
|
BrainPlug
Senior Newbie 
|
 |
«
Reply #15 - Posted
2005-08-27 13:32:00 » |
|
it's me again .... Remeber me and my problem ? In the meantime I found out, there is this class "ModelContext" where all information found out by the "ChunkProcessor"s is stored. But i cant find the place where the real "Shape3D"s (that can be found later in the TDSModel) are created. greetz Marc
|
|
|
|
|
kevglass
|
 |
«
Reply #16 - Posted
2005-08-29 15:29:13 » |
|
In NamedObjectProcessor.java - the bit of code that reads: 1 2 3
| context.object = new TransformGroup(); context.shape = new Shape3D(); context.shape.setAppearance(new Appearance()); |
could be changed to: 1 2 3 4
| context.object = new TransformGroup(); context.shape = new Shape3D(); context.shape.setName(context.objectName); context.shape.setAppearance(new Appearance()); |
Might work? Kev
|
|
|
|
BrainPlug
Senior Newbie 
|
 |
«
Reply #17 - Posted
2005-08-31 15:22:34 » |
|
Hi, thank you for coming back to my problem ..... in the meantime i solved it by myself.
It is not enough to insert the line
context.shape.setName(context.objectName);
because the Shape3D will be copied later with
<com.xith3d.scenegraph.Node>.sharedCopy(<Shape3D>)
and the made copy will be attached to the scenegraph. This method does NOT copy the name of the given node and that was the problem. So I changed the method a bit and it worked.
anyway .... thanks for your help :-)
|
|
|
|
|
arne
Senior Member   
money is the worst drug- we should not let it rule
|
 |
«
Reply #18 - Posted
2005-08-31 16:25:41 » |
|
I think it would be now problem if you would commit your changes - or if this is too much work - simply give the line numbers and the changes, so croft, kev or whoever has already got developer acces can also change that while he's editing the code anyways.
|
|
|
|
kevglass
|
 |
«
Reply #19 - Posted
2005-08-31 16:49:22 » |
|
Um, I would say thats a fault with Xith core tho, shared copy does maintain names?
What happens when you want to duplicate your model - you can no longer access its sub-parts.
Kev
|
|
|
|
William Denniss
|
 |
«
Reply #20 - Posted
2005-09-01 02:59:42 » |
|
I agree this is a bug in Xith3D. I have commited a change to sharedCopy so it now also copies names.
Kev should your change also be committed?
Cheers,
Will.
|
|
|
|
kevglass
|
 |
«
Reply #21 - Posted
2005-09-01 10:13:22 » |
|
Yep, would make sense to store the names from the 3DS.
Nice quick turn around time, well done William!
Kev
|
|
|
|
William Denniss
|
 |
«
Reply #22 - Posted
2005-09-01 14:33:13 » |
|
Thanks  I have commited this change then too. Cheers, Will.
|
|
|
|
|