Page 1 of 1

How I can start in the center of my mesh?

Posted: Mon Nov 03, 2008 11:59 pm
by Gideon
How?

Posted: Tue Nov 04, 2008 1:11 am
by Acki
I think you mean node, not mesh... :lol:
you can try it with:

Code: Select all

vector3df cntr = node->getBoundingBox().getCenter();
but I doubt that is what you want... ;)
it's not that easy though, because a mesh usually is more complex... ;)

Posted: Tue Nov 04, 2008 1:50 am
by Gideon
All good yet, but I have again the problem.
Look:
From above:
Image
From below:
Image
Whay is it?

Posted: Tue Nov 04, 2008 2:24 am
by Acki
Gideon wrote:What is it?
I don't know, tell me what you expect and what you get...

Posted: Tue Nov 04, 2008 2:40 am
by Gideon
This is a *.b3d world. It's like good in the Gile[s] and 3ds Max, but when I have load it... i see this.

Posted: Tue Nov 04, 2008 2:52 am
by vitek
It looks to me like the normals are on the wrong sides of the resulting mesh. I don't know if this is a problem in the mesh itself or if it is a problem with the reader code.

Posted: Tue Nov 04, 2008 3:07 am
by Gideon
Code:

Code: Select all

#include <irrlicht.h>
#include <iostream>

using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

int main()
{
        IrrlichtDevice *device =
                createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480));

        if (device == 0)
                return 1; 
        video::IVideoDriver* driver = device->getVideoDriver();
        scene::ISceneManager* smgr = device->getSceneManager();
        device->getFileSystem()->addZipFileArchive("../../media/mapppeZ!.zip");
        scene::IAnimatedMesh* mesh = smgr->getMesh("ee.b3d");
        scene::ISceneNode* node = 0;
        if (mesh)
                node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -11, 12);
        if (node)
                node->setPosition(core::vector3df(0,-1,0));
        smgr->addSkyBoxSceneNode( 
                                  driver->getTexture("../../media/irrlicht2_up.jpg"), 
                                  driver->getTexture("../../media/irrlicht2_dn.jpg"), 
                                  driver->getTexture("../../media/irrlicht2_lf.jpg"), 
                                  driver->getTexture("../../media/irrlicht2_rt.jpg"), 
                                  driver->getTexture("../../media/irrlicht2_ft.jpg"), 
                                  driver->getTexture("../../media/irrlicht2_bk.jpg"));
        scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f); 
        cam->setPosition(core::vector3df(0,0,0)); 
        cam->setTarget(core::vector3df(0,0,0));
        smgr->addCameraSceneNodeFPS();
        device->getCursorControl()->setVisible(false);
        int lastFPS = -1;
        
        while(device->run())
        {
                if (device->isWindowActive())
                {
                        driver->beginScene(true, true, video::SColor(255,200,200,200));
                        smgr->drawAll();
                        driver->endScene();

                        int fps = driver->getFPS();

                        if (lastFPS != fps)
                        {
                                core::stringw str = L"gently caress!!!!!!!!!";
                                str += driver->getName();
                                str += " | FPS:";
                                str += fps;

                                device->setWindowCaption(str.c_str());
                                lastFPS = fps;
                        }
                }
                else
                        device->yield();
        }
        device->drop();
        return 0;
}

Posted: Tue Nov 04, 2008 8:33 am
by JP
is that even vaguely like it should look?

it's probably nothing to do with normals as normals are just used for lighting and this clearly isn't a lighting issue.

more likely the triangles are wound the wrong way round so they're facing the opposite direction to where they should be facing. so you've probably got backface culling turned on so you don't see the backs of the triangles which in this case you would want to, you can change this parameter in irredit under the materials section. but of course for efficiency's sake you'd want backface culling on and for the triangles to be wound correctly, which would have to be sorted out in your modelling program.

Posted: Tue Nov 04, 2008 9:59 am
by Gideon
In the IrrEdit I have seen the same. Where the "face" function in IrrEdit? I did not found it.

Posted: Tue Nov 04, 2008 10:06 am
by JP
Sorry i thought you were using irredit but you're not (or not in the screenshots anyway), it's not necessary to use irredit for this but you can do. it's in the materials tab of the node, bottom left when you have the correct node selected, scroll down a bit and there's a tick box to turn back face culling on or off.

In irrlicht though you can set it like this:

node->setMaterialFlag(video::EMF_BACKFACE_CULL, false);

I think that's the right enum, you might have to check the API if it doesn't compile!

Posted: Tue Nov 04, 2008 10:20 am
by Gideon
This is not work...
The compiler write me:
`EMF_BACKFACE_CULL' is not a member of `irr::video'
:(
Why?..8(
P.S. May be use in 3ds Max the Modyfi "Normal"?

Posted: Tue Nov 04, 2008 10:38 am
by JP
It's not working because you didn't read the last line of my post... :roll:

Posted: Tue Nov 04, 2008 11:02 am
by Gideon
Sorry, man. But I did not find in your post the answer on my qestion... :cry: Don't damage me, please... :roll:
I speak English very-very bad...=( What I must do?

Posted: Tue Nov 04, 2008 11:19 am
by JP
Read the documentation/API to find out the correct enum to use. Maybe it's EMF_BACK_FACE_CULL.

Posted: Tue Nov 04, 2008 12:07 pm
by Gideon
Thank's, man. I can complited my world and I very happy now=) Biiiigggest thank's! :P