Real time Loading

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Unforgivable.Course
Posts: 46
Joined: Tue Feb 07, 2006 6:28 pm

Real time Loading

Post by Unforgivable.Course »

hi

i try to load an IAnimatedMeshSceneNode with a function in main loop . it loaded but i cann't see that . if i try to load it befor starting the main loop it loaded success and i can see that very good .

well , what's problem ??
Get Ready For an Amazing Journey Into the World of Game Development
Ced666
Posts: 86
Joined: Fri Jan 13, 2006 10:29 am
Location: Belgium

Post by Ced666 »

it loaded but i cann't see that
What do you mean ? How did you check that it was loaded ? And what is the problem ?

Post code also so we can see what you are doing wrong.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I cannot imagine what that code would really look like, but according to your description you're loading the mesh it time again. This would block the complete render such that you'll get only a frame per minute or so. Try to keep the main loop free from most things. Preload things or react on events.
Unforgivable.Course
Posts: 46
Joined: Tue Feb 07, 2006 6:28 pm

Post by Unforgivable.Course »

it's my function for loading the character :

Code: Select all

void LoadDarren(vector3df DarrenPos,vector3df DarrenRot)
{

	if (Body) Body->remove();

	IAnimatedMesh *BodyMesh = smgr->getMesh("./Models/sydney.md2");
	Body = 0;
	Body = smgr->addAnimatedMeshSceneNode(BodyMesh,0);
	Body->setPosition(DarrenPos);
	Body->setRotation(DarrenRot);
	Body->setScale(vector3df(2,2,2));
	Body->setMaterialFlag(EMF_LIGHTING,false);
	Body->setMaterialTexture(0,driver->getTexture("./Models/sydney.bmp")); // Must Be Removed in Originally Source
	Body->setAnimationSpeed(40);
	
	ISceneNodeAnimator* anim =
    smgr->createCollisionResponseAnimator(
		selector, Body, vector3df(30,50,30),
		core::vector3df(0,-1,0),
		core::vector3df(0,0,0));

	Body->addAnimator(anim);
	anim->drop();
	
}
i know that character loaded because in DOS Console i saw : Loaded Mesh : sydney.md2 ....

i can use this function only befor starting main loop . i tested it in every situation . what's your idea ?
Get Ready For an Amazing Journey Into the World of Game Development
xterminhate
Posts: 206
Joined: Thu Sep 01, 2005 9:26 pm
Location: France

Post by xterminhate »

check the position of the node you're loading... maybe it is out of range of the camera.
Return to Irrlicht after years... I'm lovin it.
It's hard to be a Man !
Si vis pacem para belum
Ced666
Posts: 86
Joined: Fri Jan 13, 2006 10:29 am
Location: Belgium

Post by Ced666 »

Show the code of both situations where you are calling this function. And check the solution of hybrid too (did you miss it ?).
Unforgivable.Course
Posts: 46
Joined: Tue Feb 07, 2006 6:28 pm

Post by Unforgivable.Course »

i just try calling this function in main loop one time . i limit it with if and one boolean variable . do you have any solutions ??
Get Ready For an Amazing Journey Into the World of Game Development
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Not without seeing the code. Might be a wrong initialization. Do you mean a main loop, or the main function? Please post the code including the working version.
Unforgivable.Course
Posts: 46
Joined: Tue Feb 07, 2006 6:28 pm

Post by Unforgivable.Course »

my mean is main LOOP . look , it's another function that call LoadDarren() :


Code: Select all

void Game_Level1()
{
if (!Level1_Repeat) {
// This part only one time will execute
LoadDarren(vector3df(0,50,0),vector3df(0,100,0));
Level1_Repeat = true;
}
// [Level1 Loop]
SetCamera(vector3df(100,400,10),vector3df(0,0,0),vector3df(0,0,0));

// [/Level1 Loop]

}
write this function with LoadDarren() (in before post) in another cpp file and Include that file in irrlicht main cpp file . use Game_Level1() in Main loop and then before the main loop and see the result .

Note that define these variables in global (usually upper than functions ) :


Code: Select all

IAnimatedMeshSceneNode* Body;
IVideoDriver* driver = 0; ISceneManager* smgr = 0; IGUIEnvironment* env = 0;
bool Repeat,Level1_Repeat;

now please say me what's this problem ??
Get Ready For an Amazing Journey Into the World of Game Development
Post Reply