Game Development Community

Why is "BeginSort" sceneObject rendering in front of terrain?

by Steven Peterson · in Torque Game Engine Advanced · 05/02/2006 (5:53 pm) · 1 replies

I'm working on new cloudLayers, which are derived from sceneObject.

if (state->isObjectRendered(this))
   {      
      SceneRenderImage* image = new SceneRenderImage;
      image->obj = this;
      image->isTranslucent = true;
      image->sortType = SceneRenderImage::BeginSort;
      state->insertRenderImage(image);
   }

According to all the docs that block in CloudLayer::PrepRenderImage() should cause the layer to be rendered after/in-front-of the sky but before/behind the terrain or anything else. Instead it is rendering in-front-of everything! In fact there is no discernable difference between using: "BeginSort", "Normal", or "EndSort".

Changing "isTranslucent" never seems to change anything either, except that setting it to True and using "SceneRenderImage::Sky;" is a run-time error on mission-load.

The clouds look great excet that they are in the wrong render-Order. Using a "SceneRenderImage::Sky;" (and isTranslucent=false) pins the clouds to the sky correctly. However, if I have multiple layers in this case, as the player walks/looks around the sky flickers between: no-layers, layer1, layer2, both.

I think using "SceneRenderImage::BeginSort;" for my sort-type is the correct setting, and the problem may be in renderObject(). However I don't really understand everything thats happening here. What might be causing this object to render out-of-order regardless? Can anyone point me in the right direction?


NOTE: The renerObject() function is a descendent of the one found in sky.cc.


Thanks for any help!
Steven