Add gl_cg_save_cgp().

This commit is contained in:
Themaister 2012-02-08 17:23:44 +01:00
parent f6edb9a607
commit 315b28862a
2 changed files with 39 additions and 0 deletions

View File

@ -1199,3 +1199,32 @@ bool gl_cg_load_shader(unsigned index, const char *path)
}
}
bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info)
{
if (!info->shader[0] || !*info->shader[0])
return false;
FILE *file = fopen(path, "w");
if (!file)
return false;
unsigned shaders = info->shader[1] && *info->shader[1] ? 2 : 1;
fprintf(file, "shaders = %u\n", shaders);
fprintf(file, "shader0 = %s\n", info->shader[0]);
if (shaders == 2)
fprintf(file, "shader1 = %s\n", info->shader[1]);
fprintf(file, "filter_linear0 = %s\n", info->filter_linear[0] ? "true" : "false");
if (info->render_to_texture)
{
fprintf(file, "filter_linear1 = %s\n", info->filter_linear[1] ? "true" : "false");
fprintf(file, "scale_type0 = source\n");
fprintf(file, "scale0 = %.1f\n", info->fbo_scale);
}
fclose(file);
return true;
}

View File

@ -54,4 +54,14 @@ void gl_cg_set_compiler_args(const char **argv);
bool gl_cg_load_shader(unsigned index, const char *path);
struct gl_cg_cgp_info
{
const char *shader[2];
bool filter_linear[2];
bool render_to_texture;
float fbo_scale;
};
bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info);
#endif