Game Development Community

How to force a T2DSceneObject to render?

by Doug Hamilton · in Torque X 2D · 02/27/2010 (12:46 pm) · 1 replies

I've been doing some modifications to the Torque X engine to support 2D shadow casting. It's currently working very well, but the problem is I need any T2DSceneObject that has the ShadowComponent attached to it, to always render, ignoring the camera bounds check. I need this because my shadows extend a large distance from the object, and when the object is outside the view area of the camera, the objects no longer render, meaning their shadows no longer render.

I have access to the source code but I can't seem to make sense of the camera bounds checking.

Does anyone know an easy way to implement this? I was hoping for something as elegant as adding a boolean to the SceneObject class that will make the object render no matter how far away it is from the camera.

#1
02/28/2010 (7:20 am)
Have a look at T2DSceneGraph::_RenderObjects()

The scenegraph does a query to find all the objects to render (i.e. within the camera extents). You can simply append your shadowing objects to that query result and they will get rendered along with all the objects that are officially deemed to be 'onscreen'. You may need to check that you aren't duplicating objects already in the list, of course.


And keep us posted on how the 2D shadowing stuff turns out - I haven't seen that done in tx yet.