Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Help me with my attempted shared TDSModel  (Read 680 times)
0 Members and 1 Guest are viewing this topic.
Offline itistoday

Junior Member




There's too much blood in my caffeine system.


« Posted 2004-11-11 21:38:18 »

Ok.  Without really reading all the 3DS loader code (it's rather difficult to follow and uncommented), I tried to "brute force" the creation of a sharedCopy TDSModel.  I'm using a slightly modified 3ds loader library, the changes being:

1) When you use the loader to load a 3DS file, now you have to put the calling class (this) into the constructor, like this:
1  
TDSLoader(this).load(file, true);

2) Various changes such as the changing of private varibles to public, and the creation of a Point3f object inside the TimedTransforms to allow me to copy them into the new TDSModel.
3) Creation of an Iterator in TDSModel.

The source is here.
The library is here.  You can just drag the library into one of your universal library folders (the java.ext.dirs property will show you where this is).
The library source with my modifications is here.
And an example animated model you could use is here.

I didn't sign the library, i hope that doesn't cause any problems...

The TDSModel has two things that need to be copied I think.  One is an ArrayList that contains all the transforms, and is used with the setTime() function, and the other are the actual children of the model.  That is why traverseTree() is called twice, and that is the reason for the arraylist parameter.  traverseTree() will go through either the ArrayList or the actual TDSModel, and add TransformGroups, Transform3D's, frames, and finally the Shape3D objects at the end to the model variable (the model that I'm trying to make into a sharedcopy).

Currently, the Ship class will make an identical looking copy of the TDSModel, but it WILL NOT ANIMATE!! ARG!! Smiley

My guess is that I'm forgetting to copy something else...

Somebody please help me out.

Offline kevglass

JGO Kernel


Medals: 171
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1 - Posted 2004-11-12 05:43:57 »

Since I have no computer to actually build this on at the moment I'm afraid this is from visual inspection:

The assumption that you only ever have one group inside another may be wrong..

The copying code would probably make more sense and need less public variables if you added copy() to TimedTransform and made it return a copy of itself. Then you could just have one special case for TimedTransforms (using an instanceof?)

I'm not 100%, but I think the reason it doesn't work is because your argument "arraylist" passed to "traverseTree" is never set to true? This means that while the TDSModel has the transforms added beneath it in the scenegraph they're not added to its internal list which is used to control the animation. The flag "arraylist" is actually redunant anyway since any TimedTransform you create should be added to the TDSModel with addTransform().

Kev

PS. Its still a really bad idea to be sticking libraries for stuff like this in your "universal library folders". Its not realistic to your eventual deployment.


Offline itistoday

Junior Member




There's too much blood in my caffeine system.


« Reply #2 - Posted 2004-11-12 18:03:02 »

Quote
Since I have no computer to actually build this on at the moment I'm afraid this is from visual inspection:

The assumption that you only ever have one group inside another may be wrong..

No, I'm used a modified version of the traverseTree function to print out the entire tree of the TDSModel, and it seems like the TDSModel itself has say, 4 children.  Then each of these will have only one child, which will only have one child, untill you have 4 children for the TDSModel, and each of these children will have one child totalling for a line of 4 children (if that makes sense).  Then the array list is a bit different, it has about 12 children (depending on the model), and each of these has a line ranging from like 4 to 2 children... but like the others, only one child per transform.

Quote
The copying code would probably make more sense and need less public variables if you added copy() to TimedTransform and made it return a copy of itself. Then you could just have one special case for TimedTransforms (using an instanceof?)

Probably, but this should still work, and I when I get this working, I might go the extra mile to add that to the library.

Quote
I'm not 100%, but I think the reason it doesn't work is because your argument "arraylist" passed to "traverseTree" is never set to true? This means that while the TDSModel has the transforms added beneath it in the scenegraph they're not added to its internal list which is used to control the animation. The flag "arraylist" is actually redunant anyway since any TimedTransform you create should be added to the TDSModel with addTransform().

No, it is set to true here:
1  
2  
3  
4  
5  
while(i.hasNext()) {
                  numtransforms++;
                  Object a = i.next();
                  traverseTree(a, temp, null, true);
            }

And they are added using with addTransform if it's from the arraylist.

Quote
Kev

PS. Its still a really bad idea to be sticking libraries for stuff like this in your "universal library folders". Its not realistic to your eventual deployment.

Meh, I prefer it this way while I'm developing, because it makes it much easier to compile things, and what if I end up not using this or that? Then I can easily change it without any problems.  Also, I could end up using this system on other systems buy using an installer.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (45 views)
2014-09-23 14:38:19

radar3301 (27 views)
2014-09-21 23:33:17

BurntPizza (63 views)
2014-09-21 02:42:18

BurntPizza (33 views)
2014-09-21 01:30:30

moogie (41 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!