Version 0.7 has been released.
New native example: 10.Shaders.
New Lime examples: L03.RGBSwirl and L04.ParticleEmitterViewer (read below about them).
Release Notes
~
Added class Logger. I don't know how could i forget about it
, but found its usage only in 10.Shaders example, so ported it. Now you can easily write to log next way:
Code: Select all
device.Logger.Log("a log message");
~
Added class GPUProgrammingServices. Now its possible to use shaders as shown in 10.Shaders example.
1) There are some changes in adding new materials in Irrlicht (from native c++ version): GPUProgrammingServices.Add*() methods and Video.AddMaterialRenderer() now returns MaterialType (was int); however the return value should be compared with "-1" (you have to cast return value to int to do this).
2) GPUProgrammingServices class has 2 static events: OnSetMaterial and OnSetConstants; you should handle this events if you want to pass parameters to your shaders (see 10.Shaders example). Please note: maybe in future OnSetMaterial will be removed and combined with OnSetConstants because they called synchronously, so if you have more than 1 material and in OnSetConstants you want to know which one is under processing right now -- you have to handle OnSetMaterial (this is the way its done in native Irrlicht, and looks a bit strange for me... i'm not very familiar with shaders and its programming, so i decided to do not change the way its done).
~
Added method FileSystem.CreateMemoryReadFile(filename, content). The content is an array of bytes that you may generate to create in-memory file. Please note, that "content" is "input"-only argument (it is not "reference"), so it is one-way-only and the content of returned ReadFile object will not be changed if you change your input array after the call (it is possible in native c++ Irrlicht, but not in this wrapper). Probably some sort of "update" method will be added in future.
~
MeshBuffer class has been extended. Added get-only properties: Indices and Vertices. Both returns Object. This is due to each MeshBuffer can hold different index type and vertex type. You can check VertexType (or IndexType) property at run time to know how to cast the value. For example if you work only with VertexType.Standard, you just do:
Code: Select all
Vertex3D[] v = (Vertex3D[])meshBuffer.Vertices;
// now you can read value of each vertex;
// ofcause if you do then v[0].Color = ... , you just edit your local array copy; read below how to modify data.
Added support for mesh manipulation. Next methods added:
Code: Select all
public void Append(Vertex3D[] verticesStandard, ushort[] indices16bit);
public void Append(Vertex3DTangents[] verticesTangents, ushort[] indices16bit);
public void Append(Vertex3DTTCoords[] verticesTTCoords, ushort[] indices16bit);
Each method works with its own vertex type. Indeed, you can check VertexType, and use proper methods. For example, if you have VertexType == VertexType.Standard and will try to use Append() with Vertex3DTangents array, you will get failed assertion check. Current native IMeshBuffer do not support appending data with indices other than IndexType._16Bit type, so there is no ability to add data with 32 bit indices for now.
Native Irrlicht much flexible here, it allows you to get vertices pointer (with void* getVertices()) and change values directly. As compensation to this cool native ability, i have invented next methods:
Code: Select all
public void UpdateIndices(ushort[] indices16bit, int startIndex);
public void UpdateVertices(Vertex3D[] verticesStandard, int startIndex);
public void UpdateVertices(Vertex3DTangents[] verticesTangents, int startIndex);
public void UpdateVertices(Vertex3DTTCoords[] verticesTTCoords, int startIndex);
These methods able to modify certain parts of incides and vertices. Please note, you have also use only proper type: if your VertexType == VertexType::Tangents, you can use UpdateVertices() method with tangents array only, or assertion check will fail. Also in this methods VertexCount (and IndexCount in case of UpdateIndices()) takes place, for example: if you have mesh buffer with 20 vertices, and you will call UpdateVertices(newVertices, 10) and newVertices.Length would 15, you will also get assertion check failed. These methods can only modify existing continuous parts of data (they do not append/remove data).
Next sample shows the usage of these methods:
Code: Select all
// We create simple cube mesh scene node
MeshSceneNode cube = smgr.AddCubeSceneNode(20); // this creates cube with -10 .. +10 coords at all three axies.
// We add triangle just above the cube (not touching it)
MeshBuffer mb = cube.Mesh.GetMeshBuffer(0);
Vertex3D[] av = new Vertex3D[3];
av[0] = new Vertex3D( 11,11, 11); // we do not care about normal vectors (as we do not use lighting),
av[1] = new Vertex3D(-11,11,-11); // and we do not care about texture coords,
av[2] = new Vertex3D( 0,18, 0); // and vertex color in this example; if we care -- we can use more specific contructors.
ushort[] ai = new ushort[3] { 0, 1, 2 };
mb.Append(av, ai);
// Now our new triangle became a part of the whole mesh,
// this means that indices and vertices now do not have old
// 0, 1 and 2 positions, but appended to all the mesh.
// Next code shows how to change (flip face) only the triangle that we just added.
int oldIndexCount = mb.IndexCount - 3;
int oldVertexCount = mb.VertexCount - 3;
ai[0] = (ushort)(2 + oldVertexCount); // was 0
ai[1] = (ushort)(1 + oldVertexCount); // was 1 (we could do not use this line at all)
ai[2] = (ushort)(0 + oldVertexCount); // was 2
mb.UpdateIndices(ai, oldIndexCount);
// Now our custom triangle has flipped its face.
~
Added intellisense documentation for Visual Studio. Now when you compile IrrlichtLime, bin folder will also contain IrrlichtLime.xml file, which will be used by VS' intellisense automatically when you reference IrrlcihtLime.dll in your project. Currently next namespaces are documented:
IrrlichtLime
IrrlichtLime.Core
IrrlichtLime.IO
IrrlichtLime.Video
This should really help those, who started to use Irrlicht Lime without experience with native C++ Irrlicht Engine.
~
Two new Lime examples added.
L03.RGBSwirl
This example draw nice RGB swirl. It looks like its complete 2D graphics, but its not. Indeed its 3D: there is a sphere in pointcloud mode rapidly rotating, the camera with affected view matrix which makes all looks quite unrecognizable, BeginScene() do not clears the backbuffer, so the image repaints itself over and over again. There are also 3 lights with colors red, green and blue, which rotates and lights the sphere parts, you may see it when running example, in places where light ranges overlaps -- we can see color mix, and in the center -- white color, which is mix of red, green and blue at the same time. Source code quite short.
Sceenshot:
L04.ParticleEmitterViewer
This example is a simple particle viewer, that allows to change some parameters on the fly of created particle system and see the changes immediatly.
This example demonstates some cool features:
- correctly react on window resizes; you may even choose the behavior: keep aspect ratio or not;
- renders all its graphics in separete thread (now Thread class used, not BackgroundWorker component like it was in L02.WinFormsWindow example);
- implements a command queue mechanism, when UI send commands to rendering thread and does not wait its processing to finish, they added to the queue and wait for processing there. This makes all runs much safe and smooth;
- shows how to calculate time spent on rendering of each frame;
Sceenshot:
~
Updated Irrlicht SDK to trunk rev. 3427.
Full list of changes: http://irrlichtlime.svn.sourceforge.net ... athrev=212