What happen to fxRenderObject?
by Caylo Gypsyblood · in Torque Game Engine Advanced · 03/13/2009 (6:37 am) · 32 replies
Do anyone have an TGEA1.8+ version of fxRenderObject? It was a great example object to learn from, and im missing it like an old friend.
#22
I can't believe this.
Ross thank you very much.
I have the answer for 1.7.1.
Find
And change it to
The answer for 1.8.0 is almost exactly the same.
Instead of
I go to bed now .
03/15/2009 (8:55 am)
OMG!!!I can't believe this.
Ross thank you very much.
I have the answer for 1.7.1.
Find
bool fxRenderObject::prepRenderImage( SceneState* state, const U32 stateKey, const U32 startZone,
const bool modifyBaseZoneState)
{
if (isLastState(state, stateKey))
return false;
setLastState(state, stateKey);
// This should be sufficient for most objects that don't manage zones, and
// don't need to return a specialized RenderImage...
if( (state->isObjectRendered(this) || gClientSceneGraph->isReflectPass()) )
{
renderObject( state , NULL);
}
return false;
}And change it to
bool fxRenderObject::prepRenderImage( SceneState* state, const U32 stateKey, const U32 startZone,
const bool modifyBaseZoneState)
{
if (isLastState(state, stateKey))
return false;
setLastState(state, stateKey);
// This should be sufficient for most objects that don't manage zones, and
// don't need to return a specialized RenderImage...
if( (state->isObjectRendered(this) || gClientSceneGraph->isReflectPass()) )
{
RenderInst *ri = gRenderInstManager.allocInst();
ri->obj = this;
ri->state = state;
ri->type = RenderInstManager::RIT_Mesh;
gRenderInstManager.addInst( ri );
renderObject( state , ri);
}
return false;
}The answer for 1.8.0 is almost exactly the same.
Instead of
RenderInst *ri = gRenderInstManager.allocInst();It should be
ObjectRenderInst *ri = gRenderInstManager->allocInst<ObjectRenderInst>();
I go to bed now .
#24
help?
03/15/2009 (11:18 am)
what are you guys putting in the "material" field? I cant get it to render at all, but its there in the scene.help?
#25
Wish there were some comments in this c'code that helped define the base terminology used at very least.
03/15/2009 (11:19 am)
That prepRenderImage do not 'sparkle' with the TSStatic::prepRenderImage, im just as confused as ever. Argh! where is the continuity with this engine? My confusion is probably based off some fundamental 'definition' fallacy, with me expecting renderObject( state ); to be handled similar with all object classes; for example(not the confusion exactly, if I could express the confusion i could solve it myself, im waiting for that epiphany that just makes it CLICK). Wish there were some comments in this c'code that helped define the base terminology used at very least.
#26
03/15/2009 (12:20 pm)
@Caylo, well for one thing, TSStatic is rendering from a shape, so the render instance is submitted from inside TSShapeInstance::render(). fxRenderObject is setting up a custom render instance and render function, which is why it's different (read my previous post).
#27
Im glad feeling stupid over this assumption at least leads to a bit better understanding of Torque.
03/15/2009 (12:39 pm)
Ah, so my thinking fxRenderObject is actually a bit deceptive in that it is not truly a representation of a general purpose 'renderobject'. (that just reminded me of the similarity fxRenderObject and sgDecalProjector have in common, and all this time i could have gleamed the same info from looking at sgDecalProjector who works fine in TGEA1.8.1 BIG DUH!) Im glad feeling stupid over this assumption at least leads to a bit better understanding of Torque.
#28
03/15/2009 (6:29 pm)
@Bill, so you got it working?
#29
fxRenderObject TGEA 1.7.1
I will work on the 1.8.+ port when I get a chance.
03/15/2009 (6:34 pm)
@Ross - Yes.fxRenderObject TGEA 1.7.1
I will work on the 1.8.+ port when I get a chance.
#30
to the end of the prepRenderImage call. I think that the RenderInstManager will call that - are you sure it's needed?
Fwiw, I believe what happens is that every item that can be rendered (in view frustum, visible zones etc) has the prepRenderImage called. This then adds a "RenderInst" that points to the current object to the RenderInstManager, which stores it in a "bin" depending on what type of object it is. The Bin is a special type of objectManager. Later down the chain, the RenderInstManager Walks it's list of Bins and calls render() on all the bins, which should call renderObject() if it was stored in a bin that was an Object bin.
edit: you are also missing this assignment:
This will let it go to the regular Object Manager, as opposed to the RenderTranslucentMgr. The RenderTranslucentMgr doesn't look like it wants to work with regular RIT_Object types - it wants RIT_ObjectTranslucent types. So you could miss the render, because the translucent flag has some random value in it.
03/15/2009 (6:55 pm)
@Bill - it looks like the only change from the code I had was that you added this:renderObject( state , ri);
to the end of the prepRenderImage call. I think that the RenderInstManager will call that - are you sure it's needed?
Fwiw, I believe what happens is that every item that can be rendered (in view frustum, visible zones etc) has the prepRenderImage called. This then adds a "RenderInst" that points to the current object to the RenderInstManager, which stores it in a "bin" depending on what type of object it is. The Bin is a special type of objectManager. Later down the chain, the RenderInstManager Walks it's list of Bins and calls render() on all the bins, which should call renderObject() if it was stored in a bin that was an Object bin.
edit: you are also missing this assignment:
ri->translucent = false;
This will let it go to the regular Object Manager, as opposed to the RenderTranslucentMgr. The RenderTranslucentMgr doesn't look like it wants to work with regular RIT_Object types - it wants RIT_ObjectTranslucent types. So you could miss the render, because the translucent flag has some random value in it.
#31
I was up real late trying to figure this out and uploaded the zip when I thought I had it done.
When I looked at it better today I removed that call and it works fine and I just now re-uploaded the zip file.
I believe you are correct on the render calls.
A quick look at 1.8.1 and I think this is where fxRenderObject will show how useful it can be.
Just have to figure out the stateblock stuff now.
03/15/2009 (7:09 pm)
@Jaimi - renderObject( state , ri); can be commented out.I was up real late trying to figure this out and uploaded the zip when I thought I had it done.
When I looked at it better today I removed that call and it works fine and I just now re-uploaded the zip file.
I believe you are correct on the render calls.
A quick look at 1.8.1 and I think this is where fxRenderObject will show how useful it can be.
Just have to figure out the stateblock stuff now.
#32
It has been corrected and is in the zip file link.
03/15/2009 (7:13 pm)
@Jaimi - Yes I did miss ri->translucent = false;the first time.
It has been corrected and is in the zip file link.
Torque 3D Owner Caylo Gypsyblood