Commit 2f259f54 authored by Christopher Tenter's avatar Christopher Tenter
Browse files

ACG ShaderGenerator: track source of imported files in shader comments

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18217 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7102d991
......@@ -376,6 +376,12 @@ void ShaderGenerator::addIncludeFile(QString _fileName)
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream fileStream(&file);
// track source of include files in shader comment
imports_.push_back("// ==============================================================================");
imports_.push_back(QString("// ShaderGenerator - begin of imported file: ") + _fileName);
while (!fileStream.atEnd())
{
......@@ -383,6 +389,13 @@ void ShaderGenerator::addIncludeFile(QString _fileName)
imports_.push_back(tmpLine.simplified());
}
// mark end of include file in comment
imports_.push_back(QString("// ShaderGenerator - end of imported file #include \"") + _fileName);
imports_.push_back("// ==============================================================================");
}
}
......@@ -468,9 +481,18 @@ void ShaderProgGenerator::loadStringListFromFile(QString _fileName, QStringList*
void ShaderProgGenerator::loadLightingFunctions()
{
if (lightingCode_.size()) return;
QString fileName = shaderDir_ + QDir::separator() + QString(LIGHTING_CODE_FILE);
lightingCode_.push_back("// ==============================================================================");
lightingCode_.push_back(QString("// ShaderGenerator - default lighting functions imported from file: ") + fileName);
// load shader code from file
loadStringListFromFile(shaderDir_ + QDir::separator() + QString(LIGHTING_CODE_FILE), &lightingCode_);
loadStringListFromFile(fileName, &lightingCode_);
lightingCode_.push_back(QString("// ShaderGenerator - end of default lighting functions"));
lightingCode_.push_back("// ==============================================================================");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment