Historique des modifications - Message

Message #11788

Sujet: Changer la coloration de la texture d'une skybox


TypeDateAuteurContenu
Dernière modification07-05-2017 00:07:05jonath313
Merci Magun pour tas réponse.
Par contre en ce qui concerne les shaders je suis au niveau 0.
Je ne vois pas comment çà s'utilise, peux tu m'expliquer tas premiére solution stp ?

En attendant, j'ai essayé de tester la deuxième solution qui me parait plus gourmande :

Code c++ :


    /// Chargement texture du MATIN
    ITexture *SkyBoxTO_Mat = driver->getTexture ("media/map/summer_day1/matin_6.jpg"); // top
    ITexture *SkyBoxBO_Mat = driver->getTexture ("media/map/summer_day1/matin_5.jpg"); // bottom
    ITexture *SkyBoxLE_Mat = driver->getTexture ("media/map/summer_day1/matin_4.jpg"); // left
    ITexture *SkyBoxRI_Mat = driver->getTexture ("media/map/summer_day1/matin_2.jpg"); // right
    ITexture *SkyBoxFR_Mat = driver->getTexture ("media/map/summer_day1/matin_1.jpg"); // front
    ITexture *SkyBoxBK_Mat = driver->getTexture ("media/map/summer_day1/matin_3.jpg"); // back

    int color_alpha = 0;
    int color_red   = 255;
    int color_green = 0;
    int color_blue  = 0;

    char* tmp = (char*)SkyBoxTO_Mat->lock();
    for(int x = 0; x<SkyBoxTO_Mat->getSize().Width; x += 4) 
    {
          for(int y = 0; y<SkyBoxTO_Mat->getSize().Height; ++y) 
          {
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 0] *= color_alpha;
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 1] *= color_red;
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 2] *= color_green;
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 3] *= color_blue;
          }
     }
    SkyBoxTO_Mat->unlock();

    /// Creation de la skybox du MATIN
    MapItems.skybox[skyboxMatin_e] = smgr->addSkyBoxSceneNode((ITexture *)tmp, SkyBoxBO_Mat,SkyBoxLE_Mat,SkyBoxRI_Mat,SkyBoxFR_Mat,SkyBoxBK_Mat,0,-1);



Et çà ne fonctionne pas, mon programme compile mais plante littéralement. J'ai fais une erreur ?
Création du message06-05-2017 23:27:13jonath313
Merci Magun pour tas réponse.
Par contre en ce qui concerne les shaders je suis au niveau 0.
Je ne vois pas comment çà s'utilise, peux tu m'expliquer tas premiére solution stp ?

En attendant, j'ai essayé de tester la deuxième solution qui me parait plus gourmande :

Code c++ :


    /// Chargement texture du MATIN
    ITexture *SkyBoxTO_Mat = driver->getTexture ("media/map/summer_day1/matin_6.jpg"); // top
    ITexture *SkyBoxBO_Mat = driver->getTexture ("media/map/summer_day1/matin_5.jpg"); // bottom
    ITexture *SkyBoxLE_Mat = driver->getTexture ("media/map/summer_day1/matin_4.jpg"); // left
    ITexture *SkyBoxRI_Mat = driver->getTexture ("media/map/summer_day1/matin_2.jpg"); // right
    ITexture *SkyBoxFR_Mat = driver->getTexture ("media/map/summer_day1/matin_1.jpg"); // front
    ITexture *SkyBoxBK_Mat = driver->getTexture ("media/map/summer_day1/matin_3.jpg"); // back

    int color_alpha = 0;
    int color_red   = 255;
    int color_green = 0;
    int color_blue  = 0;

    char* tmp = (char*)SkyBoxTO_Mat->lock();
    for(int x = 0; x<SkyBoxTO_Mat->getSize().Width; x += 4) 
    {
          for(int y = 0; y<SkyBoxTO_Mat->getSize().Height; ++y) 
          {
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 0] *= color_alpha;
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 1] *= color_red;
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 2] *= color_green;
               tmp[y * SkyBoxTO_Mat->getSize().Width + x + 3] *= color_blue;
          }
     }
    SkyBoxTO_Mat->unlock();

    /// Creation de la skybox du MATIN
    MapItems.skybox[skyboxMatin_e] = smgr->addSkyBoxSceneNode((ITexture *)tmp, SkyBoxBO_Mat,SkyBoxLE_Mat,SkyBoxRI_Mat,SkyBoxFR_Mat,SkyBoxBK_Mat,0,-1);



Et çà ne fonctionne pas, mon programme compile mais plante littéralement. J'ai fais une erreur ?

Retour

OptionsLiens officielsCaractéristiquesStatistiquesCommunauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1441 sujets
11339 messages
Dernier membre inscrit: Saidov17
71 invités en ligne
membre en ligne: -
RSS Feed