(C++)Irrlicht 1.1 : Fake Glow,Dream and Night Vision

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
hanswurst
Posts: 4
Joined: Sat Mar 31, 2007 5:22 pm

Post by hanswurst »

OK, sorry.

I put that switch/case thing at the wrong place. it has to be called directly after beginScene().

Now the screen is not turning black anymore, instead nothing happens when trying to use on of the effects. :roll:
7h0mm4y
Posts: 3
Joined: Sat Mar 31, 2007 3:34 pm

Post by 7h0mm4y »

I did a couple of runs with the debugger, to learn that the method: "CQuadSceneNode::OnAnimate()" ("CQuadSceneNode::OnPreRender()") is never called. :?
hanswurst
Posts: 4
Joined: Sat Mar 31, 2007 5:22 pm

Post by hanswurst »

Found that out too.
I even commented it out....doesn't change anything.
As far as i understand it, OnAnimate() is called before everything is rendered (like OnPreRender() did). So, what is the argument for? I don't get it :?
hanswurst
Posts: 4
Joined: Sat Mar 31, 2007 5:22 pm

Post by hanswurst »

To be sure, i tried all available renderer, used a "fresh" FPS-Camera, but no Effect appears. There are 3 possibilities left:
- either my code is wrong,
- effects are incompatible with 1.3 (actually impossible), or
- i don't understand that OnAnimate() function right, and that this is the function causing this problem, although it is never used.
mrcdrc
Posts: 7
Joined: Sat Mar 31, 2007 10:26 am

Post by mrcdrc »

In order to get this code working with Irrlicht 1.3 i replaced OnPreRender() with the new method called OnRegisterSceneNode() (instead of OnAnimate() which actually isn't meant to be used for registering scene nodes for rendering anyways) and the code at least works. Allthough i am using my own ICameraSceneNode so the effects currently do not show up as expected...still looking for an idea how to fix that transformation stuff the right way...

bye
mrc
7h0mm4y
Posts: 3
Joined: Sat Mar 31, 2007 3:34 pm

Post by 7h0mm4y »

Thank you :D it works now, but sometimes the effect just stops and after i move a bit around it continues :roll:
mrcdrc
Posts: 7
Joined: Sat Mar 31, 2007 10:26 am

Post by mrcdrc »

Ok, i fixed that transformation problem just by adding a 'setRotation(vector3df(RotX, RotY, 0));' to my camera animation code.

The usual behavior is to just construct a temporary rotation matrix and update camera position and target accordingly. The position of the ICameraSceneNode was updated too (setPosition) but 'setRotation' was missing. At least in my code.

Now the transformation of the quads relative to the camera is correct.

The only strange thing left is that the effect seems to be heavily 'overdozed'. Looks like and endless feedback loop...
hmmm.

bye
mrc
allked
Posts: 12
Joined: Mon Oct 02, 2006 3:44 am

Post by allked »

1>e:\myworkirr\glowworks\demo_n3\ceffects.h(17) : error C2011: 'EffectsLibrary::CQuadSceneNode' : 'class' type redefinition
1> e:\myworkirr\glowworks\demo_n3\ceffects.h(17) : see declaration of 'EffectsLibrary::CQuadSceneNode'



i only got 1 error but i don't know what's wrong ,any help? thanku al
linkoraclehero
Posts: 81
Joined: Sat Sep 09, 2006 6:46 am

Post by linkoraclehero »

Okay, I've figured it out. And yes, it runs fairly well on 1.3.

Follow these steps:

Add a deconstructor to the CPP and H files:
CPP: CQuadSceneNode::~CQuadSceneNode() {}
H: ~CQuadSceneNode();

Change onPreRender() to OnRegisterSceneNode():
CPP: void CQuadSceneNode::OnRegisterSceneNode()
H: virtual void OnRegisterSceneNode();

Call a create BEFORE the main loop:
EffectsLibrary::CreateGlow(cam,smgr,20);

Call Render AFTER endScene():
driver->endScene();
EffectsLibrary::RenderGlow(smgr,128,128,128,128,20);

I'll work on bettering the code and making it more advanced.

[Edit]
Here's a screenshot, running smooth on 1.3 :]
Image

I'll have the updated setup at http://bladestrife.net/downloads.php soon enough :]
Fixes a few code problems (Defaults being in CPP, not H), and I'll translate it into english. Also, allow you to possibly set the resolution of the effects.
linkoraclehero
Posts: 81
Joined: Sat Sep 09, 2006 6:46 am

Post by linkoraclehero »

I added a CreateSwimEffect, gives the effect of swimming underwater :]
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

cool... can these be added into the core?
linkoraclehero
Posts: 81
Joined: Sat Sep 09, 2006 6:46 am

Post by linkoraclehero »

There's no point in putting them into the engine... I'm going to look into a way to draw without the scene node, as well as looking for a way to hook into DX9's render device and be able to apply fullscreen effects there too. I'm not an expert, I just seem to stumble on good and useful ideas. If things go well, you'll see some of these findings in 1.4 8)
porcus
Posts: 149
Joined: Sun May 27, 2007 6:24 pm
Location: Germany

Post by porcus »

The download link is not correct.
Can someone upload this again, PLEASE ?
kiranmaya
Posts: 31
Joined: Tue Jan 30, 2007 9:10 am

Post by kiranmaya »

porcus
Posts: 149
Joined: Sun May 27, 2007 6:24 pm
Location: Germany

Post by porcus »

Simson wrote:It's limited at Camera FPS because my level in maths is low and i don't know how to get the camera rotation.
If you find the solution, don't hesitate to post the code :).
Whats with getrotation() ?
Post Reply