forked from qt-creator/qt-creator
Load the shader intializers.
This commit is contained in:
@@ -102,6 +102,10 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), error_message))
|
||||
return false;
|
||||
|
||||
m_glsl_120_frag = glslFile(QLatin1String("glsl_120.frag"));
|
||||
m_glsl_120_vert = glslFile(QLatin1String("glsl_120.vert"));
|
||||
m_glsl_120_common = glslFile(QLatin1String("glsl_120_common.glsl"));
|
||||
|
||||
// m_modelManager = new ModelManager(this);
|
||||
// addAutoReleasedObject(m_modelManager);
|
||||
|
||||
@@ -224,4 +228,30 @@ Core::Command *GLSLEditorPlugin::addToolAction(QAction *a, Core::ActionManager *
|
||||
return command;
|
||||
}
|
||||
|
||||
QByteArray GLSLEditorPlugin::glslFile(const QString &fileName)
|
||||
{
|
||||
QString path = Core::ICore::instance()->resourcePath();
|
||||
path += QLatin1String("/glsl/");
|
||||
path += fileName;
|
||||
QFile file(path);
|
||||
if (file.open(QFile::ReadOnly))
|
||||
return file.readAll();
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QByteArray GLSLEditorPlugin::fragmentShaderInit() const
|
||||
{
|
||||
return m_glsl_120_frag;
|
||||
}
|
||||
|
||||
QByteArray GLSLEditorPlugin::vertexShaderInit() const
|
||||
{
|
||||
return m_glsl_120_vert;
|
||||
}
|
||||
|
||||
QByteArray GLSLEditorPlugin::shaderInit() const
|
||||
{
|
||||
return m_glsl_120_common;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(GLSLEditorPlugin)
|
||||
|
||||
@@ -83,7 +83,13 @@ public:
|
||||
|
||||
void initializeEditor(GLSLEditor::GLSLTextEditor *editor);
|
||||
|
||||
QByteArray fragmentShaderInit() const;
|
||||
QByteArray vertexShaderInit() const;
|
||||
QByteArray shaderInit() const;
|
||||
|
||||
private:
|
||||
QByteArray glslFile(const QString &fileName);
|
||||
|
||||
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const QString &name,
|
||||
Core::ActionContainer *c1, const QString &keySequence);
|
||||
|
||||
@@ -93,6 +99,9 @@ private:
|
||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||
|
||||
QPointer<TextEditor::ITextEditable> m_currentTextEditable;
|
||||
QByteArray m_glsl_120_frag;
|
||||
QByteArray m_glsl_120_vert;
|
||||
QByteArray m_glsl_120_common;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user