castano / qshaderedit

Automatically exported from code.google.com/p/qshaderedit
GNU General Public License v2.0
9 stars 3 forks source link

Add multiple files save and load. #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
None.

What is the expected output? What do you see instead?
I think it would be cool to be able to save the glsl effects in either one 
glsl file, or in 1 glsl file, plus some multiple effect files on my system.
Ex: i have a effec in files x.vs x.fs, and I want to have its source loaded 
from those files.

What version of the product are you using? On what operating system?
svn 210 sbayon-GNU/linux

Please provide any additional information below.
I provide a patch to do this.
It adds extra tags like [VertexShaderFile], [GeometryShaderFile], 
[FragmentShaderFile].
I actually still did not add geometry shaders, but part of the code is 
there.
Then on a *File tag it calls the correspondent loader instead of the 
original loader (which keeps being called for the normal tags).
The save work in the reverse way, by checking a new state flag in the 
effect class; "save as multiples files" boolean.
This this is set in the edit>options>general tab. Also added.

Actually I don't really like the way this value is being set.
To maintain some conformity with the current code I added an extra call to 
the qshaderedit class.
But I think the dialog should receive an interface ("abstract class" not a 
GUI) to have access to modification of the corresponding parameters.

Still didn't test it throughly, but it's working for my own needs.

Cheers

Original issue reported on code.google.com by paulo.fe...@gmail.com on 5 Apr 2010 at 5:39

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, there are many ways to do the same thing, and I decided that I couldn't 
live with myself if I let the patch code as it was in v1 (see above).
So here's v2 of the same patch, which can be applied to qshaderedit svn 210 
without 
the patch above (1st file), or with it already applied (2st file).

If you you look at the later file you'll notice it's just a simplification of 
the 
other code.
It reduces the necessary code and increases maintainability at the expense of 
some 
extra parameters in the function invocation.

Cheers.

PS: Unlike prof. Knuth, not only did I not test the code, I also did not prove 
it 
correct, so be warned. However it should work... lol

Original comment by paulo.fe...@gmail.com on 6 Apr 2010 at 6:26

Attachments:

GoogleCodeExporter commented 9 years ago
Forgot to set the state (save into multiple files) on load.
This would make the shades be saved into the default single file format.

Here's a patch for that. It needs to be applied to a src after applying V2 
patch 
above.

Original comment by paulo.fe...@gmail.com on 8 Apr 2010 at 7:14

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, maybe that's asling too much, so here's one for svn V210.
Cheers

Original comment by paulo.fe...@gmail.com on 8 Apr 2010 at 7:19

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, just remembered that I'm not letting people choose their shader files 
extensions.
I'll add that to the options>general tab.
Since I'll be doing that I'll also change the way the options dialog interfaces 
with 
the application, by adding interfaces to set and get the values.
Coming soon to a patch near you.

Original comment by paulo.fe...@gmail.com on 8 Apr 2010 at 9:50

GoogleCodeExporter commented 9 years ago
ok, I added a couple of line edits to edit the vertex and fragment extensions.
On load, it will record the current file extensions.
These may be edited, and on save they will be used as the file extensions.

Again, didn't prove it correct nor did I actually tested it extensively, but it 
should work. :)

This also corrects a bug that I had from removing the new lines from the file 
tags in 
the glsleffect.cpp.

However, this time I'm only uploading the patch version to be applied against 
svn 
v210.

PS: Don't forget to apply the patch against the cpu hogging, which is available 
on a 
separate issue. 

Original comment by paulo.fe...@gmail.com on 8 Apr 2010 at 8:07

Attachments: