SgDecalProjector: wrong projection direction
by Marc Dreamora Schaerer · in Torque Game Engine Advanced · 08/21/2007 (2:42 pm) · 13 replies
The decal projector projects in the wrong direction.
As a blind guess, I would say the one that ported it forgot about the different coordinate systems between TGE (OpenGL) and TGEA (DirectX), as the projector projects upwards instead of downwards.
To fix that, simply alter the
= SG_STATIC_SPOT_VECTOR_NORMALIZED * 10.0f
= SG_STATIC_SPOT_VECTOR_NORMALIZED * 100.0f
in sgDecalProjector.cc to
= SG_STATIC_SPOT_VECTOR_NORMALIZED * -10.0f
= SG_STATIC_SPOT_VECTOR_NORMALIZED * -100.0f
Above that I would like to point out that the needed code to have footprints is still commented out.
Beside the code refering to decals in player.cpp which you need to uncomment, you have to uncomment
//IMPLEMENT_SETDATATYPE(DecalData)
//IMPLEMENT_GETDATATYPE(DecalData)
in decalManager.cpp and add
IMPLEMENT_CONSOLETYPE(DecalData)
in front of it, as well as add
DECLARE_CONSOLETYPE(DecalData);
to the end of decalManager.h before the #endif
If you want to fix it yourself.
As a blind guess, I would say the one that ported it forgot about the different coordinate systems between TGE (OpenGL) and TGEA (DirectX), as the projector projects upwards instead of downwards.
To fix that, simply alter the
= SG_STATIC_SPOT_VECTOR_NORMALIZED * 10.0f
= SG_STATIC_SPOT_VECTOR_NORMALIZED * 100.0f
in sgDecalProjector.cc to
= SG_STATIC_SPOT_VECTOR_NORMALIZED * -10.0f
= SG_STATIC_SPOT_VECTOR_NORMALIZED * -100.0f
Above that I would like to point out that the needed code to have footprints is still commented out.
Beside the code refering to decals in player.cpp which you need to uncomment, you have to uncomment
//IMPLEMENT_SETDATATYPE(DecalData)
//IMPLEMENT_GETDATATYPE(DecalData)
in decalManager.cpp and add
IMPLEMENT_CONSOLETYPE(DecalData)
in front of it, as well as add
DECLARE_CONSOLETYPE(DecalData);
to the end of decalManager.h before the #endif
If you want to fix it yourself.
About the author
#2
If you do not use it, you first might first need to create the needed datablocks and player datablock entries.
Add this to your PlayerData Datablock
and this somewhere up in the player.cs
if you don't have the footprint texture, just use a different one to test :)
There are a few lines you need to uncomment in player.cpp actually (like the addField line and others). Generally those refering to the decal. Just in case you have not done that yet or rebuild TGEA
08/22/2007 (2:36 am)
Oh, I forgot, this was assuming that you use the fps.starter for TGEA.If you do not use it, you first might first need to create the needed datablocks and player datablock entries.
Add this to your PlayerData Datablock
// Foot Prints decalData = PlayerFootprint; decalOffset = 0.25;
and this somewhere up in the player.cs
datablock DecalData(PlayerFootprint)
{
sizeX = 0.25;
sizeY = 0.25;
textureName = "~/data/shapes/player/footprint";
};if you don't have the footprint texture, just use a different one to test :)
There are a few lines you need to uncomment in player.cpp actually (like the addField line and others). Generally those refering to the decal. Just in case you have not done that yet or rebuild TGEA
#3
08/22/2007 (4:43 am)
Thanks a lot, it works!
#4
Just out of curiosity: Does anyone know exactly why this code was commented out? If this is the only bug with the footprint system, I don't understand why it was turned off.
I'm curious because in the general case, it seems like several pieces of TGE functionality are commented out in the TGEA. Is there a list or explanation somewhere regarding these pieces?
08/28/2007 (3:30 pm)
Excellent! Thank you for figuring this out.Just out of curiosity: Does anyone know exactly why this code was commented out? If this is the only bug with the footprint system, I don't understand why it was turned off.
I'm curious because in the general case, it seems like several pieces of TGE functionality are commented out in the TGEA. Is there a list or explanation somewhere regarding these pieces?
#5
08/29/2007 (8:29 am)
I think, in general, GG considers them low priority and they are focusing their efforts on more fundamental systems to ensure they are working properly. If we (as community members) can come up with reliable fixes for things like the footprints, and splashes then they'll probably include them in the next update.
#6
08/29/2007 (2:12 pm)
Bulletholes are also pretty easy to get back working (there is a thread on them from a year ago or so) in a similar fashion to footprints. The code works, it just needs to be ported to 1.4/1.5 standards in a couple of places and uncommented.
#7
sgDecalProject on the lighting folder was just an empty dummy file.
For that reason those code blocks were commented out, there was no projector.
Sadly, the world editor of TGEA is a such worse mess, that this stuff never got removed there ...
Similar to the fxShapeReplicator ported by users, which is needed to make that one working in the editor as well.
*the editor of TGEA is quite bugged compared to the TGE one. Mission area boundary not showing, legacy terrain bounding box not showing etc etc etc. there are quite some options on object that don't work or work similarily to what documented and/or expected, that I really ask myself why the stuff didn't get a cleanup before of the 1.0 release. I'm right now doing this for our team to only have the stuff in working and to reimplement stuff that was removed and add a few things like a material editor and a decent particle editor (with a hopefully soon to be released AFX TGEA in mind)*
08/30/2007 (3:04 am)
Untel 1.0.2, the decal projector was not even ported over to TGEA.sgDecalProject on the lighting folder was just an empty dummy file.
For that reason those code blocks were commented out, there was no projector.
Sadly, the world editor of TGEA is a such worse mess, that this stuff never got removed there ...
Similar to the fxShapeReplicator ported by users, which is needed to make that one working in the editor as well.
*the editor of TGEA is quite bugged compared to the TGE one. Mission area boundary not showing, legacy terrain bounding box not showing etc etc etc. there are quite some options on object that don't work or work similarily to what documented and/or expected, that I really ask myself why the stuff didn't get a cleanup before of the 1.0 release. I'm right now doing this for our team to only have the stuff in working and to reimplement stuff that was removed and add a few things like a material editor and a decent particle editor (with a hopefully soon to be released AFX TGEA in mind)*
#8
08/30/2007 (8:47 am)
J.C. Smith would you mind posting a link to that thread? I've been looking for a TGEA bullet holes solution but didn't find something (you obviously did).
#9
http://www.garagegames.com/mg/forums/result.thread.php?qt=50453
All that basically needs to be done though is to convert the stuff to the 1.4+ style of:
IMPLEMENT_CONSOLETYPE
instead of the old method, then uncomment the areas in projectile.cpp, projectile.h and decalmanager.cpp/h related to decals and make sure that your weapons have the decals in their datablocks.
08/30/2007 (3:55 pm)
Actually I apparently never pasted in the code. Was referring to this thread way back when: http://www.garagegames.com/mg/forums/result.thread.php?qt=50453
All that basically needs to be done though is to convert the stuff to the 1.4+ style of:
IMPLEMENT_CONSOLETYPE
instead of the old method, then uncomment the areas in projectile.cpp, projectile.h and decalmanager.cpp/h related to decals and make sure that your weapons have the decals in their datablocks.
#10
08/30/2007 (11:23 pm)
Thanks, I'll give it a try.
#11
08/31/2007 (12:36 pm)
Thanks J.C., it works like expected :)
#12
Will definitely bring up some more happy faces on the dev and tester team to see some results of their activity in the world.
08/31/2007 (1:16 pm)
Thanks for pointing that out J.C.Will definitely bring up some more happy faces on the dev and tester team to see some results of their activity in the world.
#13
Woops, missed this part:
It's all good now!
10/30/2007 (2:19 pm)
My bullet holes don't seem to appear. My projectile.cpp/.h files do not have anything mentioning "decal" in them, either.. although you say to uncomment code relating to the decals in them.Woops, missed this part:
Quote:Bullet holes also work but its a lot of different code blocks to paste and it's 2AM here, I need sleep. Basically though you can just cut and paste all areas with decal in the name from the TGE version of projectile.cpp and projectile.h after plugging up the decalmanager and then bullet holes will work. You will need to add the decaldata to your projectile also, of course
It's all good now!
Torque Owner Shaderman
I followed your instructions but footprints don't work for me yet. What else could be missing?