mamairaja
01-01-2011 14:05:30
First I wish a very happy new year to betajaen, spacegaier and nxogre users
Today I have tried Some heightfield operation with nxogre. (code from wiki article
http://www.ogre3d.org/tikiwiki/tiki-index.php?page=BloodyMess+Ogre::Terrain+Heightfield)
problem found when it comes to
NxOgre::HeightField *hf = mhf.end(name.c_str());
I am using Buggy Swires.
P.S. - please note that i have edited the original code
NxOgre::ManualHeightField *mhf = OGRE_NEW_T(NxOgre::ManualHeightField, Ogre::MEMCATEGORY_GENERAL)();
to stack mem
NxOgre::ManualHeightField mhf;
because it gave me a compile error
Could you please provide a clue?
Thank you
~mamairaja
mamairaja
01-01-2011 15:10:19
Curious to ask
NxOgre::ManualHeightField::end(...);
function requires Path& parameter, and I am providing string "OgreTerrain/1114696642".
What does this parameter means?
Here, do I need to do something with Nxogre resource system?
~mamairaja
betajaen
01-01-2011 15:28:20
Yep.
Don't give it anything, or tell it to cook to a file; "file://myheightfield.xm"
mamairaja
01-01-2011 19:06:41
I thank you for replying
Yep.
Don't give it anything, or tell it to cook to a file; "file://myheightfield.xm"
have a little problem with understanding.
Does this mean keep it blank all the time ( mhf.end() ) and even don't try anything like mhf.end("file://myheightfield.xm") ?
I have tried both ways but problem still comes.
BTW, from where i can find if these lines are printed? Took them from NxOgre::ManualHeightField::end
NxOgre_DebugPrint_HeightFields("ManualHeightField -- end");
NxOgre_DebugPrint_HeightFields("Attempting to cook to resource");
NxOgre_DebugPrint_HeightFields("Attempting to read heightfield.");
betajaen
01-01-2011 20:12:17
warkanum
02-01-2011 13:30:40
I have the exact same problem since I switched to Buggy Swires. If you find a solution, please post.
My code where crash happens:
NxOgre::ManualHeightField mhf;
mhf.begin(size, size);
Ogre::Real normMin = -32768.0f;
Ogre::Real normMax = 32767.0f;
for(int x = 0; x < size; ++x)
{
NxOgre::Enums::HeightFieldTesselation tess = NxOgre::Enums::HeightFieldTesselation_NW_SE;
for(int z = size-1; z >= 0; --z)
{
Ogre::Real height = data[(size * z) + x];
short sample = (short)(((height - minHeight) / (maxHeight - minHeight)) * (normMax - normMin) + normMin);
mhf.sample(sample, 0, 0, tess);
if(tess == NxOgre::Enums::HeightFieldTesselation_NE_SW)
tess = NxOgre::Enums::HeightFieldTesselation_NW_SE;
else
tess = NxOgre::Enums::HeightFieldTesselation_NE_SW;
}
}
CRASH HERE:
NxOgre::HeightField *hf = mhf.end("ogre://Terrain/physheightfieldcache.xm");
OR
NxOgre::HeightField *hf = mhf.end("");
By the way, betajaen, I really like new nxogre and character controllers. Nice job and thanks.
betajaen
02-01-2011 14:02:04
Alright. I'll see if I can replicate the problem.
betajaen
02-01-2011 20:27:00
Okay, it seems to be the Memory Resource class. For now, switch to use file protocol, and it should work then.
i.e.
#include "NxOgre.h"
void main()
{
NxOgre::World* world = NxOgre::World::createWorld();
NxOgre::ManualHeightField hf;
hf.begin(8,8);
for (size_t i=0;i < 8;i++)
{
for (size_t j=0;j < 8;j++)
{
hf.sample(i + (j*8));
}
}
NxOgre::HeightField* h = hf.end(true, "file://test.xm");
NxOgre::World::destroyWorld();
}
I'll try and investigate the exact cause.
[Edit]
Other things like the ManualMesh will have a similar crash if you use "memory://", just switch to "file://whatever" and it'll be good to go.
betajaen
03-01-2011 11:19:05
Once you have the heightfield cooked to a file, there is no need to cook it again. You can just load it in now instead.
warkanum
03-01-2011 19:31:47
Indeed, I find cooking it and using it that way much better. I think the problem is solved, well for the forum thread anyway. Did you find the cause of that memory problem?
betajaen
03-01-2011 19:38:51
No, I haven't investigated it yet.
It's a heap corruption, so it's likely to be in the MemoryResource::write function. I'm likely to replace the internals with a buffer, instead of the "home brew" I have there. My Buffer class is more reliable and tested.
mamairaja
07-01-2011 11:54:49
Oh...
My own question answered without any notification to me.
Thanks betajaen
yes it works
thanx
betajaen
08-01-2011 18:36:39
Think I fixed "memory://"
It's on the latest BuggySwires (Lemonade), if anyone is willing to try it out.
mamairaja
09-01-2011 08:00:23
Yes sir,
works great.
One more thing new nexogre seems to be require all physx prefixed dlls (eg - PhysXCooking.dll) in the same debug/release folder
otherwise
mWorld = NxOgre::World::createWorld();
gives runtime error
i am using physx 2.8.4.4
Thank you for the help
[edit]probably it's not nxogre requirement, it's physx requirement[/edit]
betajaen
09-01-2011 10:16:49
Yeah, I get it too. It's a pain. I wish Nvidia would update their SystemSoftware to include them.