Commit 9241ccac authored by Frédéric Larue's avatar Frédéric Larue

Functions added to the DisplayableInterface class to ease the creation of...

Functions added to the DisplayableInterface class to ease the creation of shaders from Qt resources.
parent f1eeda8e
......@@ -44,7 +44,7 @@
<x>0</x>
<y>0</y>
<width>1198</width>
<height>21</height>
<height>17</height>
</rect>
</property>
<widget class="QMenu" name="menuFils">
......@@ -332,7 +332,7 @@
<x>0</x>
<y>0</y>
<width>384</width>
<height>373</height>
<height>386</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
......@@ -514,7 +514,7 @@
</action>
<action name="actionLoadImage">
<property name="text">
<string>Load image</string>
<string>Load file</string>
</property>
<property name="shortcut">
<string>Ctrl+L</string>
......
......@@ -42,6 +42,44 @@ private:
protected:
/** Recover the current viewer to which this Displayable is associated. */
inline GLViewer* getViewer() const { return m_Viewer; }
inline bool shaderFromResources( GPU::Shader &shader,
const QString &vshResourceName,
const QString &fshResourceName,
std::string *logs = NULL )
{
QFile vshResource( vshResourceName );
QFile fshResource( fshResourceName );
return vshResource.open( QIODevice::ReadOnly | QIODevice::Text ) &&
fshResource.open( QIODevice::ReadOnly | QIODevice::Text ) &&
GPU::CreateShaderFromSources(
shader,
(char*) vshResource.map( 0, vshResource.size() ),
(char*) fshResource.map( 0, fshResource.size() ),
logs
);
}
inline bool shaderFromResources( GPU::Shader &shader,
const QString &vshResourceName,
const QString &gshResourceName,
const QString &fshResourceName,
std::string *logs = NULL )
{
QFile vshResource( vshResourceName );
QFile gshResource( gshResourceName );
QFile fshResource( fshResourceName );
return vshResource.open( QIODevice::ReadOnly | QIODevice::Text ) &&
gshResource.open( QIODevice::ReadOnly | QIODevice::Text ) &&
fshResource.open( QIODevice::ReadOnly | QIODevice::Text ) &&
GPU::CreateShaderFromSources(
shader,
(char*) vshResource.map( 0, vshResource.size() ),
(char*) gshResource.map( 0, gshResource.size() ),
(char*) fshResource.map( 0, fshResource.size() ),
logs
);
}
public:
inline DisplayableInterface( GenericUIData *m, GLViewer *v ) : QObject(), m_Data(m), m_Viewer(v), m_IsAnimationPaused(false) {}
......
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