OSDN Git Service

321
[psychlops/cpp.git] / psychlops / extension / standard / shader / psychlops_g_shader_fig.cpp
index 5e63b4f..760351d 100644 (file)
@@ -112,8 +112,12 @@ namespace Figures {
                setFunction(tmp);
        }
        void ShaderImage::setFunction(const std::string &source, ShaderInterface::Version reparse)
-       {
+       {\r
+               glslversion = reparse;
                switch(reparse) {
+               case ShaderInterface::THROUGH:
+                       orig_source = source;
+                       break;
                case ShaderInterface::AUTO_DETECT:
                case ShaderInterface::GLSL1_1:
                        ShaderInterface::reparseGLSL1_1(source, orig_source, orig_args);
@@ -220,11 +224,15 @@ namespace Figures {
        void ShaderField::setFunction(const char* source, ShaderInterface::Version reparse)
        {
                std::string tmp(source);
-               setFunction(tmp);
+               setFunction(tmp, reparse);
        }
        void ShaderField::setFunction(const std::string &source, ShaderInterface::Version reparse)
-       {
+       {\r
+               glslversion = reparse;
                switch(reparse) {
+               case ShaderInterface::THROUGH:
+                       orig_source = source;
+                       break;
                case ShaderInterface::AUTO_DETECT:
                case ShaderInterface::GLSL1_1:
                        ShaderInterface::reparseGLSL1_1(source, orig_source, orig_args);
@@ -248,7 +256,18 @@ namespace Figures {
        }
        void ShaderField::cache(DrawableWithCache &target)
        {
-               api.cacheField(orig_source, orig_args, target);
+               switch(glslversion) {
+               case ShaderInterface::THROUGH:
+                       api.cache(orig_source, orig_args, target);
+                       break;
+               case ShaderInterface::AUTO_DETECT:
+               case ShaderInterface::GLSL1_1:
+                       api.cacheField(orig_source, orig_args, target);
+                       break;
+               default:
+                       api.cacheField(orig_source, orig_args, target);
+                       break;
+               }
        }
        void ShaderField::cache(const char *source, DrawableWithCache &target)
        {