Irrlicht Wrapper for 3D games and applications

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Postby Frank Dodd » Mar 28, 2011 18:19

As agamemnus has said there is no built in automatic LOD system although the wrapper does contain some helper functions that you can see in example "104_Example_LOD" at one point I did look into an imposter node too but as is usual these days it overran the time budget I set aside for it and so the LOD manager was implemented and it does a fairly good job with automatic node switching and fading.

Using a simple shadow object can be done by attaching a different mesh for the shadow. For example if in "08_Example_ShadowAndLights" you change

Code: Select all

IrrAddNodeShadow( SceneNode )


for

Code: Select all

DIM as irr_mesh roundMesh = IrrGetMesh( "./media/sphere.x" )
IrrScaleMesh( roundMesh, 30.0 )
IrrAddNodeShadow( SceneNode, roundMesh )


You will see that Zumlin inherits a nice round shadow.

agamemnus
Thanks for the contributions on IrrStartAdvanced I will implement these suggestions into the wrapper. I will retain the current formatting however to keep the code as consistent as possible, I have also been tinkering with some automatic conversion of the documentation to doxygen format but I'm not sure if I will have time for this.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Mar 28, 2011 19:02

I just must add one more! Last one for a while... promise!

This is the camera function I am currently using... It's not 100% optimized, but better than the horrible inefficient mess of 6 or so IrrRevolveCamera calls I had before:

Code: Select all

declare sub IrrSetCamera alias "IrrSetCamera" ( _
        byval camera as irr_camera, _
        byval rotx as single, _
        byval roty as single, _
        byval rotz as single, _
        byval x as single, _
        byval y as single, _
        byval z as single )


Code: Select all

/* ----------------------------------------------------------------------------
 Sets the camera to the desired rotx/roty/rotz/x/y/z values.
*/

void DLL_EXPORT IrrSetCamera (irr::scene::ICameraSceneNode* camera,
                              float rotx, float roty, float rotz,
                              float x, float y , float z) {

 quaternion tempQuaternion;

 // Work out the 3 axes for the camera:
 // Forward = target (0,0,0) - position -- the position at (x=0, y=0) is (0,0,1).
 // Right = -1 * cross-product of up.
 // Pos = -forward + x * right + y * up;.
 vector3df up(0,1,0);
 vector3df forward(0,0,-1);
 vector3df pos(x,y,1);

 tempQuaternion.fromAngleAxis(rotz, forward);
 tempQuaternion.getMatrix().rotateVect(up);

 tempQuaternion.fromAngleAxis(rotx, up);
 tempQuaternion.getMatrix().rotateVect(forward);

 vector3df right = forward.crossProduct (up);
 tempQuaternion.fromAngleAxis(roty, right);
 tempQuaternion.getMatrix().rotateVect(forward);
 tempQuaternion.getMatrix().rotateVect(up);

 pos = pos + z * forward;
 camera->setUpVector (up);
 camera->setTarget (pos + forward);
 camera->setPosition (pos);
}
Last edited by agamemnus on Mar 30, 2011 19:08, edited 9 times in total.
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Postby Frank Dodd » Mar 28, 2011 21:34

Interesting, what do you actually use that camera code for?
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Mar 28, 2011 23:33

It's designed for a top-down view of a battlefield or some other map. First a zoom value, then an x/y offset along the plane of the map.. then the rotation along the center-point of the camera.
D.J.Peters
Posts: 6989
Joined: May 28, 2005 3:28
Location: Germany

Postby D.J.Peters » Mar 29, 2011 1:52

hello agamemnus and Frank
thank you for the infos.

i compiled Squirrel V3.0 as 32 bit version on Linux and Windows
Squirrel is the script compiler and VM same as in irrEdit (Coppercube now) .

By the way i can use my FBSound lib but will be irrKlang a part of the irrWarapper in near future ?

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

Postby agamemnus » Mar 29, 2011 20:37

I modified the code above, removing some redundant lines and also initializing it with an up vector... but rotz should be pi as default.

Example usage:

IrrSetCamera (maincamera, 0, 0, 3.1415, 50, 50, -50)

This will set the camera 50 points down, 50 points to the left, and 50 points away from (0,0,0).
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Postby Frank Dodd » Mar 30, 2011 21:07

Thanks agamemnus I will include the updated code into the changes and will try to put together an example.

Hi Joshy, I think these will stay separate it would be useful to integrate them so that sounds can be loaded and positioned directly from an irredit scene but I can't imagine that I will have the time to make the changes. (There is of course the seperate FreeBasic Irrklang wrapper available)
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Apr 02, 2011 5:01

Something that might be interesting as an example would be the camera looking over a perlin-noise generated terrain. What do you think? I can set up the perlin noise function which will create the terrain mesh: just give me the base example with a rectangle mesh to start with. I think you already have some sort of terrain stuff there in the wrapper-- never tried it though... Idk, just a suggestion.

Speaking of terrain, here's an idea -- it would be (!) exciting (!) to see my camera function combined with your planet terrain scene node -- if it's ready? By keeping the camera target to the center you could create a perfect camera for a planet (sphere) -- in this case, the camera (x,y) point would always be (0,0) and two of the rotation axes would be the planet (x, y) points!
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Postby Frank Dodd » Apr 02, 2011 14:08

I do like that idea the wrapper has a perlin noise algorithm in it that was intended to be able to create fine irregular detail on surfaces I did plan to include erosion into it too.
Last edited by Frank Dodd on Jun 23, 2011 23:23, edited 1 time in total.
Kot
Posts: 326
Joined: Dec 28, 2006 10:34

Postby Kot » Apr 02, 2011 16:37

Just can't wait to see it in action :D :D :D
scottyscotty
Posts: 3
Joined: Jul 15, 2010 12:00

Postby scottyscotty » Apr 25, 2011 22:02

I'm curious about your planet node, something like see small planet in space and then zoom in all the way to some city or room in an apartment building within city? Please elaborate on purpose. Thank you for your efforts on wrapper, I wrote an animation program with FreeBasic and your Irrlicht wrapper, some of the animations can be seen at:

http://www.youtube.com/user/ScottyAnimation

Thanks again for your efforts.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Apr 27, 2011 9:09

Lolz. Odd head there.
Frank Dodd
Posts: 444
Joined: Mar 10, 2006 19:22

Postby Frank Dodd » Apr 27, 2011 22:29

Hi Scott,

Thanks for your post, I took a look at your channel and the one thing that struck me was the lip sync was well done, I have played about with that and I know how tricky it can be.

The sphere terrain provides a spherical terrain that can indeed represent a planet far out in space very inexpensively and zoom in to some very fine detail similar to the game Spore. You could certainly place a building onto the surface and enter that structure although there are lots of difficulties that arise when you start working with spherical terrains that would make such a project quite complex.
Last edited by Frank Dodd on Jun 23, 2011 23:24, edited 1 time in total.
scottyscotty
Posts: 3
Joined: Jul 15, 2010 12:00

Postby scottyscotty » May 11, 2011 8:53

@agamemnus
Glad it made you laugh. Thanks for the response.

@Frank Dodd
The "STAR WORDS" animations were done with a simple FreeBasic
program I wrote that used espeak and facial expressions, mouth
movement was done automatically by program. Never found code I
could decipher to do the same with a loaded WAV file. Though FM file yes.

The "Beautiful Glitch" and "Rupert the Cat" was done with a PureBasic
program I wrote that used the very old Xtreme3D game engine. From
here I decided to re-write using FreeBasic and your Irrlicht wrapper and
it was this program that created all the other animations. It's basically
textured planes in 3d space. Using lock/unlock to animate face in real-time. With this program I can usually create a 30-60 second
animation in an hour. Depends on pre-production of content.

All movement and facial expressions done using a joystick and patience.
Timing issues with audio/video sync over 1 minute, working on that.

Look forward to seeing planet node in action. More technology I can play with. I already know what I'm going to use it for.
D.J.Peters
Posts: 6989
Joined: May 28, 2005 3:28
Location: Germany

Postby D.J.Peters » Jun 08, 2011 20:57

Hello IrrFrank :-)
only a short note "object" is a reserved word in current SVN version of FreeBASIC
keep eyes on it in your old and new wrapper IrrDemos.

again good job so far

Joshy

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 0 guests