Real time Loading
-
Unforgivable.Course
- Posts: 46
- Joined: Tue Feb 07, 2006 6:28 pm
Real time Loading
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 ??
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
-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
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
it's my function for loading the character :
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 ?
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 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
-
Unforgivable.Course
- Posts: 46
- Joined: Tue Feb 07, 2006 6:28 pm
-
Unforgivable.Course
- Posts: 46
- Joined: Tue Feb 07, 2006 6:28 pm
my mean is main LOOP . look , it's another function that call LoadDarren() :
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 ) :
now please say me what's this problem ??
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]
}
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;
Get Ready For an Amazing Journey Into the World of Game Development