|
|
@ -513,11 +513,17 @@ namespace NL3D
|
|
|
|
|
|
|
|
|
|
|
|
if( !sp.empty() )
|
|
|
|
if( !sp.empty() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !activeVertexProgram( sp.vp ) )
|
|
|
|
if( currentProgram.vp == NULL )
|
|
|
|
return false;
|
|
|
|
{
|
|
|
|
|
|
|
|
if( !activeVertexProgram( sp.vp ) )
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( !activePixelProgram( sp.pp ) )
|
|
|
|
if( currentProgram.pp == NULL )
|
|
|
|
return false;
|
|
|
|
{
|
|
|
|
|
|
|
|
if( !activePixelProgram( sp.pp ) )
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -565,22 +571,28 @@ namespace NL3D
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
if( currentProgram.vp == NULL )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete vp;
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
vp = NULL;
|
|
|
|
{
|
|
|
|
delete pp;
|
|
|
|
delete vp;
|
|
|
|
pp = NULL;
|
|
|
|
vp = NULL;
|
|
|
|
return false;
|
|
|
|
delete pp;
|
|
|
|
|
|
|
|
pp = NULL;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( !activePixelProgram( pp ) )
|
|
|
|
if( currentProgram.pp == NULL )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete vp;
|
|
|
|
if( !activePixelProgram( pp ) )
|
|
|
|
vp = NULL;
|
|
|
|
{
|
|
|
|
delete pp;
|
|
|
|
delete vp;
|
|
|
|
pp = NULL;
|
|
|
|
vp = NULL;
|
|
|
|
return false;
|
|
|
|
delete pp;
|
|
|
|
|
|
|
|
pp = NULL;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sp.vp = vp;
|
|
|
|
sp.vp = vp;
|
|
|
@ -596,6 +608,9 @@ namespace NL3D
|
|
|
|
|
|
|
|
|
|
|
|
bool CDriverGL3::setupDynMatProgram( CMaterial& mat, uint pass )
|
|
|
|
bool CDriverGL3::setupDynMatProgram( CMaterial& mat, uint pass )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if( ( currentProgram.vp != NULL ) && ( currentProgram.pp != NULL ) )
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
CDynMaterial *m = mat.getDynMat();
|
|
|
|
CDynMaterial *m = mat.getDynMat();
|
|
|
|
const SRenderPass *rp = m->getPass( pass );
|
|
|
|
const SRenderPass *rp = m->getPass( pass );
|
|
|
|
std::string shaderRef;
|
|
|
|
std::string shaderRef;
|
|
|
@ -606,67 +621,73 @@ namespace NL3D
|
|
|
|
if( !usrShaderManager->getShader( shaderRef, &prg ) )
|
|
|
|
if( !usrShaderManager->getShader( shaderRef, &prg ) )
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
CVertexProgram *vp = new CVertexProgram();
|
|
|
|
|
|
|
|
CPixelProgram *pp = new CPixelProgram();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string shaderSource;
|
|
|
|
std::string shaderSource;
|
|
|
|
std::string log;
|
|
|
|
std::string log;
|
|
|
|
std::string name;
|
|
|
|
std::string name;
|
|
|
|
prg.getVP( shaderSource );
|
|
|
|
|
|
|
|
prg.getName( name );
|
|
|
|
if( currentProgram.vp == NULL )
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IProgram::CSource *src = new IProgram::CSource();
|
|
|
|
prg.getVP( shaderSource );
|
|
|
|
src->Profile = IProgram::glsl330v;
|
|
|
|
prg.getName( name );
|
|
|
|
src->DisplayName = name;
|
|
|
|
|
|
|
|
src->setSource( shaderSource.c_str() );
|
|
|
|
CVertexProgram *vp = new CVertexProgram();
|
|
|
|
vp->addSource( src );
|
|
|
|
{
|
|
|
|
}
|
|
|
|
IProgram::CSource *src = new IProgram::CSource();
|
|
|
|
|
|
|
|
src->Profile = IProgram::glsl330v;
|
|
|
|
|
|
|
|
src->DisplayName = name;
|
|
|
|
|
|
|
|
src->setSource( shaderSource.c_str() );
|
|
|
|
|
|
|
|
vp->addSource( src );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( !compileVertexProgram( vp ) )
|
|
|
|
if( !compileVertexProgram( vp ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete vp;
|
|
|
|
delete vp;
|
|
|
|
delete pp;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
delete vp;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( currentProgram.dynmatVP != NULL )
|
|
|
|
|
|
|
|
delete currentProgram.dynmatVP;
|
|
|
|
|
|
|
|
currentProgram.dynmatVP = vp;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
prg.getFP( shaderSource );
|
|
|
|
if( currentProgram.pp == NULL )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IProgram::CSource *src = new IProgram::CSource();
|
|
|
|
|
|
|
|
src->Profile = IProgram::glsl330f;
|
|
|
|
|
|
|
|
src->DisplayName = name;
|
|
|
|
|
|
|
|
src->setSource( shaderSource.c_str() );
|
|
|
|
|
|
|
|
pp->addSource( src );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !compilePixelProgram( pp ) )
|
|
|
|
CPixelProgram *pp = new CPixelProgram();
|
|
|
|
{
|
|
|
|
|
|
|
|
delete vp;
|
|
|
|
|
|
|
|
delete pp;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !activeVertexProgram( vp ) )
|
|
|
|
prg.getFP( shaderSource );
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete vp;
|
|
|
|
IProgram::CSource *src = new IProgram::CSource();
|
|
|
|
delete pp;
|
|
|
|
src->Profile = IProgram::glsl330f;
|
|
|
|
return false;
|
|
|
|
src->DisplayName = name;
|
|
|
|
}
|
|
|
|
src->setSource( shaderSource.c_str() );
|
|
|
|
|
|
|
|
pp->addSource( src );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !compilePixelProgram( pp ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
delete pp;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( !activePixelProgram( pp ) )
|
|
|
|
if( !activePixelProgram( pp ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete vp;
|
|
|
|
delete pp;
|
|
|
|
delete pp;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( currentProgram.dynmatVP != NULL )
|
|
|
|
if( currentProgram.dynmatPP != NULL )
|
|
|
|
delete currentProgram.dynmatVP;
|
|
|
|
delete currentProgram.dynmatPP;
|
|
|
|
currentProgram.dynmatVP = vp;
|
|
|
|
currentProgram.dynmatPP = pp;
|
|
|
|
|
|
|
|
|
|
|
|
if( currentProgram.dynmatPP != NULL )
|
|
|
|
}
|
|
|
|
delete currentProgram.dynmatPP;
|
|
|
|
|
|
|
|
currentProgram.dynmatPP = pp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|