protected void _RenderPolygon(Matrix objToWorld, SceneRenderState srs, Vector2[] vertices, Color color)
        {
            GraphicsDevice d3d = srs.Gfx.Device;
            Assert.Fatal(d3d != null, "doh");

            Assert.Fatal(vertices.Length > 0, "no vertices to render!");

            int numVerts = vertices.Length + 1;

            // make sure we have a vertex buffer
            if (_vb.IsNull)
            {
                int sizeInBytes = numVerts * GFXVertexFormat.VertexSize;
                _vb = ResourceManager.Instance.CreateDynamicVertexBuffer(ResourceProfiles.ManualStaticVBProfile, sizeInBytes);
            }

            // deal with flip
            float flipx = SceneObject != null && SceneObject.FlipX ? -1.0f : 1.0f;
            float flipy = SceneObject != null && SceneObject.FlipY ? -1.0f : 1.0f;

            // fill in vertex array
            GFXVertexFormat.PCTTBN[] pVertices = TorqueUtil.GetScratchArray<GFXVertexFormat.PCTTBN>(numVerts);
            for (int i = 0; i < numVerts - 1; ++i)
            {
                pVertices[i] = new GFXVertexFormat.PCTTBN();
                pVertices[i].Position = new Vector3(flipx * vertices[i].X, flipy * vertices[i].Y, 0.0f);
                pVertices[i].Color = color;
            }
            pVertices[numVerts - 1] = pVertices[0];

            _vb.Instance.SetData<GFXVertexFormat.PCTTBN>(pVertices, 0, numVerts);

            srs.World.Push();
            srs.World.MultiplyMatrixLocal(objToWorld);

            if (_effect == null)
            {
                _effect = new GarageGames.Torque.Materials.SimpleMaterial();
            }

            RenderInstance ri = SceneRenderer.RenderManager.AllocateInstance();
            ri.Type = RenderInstance.RenderInstanceType.Mesh2D;
            ri.ObjectTransform = srs.World.Top;
            ri.VertexBuffer = _vb.Instance;
            ri.PrimitiveType = PrimitiveType.LineStrip;
            ri.VertexSize = GFXVertexFormat.VertexSize;
            ri.VertexDeclaration = GFXVertexFormat.GetVertexDeclaration(d3d);
            ri.VertexCount = numVerts;
            ri.BaseVertex = 0;
            ri.PrimitiveCount = numVerts - 1;

            ri.UTextureAddressMode = TextureAddressMode.Clamp;
            ri.VTextureAddressMode = TextureAddressMode.Clamp;

            ri.Material = _effect;
            SceneRenderer.RenderManager.AddInstance(ri);

            srs.World.Pop();
        }
        /// <summary>
        /// Render position of last collision point and normal.  Strictly for debug purposes.  Should be called by 
        /// derived class.
        /// </summary>
        /// <param name="objToWorld">Current render transform.</param>
        /// <param name="srs">Scene render state passed in for rendering purposes.</param>
        public virtual void RenderBounds(Matrix objToWorld, SceneRenderState srs)
        {
            if (_keepCollision > 0)
            {
                _keepCollision--;
                GraphicsDevice d3d = srs.Gfx.Device;

                int numVerts = 6;

                GarageGames.Torque.Materials.SimpleMaterial effect = new GarageGames.Torque.Materials.SimpleMaterial();

                // create VB
                int sizeInBytes = numVerts * GFXVertexFormat.VertexSize;
                VertexBuffer vb = new VertexBuffer(GFXDevice.Instance.Device, sizeInBytes, BufferUsage.WriteOnly);

                // fill VB

                Color faceColor = Color.Red;

                GFXVertexFormat.PCTTBN[] vertices = TorqueUtil.GetScratchArray<GFXVertexFormat.PCTTBN>(numVerts);
                for (int i = 0; i < numVerts; ++i)
                    vertices[i].Color = faceColor;

                float d = 0.5f;
                vertices[0].Position = new Vector3(_lastCollisionPoint.X - d, _lastCollisionPoint.Y - d, 0.0f);
                vertices[1].Position = new Vector3(_lastCollisionPoint.X + d, _lastCollisionPoint.Y + d, 0.0f);
                vertices[2].Position = new Vector3(_lastCollisionPoint.X - d, _lastCollisionPoint.Y + d, 0.0f);
                vertices[3].Position = new Vector3(_lastCollisionPoint.X + d, _lastCollisionPoint.Y - d, 0.0f);
                vertices[4].Position = new Vector3(_lastCollisionPoint.X, _lastCollisionPoint.Y, 0.0f);
                vertices[5].Position = new Vector3(_lastCollisionPoint.X + _lastCollisionNormal.X * 2.0f, _lastCollisionPoint.Y + _lastCollisionNormal.Y * 2.0f, 0.0f);

                vb.SetData<GFXVertexFormat.PCTTBN>(vertices, 0, numVerts);

                RenderInstance ri = SceneRenderer.RenderManager.AllocateInstance();
                ri.Type = RenderInstance.RenderInstanceType.Mesh2D;
                ri.ObjectTransform = Matrix.Identity;
                ri.VertexBuffer = vb;
                ri.PrimitiveType = PrimitiveType.LineList;
                ri.VertexSize = GFXVertexFormat.VertexSize;
                ri.VertexDeclaration = GFXVertexFormat.GetVertexDeclaration(d3d);
                ri.BaseVertex = 0;
                ri.PrimitiveCount = 3;
                ri.VertexCount = numVerts;
                ri.UTextureAddressMode = TextureAddressMode.Clamp;
                ri.VTextureAddressMode = TextureAddressMode.Clamp;

                ri.Material = effect;
                SceneRenderer.RenderManager.AddInstance(ri);
            }
        }