Exemple #1
0
bool LightFlareData::preload( bool server, String &errorStr )
{
   if ( !Parent::preload( server, errorStr ) )
      return false;

   return _preload( server, errorStr );
}
Exemple #2
0
 /// \brief initialize using an existing shader
 /// \note the newly created shader will acquire the ownership of the underlying openGL shader only if the original shader has the ownership
 ///       if the shader acquire the ownership, destructing it will destroy the openGL shader
 shader(shader &&o)
 : shader_id(o.shader_id), ownership(o.ownership)
 {
   o.give_up_ownership();
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }
Exemple #3
0
 shader(shader<ShaderType, OShaderSourceType, OShaderSource, OShaderOption> &&o)
   : shader_id(o.get_id()), ownership(o.has_ownership())
 {
   o.give_up_ownership();
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }
Exemple #4
0
 /// \brief initialize using an existing shader
 /// \note the newly created shader will acquire the ownership of the underlying openGL shader only if the original shader has the ownership
 ///       if the shader acquire the ownership, destructing it will destroy the openGL shader
 shader(shader &o, stole_ownership_t)
 : shader_id(o.get_id()), ownership(o.has_ownership())
 {
   o.give_up_ownership();
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }
Exemple #5
0
void LightFlareData::inspectPostApply()
{
   Parent::inspectPostApply();

   // Hack to allow changing properties in game.
   // Do the same work as preload.
   
   String str;
   _preload( false, str );
}
Exemple #6
0
 /// \brief rebuild the shader only if it has changed since the last build
 /// faster than a direct call to recompile()
 /// \note the ShaderOption one_shot_compilation disable the source watch for this method
 bool recompile_if_changed()
 {
   bool changed = false;
   if (ShaderOption::value != one_shot_compilation && ShaderSource::has_source_changed())
   {
     _preload();
     changed = true;
   }
   if (changed || env.has_changed())
   {
     unlocked_recompile();
     return true;
   }
   return false;
 }
Exemple #7
0
          /// \brief create and initialize a new shader
          /// \exception shader_exception if openGL refuse to create a new shader
          shader()
            : shader_id(0)
          {
            ownership = true;

            // the ressource could be shared for file / constexpr strings. (yes, I can do that :D )
            // NOTE: this is probably not what you want.
            if (ShaderOption::value == shader_option::shared_instance)
            {
              static GLuint static_shader_id = 0;

              ownership = false;

              if (static_shader_id)
                shader_id = static_shader_id;
              else
              {
                if (!(shader_id = glCreateShader(ShaderType::value)))
                {
                  failed = true;
                  throw_on_glerror<shader_exception>("Unable to create the shader (glCreateShader)", __FILE__, __LINE__);
                  failed = false;
                }
                static_shader_id = shader_id;
              }
            }
            else if (!(shader_id = glCreateShader(ShaderType::value)))
            {
              failed = true;
              throw_on_glerror<shader_exception>("Unable to create the shader (glCreateShader)", __FILE__, __LINE__);
              failed = false;
            }

            ShaderSource::has_source_changed();      // init this func;
            _preload();
          }
Exemple #8
0
 /// \brief rebuild the shader, re-get the sources, ...
 /// \note this could be slow.
 /// \see recompile_if_changed()
 void recompile()
 {
   _preload();
   unlocked_recompile();
 }
Exemple #9
0
 shader(const shader<ShaderType, OShaderSourceType, OShaderSource, OShaderOption> &o)
   : shader_id(o.get_id()), ownership(true)
 {
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }
Exemple #10
0
 /// \brief initialize using an existing shader
 /// \note the newly created shader won't have the ownership of the underlying openGL shader:
 ///       destructing it won't destroy the openGL shader
 shader(const shader &o)
  : shader_id(o.get_id()), ownership(false)
 {
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }
Exemple #11
0
 /// \brief initialize using an existing openGL shader id
 /// \note the newly created shader will have the ownership of the underlying openGL shader:
 ///       destructing it will destroy the openGL shader
 shader(GLuint _id, assume_ownership_t)
   : shader_id(_id), ownership(true)
 {
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }
Exemple #12
0
 /// \brief initialize using an existing openGL shader id
 /// \note the newly created shader won't have the ownership of the underlying openGL shader:
 ///       destructing it won't destroy the openGL shader
 explicit shader(GLuint _id)
   : shader_id(_id), ownership(false)
 {
   ShaderSource::has_source_changed();      // init this func;
   _preload();
 }