It supports vertex colors, texture coordinates, shrinking, different interpolation functions, using a custom normal, time based or length based fading, etc.
It's written in C# and uses the newest IrrlichtLime from svn (http://sourceforge.net/p/irrlichtlime/code/HEAD/tree/), you have to compile IrrlichLime yourself.
It shouldn't be hard to port to C++.
You can use this node even for commercial projects without attribution.
The image shows one simple lightning which fades out, many lightnings which flash and a textured motion trail.
Version 1.0, 943 lines, Download: https://dl.dropboxusercontent.com/u/572 ... neNode.zip
Zip contains two files:
BeamSceneNode.cs: The class itself and some helpers.
Interpolation.cs: Some interpolation types.
Usage:
Simple user controlled beam, aligned to view, length based, local space:
Code: Select all
BeamSceneNode beam = new BeamSceneNode(parent, smgr, thickness, segmentCount, false, false, false);
beam.MaximumLength = //set length
//beam.SegmentLength //or set segment length
//Add segments. You can add segments every time, old segments will fade out
beam.AddSegment(position);
beam.AddSegment(position2);
beam.AddSegment(position3);
//Set material...
beam.Material.Type = MaterialType.TransparentAlphaChannel; //For texture use
beam.Material.SetTexture(...)
beam.Drop(); //Drop if we don't need it anymore.
Code: Select all
BeamSceneNode beam = BeamSceneNode.CreateTrail(attatch, thickness, segmentCount);
beam.FadeOutTime = 1000; //1 second trail
beam.FadeMesh = false; //don't shrink mesh
beam.ClipLastSegment = true; //makes last segment follow, important for texturing
beam.LockedAxis = BeamSceneNode.Axis.Y; //only rotate around Y axis. remove this, if you want it to rotate in every direction.
//Setup material...
//...
beam.Drop();
Code: Select all
BeamSceneNode lightning = BeamSceneNode.CreateLightning(smgr.RootNode, startPos, endPos, 4f, 5f, 16, device.Timer.Time, 250);
lightning.SetVertexColors(new Color(255, 255, 255, 255), new Color(255, 255, 255, 0), new Color(255, 255, 255, 255), new Color(255, 255, 255, 0)); //Inside color white, outside color transparent
lightning.Material.Type = MaterialType.TransparentVertexAlpha;
lightning.Drop();
I hope you like it!
If you find bugs, have any questions or feature requests, please ask!