zturtleman / mm3d

Maverick Model 3D is a 3D model editor and animator for games.
https://clover.moe/mm3d
GNU General Public License v2.0
116 stars 24 forks source link

Support Texture+Light view mode #81

Open m-7761 opened 5 years ago

m-7761 commented 5 years ago

I just noticed that the texture modes don't have the light that the flat/smooth modes have. Maybe it's a simple error, but surely someone's noticed this before?

m-7761 commented 5 years ago

I don't know, I think the lights need tinkering. I found removing ambient from the material, and pushing diffuse up brought out some definition.

The values for these lights from the initialization code (initializeGL?) seem high. If they are overlapping that could go well over 1, causing textures to appear identical to their image files. I don't see anything that changes for texture mode. It's got to be a trick of the light.

    {
        GLfloat ambient[]  = { 0.8f, 0.8f, 0.8f, 1.0f };
        GLfloat diffuse[]  = { 0.9f, 0.9f, 0.9f, 1.0f };
        GLfloat position[] = { 0.0f, 0.0f, 1.0f, 0.0f };

        glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,GL_FALSE);
        glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
        glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
        glLightfv(GL_LIGHT0,GL_POSITION,position);
        //glEnable(GL_LIGHT0);
    }

    {
        GLfloat ambient[]  = { 0.8f, 0.4f, 0.4f, 1.0f };
        GLfloat diffuse[]  = { 0.9f, 0.5f, 0.5f, 1.0f };
        GLfloat position[] = { 0.0f, 0.0f, 1.0f, 0.0f };

        glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER,GL_FALSE);
        glLightfv(GL_LIGHT1,GL_AMBIENT,ambient);
        glLightfv(GL_LIGHT1,GL_DIFFUSE,diffuse);
        glLightfv(GL_LIGHT1,GL_POSITION,position);
        //glEnable(GL_LIGHT1);
    }