Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-11-20 17:32:07 +0300
committerTon Roosendaal <ton@blender.org>2005-11-20 17:32:07 +0300
commitc52170b4ed83a279af5d1a065d173969fe3d24cd (patch)
treec7bde0a344cfc7734e4214147bb925c216370ddc /source/blender/src
parent36a9ae941510a12d092e76ac1d2cf1d731d793d3 (diff)
Patch provided by Alfredo de Greef
This adds Radiance HDR image file support. So now at least we can save the 'fbuf' (4x32 bits float colors) in Blender. It doesn't change anything for internal support in imbuf for floa colors, so when reading .hdr files it still converts it to 32 bits RGBA. As an extra I've added that saving images with F3 now also adds the optional extension, when the F10 "Extensions" option is set. One important note; I don't know the proper license for the code, it was provided without... will await feedback from Alfredo about it. For now I've added the standard Blender GPL header.
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/buttons_scene.c15
-rw-r--r--source/blender/src/filesel.c2
-rw-r--r--source/blender/src/toets.c22
-rw-r--r--source/blender/src/writeimage.c3
4 files changed, 37 insertions, 5 deletions
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 4d17416c8d4..3739a8c2d98 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -928,6 +928,7 @@ static char *imagetype_pup(void)
strcat(formatstring, "|%s %%x%d"); // add space for PNG
strcat(formatstring, "|%s %%x%d"); // add space for BMP
+ strcat(formatstring, "|%s %%x%d"); // add space for Radiance HDR
#ifdef _WIN32
strcat(formatstring, "|%s %%x%d"); // add space for AVI Codec
@@ -956,8 +957,11 @@ static char *imagetype_pup(void)
"HamX", R_HAMX,
"Iris", R_IRIS,
"Iris + Zbuffer", R_IRIZ,
- "Ftype", R_FTYPE,
- "Movie", R_MOVIE
+ "Radiance HDR", R_RADHDR,
+#ifdef __sgi
+ "Movie", R_MOVIE,
+#endif
+ "Ftype", R_FTYPE
);
} else {
sprintf(string, formatstring,
@@ -974,8 +978,11 @@ static char *imagetype_pup(void)
"HamX", R_HAMX,
"Iris", R_IRIS,
"Iris + Zbuffer", R_IRIZ,
- "Ftype", R_FTYPE,
- "Movie", R_MOVIE
+ "Radiance HDR", R_RADHDR,
+#ifdef __sgi
+ "Movie", R_MOVIE,
+#endif
+ "Ftype", R_FTYPE
);
}
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index c87c8a63693..09cf0d8a42e 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -592,6 +592,7 @@ void test_flags_file(SpaceFile *sfile)
} else if (G.have_quicktime){
if( BLI_testextensie(file->relname, ".jpg")
|| BLI_testextensie(file->relname, ".jpeg")
+ || BLI_testextensie(file->relname, ".hdr")
|| BLI_testextensie(file->relname, ".tga")
|| BLI_testextensie(file->relname, ".rgb")
|| BLI_testextensie(file->relname, ".bmp")
@@ -618,6 +619,7 @@ void test_flags_file(SpaceFile *sfile)
}
} else { // no quicktime
if(BLI_testextensie(file->relname, ".jpg")
+ || BLI_testextensie(file->relname, ".hdr")
|| BLI_testextensie(file->relname, ".tga")
|| BLI_testextensie(file->relname, ".rgb")
|| BLI_testextensie(file->relname, ".bmp")
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index ecee8a9a8c7..721738b8931 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -63,6 +63,7 @@
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_global.h"
+#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_scene.h"
@@ -73,9 +74,9 @@
#include "BIF_editsound.h"
#include "BIF_editmesh.h"
#include "BIF_interface.h"
+#include "BKE_object.h"
#include "BIF_poseobject.h"
#include "BIF_renderwin.h"
-#include "BKE_object.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_toets.h"
@@ -115,6 +116,11 @@ static void write_imag(char *name)
/* from file select */
char str[256];
+ /* addImageExtension() checks for if extension was already set */
+ if(G.scene->r.scemode & R_EXTENSION)
+ if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
+ addImageExtension(name);
+
strcpy(str, name);
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
@@ -141,6 +147,13 @@ void schrijfplaatje(char *name)
unsigned int *temprect=0;
char str[FILE_MAXDIR+FILE_MAXFILE];
+ /* radhdr: temporary call for direct float buffer save for HDR format */
+ if ((R.r.imtype==R_RADHDR) && (R.rectftot))
+ {
+ imb_savehdr_fromfloat(R.rectftot, name, R.rectx, R.recty);
+ return;
+ }
+
/* has RGBA been set? If so: use alpha channel for color zero */
IMB_alpha_to_col0(FALSE);
@@ -191,6 +204,11 @@ void schrijfplaatje(char *name)
else printf("no zbuf\n");
}
}
+ else if(R.r.imtype==R_RADHDR) {
+ /* radhdr: save hdr from rgba buffer, not really recommended, probably mistake, so warn user */
+ error("Will save, but you might want to enable the floatbuffer to save a real HDRI...");
+ ibuf->ftype= RADHDR;
+ }
else if(R.r.imtype==R_PNG) {
ibuf->ftype= PNG;
}
@@ -467,6 +485,8 @@ int untitled(char * name)
int save_image_filesel_str(char *str)
{
switch(G.scene->r.imtype) {
+ case R_RADHDR:
+ strcpy(str, "Save Radiance HDR"); return 1;
case R_PNG:
strcpy(str, "Save PNG"); return 1;
case R_BMP:
diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c
index 0c0b716d211..d7e0fd234ca 100644
--- a/source/blender/src/writeimage.c
+++ b/source/blender/src/writeimage.c
@@ -51,6 +51,9 @@ int BIF_write_ibuf(ImBuf *ibuf, char *name)
/* to be used for e.g. envmap, not rendered images */
if(G.scene->r.imtype== R_IRIS) ibuf->ftype= IMAGIC;
+ else if ((G.scene->r.imtype==R_RADHDR)) {
+ ibuf->ftype= RADHDR;
+ }
else if ((G.scene->r.imtype==R_PNG)) {
ibuf->ftype= PNG;
}