コード例 #1
0
void STKMeshSceneNode::drawSolid(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
{
    switch (irr_driver->getPhase())
    {
    case SOLID_NORMAL_AND_DEPTH_PASS:
    {
        windDir = getWind();

        computeMVP(ModelViewProjectionMatrix);
        computeTIMV(TransposeInverseModelView);

        if (type == irr_driver->getShader(ES_NORMAL_MAP))
            drawNormalPass(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
        else if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
            drawObjectRefPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix);
        else if (type == irr_driver->getShader(ES_GRASS) || type == irr_driver->getShader(ES_GRASS_REF))
            drawGrassPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, windDir);
        else
            drawObjectPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
        break;
    }
    case SOLID_LIT_PASS:
    {
        if (type == irr_driver->getShader(ES_SPHERE_MAP))
            drawSphereMap(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
        else if (type == irr_driver->getShader(ES_SPLATTING))
            drawSplatting(mesh, ModelViewProjectionMatrix);
        else if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
            drawObjectRefPass2(mesh, ModelViewProjectionMatrix, TextureMatrix);
        else if (type == irr_driver->getShader(ES_GRASS) || type == irr_driver->getShader(ES_GRASS_REF))
            drawGrassPass2(mesh, ModelViewProjectionMatrix, windDir);
        else if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT))
            drawObjectRimLimit(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix);
        else if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
            drawObjectUnlit(mesh, ModelViewProjectionMatrix);
        else if (mesh.textures[1] && type != irr_driver->getShader(ES_NORMAL_MAP))
            drawDetailledObjectPass2(mesh, ModelViewProjectionMatrix);
        else if (!mesh.textures[0])
            drawUntexturedObject(mesh, ModelViewProjectionMatrix);
        else
            drawObjectPass2(mesh, ModelViewProjectionMatrix, TextureMatrix);
        break;
    }
    default:
    {
        assert(0 && "wrong pass");
    }
    }
}
コード例 #2
0
ファイル: stkmeshscenenode.cpp プロジェクト: Podmuch/stk-code
void STKMeshSceneNode::drawSolidPass1(const GLMesh &mesh, GeometricMaterial type)
{
    irr_driver->IncreaseObjectCount();
    windDir = getWind();
    switch (type)
    {
    case FPSM_NORMAL_MAP:
        drawNormalPass(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
        break;
    case FPSM_ALPHA_REF_TEXTURE:
        drawObjectRefPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, mesh.TextureMatrix);
        break;
    case FPSM_GRASS:
        drawGrassPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, windDir);
        break;
    case FPSM_DEFAULT:
        drawObjectPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
        break;
    default:
        assert(0 && "wrong geometric material");
    }
}