GuiObjectView, guiPlayerView
by Claude-Alain Fournier · in Torque Game Engine Advanced · 03/02/2007 (4:18 am) · 64 replies
Hi all,
No I don't have a solution. I am restarting this discussion because that's one of the last problem we have in our project after port from TGE to TGEA.
We had this working in a previous TSE release (before MSE 3.5) then after that it does not work and sofar I could not find any one who could make it work.
So I have 2 questions here :
1) Is GG planning to make one of these 2 class work in TGEA one day ? if yes, when (approx...)
2) Is anyone in the GG community who have one of these class working with latest TGEA release ?
If yes, would you care releasing this as a ressource. If not, please contact me to see if we can find an agreement either financial or with code/art exchange.
Thanks in advance.
CAF
No I don't have a solution. I am restarting this discussion because that's one of the last problem we have in our project after port from TGE to TGEA.
We had this working in a previous TSE release (before MSE 3.5) then after that it does not work and sofar I could not find any one who could make it work.
So I have 2 questions here :
1) Is GG planning to make one of these 2 class work in TGEA one day ? if yes, when (approx...)
2) Is anyone in the GG community who have one of these class working with latest TGEA release ?
If yes, would you care releasing this as a ressource. If not, please contact me to see if we can find an agreement either financial or with code/art exchange.
Thanks in advance.
CAF
#22
so again:
04/16/2007 (8:30 pm)
All in all, it'd likely be alot brighter to go ahead and do up a seperate sceneGraph. Still tracing that in my offtime (ctds are a bit more important than goodies, after all). Still, thwere has to be something I'm missing to date, because I'd swear the sceneGraph definitions a *global* one, and that doesn't seem like it fits with the overall new engine code philosophy I've seen so far, so probably something I'm overlooking... (By that I mean the really old embeded stuff was just made to work, and the newer stuff they've tossed in, like the rendering revamp, post tribes2 was a few magnitudes more scalable. Gives you a hint where the folks are headed if we give em the time)so again:
Quote:Well, in the interests of speeding things up a bit, here's a partial
Quote:wich is why the codes here for folks to collaborate on, and not in a rescource that folks would be taking at face value as working 100%.
#23
I am trying to figure out how the tsShow create the scenegraph, that may give a clue. But I am afraid it use the global scenegraph also.
Damn that must be something simple enough.
My version actually is an horribly modified playerView class, but when dropping Kirk render code it almost work, I think that was a big leap forward already. I will post here is I have anything new.
04/18/2007 (9:12 am)
Yep the Scenegraph thingy is a bit worrying. I can't see how you could have a different scenegraph as it's global (I may probably be wrong here). I tried to make a separate scenegraph at some point but failed completely. I am trying to figure out how the tsShow create the scenegraph, that may give a clue. But I am afraid it use the global scenegraph also.
Damn that must be something simple enough.
My version actually is an horribly modified playerView class, but when dropping Kirk render code it almost work, I think that was a big leap forward already. I will post here is I have anything new.
#24
you'll recall the
Straightforward enough, except of course for the fact that there's no rotation-sum derivation from the nodes relationship to the parent as there is for the translation aspect. at this point, it gets into eulers, and matricies, and my eyes at least start rolling up in the back of my head...
04/18/2007 (12:37 pm)
Well, scenegraph aside for the moment (since that was, after all, the way she was set up in the origional rescource), to polish it back on up to baseline functionality, a bit more research into the mouting code shows the following problem:you'll recall the
void GuiObjectView::getObjectTransform( MatrixF *mat , S32 index)
{
MatrixF subTrans = mMeshObjects.mMesh[index].mesh->mNodeTransforms[mMeshObjects.mMesh[index].node];
Point3F subOffset = -subTrans.getPosition();
S32 pIndex = mMeshObjects.mMesh[index].parentIndex;
MatrixF parentTrans = mMeshObjects.mMesh[pIndex].mesh->mNodeTransforms[mMeshObjects.mMesh[index].parentNode];
parentTrans.mulP( subOffset );
parentTrans.setPosition( subOffset );
*mat = parentTrans;
}Straightforward enough, except of course for the fact that there's no rotation-sum derivation from the nodes relationship to the parent as there is for the translation aspect. at this point, it gets into eulers, and matricies, and my eyes at least start rolling up in the back of my head...
#25
apedicies to above code:
guiObjectVeiw.h:
class GuiObjectView : public GuiTSCtrl
//embeded scenegraph append:
SceneGraph* mClientSceneGraph;
SceneRoot* mClientSceneRoot;
DecalManager* mDecalManager;
Container mClientContainer;
guiObjectVeiw.cc:
GuiObjectView::GuiObjectView() : GuiTSCtrl()
//embeded scenegraph append:
mClientSceneGraph = new SceneGraph(true);
mClientSceneRoot = new SceneRoot;
mClientSceneGraph->addObjectToScene(mClientSceneRoot);
mDecalManager = new DecalManager;
mClientContainer.addObject(mDecalManager);
mClientSceneGraph->addObjectToScene(mDecalManager);
GuiObjectView::~GuiObjectView()
//embeded scenegraph append:
mClientSceneGraph->removeObjectFromScene(mDecalManager);
mClientContainer.removeObject(mDecalManager);
mClientSceneGraph->removeObjectFromScene(mClientSceneRoot);
delete mClientSceneRoot;
delete mClientSceneGraph;
delete mDecalManager;
mClientSceneRoot = NULL;
mClientSceneGraph = NULL;
mDecalManager = NULL;
Then changing the gClientSceneGraph entries ect in void GuiObjectView::renderWorld( const RectI &updateRect ) to the member versions doesn't really seem to be doing anything new thusfar, in terms of fixing that aspect...
(edit: refference notes: main loops in game.cc)
05/04/2007 (10:27 am)
Right so seems in the last case there, the matricies just don't hold rotational values for the wheels. simple enough to one-off hack in embeded rotations for this project. mean time,:Quote:
the correct sceneGraph?
apedicies to above code:
guiObjectVeiw.h:
class GuiObjectView : public GuiTSCtrl
//embeded scenegraph append:
SceneGraph* mClientSceneGraph;
SceneRoot* mClientSceneRoot;
DecalManager* mDecalManager;
Container mClientContainer;
guiObjectVeiw.cc:
GuiObjectView::GuiObjectView() : GuiTSCtrl()
//embeded scenegraph append:
mClientSceneGraph = new SceneGraph(true);
mClientSceneRoot = new SceneRoot;
mClientSceneGraph->addObjectToScene(mClientSceneRoot);
mDecalManager = new DecalManager;
mClientContainer.addObject(mDecalManager);
mClientSceneGraph->addObjectToScene(mDecalManager);
GuiObjectView::~GuiObjectView()
//embeded scenegraph append:
mClientSceneGraph->removeObjectFromScene(mDecalManager);
mClientContainer.removeObject(mDecalManager);
mClientSceneGraph->removeObjectFromScene(mClientSceneRoot);
delete mClientSceneRoot;
delete mClientSceneGraph;
delete mDecalManager;
mClientSceneRoot = NULL;
mClientSceneGraph = NULL;
mDecalManager = NULL;
Then changing the gClientSceneGraph entries ect in void GuiObjectView::renderWorld( const RectI &updateRect ) to the member versions doesn't really seem to be doing anything new thusfar, in terms of fixing that aspect...
(edit: refference notes: main loops in game.cc)
#26
2 points:
1- adding the following
MatrixF ident;
ident.identity();
TSMesh::setCamTrans(ident);
gets us to having a proper camera offset locale
2- replacing
GFX->clear( GFXClearZBuffer, ColorI(0,0,0), 1.0f, 0);
with
GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, ColorI(0,0,0), 1.0f, 0);
gives us a nice black background without having to set an additional bitmap there (leave alone if you preffer)
3- ALL OF THAT _WILL_ sTILL LEAVE IT TRYING TO RENDER THE WHOLE SCENE, so, what we do there is tack on:
gClientSceneGraph->renderScene(DefaultObjectType);
(note: I went back to the global *shudder* scenegraph functionality after the scenemanager rose up and strangled my debug build no matter what I tried)
end result: http://img295.imageshack.us/my.php?image=fixedjj3.jpg
05/13/2007 (1:20 am)
As with most programming tasks, the thing turned out to be so simple i'm beating myself right now (meh, considering the weeks of wailing and gnashing of teeth, might as wel keep with the trend, eh?)2 points:
1- adding the following
MatrixF ident;
ident.identity();
TSMesh::setCamTrans(ident);
gets us to having a proper camera offset locale
2- replacing
GFX->clear( GFXClearZBuffer, ColorI(0,0,0), 1.0f, 0);
with
GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, ColorI(0,0,0), 1.0f, 0);
gives us a nice black background without having to set an additional bitmap there (leave alone if you preffer)
3- ALL OF THAT _WILL_ sTILL LEAVE IT TRYING TO RENDER THE WHOLE SCENE, so, what we do there is tack on:
gClientSceneGraph->renderScene(DefaultObjectType);
(note: I went back to the global *shudder* scenegraph functionality after the scenemanager rose up and strangled my debug build no matter what I tried)
end result: http://img295.imageshack.us/my.php?image=fixedjj3.jpg
#27
next lil issue up for cleanup of course, s knocking out a proper analogue for
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
since as some have already noted in other threads, the skin args are borked too.
05/13/2007 (1:22 am)
The updated renderworld function in case I missed anything in the cliffs notes/ for those of you that are already at the point of "enough with the explainations, just make it work"://------------------------------------------------------------------------------
void GuiObjectView::renderWorld( const RectI &updateRect )
{
if (!(bool)mMeshObjects.mMainObject)
return;
GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, ColorI(0,0,0), 1.0f, 0);
GFX->setZEnable(true);
GFX->setZWriteEnable(true);
GFX->setZFunc(GFXCmpLessEqual);
GFX->setLightingEnable(true);
GFX->setAmbientLightColor(mAmbientColor);
// Determine the camera position, and store off render state...
MatrixF modelview;
MatrixF mv;
Point3F cp;
//modelview = GFX->getWorldMatrix();
mv = modelview;
mv.inverse();
mv.getColumn(3, &cp);
// Set up the base SceneState.
F32 left, right, top, bottom, nearPlane, farPlane;
GFX->getFrustum( &left, &right, &bottom, &top, &nearPlane, &farPlane );
// setup light
F32 emapAlpha = 0.0f;
LightInfo *sunlight = gClientSceneGraph->getLightManager()->sgGetSpecialLight(LightManager::sgSunLightType);
sunlight->mType = LightInfo::Vector;
sunlight->mDirection.set( -mLightDirection.x, -mLightDirection.y, -mLightDirection.z );
sunlight->mColor.set(mLightColor.red, mLightColor.green, mLightColor.blue);
sunlight->mAmbient.set(mAmbientColor.red, mAmbientColor.green, mAmbientColor.blue);
RectI viewport = GFX->getViewport();
SceneState* pBaseState = new SceneState(NULL,
0,
left, right,
bottom, top,
nearPlane,
farPlane,
viewport,
cp,
modelview,
1000,
1000,
ColorF(0.1,0.1,0.1),
0,
NULL,
1);
pBaseState->mFlipCull = false;
TSMesh::setSceneState( pBaseState );
MatrixF ident;
ident.identity();
TSMesh::setCamTrans(ident);
gClientSceneGraph->buildFogTexture(pBaseState);
TSMesh::setRefract(false);
for (S32 i=0; i<33; i++)
{
if (mMeshObjects.mMesh[i].mesh)
{
// Animate and render
if(mMeshObjects.mMesh[i].mode == 1)
{
S32 time = Platform::getVirtualMilliseconds();
S32 dt = time - mMeshObjects.mMesh[i].lastRenderTime;
mMeshObjects.mMesh[i].lastRenderTime = time;
F32 fdt = dt;
mMeshObjects.mMesh[i].mesh->advanceTime( fdt/1000.f, mMeshObjects.mMesh[i].thread );
mMeshObjects.mMesh[i].mesh->animate();
}
// If this is a mounted object transform to the correct position
if (mMeshObjects.mMesh[i].parentNode != -1)
{
MatrixF mat;
getObjectTransform( &mat, i );
GFX->pushWorldMatrix();
GFX->multWorld(mat);
mMeshObjects.mMesh[i].mesh->render();
GFX->popWorldMatrix();
}
else
{
mMeshObjects.mMesh[i].mesh->render();
}
}
}
static bool initGlow = false;
if( !initGlow )
{
initGlow = true;
GlowBuffer *glowBuff = static_cast<GlowBuffer*>(Sim::findObject("GlowBufferData"));
if( glowBuff )
{
glowBuff->init();
}
}
gClientSceneGraph->renderScene(DefaultObjectType);
TSMesh::setSceneState( NULL );
delete pBaseState;
GFX->setLightingEnable(false);
GFX->setZEnable(false);
GFX->setClipRect( updateRect);
}next lil issue up for cleanup of course, s knocking out a proper analogue for
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
since as some have already noted in other threads, the skin args are borked too.
#29
05/13/2007 (12:08 pm)
Codes all there, aside from the wheeld vehicle representation rotation hacks. still... theres the skin args to do, and that bit about adding something to the correct scenegraph bugs me a bit (no pun intended). Might just be peeling an onion looking for the seeds, but it's been brought up, so won't call this done yet till those 2 are resolved... Mr. Lundmark, could you elaborate on that a bit please?
#30
Edit: A TSControl that did not render the regular client/server world, that is!
05/13/2007 (2:09 pm)
If it's all working then I wouldn't bother. It was just a guess and something I had to go trough when I made a TSControl.Edit: A TSControl that did not render the regular client/server world, that is!
#31
05/14/2007 (1:22 am)
Kirk, thanx alot for the effort and help...
#32
in the function:
with
that'll verrify it all works, and we can toss that on up as a rescource for folks.
(And youre welcome, though more thanks should go to the gentleman that got the thing started than anything else. The comunity at it's best that.)
05/21/2007 (5:56 pm)
So... got good news, and bad news... got it working with the other rescource, but that deviates from the baseline, and requires a seperate implementation to support it, rather than just dropping it in. so: finishing this on up, if someone wants to try replacingin the function:
void GuiObjectView::meshObjects::load(S32 index, const char* name, const char* shape, const char* skin, S32 pIndex, S32 pNode, S32 detail)
/*
// Load the skin
if(dStrcmp(skin,"") != 0)
{
dSprintf(fileBuffer, sizeof( fileBuffer ), "%s", skin);
TextureHandle texture = TextureHandle(fileBuffer, MeshTexture, false);
TSMaterialList* materialList = mMesh[index].mesh->getMaterialList();
materialList->mMaterials[0] = texture;
}
*/with
mMesh[index].mesh->reSkin(StringHandle(skin));
that'll verrify it all works, and we can toss that on up as a rescource for folks.
(And youre welcome, though more thanks should go to the gentleman that got the thing started than anything else. The comunity at it's best that.)
#33
Is there anyway to get it so we can render a transparent background, on top of the playgui?
Cheers for any help
06/18/2007 (12:16 am)
Hey guys,Is there anyway to get it so we can render a transparent background, on top of the playgui?
Cheers for any help
#34
First off we need to change a couple of things with SceneGraph, it has some internal components that look specifical for the gClientContainer and gServerContainers.
Now for the changes in the SceneGraph class
'
Scroll down to
Scroll Down to unregisterZones
Scroll down to
07/03/2007 (12:09 pm)
I've built on what has already been presented in the above posts. I have delt with the SceneGraph part that was brought up. At least I think I have, it works.First off we need to change a couple of things with SceneGraph, it has some internal components that look specifical for the gClientContainer and gServerContainers.
SceneGraph.h Change [b] public: SceneGraph(bool isClient); [/b] to [b] public: SceneGraph(Container* pContainer); [/b]
Add somewhere in a protected section of SceneGraph [b] Container* mpContainer; [/b]
Now for the changes in the SceneGraph class
'
Change [b] SceneGraph::SceneGraph(bool isClient) [/b] to [b] SceneGraph::SceneGraph(Container* pContainer) [/b] Still in the same function change [b] mIsClient = isClient; [/b] to [b] mpContainer = pContainer; [/b]
Scroll down to
SceneGraph::registerZones Look for [b] pQueryContainer->findObjects(obj->mWorldBox, 0xFFFFFFFF, SimpleQueryList::insertionCallback, &list); [/b] and replace with [b] mpContainer->findObjects(obj->mWorldBox, 0xFFFFFFFF, SimpleQueryList::insertionCallback, &list); [/b]
Scroll Down to unregisterZones
replace
[b]
if ((mIsClient == true && obj != gClientSceneRoot) ||
(mIsClient == false && obj != gServerSceneRoot))
[/b]
with
[b]
if ((mpContainer == &gClientContainer && obj != gClientSceneRoot) ||
(mpContainer == &gServerContainer && obj != gServerSceneRoot))
[/b]
and replace
[b]
pQueryContainer->findObjects(obj->mWorldBox, 0xFFFFFFFF, SimpleQueryList::insertionCallback, &list);
[/b]
with
[b]
mpContainer->findObjects(obj->mWorldBox, 0xFFFFFFFF, SimpleQueryList::insertionCallback, &list);
[/b]Scroll down to
SceneGraph::zoneInsert Look for [b] pQueryContainer->findObjects(obj->mWorldBox, 0xFFFFFFFF, SimpleQueryList::insertionCallback, &list); [/b] and replace with [b] mpContainer->findObjects(obj->mWorldBox, 0xFFFFFFFF, SimpleQueryList::insertionCallback, &list); [/b]
#35
Scroll to
The only other things to do now is to change the SceneGraph calls
open main.cpp
open up the guiObjectView.cpp
I also saw I was getting a matrix error
so I added the following bold line
I think that was it all for working with its own SceneGraph.
Hope this can add to getting a fully functional GuiObjectView for TGEA working.
07/03/2007 (12:20 pm)
Now open up ScreenTraversal.cppScroll to
SceneGraph::buildSceneTree look for [b] AssertFatal(this == gClientSceneGraph, "Error, only the client scenegraph can support this call!"); [/b] and comment that line out.
The only other things to do now is to change the SceneGraph calls
open main.cpp
in InitGame change [b] gClientSceneGraph = new SceneGraph(true); [/b] to [b] gClientSceneGraph = new SceneGraph(&gClientContainer); [/b] and change [b] gServerSceneGraph = new SceneGraph(false); [/b] to [b] gServerSceneGraph = new SceneGraph(&gServerContainer); [/b]
open up the guiObjectView.cpp
GuiObjectView::GuiObjectView change [b] mClientSceneGraph = new SceneGraph(true); [/b] to [b] mClientSceneGraph = new SceneGraph(&mClientContainer); [/b]
GuiObjectView::renderWorld change [b] LightInfo *sunlight = gClientSceneGraph->getLightManager()->sgGetSpecialLight(LightManager::sgSunLightType); [/b] to [b] LightInfo *sunlight = mClientSceneGraph->getLightManager()->sgGetSpecialLight(LightManager::sgSunLightType); [/b] change [b] gClientSceneGraph->buildFogTexture(pBaseState); [/b] to [b] mClientSceneGraph->buildFogTexture(pBaseState); [/b] and change [b] gClientSceneGraph->renderScene(DefaultObjectType); [/b] to [b] mClientSceneGraph->renderScene(DefaultObjectType); [/b]
I also saw I was getting a matrix error
so I added the following bold line
// modelview = GFX->getWorldMatrix(); [b] modelview.identity();[/b]
I think that was it all for working with its own SceneGraph.
Hope this can add to getting a fully functional GuiObjectView for TGEA working.
#36
@Ashley: Not sure if this is what you're talking about but in void GuiObjectView::renderWorld a few (4) lines down just comment this out:
I've added a rotation setting (with speed) which Im using with my targetting System. If nobody objects I'll post the GuiObjectView for TGEA as a resource with my extras (changeble with the GUI editor - Background and Rotation)?
Loving the community!
James
07/03/2007 (1:42 pm)
@Simon, maybe I've missed something, but I have the GuiObjectView working with TGEA using the code in this thread... What changes does your changes do?@Ashley: Not sure if this is what you're talking about but in void GuiObjectView::renderWorld a few (4) lines down just comment this out:
GFX->clear(GFXClearZbuffer | GFXClearStencil | GFXClearTarget, ColorI(0,0,0), 1.0f, 0);to look like this (duh):
//GFX->clear(GFXClearZbuffer | GFXClearStencil | GFXClearTarget, ColorI(0,0,0), 1.0f, 0);
I've added a rotation setting (with speed) which Im using with my targetting System. If nobody objects I'll post the GuiObjectView for TGEA as a resource with my extras (changeble with the GUI editor - Background and Rotation)?
Loving the community!
James
#37
Hence. my contrubtion to hopefuly address this.
07/03/2007 (2:06 pm)
@James - It uses its own SceneGraph, if you read though the posts beforeQuote:
Stefan Lundmark
Guys, are you adding your objects (that you want in the shapeView) into the correct sceneGraph? You do not want to use the same one as your mission.
Quote:
Kirk Longendyke
Codes all there, aside from the wheeld vehicle representation rotation hacks. still... theres the skin args to do, and that bit about adding something to the correct scenegraph bugs me a bit (no pun intended). Might just be peeling an onion looking for the seeds, but it's been brought up, so won't call this done yet till those 2 are resolved... Mr. Lundmark, could you elaborate on that a bit please?
Hence. my contrubtion to hopefuly address this.
#38
Knock yourself out coz. Like I said. Soons that was discussed, and verrified to work on more than one project, Gravy.
07/03/2007 (3:20 pm)
Quote:
James Laker (BurNinG)
If nobody objects I'll post the GuiObjectView for TGEA as a resource with my extras (changeble with the GUI editor - Background and Rotation)
Knock yourself out coz. Like I said. Soons that was discussed, and verrified to work on more than one project, Gravy.
#39
07/03/2007 (4:00 pm)
@James When i do that i get artifacts all through the Gui control. Although it may be because i have it on a transparent gui over the playgui
#40
Hi,
Did you post the resource ?
07/11/2007 (11:14 pm)
Quote:I've added a rotation setting (with speed) which Im using with my targetting System. If nobody objects I'll post the GuiObjectView for TGEA as a resource with my extras (changeble with the GUI editor - Background and Rotation)?
Hi,
Did you post the resource ?
Torque Owner James Laker (BurNinG)
This is my result when I fly to "0 0 0". I have to fly there to see the Loaded shape. As u can see it's visible in the guiObjectView area, but not in the player mission, so for some reason I thought it was in the correct Scenegraph. Maybe I'm just not understanding this.