I started to test Irrlicht two weeks ago for a scientific project.
However, I still did not find a way to implement a few essential things. Namely:
--How to draw splines in the 3D space? Like, suppose I have a function which defines a curve in the 3D space. Is it possible to render it somehow with Irrlicht?
--How to implement a switch to make objects visible/invisible?
--Is it possible to change the transparency of an object on the fly? Like fade it from opaque to transparent
for opaque to transparent, what I've done is set the material type to EMT_TRANSPARENT_ADD_COLOR then darken the color of the texture of the material to black. You need a custom node for this.
setvisible(true) for invisible/visible
if I wanted splines, i'd have to go strictly opengl, write a customnode, and take over the rendering routine to use opengl commands to draw 3d curves. If i remember right, there are a WHOLE bunch of cool commands for curves in opengl.
Thanks for the reply.
So, setvisible(true) solves my problem of the visibility switch.
I'm not familiar with the OpenGL API, but will give it a try, maybe it solves my problem.
Now, for the transparency your solution does not seem to work, since when you set a material type as EMT_TRANSPARENT_ADD_COLOR, it's ALLWAYS transparent. If you set the emission color of the material with objectNode->getMaterial(0).EmissiveColor.set(0,255,255,255)
and then
objectNode->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR)
the object is still transparent.
How to solve this?
Skip,
The curves must have a lot of precision and be seen both from very close and very far. They also must be generated on the fly, from parameters written in a XML file. So, I prefer not to use your method, although it can be useful for other purposes.
You'll get the very same results with the OpenGL API as with manual triangulation becuase OpenGL also uses trinagle approximation. You can even use the GLU API to get hold of the triangle data. But it's no problem, just use enough triangles, maybe depending on the distance to the camera (dynamic LOD). Using triangulation with NURBS is not really involved, just a handful of math functions.
Yes, of course it will display it. Just create a custom scene node (read the example on that) and put the OpenGL code into the render method. Some threads on combination of OpenGL code with Irrlicht can be found in these forums, but it shouldn't be too hard if you know how to code the OpenGL parts.
That will work via the usual scene node selection based on bounding boxes. But only as long as you don't need point exact selection. That would require tesselation and conversion into Irrlicht S3DVertex structures.