Irrlicht Wrapper for 3D games and applications

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Post Reply
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

MMhmm, I see. Maybe setNode really is fine...


Busy day today. Fixed 2 bugs/problems in my program.

The first one is my z-order problem. Had to recompile Irrlicht for that.
Second one is realizing that automatic culling is not based on the view frustrum but by some box by default, and that made my culling absolutely horrid. Went from 20 to 60 fps after setting my nodes to the EAC_FRUSTRUM_BOX state.

Changes I made (I'll forget to mention this later):

1) "AutomaticCullingState = EAC_FRUSTRUM_BOX;" instead of "AutomaticCullingState = EAC_BOX;" on line 27 in CLensFlareSceneNode.cpp.

2) Culling stuff:

Irrlichtwrapper.bi:

Code: Select all

' Enumeration for all types of automatic culling for built-in scene nodes.
ENUM IRR_E_CULLING_TYPE
    EAC_OFF            = 0
    EAC_BOX            = 1
    EAC_FRUSTUM_BOX    = 2
    EAC_FRUSTUM_SPHERE = 4
END ENUM
Irrlichtwrapper.bi:

Code: Select all

declare sub IrrSetNodeAutomaticCulling alias "IrrSetNodeAutomaticCulling" (byval node as irr_node, byval value as ubyte)
wrappernode.cpp:

Code: Select all

void DLL_EXPORT IrrSetNodeAutomaticCulling (IAnimatedMeshSceneNode* node, u8 value) {
 node->setAutomaticCulling((irr::scene::E_CULLING_TYPE)value);
}
The Car
Posts: 102
Joined: Jul 08, 2005 19:02
Location: MN, USA

Post by The Car »

I think it depends on the category.

If there are lot of things to Set, it might makes sense to:

SetNode
SetElement
SetThat

...

I think if there are a lot of functions related to Node, then

NodeSet
NodeDoSomething
NodeDoThat

groups them all nicely. It is helpful in an IDE with auto-complete as well when you don't quite remember the function name you want.

But I haven't looked at the code in months, and it's not on my box, so... hopefully this was slightly helpful. :)
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Post by Frank Dodd »

Hi Agamemnus,

I hope your project is going well, it would be interesting to see some updated screenshots of it.

I am currently reviewing and importing the bug-fixes that have been posted here although I have very little time to advance the software these days. I am work as many changes as possible in with the intention of releasing a new version that now also contains a skinable GUI.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

Oh Frank...

I've turned your wrapper upside-down. I've changed hundreds of functions and it's still not enough.

Some changes you might not like...

A few things I've done:

* I do have the CEGUI wrapper working, with several hundred getter and setter functions... however, there are just so many bugs and deficiencies in CEGUI itself, and so many problems interfacing with Irrlicht (ie: in terms of textures), that I don't know if was worth it. Plus, the attitude of the main dev sucks... either laziness, or hating me because of my criticism. (I'm banned from the forum..)
I did not expect the Irrlicht GUI to progress. The main problem with it was that it was not skinnable, but I have seen that work is being done on it. Is that what you are using for a base, or some other GUI?

* Added more mesh and node manipulation/creation functions. I added a function that can create a dynamic mesh from sets of meshes that are themselves sets of mesh buffers..

* Changed animatedmeshscenenode or to ISceneNode where possible.

* Changed the name for node attribute getters/setters to specifically state "Node", ie getNodeBlah or setNodeblah.

* Added dozens of Mesh, Material getters and setters.

* Added many other getters and setters that weren't available before.

* Recompiled Irrlicht with my own features. :P

I dunno the best way to post these changes. I've been only using VC++, so the .def file is a mess (no @s).

Here is a screenshot from a few days ago.

Image
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Post by Frank Dodd »

Hi Agamemnus,

The screenshot looks cool thanks for posting, hopefully its been fun writing it and your going to have an entertaining game at the end.

At the moment I am going to limit myself to just drawing in the features and fixes highlighted in this thread since the last release, I won't have the resources to implement any large number of modifications.

The skinable GUI is achieved through wrapper support for Klaskers ImageGUISkin class and is a single call that allows all standard Irrlicht GUI objects to use images to draw their borders backgrounds and widgets its very simple but creates a distinct look. I will try and get an alpha version out at the weekend.
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Post by Frank Dodd »

I have uploaded a quick v0.7.8 alpha 1 that can be downloaded from this link.[/url]

v0.7.8 will mainly be about bug fixes however it will also include: -

Klaskers GUISkin class that makes it ridiculously easy to skin the native Irrlicht GUI with a single call and give your application a very distinct look. All praise to Klasker for this one.
Last edited by Frank Dodd on Jun 23, 2011 23:19, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

hello Frank,
why is your ODE dll 4.84MB here is it only 511KB ?

good work

Joshy
Last edited by D.J.Peters on Mar 27, 2011 13:06, edited 1 time in total.
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Post by Frank Dodd »

hi Joshy,

I must admit I'm not sure, it is probably partially because the included ode was built by myself from source with the GCC compiler and includes other statically linked components (in the same way that the GCC Irrlicht DLL is 6.6Mb and the Microsoft version is only 2Mb).

This does seam quite a difference though so its possible it has been built in debug and includes symbols, I will try to take a quick peep at it for the next release. Thanks for pointing this out.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

all your nice examples eats all the CPU power of one core
and my cooler begins to make noise

you can add an sleep in your render loop
or any irr sleep command if any

Joshy

Code: Select all

const FPS = 60
dim as double frameTime = timer + 1.0/FPS
while IrrRunning
  if timer > frameTime then
    frameTime = timer + 1.0/FPS
    ' render scene ...
  else
    sleep(1000/(FPS*1.5),1)
  end if
wend
Last edited by D.J.Peters on Mar 28, 2011 3:14, edited 1 time in total.
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Post by Frank Dodd »

Hi Joshy,

Yes some of the examples do run flat out often running at hundreds of frames per second, I have been going through them and limiting them to 60 fps. Examples like "109_Example_Beam_Node" should be more friendly to your computer, I will also try to get all of these amended for the next release.

Frank
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Post by Frank Dodd »

I have just quickly made an update to the archive to stop the sphere demo crashing, it was missing a bitmap in the file.
Last edited by Frank Dodd on Jun 23, 2011 23:20, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

only a hint

use double ever if you get the FB timer value

Joshy
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

You can limit the FPS by setting the vsync value to true.

I do have a update to IrrStart and IrrStartAdvanced... the other one had a potential problem with device->clearSystemMessages where device was 0 (causing a crash). I'm not sure if the last version you have even has "device->clearSystemMessages", but apparently it is necessary in the case that you ended a device and then just started a new one. Also, IrrStartAdvanced now allows all the device/driver starting options to be set.

"device->clearSystemMessages();" should be placed immediately after "driver->setMaterial(unlitMaterial);".

I did add default parameters to the C function itself for IrrStartAdvanced. I'm a bit queasy about not having those there.

(I really hate the tabbed indentation style so I redid the indentation of the entire function....)

Code: Select all

declare function IrrStartAdvanced alias "IrrStartAdvanced" (byval drivertype as integer, _
byval width as integer             = 750 , _
byval height as integer            = 550 , _
byval bits as ubyte                = 16  , _
byval fullscreen as ubyte          = 0   , _
byval shadows as ubyte             = 1   , _
byval dontIgnoreInput as ubyte     = 1   , _
byval vsyncEnabled as ubyte        = 1   , _
byval devicetype as ubyte          = 0   , _
byval doublebufferEnabled as ubyte = 1   , _
byval antialiasEnabled    as ubyte = 1   , _
byval highPrecisionFpu    as ubyte = 0   , _
byval stereobufferEnabled as ubyte = 0   , _
byval withAlphaChannel as ubyte    = 1   , _
byval zBufferBits as ubyte         = 16  , _
byval windowId as uinteger ptr     = 0   ) as uinteger

Code: Select all

 bool DLL_EXPORT IrrStartAdvanced (
  int drivertype = irr::video::E_DRIVER_TYPE::EDT_OPENGL, // Default of EDT_OPENGL is used if <= -1.
  int width = 750,             // Default of 750 is used if <= 0
  int height = 550,            // Default of 550 is used if <= 0
  u8 bits = 16,                // Default of 16 (bits) is used if <= 0.
  u8 fullscreen = 0,     
  u8 shadowsEnabled = 0,
  u8 dontignoreinput = 1,
  u8 vsyncEnabled = 1,

  // Extended values for IrrStartAdvanced (versus IrrStart)
  u8 devicetype = 0,           // Leave at 0 for "EIDT_BEST".
  u8 doublebufferEnabled = 1,
  u8 antialiasEnabled = 1, 
  u8 highprecisionfpu = 1,

  u8 stereobufferEnabled = 0,
  u8 withAlphaChannel = 0,
  u8 zBufferBits = 16,          // Default value should be 16.
  void* windowId = 0
 ) {
 
 E_DEVICE_TYPE devicetypeEnum[] = {EIDT_BEST, EIDT_WIN32, EIDT_WINCE, EIDT_X11, EIDT_OSX, EIDT_SDL, EIDT_FRAMEBUFFER, EIDT_CONSOLE};
 E_DRIVER_TYPE drivertypeEnum[] = {EDT_NULL, EDT_SOFTWARE, EDT_BURNINGSVIDEO, EDT_OPENGL, EDT_DIRECT3D8, EDT_DIRECT3D9};
  
 SIrrlichtCreationParameters params;

 params.EventReceiver = &receiver;
 params.LoggingLevel = irr::ELOG_LEVEL::ELL_NONE;
 params.DriverType = drivertypeEnum[drivertype];
 if (width <= 0) width = 750;
 if (height <= 0) height = 550;
 params.WindowSize = irr::core::dimension2d<u32>(width, height);
 if (bits > 0) params.Bits = bits;

 params.Fullscreen = (fullscreen != 0);
 params.Stencilbuffer = shadowsEnabled;
 params.IgnoreInput = ((1 - dontignoreinput) != 0);
 params.Vsync = (vsyncEnabled != 0);

 params.DeviceType = devicetypeEnum[devicetype];
 params.Doublebuffer = doublebufferEnabled;
 params.AntiAlias = (antialiasEnabled != 0);
 params.HighPrecisionFPU = (highprecisionfpu != 0);

 params.Stereobuffer = stereobufferEnabled;
 params.WithAlphaChannel = withAlphaChannel;
 params.ZBufferBits = zBufferBits;
 params.WindowId = windowId;

 unsigned int initStatus = 0;
 // Create an irrlicht device object.   
 if (device = createDeviceEx(params)) {
  // Get a pointer to the video driver, the SceneManager and the graphical user interface environment.
  if (( driver = device->getVideoDriver()) && ( smgr = device->getSceneManager()) && ( guienv = device->getGUIEnvironment())) {

   // The system has started up correctly:
   initStatus = 1;

   // Don't pass events to the GUI.
   receiver.passToGUI = false;

   // Apply an unlit material to the scene so that drawing functions display in a set color.
   SMaterial unlitMaterial;
   unlitMaterial.Lighting = false;
   driver->setMaterial(unlitMaterial);
  }
  device->clearSystemMessages();
 }
 return initStatus;
}
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

I readed the wrapper reference manual
but some questions are open

if you have high detailed car node with 8000 polgones

how you can set a low detailed version for the shadow model ?

HiPolyCarNode rendering on shadow off
LoPolyCarNode rendering off shadow on

Can the Irrlicht engine create level of details LOD's self
or must the Irrlicht user support different versions of the same 3D model?

Joshy
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

There is no built-in LOD system. You have to do it yourself, but it's pretty easy to set up. Just create a node with subnodes of all the different versions of a model, then set the correct node visible according to its distance from the camera every time the camera position changes.
Post Reply