#0 

30-12-2010 16:22:29

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

Bonjours, voila mon problème dans mon programme je n'utilise pas de lumière, je compile le programme et le lance résultat plantage du programme inexpliquée, bon je lance le debug et voici se qu'il me rend :

#0 6353A059    irr::video::CNullDriver::addDynamicLight() (C:\Users\Ducler Stephane\Desktop\Langage C et C++\Stargate Resurrection\Irrlicht.dll:??)
#1 63574552    irr::video::COpenGLDriver::addDynamicLight() (C:\Users\Ducler Stephane\Desktop\Langage C et C++\Stargate Resurrection\Irrlicht.dll:??)
#2 00000000    0x00401b12 in ??() (??:??)
#3 00000000    0x003e5ef0 in ??() (??:??)
#4 00000000    0x00000010 in ??() (??:??)
#5 00000000    0x00000000 in ??() (??:??)

donc si je sais bien lire et que j'ai pas sauter des lignes quand j'ai essayer de le débugger, il y a un problème dans la dll hors quand je l'utilise dans un autre programme sa, sa marche donc bon.
voila mon code:

Code:

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

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(1024, 768), 32,false, false, false);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();

IAnimatedMesh* glif[36], *modele, *stargate, *kawosh, *sol;
IAnimatedMesh* chevronI1, *chevronI2, *chevronI3, *chevronI4, *chevronI5, *chevronI6, *chevronI7, *event, *event_back;
IAnimatedMesh* chevronA1, *chevronA2, *chevronA3, *chevronA4, *chevronA5, *chevronA6, *chevronA7;

IAnimatedMeshSceneNode* gliff[36], *Nmodele, *world, *eh, *eh_b, *kawoosh, *sool;
IAnimatedMeshSceneNode* chI1, *chI2, *chI3, *chI4, *chI5, *chI6, *chI7;
IAnimatedMeshSceneNode* chA1, *chA2, *chA3, *chA4, *chA5, *chA6, *chA7;

ITriangleSelector* selector = 0;
ITriangleSelector* selector1 = 0;
scene::IMetaTriangleSelector *metaSelector;

scene::ISceneNode* hitNode;

ITexture* eht[9];

ICameraSceneNode *camera;

IParticleSystemSceneNode* particleSystem;
IParticleAnimatedMeshSceneNodeEmitter* emitter;

int i = 0;

int vitesse = 1000;
float step=0.0f;

float time=(irr::f32)device->getTimer()->getTime() / 1000.0f,oldtime,deltaTime;

class MyEventReceiver : public IEventReceiver
{
public:
        // This is the one method that we have to implement
        virtual bool OnEvent(const SEvent& event)
        {
                // Remember whether each key is down or up
                if (event.EventType == irr::EET_KEY_INPUT_EVENT)
                        KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;

                return false;
        }

        // This is used to check whether a key is being held down
        virtual bool IsKeyDown(EKEY_CODE keyCode) const
        {
                return KeyIsDown[keyCode];
        }

        MyEventReceiver()
        {
                for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
                        KeyIsDown[i] = false;
        }

private:
        // We use this array to store the current state of each key
        bool KeyIsDown[KEY_KEY_CODES_COUNT];
};

void chargement()
{
    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
    ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("Data/sky/skydome.jpg"),16,8,0.95f,2.0f);
    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

    stargate = smgr->getMesh("Data/gate sga/stargate sga.b3d");
    world = smgr->addAnimatedMeshSceneNode(stargate);

    camera = smgr->addCameraSceneNodeFPS(0, 100.0f, 0.5f, 0, 0, 0, true, 3);
    camera->setFarValue(7000);
    camera->setNearValue(0.1f);

    modele = smgr->getMesh("Data/p90/p90.b3d");
    Nmodele = smgr->addAnimatedMeshSceneNode(modele,camera);
    Nmodele->setVisible(false);

    sol = smgr->getMesh("Data/finca/finca.b3d");
    sool = smgr->addAnimatedMeshSceneNode(sol);

    kawosh = smgr->getMesh("Data/eh/kawoosh.b3d");
    kawoosh = smgr->addAnimatedMeshSceneNode(kawosh,world);

    world->setPosition(vector3df(0,128,700));
    world->setRotation(vector3df(0,90,0));
    event = smgr->getMesh("Data/eh/eventHorizon.b3d");
    eh = smgr->addAnimatedMeshSceneNode(event, world);

    eh->setRotation(vector3df(0,180,0));
    eh->setScale(vector3df(1,1.1f,1.2f));

    event_back = smgr->getMesh("Data/eh/eventHorizon.b3d");

    eh_b = smgr->addAnimatedMeshSceneNode(event, world);
    eh_b->setScale(vector3df(1,1.1f,1.2f));
    eh_b->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);

    chevronI1 = smgr->getMesh("Data/chevronI/sga_chevron1.b3d");
    chevronI2 = smgr->getMesh("Data/chevronI/sga_chevron2.b3d");
    chevronI3 = smgr->getMesh("Data/chevronI/sga_chevron3.b3d");
    chevronI4 = smgr->getMesh("Data/chevronI/sga_chevron4.b3d");
    chevronI5 = smgr->getMesh("Data/chevronI/sga_chevron5.b3d");
    chevronI6 = smgr->getMesh("Data/chevronI/sga_chevron6.b3d");
    chevronI7 = smgr->getMesh("Data/chevronI/sga_chevron7.b3d");

    chevronA1 = smgr->getMesh("Data/chevronA/sga_chevron1.b3d");
    chevronA2 = smgr->getMesh("Data/chevronA/sga_chevron2.b3d");
    chevronA3 = smgr->getMesh("Data/chevronA/sga_chevron3.b3d");
    chevronA4 = smgr->getMesh("Data/chevronA/sga_chevron4.b3d");
    chevronA5 = smgr->getMesh("Data/chevronA/sga_chevron5.b3d");
    chevronA6 = smgr->getMesh("Data/chevronA/sga_chevron6.b3d");
    chevronA7 = smgr->getMesh("Data/chevronA/sga_chevron7.b3d");

    chI1 = smgr->addAnimatedMeshSceneNode(chevronI1, world);
    chI2 = smgr->addAnimatedMeshSceneNode(chevronI2, world);
    chI3 = smgr->addAnimatedMeshSceneNode(chevronI3, world);
    chI4 = smgr->addAnimatedMeshSceneNode(chevronI4, world);
    chI5 = smgr->addAnimatedMeshSceneNode(chevronI5, world);
    chI6 = smgr->addAnimatedMeshSceneNode(chevronI6, world);
    chI7 = smgr->addAnimatedMeshSceneNode(chevronI7, world);

    chA1 = smgr->addAnimatedMeshSceneNode(chevronA1, world);
    chA2 = smgr->addAnimatedMeshSceneNode(chevronA2, world);
    chA3 = smgr->addAnimatedMeshSceneNode(chevronA3, world);
    chA4 = smgr->addAnimatedMeshSceneNode(chevronA4, world);
    chA5 = smgr->addAnimatedMeshSceneNode(chevronA5, world);
    chA6 = smgr->addAnimatedMeshSceneNode(chevronA6, world);
    chA7 = smgr->addAnimatedMeshSceneNode(chevronA7, world);

    glif[0] = smgr->getMesh("Data/gate sga/sga-inc_active1.b3d");
    glif[1] = smgr->getMesh("Data/gate sga/sga-inc_active2.b3d");
    glif[2] = smgr->getMesh("Data/gate sga/sga-inc_active3.b3d");
    glif[3] = smgr->getMesh("Data/gate sga/sga-inc_active4.b3d");
    glif[4] = smgr->getMesh("Data/gate sga/sga-inc_active5.b3d");
    glif[5] = smgr->getMesh("Data/gate sga/sga-inc_active6.b3d");
    glif[6] = smgr->getMesh("Data/gate sga/sga-inc_active7.b3d");
    glif[7] = smgr->getMesh("Data/gate sga/sga-inc_active8.b3d");
    glif[8] = smgr->getMesh("Data/gate sga/sga-inc_active9.b3d");
    glif[9] = smgr->getMesh("Data/gate sga/sga-inc_active10.b3d");
    glif[10] = smgr->getMesh("Data/gate sga/sga-inc_active11.b3d");
    glif[11] = smgr->getMesh("Data/gate sga/sga-inc_active12.b3d");
    glif[12] = smgr->getMesh("Data/gate sga/sga-inc_active13.b3d");
    glif[13] = smgr->getMesh("Data/gate sga/sga-inc_active14.b3d");
    glif[14] = smgr->getMesh("Data/gate sga/sga-inc_active15.b3d");
    glif[15] = smgr->getMesh("Data/gate sga/sga-inc_active16.b3d");
    glif[16] = smgr->getMesh("Data/gate sga/sga-inc_active17.b3d");
    glif[17] = smgr->getMesh("Data/gate sga/sga-inc_active18.b3d");
    glif[18] = smgr->getMesh("Data/gate sga/sga-inc_active19.b3d");
    glif[19] = smgr->getMesh("Data/gate sga/sga-inc_active20.b3d");
    glif[20] = smgr->getMesh("Data/gate sga/sga-inc_active21.b3d");
    glif[21] = smgr->getMesh("Data/gate sga/sga-inc_active22.b3d");
    glif[22] = smgr->getMesh("Data/gate sga/sga-inc_active23.b3d");
    glif[23] = smgr->getMesh("Data/gate sga/sga-inc_active24.b3d");
    glif[24] = smgr->getMesh("Data/gate sga/sga-inc_active25.b3d");
    glif[25] = smgr->getMesh("Data/gate sga/sga-inc_active26.b3d");
    glif[26] = smgr->getMesh("Data/gate sga/sga-inc_active27.b3d");
    glif[27] = smgr->getMesh("Data/gate sga/sga-inc_active28.b3d");
    glif[28] = smgr->getMesh("Data/gate sga/sga-inc_active29.b3d");
    glif[29] = smgr->getMesh("Data/gate sga/sga-inc_active30.b3d");
    glif[30] = smgr->getMesh("Data/gate sga/sga-inc_active31.b3d");
    glif[31] = smgr->getMesh("Data/gate sga/sga-inc_active32.b3d");
    glif[32] = smgr->getMesh("Data/gate sga/sga-inc_active33.b3d");
    glif[33] = smgr->getMesh("Data/gate sga/sga-inc_active34.b3d");
    glif[34] = smgr->getMesh("Data/gate sga/sga-inc_active35.b3d");
    glif[35] = smgr->getMesh("Data/gate sga/sga-inc_active36.b3d");

    for(int i = 0; i <= 35; i++)
    {
        gliff[i] = smgr->addAnimatedMeshSceneNode(glif[i],world);
        gliff[i]->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
    }


    chI1->setMaterialFlag(EMF_LIGHTING, false);
    chI2->setMaterialFlag(EMF_LIGHTING, false);
    chI3->setMaterialFlag(EMF_LIGHTING, false);
    chI4->setMaterialFlag(EMF_LIGHTING, false);
    chI5->setMaterialFlag(EMF_LIGHTING, false);
    chI6->setMaterialFlag(EMF_LIGHTING, false);
    chI7->setMaterialFlag(EMF_LIGHTING, false);

    chA1->setMaterialFlag(EMF_LIGHTING, false);
    chA2->setMaterialFlag(EMF_LIGHTING, false);
    chA3->setMaterialFlag(EMF_LIGHTING, false);
    chA4->setMaterialFlag(EMF_LIGHTING, false);
    chA5->setMaterialFlag(EMF_LIGHTING, false);
    chA6->setMaterialFlag(EMF_LIGHTING, false);
    chA7->setMaterialFlag(EMF_LIGHTING, false);

    Nmodele->setPosition(Nmodele->getPosition() + vector3df(4.2f,0,-2.5f));
    Nmodele->setFrameLoop(30,60);

    kawoosh->setVisible(false);
    kawoosh->setFrameLoop(1,104);
    kawoosh->setAnimationSpeed(0);

    particleSystem = smgr->addParticleSystemSceneNode(false, world, 0, vector3df(15,0,0));

    emitter = particleSystem->createAnimatedMeshSceneNodeEmitter(kawoosh, true,vector3df(0,0,0),1000,-1,false,2800,3000,SColor(255,200,200,255),SColor(255,180,180,255),150,150,10,dimension2df(30, 30),dimension2df(45, 45));
    particleSystem->setEmitter(emitter);

    particleSystem->setVisible(false);

    particleSystem->setMaterialFlag(irr::video::EMF_ZWRITE_ENABLE, false);     // desactive zbuffer pour surfaces derriere
    particleSystem->setMaterialTexture(0, driver->getTexture("Data/eh/particule_eh.bmp"));     // on colle une texture
    particleSystem->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);

    sool->setAutomaticCulling ( scene::EAC_BOX );
    world->setAutomaticCulling ( scene::EAC_FRUSTUM_SPHERE);

    selector = smgr->createOctreeTriangleSelector(sool->getMesh(), sool, 0);
    sool->setTriangleSelector(selector);
    selector1 = smgr->createOctreeTriangleSelector(world->getMesh(), world, 0);
    world->setTriangleSelector(selector1);

    metaSelector = smgr->createMetaTriangleSelector();
    metaSelector->addTriangleSelector(selector);
    metaSelector->addTriangleSelector(selector1);

    scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
                                          metaSelector, camera, core::vector3df(20,10,20),
                                          core::vector3df(0,-10,0),
                                          core::vector3df(0,50,0));

    metaSelector->drop();
    camera->addAnimator(anim);
    anim->drop();

    camera->setPosition(vector3df(500,100,0));
}

void chargevent()
{
    ISceneNodeAnimator *anim;

    core::array<video::ITexture*> textures;
    for (s32 g=1; g<20; ++g)
    {
        char tmp[64];
        sprintf(tmp, "Data/eh/eh/eh%d.png", g);
        video::ITexture* t = driver->getTexture(tmp);
        textures.push_back(t);
    }

    anim = smgr->createTextureAnimator(textures, 100);
    eh->addAnimator(anim);
    eh_b->addAnimator(anim);
}

void gate_idle()
{
    eh->setVisible(false);
    eh_b->setVisible(false);
    for(s32 i = 0; i < 36; i++)
    {
        gliff[i]->setVisible(false);
    }
}

void incoming()
{
    bool active = false;

    if (device->getTimer()->getTime () - vitesse > 160 && i <= 35)
    {
        gliff[i]->setVisible(true);
        if(i>0)
        {
            gliff[i-1]->setVisible(false);
        }
        i = i + 1;
        vitesse = device->getTimer()->getTime ();
    }

    if(i >= 36)
    {
        active = true;
    }
    if(active == true)
    {
        eh->setVisible(true);
        eh_b->setVisible(true);
        kawoosh->setAnimationSpeed(30);
        particleSystem->setVisible(true);
        if(kawoosh->getFrameNr() >= 96)
        {
            particleSystem->setVisible(false);
            kawoosh->setAnimationSpeed(0);
        }
    }
}

int main(int argc, char** argv)
{
    bool active = false;
    MyEventReceiver receiver;
    device->setEventReceiver(&receiver);
    chargement();
    chargevent();
    gate_idle();
    emitter->drop();

    wchar_t titre[100];

    while(device->run())
    {
        oldtime = time;
        time = (irr::f32)device->getTimer()->getTime() / 1000.0f;
        deltaTime = time - oldtime;

        if(receiver.IsKeyDown(KEY_KEY_C))
        {
            active = true;
        }

        if(active == true)
        {
            incoming();
        }

        swprintf(titre, L"FPS : %d", driver->getFPS());
        device->setWindowCaption(titre);

        driver->beginScene(true, true, SColor(0,0,0,0));

        smgr->drawAll();

        driver->endScene();
    }
    device->drop();

    return 0;
}

j'aurais aimer avoir votre aide.

Hors ligne


#1 

30-12-2010 17:30:25

Magun
SleekThink Producer
Lieu: Punakha
Date d'inscription: 18-11-2007
Messages: 910
Corrections: 2
Site web

je ne veut pas être méchant mais c'est super mal coder smile
tu initialise beaucoup de variable en dehord du main ou d'une fonction oui cela marche mais tu prend de mauvaise habitude
si tu doit initialiser des variable "global", se sont en rêgle général des const char*, sinon c'est a éviter

je pensse que tu devrait réorganisé ton code (des class notament),
pour ton problème, essaye de recompiller irrlicht voir le metre à jours, si ce n'est pas ça je dirais que c'est ton code
je les survoler et effectivement tu n'utilise pas de light, recompile en debug avec le code profiling ( -g + -pg )

Hors ligne


#2 

30-12-2010 17:46:27

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

je sais que je code tres mal, demain je refait en entier le code donc je corrigerais cela, merci et pour recompiler irrlicht se sera demain aussi.

Hors ligne


#3 

30-12-2010 20:21:02

TUpac
Habitué
Date d'inscription: 08-09-2009
Messages: 387
Corrections: 1

+1 Magun !!
La première chose à apprendre c'est le debugger !!!
Après c'est magique on se dépatouille tout seul wink


"Si vous ne partagez pas votre stabilité avec les pauvres, les pauvres partageront leur instabilité avec vous."

Hors ligne


#4 

30-12-2010 23:28:29

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

d'accords de toute façon je devait reprendre le code sa est juste pour tester les modeles de la porte des étoiles.

Hors ligne


Options Liens officiels Caractéristiques Statistiques Communauté
Corrections
irrlicht
irrklang
irredit
irrxml
xhtml 1.0
css 2.1
Propulsé par FluxBB
Traduit par FluxBB.fr
882 membres
1429 sujets
11119 messages
Dernier membre inscrit: LiseBuisson96
41 invités en ligne
Aucun membre connecté
RSS Feed