Beispiel #1
0
/////////////////////////////////////////
// ContextOfWRATH  methods
const WRATHGLStateChange::state_change::handle&
ContextOfWRATH::
getBlenderFromCompositeOp(enum CompositeOperator op)
{
  WRATHStaticInit();
  static BlendersFromCompositeModes v;
  return v.getHandle(op);
}
 /*!\fn const WRATHLayerItemNodeBase::node_function_packet& functions()
   Returns same value as node_functions()
  */
 static
 const WRATHLayerItemNodeBase::node_function_packet&
 functions(void)
 {
   WRATHStaticInit();
   static WRATHLayerItemNodeFunctionPacketT<T, WRATHLinearGradientValue> R;
   return R;
 }
const WRATHGradientSourceBase*
WRATHLinearGradientValue::
gradient_source(void)
{
  WRATHStaticInit();
  static LayerItemNodeLinearGradientSource R;
  return &R;
}
const WRATHGradientSourceBase*
WRATHRadialGradientValue::
gradient_source(void)
{
  WRATHStaticInit();
  static LocalGradientSource R;
  return &R;
}
const WRATHLayerNodeValuePackerBase::function_packet&
WRATHLayerNodeValuePackerTextureFixed::
functions(void)
{
  WRATHStaticInit();
  static NodePackerTextureFunctions return_value;
  return return_value;
}
const WRATHLayerItemNodeBase::node_function_packet&
WRATHLayerItemNodeTranslateValues::
functions(void) 
{
  WRATHStaticInit();
  static NodeTranslateFunctions return_value;

  return return_value;
}
//////////////////////////////////////////////////
// WRATHLayerNodeValuePackerHybridImplement methods
const WRATHLayerNodeValuePackerBase::function_packet*
WRATHLayerNodeValuePackerHybridImplement::
fetch_function_packet(const WRATHLayerNodeValuePackerBase::function_packet *VertexPacker,
                      const WRATHLayerNodeValuePackerBase::function_packet *FragmentPacker)
{
    WRATHStaticInit();
    static LocalFunctionPacketStorage R;

    WRATHassert(VertexPacker->supports_per_node_value(GL_VERTEX_SHADER));
    WRATHassert(FragmentPacker->supports_per_node_value(GL_FRAGMENT_SHADER));

    return R.fetch(VertexPacker, FragmentPacker);
}
const WRATHFontConfig::FontSpecification&
WRATHFontConfig::
fetch_font_entry_detailed(const InFontSpecification &spec)
{
  WRATHStaticInit();

  static FontSpecification null_value;
  WRATHFontFetch::font_handle hnd;
  FontList::const_iterator iter;

  hnd=fetch_font_entry(spec);
  iter=font_list().find(hnd);

  return (iter!=font_list().end())?
    iter->second:
    null_value;
}
const WRATHShaderBrushSourceHoard&
WRATHDefaultShapeShader::
shader_hoard(void)
{
    WRATHStaticInit();
    static WRATHShaderBrushSourceHoard R(WRATHGLShader::shader_source_collection()
                                         .absorb_shader_stage(GL_VERTEX_SHADER,
                                                 WRATHGLShader::shader_source()
                                                 .add_macro("WRATH_APPLY_BRUSH")
                                                 .add_source("shape.vert.wrath-shader.glsl",
                                                         WRATHGLShader::from_resource))

                                         .absorb_shader_stage(GL_FRAGMENT_SHADER,
                                                 WRATHGLShader::shader_source()
                                                 .add_macro("WRATH_APPLY_BRUSH")
                                                 .add_source("shape.frag.wrath-shader.glsl",
                                                         WRATHGLShader::from_resource) ));

    return R;
}
std::string
ngl_preErrorCheck(const char *call, const char *function_name, 
                  const char *fileName, int line, 
                  void* fptr)
{
  WRATHStaticInit();

  WRATHunused(call);
  WRATHunused(function_name);
  WRATHunused(fileName);
  WRATHunused(line);
  WRATHunused(fptr);
  std::string return_value;

  if(ngl_log_gl_commands())
    {
      std::ostringstream str;
      str << "Pre-Log[" << fileName << ", " << line << "]";
      return_value=str.str();
    }

  return return_value;
}
std::string 
ngl_ErrorCheck(const char *call, const char *function_name, 
               const char *fileName, int line, 
               void* fptr)
{
  WRATHStaticInit();

  std::ostringstream str;
  int errorcode;
  int count;
 
  
  WRATHunused(call);
  WRATHunused(function_name);
  WRATHunused(fileName);
  WRATHunused(line);

  if(fptr==ngl_functionPointer(glGetError))
    {
      return std::string();
    }

  errorcode=glGetError();
  if(errorcode==GL_NO_ERROR and !ngl_log_gl_commands())
    {
      return std::string();
    }

  for(count=0; errorcode!=GL_NO_ERROR; ++count, errorcode=glGetError() )
    {
      if(count!=0)
        {
          str << ",";
        }

      switch(errorcode)
        {
        case GL_INVALID_ENUM:
          str << "GL_INVALID_ENUM ";
          break;
        case GL_INVALID_VALUE:
          str << "GL_INVALID_VALUE ";
          break;
        case GL_INVALID_OPERATION:
          str << "GL_INVALID_OPERATION ";
          break;
        case GL_OUT_OF_MEMORY:
          str << "GL_OUT_OF_MEMORY ";
          break; 

        default:
          str << "\n\tUnknown errorcode: 0x" << std::hex << errorcode;
        }
      
      
    }

  if(count==0)
    {
      str << "Post-Log(GL command returned)";
    }
  return str.str();
}