forked from qt-creator/qt-creator
Detect the type of the shader.
This commit is contained in:
@@ -1,14 +1,26 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
|
|
||||||
<mime-type type="application/x-glsl">
|
<mime-type type="application/x-glsl">
|
||||||
<alias type="text/x-glsl"/>
|
<alias type="text/x-glsl"/>
|
||||||
<sub-class-of type="text/plain"/>
|
<sub-class-of type="text/plain"/>
|
||||||
<comment>GLSL file</comment>
|
<comment>GLSL Shader file</comment>
|
||||||
<glob pattern="*.glsl"/>
|
<glob pattern="*.glsl"/>
|
||||||
<glob pattern="*.shader"/>
|
<glob pattern="*.shader"/>
|
||||||
|
</mime-type>
|
||||||
|
|
||||||
|
<mime-type type="text/x-glsl-frag">
|
||||||
|
<sub-class-of type="text/x-glsl"/>
|
||||||
|
<comment>GLSL Fragment Shader file</comment>
|
||||||
<glob pattern="*.frag"/>
|
<glob pattern="*.frag"/>
|
||||||
<glob pattern="*.vert"/>
|
|
||||||
<glob pattern="*.fsh"/>
|
<glob pattern="*.fsh"/>
|
||||||
|
</mime-type>
|
||||||
|
|
||||||
|
<mime-type type="text/x-glsl-vert">
|
||||||
|
<sub-class-of type="text/x-glsl"/>
|
||||||
|
<comment>GLSL Fragment Shader file</comment>
|
||||||
|
<glob pattern="*.vert"/>
|
||||||
<glob pattern="*.vsh"/>
|
<glob pattern="*.vsh"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
|
||||||
</mime-info>
|
</mime-info>
|
||||||
|
|||||||
@@ -276,7 +276,9 @@ void GLSLTextEditor::updateDocumentNow()
|
|||||||
Semantic sem;
|
Semantic sem;
|
||||||
Scope *globalScope = engine.newNamespace();
|
Scope *globalScope = engine.newNamespace();
|
||||||
sem.translationUnit(plugin->shaderInit()->ast, globalScope, plugin->shaderInit()->engine);
|
sem.translationUnit(plugin->shaderInit()->ast, globalScope, plugin->shaderInit()->engine);
|
||||||
|
if (isVertexShader())
|
||||||
sem.translationUnit(plugin->vertexShaderInit()->ast, globalScope, plugin->vertexShaderInit()->engine);
|
sem.translationUnit(plugin->vertexShaderInit()->ast, globalScope, plugin->vertexShaderInit()->engine);
|
||||||
|
if (isFragmentShader())
|
||||||
sem.translationUnit(plugin->fragmentShaderInit()->ast, globalScope, plugin->fragmentShaderInit()->engine);
|
sem.translationUnit(plugin->fragmentShaderInit()->ast, globalScope, plugin->fragmentShaderInit()->engine);
|
||||||
sem.translationUnit(ast, globalScope, &engine);
|
sem.translationUnit(ast, globalScope, &engine);
|
||||||
|
|
||||||
@@ -314,3 +316,13 @@ void GLSLTextEditor::updateDocumentNow()
|
|||||||
// refresh the identifiers.
|
// refresh the identifiers.
|
||||||
m_identifiers = engine.identifiers();
|
m_identifiers = engine.identifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GLSLTextEditor::isVertexShader() const
|
||||||
|
{
|
||||||
|
return mimeType() == QLatin1String("text/x-glsl-vert");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GLSLTextEditor::isFragmentShader() const
|
||||||
|
{
|
||||||
|
return mimeType() == QLatin1String("text/x-glsl-frag");
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public:
|
|||||||
|
|
||||||
QSet<QString> identifiers() const;
|
QSet<QString> identifiers() const;
|
||||||
|
|
||||||
|
bool isVertexShader() const;
|
||||||
|
bool isFragmentShader() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setFontSettings(const TextEditor::FontSettings &);
|
virtual void setFontSettings(const TextEditor::FontSettings &);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user