TreeRep Port
by Skylar Kelty · in Torque Game Engine Advanced · 08/24/2007 (2:44 am) · 21 replies
About the author
#2
08/27/2007 (3:44 am)
Ah ok thanks :D
#3
Since this replicator inherits from ITickable it still ticks every 32ms (by default).
To better control this tick functionality I added a few lines of code. Basically I turn off ProcessTicks when its not needed, and turn it back on if a replicator is ever updated to use turbulence.
All of these changes are made to fxTreeReplicator.cpp
Here are the changes:
In fxTreeReplicator::fxTreeReplicator() right under mProcessTick = false; add
In fxTreeReplicator::StartUp right after mTreeReplicationStarted = true; add
Finally in fxTreeReplicator::unpackUpdate right at the very bottom of the function add:
09/30/2007 (8:31 pm)
James, great job on the port. I did make a few small changes to fix up this resource a little. By default most of the functions check:if (!mFieldData.mUseTurbulence) return;
Since this replicator inherits from ITickable it still ticks every 32ms (by default).
To better control this tick functionality I added a few lines of code. Basically I turn off ProcessTicks when its not needed, and turn it back on if a replicator is ever updated to use turbulence.
All of these changes are made to fxTreeReplicator.cpp
Here are the changes:
In fxTreeReplicator::fxTreeReplicator() right under mProcessTick = false; add
this->setProcessTicks(mProcessTick);
In fxTreeReplicator::StartUp right after mTreeReplicationStarted = true; add
if(mFieldData.mUseTurbulence)
{
mProcessTick = true;
this->setProcessTicks(mProcessTick);
}Finally in fxTreeReplicator::unpackUpdate right at the very bottom of the function add:
if(mFieldData.mUseTurbulence)
{
mProcessTick = true;
this->setProcessTicks(mProcessTick);
}
#4
Thanks in advance. :)
10/09/2007 (6:07 pm)
I've got this working under TGEA in my project, and the trees are showing up in the mission, but I'm not seeing any turbulence effects. I've turned on the UseTurbulence flag in the instantiation. Is there something else I need to do before I see any turbulence? Do I need to use a specific tree model, or will any one do?Thanks in advance. :)
#5
You have to use a tree with some named nodes, like trunc0000 and trunc0001 as you can see in the tree.ms3d file that exist in the original resource, before you get the turbulence effects.
Kind regards
Thomas
10/14/2007 (5:59 am)
Hi Arcanor.You have to use a tree with some named nodes, like trunc0000 and trunc0001 as you can see in the tree.ms3d file that exist in the original resource, before you get the turbulence effects.
Kind regards
Thomas
#6
10/14/2007 (8:05 am)
Thanks so much for your post Thomas. Thanks to you it's now working for me. :)
#7
10/19/2007 (5:21 am)
Thanks for this, its great
#8
Hi there... would you like to share your implementation or, if not, can you give an explanation of the changes you made?
I'm absolutely not a programmer... :-P
Tnx ;-)
01/04/2008 (3:50 pm)
@Arcanor :Hi there... would you like to share your implementation or, if not, can you give an explanation of the changes you made?
I'm absolutely not a programmer... :-P
Tnx ;-)
#9
The thing that helped me to get it working was Thomas Tomo Larsen suggesting to use a tree model with appropriately named nodes, as in the "tree.ms3d" model provided with the original resource (see the original post in this thread for a link to it). The nodes in that file were named: roots, trunk0000, trunk0001, branch0000, branch0001, branch0100, branch0101, branch0200, branch0201, leaf000, leaf001, ..., leaf009.
By looking at fxTreeReplicator.cpp (or .cc) in the getTreeNodes() function you can see the names of the nodes it is looking for, specifically:
- one node named "roots"
- some number of trunk nodes named "trunkXXYY" where XX is the trunk number and YY is the sub-node on that particular trunk (max 3 trunks, with up to 3 sub-nodes on each trunk)
- some number of branch nodes named "branchXXYY" (max 10 branches, with up to 3 sub-nodes on each branch)
- some number of leaf nodes named "leafXXX" where XXX is the leaf number (max 100)
- some number of leaf object nodes named "leafXXXD0" where XXX is the leaf number, and the "D0" at the end indicates that it's supposed to use an object instead of just a billboard (max 100)
I hope this helps you to understand how to use this resource better.
01/04/2008 (7:14 pm)
@JoZ: I didn't actually make any code changes besides those that Matt Kronyak suggested above.The thing that helped me to get it working was Thomas Tomo Larsen suggesting to use a tree model with appropriately named nodes, as in the "tree.ms3d" model provided with the original resource (see the original post in this thread for a link to it). The nodes in that file were named: roots, trunk0000, trunk0001, branch0000, branch0001, branch0100, branch0101, branch0200, branch0201, leaf000, leaf001, ..., leaf009.
By looking at fxTreeReplicator.cpp (or .cc) in the getTreeNodes() function you can see the names of the nodes it is looking for, specifically:
- one node named "roots"
- some number of trunk nodes named "trunkXXYY" where XX is the trunk number and YY is the sub-node on that particular trunk (max 3 trunks, with up to 3 sub-nodes on each trunk)
- some number of branch nodes named "branchXXYY" (max 10 branches, with up to 3 sub-nodes on each branch)
- some number of leaf nodes named "leafXXX" where XXX is the leaf number (max 100)
- some number of leaf object nodes named "leafXXXD0" where XXX is the leaf number, and the "D0" at the end indicates that it's supposed to use an object instead of just a billboard (max 100)
I hope this helps you to understand how to use this resource better.
#10
01/06/2008 (5:26 am)
Tnx a lot :) !!!
#11
I am a total newbie to this and hope someone can explain.
Thanks in advance!
/Heegaard
EDIT: found it in my cs file!
02/04/2008 (1:59 pm)
I have just made the changes above and compiled it and with no errors, but when I launch there is no fxTreeReplicator menu item.I am a total newbie to this and hope someone can explain.
Thanks in advance!
/Heegaard
EDIT: found it in my cs file!
#12
Added Matt Kronyak's changes - thanks :)
Attempted to fix the circle renderer but, not much luck there.
It shows when it wants to and not the whole circle, not the right color.
Anyway thought you should all know - theres a new version, grab it!
02/26/2008 (2:12 pm)
Sorry bout the bump, i've updated this since I needed it for my project.Added Matt Kronyak's changes - thanks :)
Attempted to fix the circle renderer but, not much luck there.
It shows when it wants to and not the whole circle, not the right color.
Anyway thought you should all know - theres a new version, grab it!
#13
03/23/2008 (12:49 am)
Anyone tried to port this to work with TGEA 1.7?
#14
Aside from implementing ITickable interface (or abstract class rather), there are a few functions that treerep uses for itself you would need to copy over, and then just implement the processTick method (copy and paste) from this current resource.
@Ron, have you had a chance to try this as-is in TGEA 1.7 yourself to see if it will work? If so what problems are you having with it? Build errors?
03/23/2008 (3:30 am)
I haven't tried this in TGEA 1.7, but I believe the 1.7 has a fully functional fxShapeReplicator in it (I haven't verified this either mainly because I'm not working with TGEA 1.7 right now). If that's the case I think it wouldn't be too hard to either copy the fxShapeReplicator class, rename it to fxTreeReplicator and add in the functionality, or just to extend fxShapeReplicator to use the functionality that the tree replicator adds.Aside from implementing ITickable interface (or abstract class rather), there are a few functions that treerep uses for itself you would need to copy over, and then just implement the processTick method (copy and paste) from this current resource.
@Ron, have you had a chance to try this as-is in TGEA 1.7 yourself to see if it will work? If so what problems are you having with it? Build errors?
#15
05/23/2008 (6:37 pm)
Is there any sort of culling capability for this or even the shape replicator? I am having prolems with tree branches showing through my interiors. I am using the Sharp tree pack with this.
#16
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6467
I'm not sure if it will work in TGEA or not, but it's worth looking into.
05/23/2008 (7:53 pm)
@Ron - There is a TGE resource for this:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6467
I'm not sure if it will work in TGEA or not, but it's worth looking into.
#17
05/23/2008 (9:09 pm)
Thanks Jaimi, it worked perfectly and was a very easy port, just had to comment out the include for dgl. I had removed this when I ported over to TGEA and hadn't even thought about it. Thanks again.
#18
s72.photobucket.com/albums/i192/DTDA/?action=view¤t=treetranslighting.flv
05/24/2008 (6:08 pm)
Now if someone can tell me what I am doing wrong here. Look at how the branches flicker.s72.photobucket.com/albums/i192/DTDA/?action=view¤t=treetranslighting.flv
#19
05/27/2008 (10:46 pm)
Am I the only guy that sees tree limb flickering?
#20
05/28/2008 (2:57 am)
Please stop bumping, I see the flicker but thats more John Kabus's thing, ask him.
Torque Owner Jeremiah Fulbright