Page 1 of 1

WaterSurfaceSceneNode

Posted: Fri Sep 11, 2009 9:39 am
by Chet
Completely stuck here on trying out water. (Ya I am a total noob )
The following code compiles fine but program crashes right after mesh is loaded (the mesh works fine loaded as a regular mesh).

scene::ISceneNode * water = smgr->addWaterSurfaceSceneNode(smgr->getMesh("../../media2/lake.x"));
water->setPosition(core::vector3df(20000,100,2500));
water->setScale(core::vector3df(100,100,100));
water->setRotation(core::vector3df(180));


I have also tried out the RealisticWaterSceneNode but having an even worse time with that since I am missing something in setting it up and keep getting an
'undefined reference to 'RealisticWaterSceneNode'. Here is the code I have for that:
RealisticWaterSceneNode* Water=new RealisticWaterSceneNode(smgr, 3600.0f, 600.0f,
driver->getTexture("data/waterbump.png"),device->getTimer());

(and no I am not trying them at the same time)

Thanks to anyone willing to take time to help a fumbling noob.

Posted: Fri Sep 11, 2009 11:27 am
by JP
with the realistic water node it sounds like you're not linking to the file containing the water node class.. Have you added it into your project correctly? it needs to appear in your IDE listed with the other files in your project.

with the irrlicht water node just use the debugger to show you the line that's crashing, maybe the node 'water' is NULL and so you then dereference it causing a crash.

Posted: Fri Sep 11, 2009 12:16 pm
by Chet
Yes the realisticwaternode file is in the project and the header file is properly included. That file at least compiles ok, I suspect I am missing something in defining it.

I'll try the debugger (soon as I figure out how :D)

Edit1:
:(
It seems to be a system problem
---------------
Debugger name and version: GNU gdb 6.7.50.20071127
Child process PID: 1992
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!DbgUiConnectToDbg () (D:\WINDOWS\System32\ntdll.dll)
---------------------

I replaced the dll in case I had a corrupted one and rebooted with the same results.

Edit2:
I talked the realisticwaterSceneNode into working somehow, except all I get now is a black screen ....

Edit3: black screen solved - sorry no idea how either.

Posted: Sat Sep 19, 2009 5:02 am
by Yoshiko
How to write it in irrXML?
I tried like this:

Code: Select all

	<node type="waterSurface">

		<attributes>
			<string name="Name" value="" />
			<int name="Id" value="-1" />
			<vector3d name="Position" value="0.000000, 10.000000, 10.000000" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
			<bool name="Visible" value="true" />
			<enum name="AutomaticCulling" value="box" />
			<int name="DebugDataVisible" value="0" />
			<bool name="IsDebugObject" value="false" />
			<float name="waveHeight " value="2.000000" />
			<float name="waveSpeed " value="200.000000" />
			<float name="waveLength " value="10.000000" />
		</attributes>

		<materials>
			<attributes>
				...
			</attributes>
		</materials>
	</node>
But nothing.

Posted: Wed Sep 23, 2009 8:00 am
by Yoshiko
I realized - I need a Preloaded mesh! ...
Something like this:

Code: Select all

	<node type="animatedMesh">

		<attributes>
			<string name="Name" value="water_mesh" />
			<int name="Id" value="-1" />
			<vector3d name="Position" value="0.000000, -10.000000, 0.000000" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
			<bool name="Visible" value="true" />
			<enum name="AutomaticCulling" value="box" />
			<int name="DebugDataVisible" value="0" />
			<bool name="IsDebugObject" value="false" />
			<string name="Mesh" value="../../media/water_mesh.MD3" />
			<bool name="ReadOnlyMaterials" value="false" />
		</attributes>

		<materials>
			<attributes>
				...
			</attributes>
		</materials>
	</node>

	<node type="waterSurface">

		<attributes>
			<float name="WaveLength" value="30.000000" />
			<float name="WaveSpeed" value="300.000000" />
			<float name="WaveHeight" value="3.000000" />
			<string name="Name" value="water" />
			<int name="Id" value="-1" />
			<vector3d name="Position" value="0.000000, -10.000000, 0.000000" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
			<bool name="Visible" value="true" />
			<enum name="AutomaticCulling" value="box" />
			<int name="DebugDataVisible" value="0" />
			<bool name="IsDebugObject" value="false" />
			<string name="Mesh" value="water_mesh" />
			<bool name="ReadOnlyMaterials" value="false" />
		</attributes>

		<materials>
			<attributes>
				...
			</attributes>
		</materials>
	</node>

And... nothing