Motion trails?
by Alex Chouls · in Torque X 2D · 06/07/2007 (8:20 pm) · 1 replies
I'm trying to make glowing trails similar to those in Homeworld and fighting games. The objects are moving fast, so the particle trail method doesn't work.
Is there a way to build an arbitrary textured polygon shape in TorqueX? e.g. a ribbon of polygons built behind a moving sceneobject.
I've looked into T2dPolygon but that seems to be a wireframe polygon.
I've also looked at T2dQuad but can't figure out how to use it.
Is it possible to combine the underlying XNA functionality in a TorqueX render pass?
Is there a way to build an arbitrary textured polygon shape in TorqueX? e.g. a ribbon of polygons built behind a moving sceneobject.
I've looked into T2dPolygon but that seems to be a wireframe polygon.
I've also looked at T2dQuad but can't figure out how to use it.
Is it possible to combine the underlying XNA functionality in a TorqueX render pass?
About the author
Torque Owner Thomas Buscaglia
It might be a bit tricky if you don't have source, so here's an example from T2DQuad.Render:
// Note: 'srs' is the SceneRenderState object passed to Render srs.World.Push(); srs.World.MultiplyMatrixLocal(objToWorld); RenderInstance ri = SceneRenderer.RenderManager.AllocateInstance(); ri.RotationOnly = rotation; // fils the render instance with relevant data (see below) FillRenderInstance(ri, srs); BaseSceneGraph.Instance.GetLightManager().GetBestLights(ri.Lights); SceneRenderer.RenderManager.AddInstance(ri); srs.World.Pop();For great justice, here's the T2DQuad.FillRenderInstance method:
public void FillRenderInstance(RenderInstance ri, SceneRenderState srs) { GraphicsDevice d3d = srs.Gfx.Device; Assert.Fatal(d3d != null, "doh"); ri.Type = RenderInstance.RenderInstanceType.Mesh2D; ri.SceneObject = srs.CurrentSceneObject; ri.ProjectionTransform = srs.Projection; ri.ObjectTransform = srs.World.Top; ri.PrimitiveType = PrimitiveType.TriangleFan; ri.VertexDeclaration = GFXVertexFormat.GetVertexDeclaration(srs.Gfx.Device); ri.VertexBuffer = _vb.Buffer as VertexBuffer; ri.BaseVertex = _vb.StartIndex; ri.NumVerts = _vb.Count; ri.VertexSize = _vb.ElementSize; ri.PrimitiveCount = 2; ri.TexU = _texU; ri.TexV = _texV; ri.Material = _material; }