2011-02-23 10:52:22 +00:00
|
|
|
/*
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup render
|
2011-02-27 19:31:27 +00:00
|
|
|
*/
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include <fcntl.h>
|
2008-03-26 15:25:56 +00:00
|
|
|
#include <float.h>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <math.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2018-06-08 08:07:48 +02:00
|
|
|
#ifndef WIN32
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
# include <unistd.h>
|
|
|
|
#else
|
|
|
|
# include <io.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "IMB_imbuf.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "IMB_imbuf_types.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
|
|
|
#include "DNA_image_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_texture_types.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_math.h"
|
2006-09-30 21:29:47 +00:00
|
|
|
#include "BLI_threads.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
|
|
|
#include "BKE_image.h"
|
|
|
|
|
2020-11-09 15:42:38 +01:00
|
|
|
#include "RE_texture.h"
|
2011-02-14 18:20:10 +00:00
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "render_types.h"
|
2020-11-06 14:16:27 -05:00
|
|
|
#include "texture_common.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2011-06-28 12:48:39 +00:00
|
|
|
static void boxsample(ImBuf *ibuf,
|
|
|
|
float minx,
|
|
|
|
float miny,
|
|
|
|
float maxx,
|
|
|
|
float maxy,
|
|
|
|
TexResult *texres,
|
|
|
|
const short imaprepeat,
|
|
|
|
const short imapextend);
|
2011-06-09 16:12:10 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* *********** IMAGEWRAPPING ****************** */
|
|
|
|
|
2006-01-11 18:39:19 +00:00
|
|
|
/* x and y have to be checked for image size */
|
2012-05-26 16:04:31 +00:00
|
|
|
static void ibuf_get_color(float col[4], struct ImBuf *ibuf, int x, int y)
|
2006-01-11 18:39:19 +00:00
|
|
|
{
|
|
|
|
int ofs = y * ibuf->x + x;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ibuf->rect_float) {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (ibuf->channels == 4) {
|
|
|
|
const float *fp = ibuf->rect_float + 4 * ofs;
|
2011-11-06 16:38:21 +00:00
|
|
|
copy_v4_v4(col, fp);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else if (ibuf->channels == 3) {
|
|
|
|
const float *fp = ibuf->rect_float + 3 * ofs;
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3(col, fp);
|
2019-03-25 11:55:36 +11:00
|
|
|
col[3] = 1.0f;
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
const float *fp = ibuf->rect_float + ofs;
|
|
|
|
col[0] = col[1] = col[2] = col[3] = *fp;
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2006-01-11 18:39:19 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
const char *rect = (char *)(ibuf->rect + ofs);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
col[0] = ((float)rect[0]) * (1.0f / 255.0f);
|
|
|
|
col[1] = ((float)rect[1]) * (1.0f / 255.0f);
|
|
|
|
col[2] = ((float)rect[2]) * (1.0f / 255.0f);
|
|
|
|
col[3] = ((float)rect[3]) * (1.0f / 255.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-31 13:52:13 +00:00
|
|
|
/* bytes are internally straight, however render pipeline seems to expect premul */
|
|
|
|
col[0] *= col[3];
|
|
|
|
col[1] *= col[3];
|
|
|
|
col[2] *= col[3];
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2006-01-11 18:39:19 +00:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2015-01-27 16:14:53 +05:00
|
|
|
int imagewrap(Tex *tex,
|
|
|
|
Image *ima,
|
|
|
|
const float texvec[3],
|
|
|
|
TexResult *texres,
|
|
|
|
struct ImagePool *pool,
|
|
|
|
const bool skip_load_image)
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
{
|
|
|
|
float fx, fy, val1, val2, val3;
|
2006-12-20 17:57:56 +00:00
|
|
|
int x, y, retval;
|
2011-06-28 12:48:39 +00:00
|
|
|
int xi, yi; /* original values */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* we need to set retval OK, otherwise texture code generates normals itself... */
|
2020-01-14 19:38:28 +01:00
|
|
|
retval = texres->nor ? (TEX_RGB | TEX_NOR) : TEX_RGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* quick tests */
|
2019-12-20 21:46:36 +01:00
|
|
|
if (ima == NULL) {
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-12-20 21:46:36 +01:00
|
|
|
/* hack for icon render */
|
|
|
|
if (skip_load_image && !BKE_image_has_loaded_ibuf(ima)) {
|
|
|
|
return retval;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-12-20 21:46:36 +01:00
|
|
|
ImageUser *iuser = &tex->iuser;
|
|
|
|
ImageUser local_iuser;
|
|
|
|
if (ima->source == IMA_SRC_TILED) {
|
|
|
|
/* tex->iuser might be shared by threads, so create a local copy. */
|
|
|
|
local_iuser = tex->iuser;
|
|
|
|
iuser = &local_iuser;
|
|
|
|
|
|
|
|
float new_uv[2];
|
|
|
|
iuser->tile = BKE_image_get_tile_from_pos(ima, texvec, new_uv, NULL);
|
|
|
|
fx = new_uv[0];
|
|
|
|
fy = new_uv[1];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fx = texvec[0];
|
|
|
|
fy = texvec[1];
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-12-20 21:46:36 +01:00
|
|
|
|
|
|
|
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(ima, iuser, pool);
|
|
|
|
|
|
|
|
ima->flag |= IMA_USED_FOR_RENDER;
|
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
|
2019-12-20 21:46:36 +01:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2012-11-15 15:59:58 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* setup mapping */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->imaflag & TEX_IMAROT) {
|
2019-12-20 21:46:36 +01:00
|
|
|
SWAP(float, fx, fy);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->extend == TEX_CHECKER) {
|
2006-12-20 17:57:56 +00:00
|
|
|
int xs, ys;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
xs = (int)floor(fx);
|
|
|
|
ys = (int)floor(fy);
|
|
|
|
fx -= xs;
|
|
|
|
fy -= ys;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-07 09:48:59 +00:00
|
|
|
if ((tex->flag & TEX_CHECKER_ODD) == 0) {
|
|
|
|
if ((xs + ys) & 1) {
|
|
|
|
/* pass */
|
|
|
|
}
|
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-10-07 09:48:59 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2012-10-07 09:48:59 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if ((tex->flag & TEX_CHECKER_EVEN) == 0) {
|
|
|
|
if ((xs + ys) & 1) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
/* scale around center, (0.5, 0.5) */
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->checkerdist < 1.0f) {
|
|
|
|
fx = (fx - 0.5f) / (1.0f - tex->checkerdist) + 0.5f;
|
|
|
|
fy = (fy - 0.5f) / (1.0f - tex->checkerdist) + 0.5f;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
x = xi = (int)floorf(fx * ibuf->x);
|
|
|
|
y = yi = (int)floorf(fy * ibuf->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->extend == TEX_CLIPCUBE) {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (x < 0 || y < 0 || x >= ibuf->x || y >= ibuf->y || texvec[2] < -1.0f || texvec[2] > 1.0f) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2020-11-06 12:30:59 +11:00
|
|
|
else if (ELEM(tex->extend, TEX_CLIP, TEX_CHECKER)) {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (x < 0 || y < 0 || x >= ibuf->x || y >= ibuf->y) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->extend == TEX_EXTEND) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (x >= ibuf->x) {
|
2019-03-25 11:55:36 +11:00
|
|
|
x = ibuf->x - 1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (x < 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
x = 0;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
x = x % ibuf->x;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (x < 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
x += ibuf->x;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->extend == TEX_EXTEND) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (y >= ibuf->y) {
|
2019-03-25 11:55:36 +11:00
|
|
|
y = ibuf->y - 1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (y < 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
y = 0;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
y = y % ibuf->y;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (y < 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
y += ibuf->y;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-30 20:09:02 +10:00
|
|
|
/* Keep this before interpolation T29761. */
|
2013-05-22 06:22:28 +00:00
|
|
|
if (ima) {
|
2019-05-18 20:52:20 +02:00
|
|
|
if ((tex->imaflag & TEX_USEALPHA) && (ima->alpha_mode != IMA_ALPHA_IGNORE)) {
|
2013-05-22 06:22:28 +00:00
|
|
|
if ((tex->imaflag & TEX_CALCALPHA) == 0) {
|
2014-04-01 11:34:00 +11:00
|
|
|
texres->talpha = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-05-22 06:22:28 +00:00
|
|
|
}
|
2013-02-07 15:36:59 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-06-09 16:12:10 +00:00
|
|
|
/* interpolate */
|
|
|
|
if (tex->imaflag & TEX_INTERPOL) {
|
|
|
|
float filterx, filtery;
|
|
|
|
filterx = (0.5f * tex->filtersize) / ibuf->x;
|
|
|
|
filtery = (0.5f * tex->filtersize) / ibuf->y;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-30 20:09:02 +10:00
|
|
|
/* Important that this value is wrapped T27782.
|
2011-06-28 12:48:39 +00:00
|
|
|
* this applies the modifications made by the checks above,
|
|
|
|
* back to the floating point values */
|
|
|
|
fx -= (float)(xi - x) / (float)ibuf->x;
|
|
|
|
fy -= (float)(yi - y) / (float)ibuf->y;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
boxsample(ibuf,
|
|
|
|
fx - filterx,
|
|
|
|
fy - filtery,
|
|
|
|
fx + filterx,
|
|
|
|
fy + filtery,
|
|
|
|
texres,
|
|
|
|
(tex->extend == TEX_REPEAT),
|
|
|
|
(tex->extend == TEX_EXTEND));
|
2011-06-09 16:12:10 +00:00
|
|
|
}
|
2011-06-28 12:48:39 +00:00
|
|
|
else { /* no filtering */
|
2011-06-09 16:12:10 +00:00
|
|
|
ibuf_get_color(&texres->tr, ibuf, x, y);
|
2011-06-28 12:48:39 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (texres->nor) {
|
|
|
|
if (tex->imaflag & TEX_NORMALMAP) {
|
2019-08-18 04:11:50 +10:00
|
|
|
/* Normal from color:
|
2012-07-07 22:51:57 +00:00
|
|
|
* The invert of the red channel is to make
|
|
|
|
* the normal map compliant with the outside world.
|
|
|
|
* It needs to be done because in Blender
|
|
|
|
* the normal used in the renderer points inward. It is generated
|
|
|
|
* this way in calc_vertexnormals(). Should this ever change
|
|
|
|
* this negate must be removed. */
|
2020-11-06 11:25:27 +11:00
|
|
|
texres->nor[0] = -2.0f * (texres->tr - 0.5f);
|
|
|
|
texres->nor[1] = 2.0f * (texres->tg - 0.5f);
|
|
|
|
texres->nor[2] = 2.0f * (texres->tb - 0.5f);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* bump: take three samples */
|
2019-03-25 11:55:36 +11:00
|
|
|
val1 = texres->tr + texres->tg + texres->tb;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (x < ibuf->x - 1) {
|
2006-12-20 17:57:56 +00:00
|
|
|
float col[4];
|
2019-03-25 11:55:36 +11:00
|
|
|
ibuf_get_color(col, ibuf, x + 1, y);
|
|
|
|
val2 = (col[0] + col[1] + col[2]);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2013-03-09 03:46:30 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
val2 = val1;
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (y < ibuf->y - 1) {
|
2006-12-20 17:57:56 +00:00
|
|
|
float col[4];
|
2019-03-25 11:55:36 +11:00
|
|
|
ibuf_get_color(col, ibuf, x, y + 1);
|
|
|
|
val3 = (col[0] + col[1] + col[2]);
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
val3 = val1;
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* do not mix up x and y here! */
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->nor[0] = (val1 - val2);
|
|
|
|
texres->nor[1] = (val1 - val3);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2013-03-09 03:46:30 +00:00
|
|
|
if (texres->talpha) {
|
|
|
|
texres->tin = texres->ta;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (tex->imaflag & TEX_CALCALPHA) {
|
2012-12-21 05:07:26 +00:00
|
|
|
texres->ta = texres->tin = max_fff(texres->tr, texres->tg, texres->tb);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2013-03-09 03:46:30 +00:00
|
|
|
else {
|
|
|
|
texres->ta = texres->tin = 1.0;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-09 03:46:30 +00:00
|
|
|
if (tex->flag & TEX_NEGALPHA) {
|
|
|
|
texres->ta = 1.0f - texres->ta;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-16 16:48:41 +11:00
|
|
|
/* de-premul, this is being pre-multiplied in shade_input_do_shade()
|
2013-04-11 12:37:33 +00:00
|
|
|
* do not de-premul for generated alpha, it is already in straight */
|
2019-03-25 11:55:36 +11:00
|
|
|
if (texres->ta != 1.0f && texres->ta > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
|
|
|
|
fx = 1.0f / texres->ta;
|
|
|
|
texres->tr *= fx;
|
|
|
|
texres->tg *= fx;
|
|
|
|
texres->tb *= fx;
|
2007-12-04 19:06:00 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-17 07:20:12 +00:00
|
|
|
BRICONTRGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
|
|
|
|
{
|
|
|
|
rctf *rf, *newrct;
|
|
|
|
short a;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
a = *count;
|
|
|
|
rf = stack;
|
|
|
|
for (; a > 0; a--) {
|
|
|
|
if (rf->xmin < x1) {
|
|
|
|
if (rf->xmax < x1) {
|
|
|
|
rf->xmin += (x2 - x1);
|
|
|
|
rf->xmax += (x2 - x1);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (rf->xmax > x2) {
|
2019-03-25 11:55:36 +11:00
|
|
|
rf->xmax = x2;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct = stack + *count;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
(*count)++;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->xmax = x2;
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct->xmin = rf->xmin + (x2 - x1);
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->ymin = rf->ymin;
|
|
|
|
newrct->ymax = rf->ymax;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (newrct->xmin == newrct->xmax) {
|
2019-03-25 11:55:36 +11:00
|
|
|
(*count)--;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->xmin = x1;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else if (rf->xmax > x2) {
|
|
|
|
if (rf->xmin > x2) {
|
|
|
|
rf->xmin -= (x2 - x1);
|
|
|
|
rf->xmax -= (x2 - x1);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (rf->xmin < x1) {
|
2019-03-25 11:55:36 +11:00
|
|
|
rf->xmin = x1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct = stack + *count;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
(*count)++;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->xmin = x1;
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct->xmax = rf->xmax - (x2 - x1);
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->ymin = rf->ymin;
|
|
|
|
newrct->ymax = rf->ymax;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (newrct->xmin == newrct->xmax) {
|
2019-03-25 11:55:36 +11:00
|
|
|
(*count)--;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->xmax = x2;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
rf++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
|
|
|
|
{
|
|
|
|
rctf *rf, *newrct;
|
|
|
|
short a;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
a = *count;
|
|
|
|
rf = stack;
|
|
|
|
for (; a > 0; a--) {
|
|
|
|
if (rf->ymin < y1) {
|
|
|
|
if (rf->ymax < y1) {
|
|
|
|
rf->ymin += (y2 - y1);
|
|
|
|
rf->ymax += (y2 - y1);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (rf->ymax > y2) {
|
2019-03-25 11:55:36 +11:00
|
|
|
rf->ymax = y2;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct = stack + *count;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
(*count)++;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->ymax = y2;
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct->ymin = rf->ymin + (y2 - y1);
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->xmin = rf->xmin;
|
|
|
|
newrct->xmax = rf->xmax;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (newrct->ymin == newrct->ymax) {
|
2019-03-25 11:55:36 +11:00
|
|
|
(*count)--;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->ymin = y1;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else if (rf->ymax > y2) {
|
|
|
|
if (rf->ymin > y2) {
|
|
|
|
rf->ymin -= (y2 - y1);
|
|
|
|
rf->ymax -= (y2 - y1);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (rf->ymin < y1) {
|
2019-03-25 11:55:36 +11:00
|
|
|
rf->ymin = y1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct = stack + *count;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
(*count)++;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->ymin = y1;
|
2019-03-25 11:55:36 +11:00
|
|
|
newrct->ymax = rf->ymax - (y2 - y1);
|
2012-03-24 02:51:46 +00:00
|
|
|
newrct->xmin = rf->xmin;
|
|
|
|
newrct->xmax = rf->xmax;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (newrct->ymin == newrct->ymax) {
|
2019-03-25 11:55:36 +11:00
|
|
|
(*count)--;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->ymax = y2;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
rf++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static float square_rctf(rctf *rf)
|
|
|
|
{
|
|
|
|
float x, y;
|
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
x = BLI_rctf_size_x(rf);
|
|
|
|
y = BLI_rctf_size_y(rf);
|
2012-08-21 20:34:05 +00:00
|
|
|
return x * y;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float clipx_rctf(rctf *rf, float x1, float x2)
|
|
|
|
{
|
|
|
|
float size;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
size = BLI_rctf_size_x(rf);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (rf->xmin < x1) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->xmin = x1;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if (rf->xmax > x2) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->xmax = x2;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rf->xmin > rf->xmax) {
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
rf->xmin = rf->xmax;
|
|
|
|
return 0.0;
|
|
|
|
}
|
2020-08-07 13:37:22 +02:00
|
|
|
if (size != 0.0f) {
|
2012-09-15 11:48:20 +00:00
|
|
|
return BLI_rctf_size_x(rf) / size;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
return 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static float clipy_rctf(rctf *rf, float y1, float y2)
|
|
|
|
{
|
|
|
|
float size;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
size = BLI_rctf_size_y(rf);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (rf->ymin < y1) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->ymin = y1;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if (rf->ymax > y2) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rf->ymax = y2;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rf->ymin > rf->ymax) {
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
rf->ymin = rf->ymax;
|
|
|
|
return 0.0;
|
|
|
|
}
|
2020-08-07 13:37:22 +02:00
|
|
|
if (size != 0.0f) {
|
2012-09-15 11:48:20 +00:00
|
|
|
return BLI_rctf_size_y(rf) / size;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
return 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
|
|
|
|
{
|
2019-06-15 09:24:38 +10:00
|
|
|
/* Sample box, is clipped already, and minx etc. have been set at ibuf size.
|
|
|
|
* Enlarge with anti-aliased edges of the pixels. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-01-11 18:39:19 +00:00
|
|
|
float muly, mulx, div, col[4];
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
int x, y, startx, endx, starty, endy;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
startx = (int)floor(rf->xmin);
|
|
|
|
endx = (int)floor(rf->xmax);
|
|
|
|
starty = (int)floor(rf->ymin);
|
|
|
|
endy = (int)floor(rf->ymax);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (startx < 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
startx = 0;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (starty < 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
starty = 0;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (endx >= ibuf->x) {
|
2019-03-25 11:55:36 +11:00
|
|
|
endx = ibuf->x - 1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (endy >= ibuf->y) {
|
2019-03-25 11:55:36 +11:00
|
|
|
endy = ibuf->y - 1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (starty == endy && startx == endx) {
|
2006-01-11 18:39:19 +00:00
|
|
|
ibuf_get_color(&texres->tr, ibuf, startx, starty);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
div = texres->tr = texres->tg = texres->tb = texres->ta = 0.0;
|
|
|
|
for (y = starty; y <= endy; y++) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
muly = 1.0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (starty == endy) {
|
2012-10-07 09:48:59 +00:00
|
|
|
/* pass */
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (y == starty) {
|
2019-03-25 11:55:36 +11:00
|
|
|
muly = 1.0f - (rf->ymin - y);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (y == endy) {
|
2019-03-25 11:55:36 +11:00
|
|
|
muly = (rf->ymax - y);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (startx == endx) {
|
|
|
|
mulx = muly;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-01-11 18:39:19 +00:00
|
|
|
ibuf_get_color(col, ibuf, startx, y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->ta += mulx * col[3];
|
|
|
|
texres->tr += mulx * col[0];
|
|
|
|
texres->tg += mulx * col[1];
|
|
|
|
texres->tb += mulx * col[2];
|
|
|
|
div += mulx;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
for (x = startx; x <= endx; x++) {
|
|
|
|
mulx = muly;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (x == startx) {
|
2019-03-25 11:55:36 +11:00
|
|
|
mulx *= 1.0f - (rf->xmin - x);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (x == endx) {
|
2019-03-25 11:55:36 +11:00
|
|
|
mulx *= (rf->xmax - x);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-01-11 18:39:19 +00:00
|
|
|
ibuf_get_color(col, ibuf, x, y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (mulx == 1.0f) {
|
|
|
|
texres->ta += col[3];
|
|
|
|
texres->tr += col[0];
|
|
|
|
texres->tg += col[1];
|
|
|
|
texres->tb += col[2];
|
|
|
|
div += 1.0f;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->ta += mulx * col[3];
|
|
|
|
texres->tr += mulx * col[0];
|
|
|
|
texres->tg += mulx * col[1];
|
|
|
|
texres->tb += mulx * col[2];
|
|
|
|
div += mulx;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (div != 0.0f) {
|
|
|
|
div = 1.0f / div;
|
|
|
|
texres->tb *= div;
|
|
|
|
texres->tg *= div;
|
|
|
|
texres->tr *= div;
|
|
|
|
texres->ta *= div;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tr = texres->tg = texres->tb = texres->ta = 0.0f;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-28 12:48:39 +00:00
|
|
|
static void boxsample(ImBuf *ibuf,
|
|
|
|
float minx,
|
|
|
|
float miny,
|
|
|
|
float maxx,
|
|
|
|
float maxy,
|
|
|
|
TexResult *texres,
|
|
|
|
const short imaprepeat,
|
|
|
|
const short imapextend)
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
{
|
|
|
|
/* Sample box, performs clip. minx etc are in range 0.0 - 1.0 .
|
2021-02-09 10:42:00 +11:00
|
|
|
* Enlarge with anti-aliased edges of pixels.
|
2011-06-28 12:48:39 +00:00
|
|
|
* If variable 'imaprepeat' has been set, the
|
|
|
|
* clipped-away parts are sampled as well.
|
|
|
|
*/
|
2019-04-22 03:05:53 +10:00
|
|
|
/* note: actually minx etc isn't in the proper range...
|
|
|
|
* this due to filter size and offset vectors for bump */
|
2011-03-29 01:47:03 +00:00
|
|
|
/* note: talpha must be initialized */
|
2012-07-16 23:23:33 +00:00
|
|
|
/* note: even when 'imaprepeat' is set, this can only repeat once in any direction.
|
2011-06-28 12:48:39 +00:00
|
|
|
* the point which min/max is derived from is assumed to be wrapped */
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
TexResult texr;
|
|
|
|
rctf *rf, stack[8];
|
2019-03-25 11:55:36 +11:00
|
|
|
float opp, tot, alphaclip = 1.0;
|
|
|
|
short count = 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
rf = stack;
|
|
|
|
rf->xmin = minx * (ibuf->x);
|
|
|
|
rf->xmax = maxx * (ibuf->x);
|
|
|
|
rf->ymin = miny * (ibuf->y);
|
|
|
|
rf->ymax = maxy * (ibuf->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texr.talpha = texres->talpha; /* is read by boxsample_clip */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (imapextend) {
|
2019-03-25 11:55:36 +11:00
|
|
|
CLAMP(rf->xmin, 0.0f, ibuf->x - 1);
|
|
|
|
CLAMP(rf->xmax, 0.0f, ibuf->x - 1);
|
2005-11-26 17:56:39 +00:00
|
|
|
}
|
2019-04-22 09:08:06 +10:00
|
|
|
else if (imaprepeat) {
|
2007-02-09 10:35:04 +00:00
|
|
|
clipx_rctf_swap(stack, &count, 0.0, (float)(ibuf->x));
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
alphaclip = clipx_rctf(rf, 0.0, (float)(ibuf->x));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (alphaclip <= 0.0f) {
|
|
|
|
texres->tr = texres->tb = texres->tg = texres->ta = 0.0;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
return;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (imapextend) {
|
2019-03-25 11:55:36 +11:00
|
|
|
CLAMP(rf->ymin, 0.0f, ibuf->y - 1);
|
|
|
|
CLAMP(rf->ymax, 0.0f, ibuf->y - 1);
|
2005-11-26 17:56:39 +00:00
|
|
|
}
|
2019-04-22 09:08:06 +10:00
|
|
|
else if (imaprepeat) {
|
2007-02-09 10:35:04 +00:00
|
|
|
clipy_rctf_swap(stack, &count, 0.0, (float)(ibuf->y));
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
alphaclip *= clipy_rctf(rf, 0.0, (float)(ibuf->y));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (alphaclip <= 0.0f) {
|
|
|
|
texres->tr = texres->tb = texres->tg = texres->ta = 0.0;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
return;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (count > 1) {
|
|
|
|
tot = texres->tr = texres->tb = texres->tg = texres->ta = 0.0;
|
2012-03-24 07:52:14 +00:00
|
|
|
while (count--) {
|
2010-03-14 18:22:04 +00:00
|
|
|
boxsampleclip(ibuf, rf, &texr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
opp = square_rctf(rf);
|
|
|
|
tot += opp;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tr += opp * texr.tr;
|
|
|
|
texres->tg += opp * texr.tg;
|
|
|
|
texres->tb += opp * texr.tb;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (texres->talpha) {
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->ta += opp * texr.ta;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
rf++;
|
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tot != 0.0f) {
|
|
|
|
texres->tr /= tot;
|
|
|
|
texres->tg /= tot;
|
|
|
|
texres->tb /= tot;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (texres->talpha) {
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->ta /= tot;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-22 09:08:06 +10:00
|
|
|
else {
|
2010-03-14 18:22:04 +00:00
|
|
|
boxsampleclip(ibuf, rf, texres);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (texres->talpha == 0) {
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->ta = 1.0;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (alphaclip != 1.0f) {
|
2008-09-11 16:50:34 +00:00
|
|
|
/* premul it all */
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tr *= alphaclip;
|
|
|
|
texres->tg *= alphaclip;
|
|
|
|
texres->tb *= alphaclip;
|
|
|
|
texres->ta *= alphaclip;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2019-04-22 03:05:53 +10:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* from here, some functions only used for the new filtering */
|
2009-07-21 13:20:35 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* anisotropic filters, data struct used instead of long line of (possibly unused) func args */
|
2010-05-26 08:06:51 +00:00
|
|
|
typedef struct afdata_t {
|
|
|
|
float dxt[2], dyt[2];
|
|
|
|
int intpol, extflag;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* feline only */
|
2010-05-26 08:06:51 +00:00
|
|
|
float majrad, minrad, theta;
|
|
|
|
int iProbes;
|
|
|
|
float dusc, dvsc;
|
|
|
|
} afdata_t;
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* this only used here to make it easier to pass extend flags as single int */
|
|
|
|
enum { TXC_XMIR = 1, TXC_YMIR, TXC_REPT, TXC_EXTD };
|
2009-07-21 13:20:35 +00:00
|
|
|
|
2020-11-12 11:35:31 +11:00
|
|
|
/**
|
|
|
|
* Similar to `ibuf_get_color()` but clips/wraps coords according to repeat/extend flags
|
|
|
|
* returns true if out of range in clip-mode.
|
|
|
|
*/
|
2012-05-26 16:04:31 +00:00
|
|
|
static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extflag)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
int clip = 0;
|
|
|
|
switch (extflag) {
|
2019-03-25 11:55:36 +11:00
|
|
|
case TXC_XMIR: /* y rep */
|
|
|
|
x %= 2 * ibuf->x;
|
|
|
|
x += x < 0 ? 2 * ibuf->x : 0;
|
|
|
|
x = x >= ibuf->x ? 2 * ibuf->x - x - 1 : x;
|
2009-07-21 13:20:35 +00:00
|
|
|
y %= ibuf->y;
|
|
|
|
y += y < 0 ? ibuf->y : 0;
|
|
|
|
break;
|
2019-03-25 11:55:36 +11:00
|
|
|
case TXC_YMIR: /* x rep */
|
2009-07-21 13:20:35 +00:00
|
|
|
x %= ibuf->x;
|
|
|
|
x += x < 0 ? ibuf->x : 0;
|
2019-03-25 11:55:36 +11:00
|
|
|
y %= 2 * ibuf->y;
|
|
|
|
y += y < 0 ? 2 * ibuf->y : 0;
|
|
|
|
y = y >= ibuf->y ? 2 * ibuf->y - y - 1 : y;
|
2009-07-21 13:20:35 +00:00
|
|
|
break;
|
|
|
|
case TXC_EXTD:
|
|
|
|
x = (x < 0) ? 0 : ((x >= ibuf->x) ? (ibuf->x - 1) : x);
|
|
|
|
y = (y < 0) ? 0 : ((y >= ibuf->y) ? (ibuf->y - 1) : y);
|
|
|
|
break;
|
|
|
|
case TXC_REPT:
|
|
|
|
x %= ibuf->x;
|
|
|
|
x += (x < 0) ? ibuf->x : 0;
|
|
|
|
y %= ibuf->y;
|
|
|
|
y += (y < 0) ? ibuf->y : 0;
|
|
|
|
break;
|
2019-03-25 11:55:36 +11:00
|
|
|
default: { /* as extend, if clipped, set alpha to 0.0 */
|
2012-07-07 22:51:57 +00:00
|
|
|
if (x < 0) {
|
|
|
|
x = 0;
|
|
|
|
} /* TXF alpha: clip = 1; } */
|
|
|
|
if (x >= ibuf->x) {
|
|
|
|
x = ibuf->x - 1;
|
|
|
|
} /* TXF alpha: clip = 1; } */
|
|
|
|
if (y < 0) {
|
|
|
|
y = 0;
|
|
|
|
} /* TXF alpha: clip = 1; } */
|
|
|
|
if (y >= ibuf->y) {
|
|
|
|
y = ibuf->y - 1;
|
2009-07-21 13:20:35 +00:00
|
|
|
} /* TXF alpha: clip = 1; } */
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (ibuf->rect_float) {
|
2019-03-25 11:42:28 +11:00
|
|
|
const float *fp = ibuf->rect_float + (x + y * ibuf->x) * ibuf->channels;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ibuf->channels == 1) {
|
2009-07-21 13:20:35 +00:00
|
|
|
col[0] = col[1] = col[2] = col[3] = *fp;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
else {
|
|
|
|
col[0] = fp[0];
|
|
|
|
col[1] = fp[1];
|
|
|
|
col[2] = fp[2];
|
2020-11-06 11:25:27 +11:00
|
|
|
col[3] = clip ? 0.0f : (ibuf->channels == 4 ? fp[3] : 1.0f);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
const char *rect = (char *)(ibuf->rect + x + y * ibuf->x);
|
2012-12-31 13:52:13 +00:00
|
|
|
float inv_alpha_fac = (1.0f / 255.0f) * rect[3] * (1.0f / 255.0f);
|
|
|
|
col[0] = rect[0] * inv_alpha_fac;
|
|
|
|
col[1] = rect[1] * inv_alpha_fac;
|
|
|
|
col[2] = rect[2] * inv_alpha_fac;
|
2020-11-06 11:25:27 +11:00
|
|
|
col[3] = clip ? 0.0f : rect[3] * (1.0f / 255.0f);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
return clip;
|
|
|
|
}
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* as above + bilerp */
|
2012-05-26 16:04:31 +00:00
|
|
|
static int ibuf_get_color_clip_bilerp(
|
|
|
|
float col[4], ImBuf *ibuf, float u, float v, int intpol, int extflag)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
if (intpol) {
|
|
|
|
float c00[4], c01[4], c10[4], c11[4];
|
|
|
|
const float ufl = floorf(u -= 0.5f), vfl = floorf(v -= 0.5f);
|
|
|
|
const float uf = u - ufl, vf = v - vfl;
|
2020-11-06 11:25:27 +11:00
|
|
|
const float w00 = (1.0f - uf) * (1.0f - vf), w10 = uf * (1.0f - vf), w01 = (1.0f - uf) * vf,
|
2019-03-25 11:55:36 +11:00
|
|
|
w11 = uf * vf;
|
2009-07-21 13:20:35 +00:00
|
|
|
const int x1 = (int)ufl, y1 = (int)vfl, x2 = x1 + 1, y2 = y1 + 1;
|
|
|
|
int clip = ibuf_get_color_clip(c00, ibuf, x1, y1, extflag);
|
|
|
|
clip |= ibuf_get_color_clip(c10, ibuf, x2, y1, extflag);
|
|
|
|
clip |= ibuf_get_color_clip(c01, ibuf, x1, y2, extflag);
|
|
|
|
clip |= ibuf_get_color_clip(c11, ibuf, x2, y2, extflag);
|
2019-03-25 11:55:36 +11:00
|
|
|
col[0] = w00 * c00[0] + w10 * c10[0] + w01 * c01[0] + w11 * c11[0];
|
|
|
|
col[1] = w00 * c00[1] + w10 * c10[1] + w01 * c01[1] + w11 * c11[1];
|
|
|
|
col[2] = w00 * c00[2] + w10 * c10[2] + w01 * c01[2] + w11 * c11[2];
|
2020-11-06 11:25:27 +11:00
|
|
|
col[3] = clip ? 0.0f : w00 * c00[3] + w10 * c10[3] + w01 * c01[3] + w11 * c11[3];
|
2009-07-21 13:20:35 +00:00
|
|
|
return clip;
|
|
|
|
}
|
|
|
|
return ibuf_get_color_clip(col, ibuf, (int)u, (int)v, extflag);
|
|
|
|
}
|
|
|
|
|
2012-08-23 07:10:48 +00:00
|
|
|
static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
int xs, ys, clip = 0;
|
2020-11-06 11:25:27 +11:00
|
|
|
float tc[4], xsd, ysd, cw = 0.0f;
|
2019-03-25 11:55:36 +11:00
|
|
|
const float ux = ibuf->x * AFD->dxt[0], uy = ibuf->y * AFD->dxt[1];
|
|
|
|
const float vx = ibuf->x * AFD->dyt[0], vy = ibuf->y * AFD->dyt[1];
|
|
|
|
int xsam = (int)(0.5f * sqrtf(ux * ux + uy * uy) + 0.5f);
|
|
|
|
int ysam = (int)(0.5f * sqrtf(vx * vx + vy * vy) + 0.5f);
|
2009-07-21 13:20:35 +00:00
|
|
|
const int minsam = AFD->intpol ? 2 : 4;
|
2019-03-25 11:55:36 +11:00
|
|
|
xsam = CLAMPIS(xsam, minsam, ibuf->x * 2);
|
|
|
|
ysam = CLAMPIS(ysam, minsam, ibuf->y * 2);
|
2020-11-06 11:25:27 +11:00
|
|
|
xsd = 1.0f / xsam;
|
|
|
|
ysd = 1.0f / ysam;
|
|
|
|
texr->tr = texr->tg = texr->tb = texr->ta = 0.0f;
|
2019-09-08 00:12:26 +10:00
|
|
|
for (ys = 0; ys < ysam; ys++) {
|
|
|
|
for (xs = 0; xs < xsam; xs++) {
|
2019-03-25 11:55:36 +11:00
|
|
|
const float su = (xs + ((ys & 1) + 0.5f) * 0.5f) * xsd - 0.5f;
|
|
|
|
const float sv = (ys + ((xs & 1) + 0.5f) * 0.5f) * ysd - 0.5f;
|
|
|
|
const float pu = fx + su * AFD->dxt[0] + sv * AFD->dyt[0];
|
|
|
|
const float pv = fy + su * AFD->dxt[1] + sv * AFD->dyt[1];
|
|
|
|
const int out = ibuf_get_color_clip_bilerp(
|
|
|
|
tc, ibuf, pu * ibuf->x, pv * ibuf->y, AFD->intpol, AFD->extflag);
|
2009-07-21 13:20:35 +00:00
|
|
|
clip |= out;
|
2020-11-06 11:25:27 +11:00
|
|
|
cw += out ? 0.0f : 1.0f;
|
2009-07-21 13:20:35 +00:00
|
|
|
texr->tr += tc[0];
|
|
|
|
texr->tg += tc[1];
|
|
|
|
texr->tb += tc[2];
|
2020-11-06 11:25:27 +11:00
|
|
|
texr->ta += texr->talpha ? tc[3] : 0.0f;
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
xsd *= ysd;
|
|
|
|
texr->tr *= xsd;
|
|
|
|
texr->tg *= xsd;
|
|
|
|
texr->tb *= xsd;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* clipping can be ignored if alpha used, texr->ta already includes filtered edge */
|
2020-11-06 11:25:27 +11:00
|
|
|
texr->ta = texr->talpha ? texr->ta * xsd : (clip ? cw * xsd : 1.0f);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
2014-08-18 19:37:13 +06:00
|
|
|
typedef struct ReadEWAData {
|
|
|
|
ImBuf *ibuf;
|
|
|
|
afdata_t *AFD;
|
|
|
|
} ReadEWAData;
|
2009-07-21 13:20:35 +00:00
|
|
|
|
2014-08-18 19:37:13 +06:00
|
|
|
static void ewa_read_pixel_cb(void *userdata, int x, int y, float result[4])
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
2019-03-25 11:55:36 +11:00
|
|
|
ReadEWAData *data = (ReadEWAData *)userdata;
|
2014-08-18 19:37:13 +06:00
|
|
|
ibuf_get_color_clip(result, data->ibuf, x, y, data->AFD->extflag);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
2012-08-23 07:10:48 +00:00
|
|
|
static void ewa_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
2014-08-18 19:37:13 +06:00
|
|
|
ReadEWAData data;
|
2020-08-07 22:36:11 +10:00
|
|
|
const float uv[2] = {fx, fy};
|
2014-08-18 19:37:13 +06:00
|
|
|
data.ibuf = ibuf;
|
|
|
|
data.AFD = AFD;
|
|
|
|
BLI_ewa_filter(ibuf->x,
|
|
|
|
ibuf->y,
|
|
|
|
AFD->intpol != 0,
|
|
|
|
texr->talpha,
|
|
|
|
uv,
|
|
|
|
AFD->dxt,
|
|
|
|
AFD->dyt,
|
|
|
|
ewa_read_pixel_cb,
|
|
|
|
&data,
|
|
|
|
&texr->tr);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
2012-08-23 07:10:48 +00:00
|
|
|
static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
const int maxn = AFD->iProbes - 1;
|
2020-11-06 11:25:27 +11:00
|
|
|
const float ll = ((AFD->majrad == AFD->minrad) ? 2.0f * AFD->majrad :
|
|
|
|
2.0f * (AFD->majrad - AFD->minrad)) /
|
|
|
|
(maxn ? (float)maxn : 1.0f);
|
|
|
|
float du = maxn ? cosf(AFD->theta) * ll : 0.0f;
|
|
|
|
float dv = maxn ? sinf(AFD->theta) * ll : 0.0f;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* const float D = -0.5f*(du*du + dv*dv) / (AFD->majrad*AFD->majrad); */
|
2019-03-25 11:55:36 +11:00
|
|
|
const float D = (EWA_MAXIDX + 1) * 0.25f * (du * du + dv * dv) / (AFD->majrad * AFD->majrad);
|
2020-11-06 11:25:27 +11:00
|
|
|
float d; /* TXF alpha: cw = 0.0f; */
|
2012-07-07 22:51:57 +00:00
|
|
|
int n; /* TXF alpha: clip = 0; */
|
|
|
|
/* have to use same scaling for du/dv here as for Ux/Vx/Uy/Vy (*after* D calc.) */
|
2009-07-21 13:20:35 +00:00
|
|
|
du *= AFD->dusc;
|
|
|
|
dv *= AFD->dvsc;
|
2020-11-06 11:25:27 +11:00
|
|
|
d = texr->tr = texr->tb = texr->tg = texr->ta = 0.0f;
|
2019-03-25 11:55:36 +11:00
|
|
|
for (n = -maxn; n <= maxn; n += 2) {
|
2009-07-21 13:20:35 +00:00
|
|
|
float tc[4];
|
2019-03-25 11:55:36 +11:00
|
|
|
const float hn = n * 0.5f;
|
|
|
|
const float u = fx + hn * du, v = fy + hn * dv;
|
2019-04-18 07:21:26 +02:00
|
|
|
/* Can use ewa table here too. */
|
|
|
|
#if 0
|
|
|
|
const float wt = expf(n * n * D);
|
|
|
|
#else
|
2019-03-25 11:55:36 +11:00
|
|
|
const float wt = EWA_WTS[(int)(n * n * D)];
|
2019-04-18 07:21:26 +02:00
|
|
|
#endif
|
2019-03-25 11:55:36 +11:00
|
|
|
/*const int out =*/ibuf_get_color_clip_bilerp(
|
|
|
|
tc, ibuf, ibuf->x * u, ibuf->y * v, AFD->intpol, AFD->extflag);
|
2012-07-07 22:51:57 +00:00
|
|
|
/* TXF alpha: clip |= out;
|
2020-11-06 11:25:27 +11:00
|
|
|
* TXF alpha: cw += out ? 0.0f : wt; */
|
2019-03-25 11:55:36 +11:00
|
|
|
texr->tr += tc[0] * wt;
|
|
|
|
texr->tg += tc[1] * wt;
|
|
|
|
texr->tb += tc[2] * wt;
|
2020-11-06 11:25:27 +11:00
|
|
|
texr->ta += texr->talpha ? tc[3] * wt : 0.0f;
|
2009-07-21 13:20:35 +00:00
|
|
|
d += wt;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-06 11:25:27 +11:00
|
|
|
d = 1.0f / d;
|
2009-07-21 13:20:35 +00:00
|
|
|
texr->tr *= d;
|
|
|
|
texr->tg *= d;
|
|
|
|
texr->tb *= d;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* clipping can be ignored if alpha used, texr->ta already includes filtered edge */
|
2020-11-06 11:25:27 +11:00
|
|
|
texr->ta = texr->talpha ? texr->ta * d : 1.0f; // TXF alpha: (clip ? cw*d : 1.0f);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
#undef EWA_MAXIDX
|
|
|
|
|
|
|
|
static void alpha_clip_aniso(
|
|
|
|
ImBuf *ibuf, float minx, float miny, float maxx, float maxy, int extflag, TexResult *texres)
|
|
|
|
{
|
|
|
|
float alphaclip;
|
|
|
|
rctf rf;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-08-04 12:51:44 +10:00
|
|
|
/* TXF alpha: we're doing the same alpha-clip here as box-sample, but I'm doubting
|
2012-07-07 22:51:57 +00:00
|
|
|
* if this is actually correct for the all the filtering algorithms .. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!(extflag == TXC_REPT || extflag == TXC_EXTD)) {
|
2019-03-25 11:55:36 +11:00
|
|
|
rf.xmin = minx * (ibuf->x);
|
|
|
|
rf.xmax = maxx * (ibuf->x);
|
|
|
|
rf.ymin = miny * (ibuf->y);
|
|
|
|
rf.ymax = maxy * (ibuf->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-29 16:59:51 +00:00
|
|
|
alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
|
|
|
|
alphaclip *= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
|
2012-10-23 13:28:22 +00:00
|
|
|
alphaclip = max_ff(alphaclip, 0.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (alphaclip != 1.0f) {
|
2009-07-21 13:20:35 +00:00
|
|
|
/* premul it all */
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tr *= alphaclip;
|
|
|
|
texres->tg *= alphaclip;
|
|
|
|
texres->tb *= alphaclip;
|
|
|
|
texres->ta *= alphaclip;
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-14 18:02:41 +00:00
|
|
|
static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
|
|
|
|
{
|
|
|
|
if (tex->imaflag & TEX_MIPMAP) {
|
2018-07-10 17:54:20 +02:00
|
|
|
if (ibuf->mipmap[0] && (ibuf->userflags & IB_MIPMAP_INVALID)) {
|
|
|
|
BLI_thread_lock(LOCK_IMAGE);
|
|
|
|
if (ibuf->userflags & IB_MIPMAP_INVALID) {
|
|
|
|
IMB_remakemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
|
|
|
|
ibuf->userflags &= ~IB_MIPMAP_INVALID;
|
2013-02-13 05:07:46 +00:00
|
|
|
}
|
2018-07-10 17:54:20 +02:00
|
|
|
BLI_thread_unlock(LOCK_IMAGE);
|
|
|
|
}
|
|
|
|
if (ibuf->mipmap[0] == NULL) {
|
|
|
|
BLI_thread_lock(LOCK_IMAGE);
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ibuf->mipmap[0] == NULL) {
|
2018-07-10 17:54:20 +02:00
|
|
|
IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2018-07-10 17:54:20 +02:00
|
|
|
BLI_thread_unlock(LOCK_IMAGE);
|
|
|
|
}
|
|
|
|
/* if no mipmap could be made, fall back on non-mipmap render */
|
|
|
|
if (ibuf->mipmap[0] == NULL) {
|
|
|
|
tex->imaflag &= ~TEX_MIPMAP;
|
2010-12-14 18:02:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-27 16:14:53 +05:00
|
|
|
static int imagewraposa_aniso(Tex *tex,
|
|
|
|
Image *ima,
|
|
|
|
ImBuf *ibuf,
|
|
|
|
const float texvec[3],
|
|
|
|
float dxt[2],
|
|
|
|
float dyt[2],
|
|
|
|
TexResult *texres,
|
|
|
|
struct ImagePool *pool,
|
|
|
|
const bool skip_load_image)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
TexResult texr;
|
|
|
|
float fx, fy, minx, maxx, miny, maxy;
|
|
|
|
float maxd, val1, val2, val3;
|
|
|
|
int curmap, retval, intpol, extflag = 0;
|
|
|
|
afdata_t AFD;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
void (*filterfunc)(TexResult *, ImBuf *, float, float, afdata_t *);
|
2009-07-21 13:20:35 +00:00
|
|
|
switch (tex->texfilter) {
|
|
|
|
case TXF_EWA:
|
|
|
|
filterfunc = ewa_eval;
|
|
|
|
break;
|
|
|
|
case TXF_FELINE:
|
|
|
|
filterfunc = feline_eval;
|
|
|
|
break;
|
|
|
|
case TXF_AREA:
|
|
|
|
default:
|
|
|
|
filterfunc = area_sample;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-06 11:25:27 +11:00
|
|
|
texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* we need to set retval OK, otherwise texture code generates normals itself... */
|
2020-01-14 19:38:28 +01:00
|
|
|
retval = texres->nor ? (TEX_RGB | TEX_NOR) : TEX_RGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* quick tests */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ibuf == NULL && ima == NULL) {
|
2019-03-25 11:55:36 +11:00
|
|
|
return retval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (ima) { /* hack for icon render */
|
2015-01-27 16:14:53 +05:00
|
|
|
if (skip_load_image && !BKE_image_has_loaded_ibuf(ima)) {
|
2013-12-13 16:22:08 +06:00
|
|
|
return retval;
|
|
|
|
}
|
2013-01-21 08:49:42 +00:00
|
|
|
ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, pool);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-15 15:59:58 +00:00
|
|
|
if ((ibuf == NULL) || ((ibuf->rect == NULL) && (ibuf->rect_float == NULL))) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-27 02:56:46 +00:00
|
|
|
if (ima) {
|
|
|
|
ima->flag |= IMA_USED_FOR_RENDER;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-12-14 18:02:41 +00:00
|
|
|
/* mipmap test */
|
|
|
|
image_mipmap_test(tex, ibuf);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-09 14:01:42 +00:00
|
|
|
if (ima) {
|
2019-05-18 20:52:20 +02:00
|
|
|
if ((tex->imaflag & TEX_USEALPHA) && (ima->alpha_mode != IMA_ALPHA_IGNORE)) {
|
2013-05-09 14:01:42 +00:00
|
|
|
if ((tex->imaflag & TEX_CALCALPHA) == 0) {
|
|
|
|
texres->talpha = 1;
|
|
|
|
}
|
|
|
|
}
|
2013-02-07 15:36:59 +00:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
texr.talpha = texres->talpha;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->imaflag & TEX_IMAROT) {
|
|
|
|
fy = texvec[0];
|
|
|
|
fx = texvec[1];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fx = texvec[0];
|
|
|
|
fy = texvec[1];
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* pixel coordinates */
|
2012-12-21 05:07:26 +00:00
|
|
|
minx = min_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
|
|
|
|
maxx = max_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
|
|
|
|
miny = min_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
|
|
|
|
maxy = max_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* tex_sharper has been removed */
|
2019-03-25 11:55:36 +11:00
|
|
|
minx = (maxx - minx) * 0.5f;
|
|
|
|
miny = (maxy - miny) * 0.5f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->imaflag & TEX_FILTER_MIN) {
|
2019-04-22 03:05:53 +10:00
|
|
|
/* Make sure the filtersize is minimal in pixels
|
|
|
|
* (normal, ref map can have miniature pixel dx/dy). */
|
2011-11-11 13:09:14 +00:00
|
|
|
const float addval = (0.5f * tex->filtersize) / (float)MIN2(ibuf->x, ibuf->y);
|
2019-04-22 09:08:06 +10:00
|
|
|
if (addval > minx) {
|
2009-07-21 13:20:35 +00:00
|
|
|
minx = addval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (addval > miny) {
|
2009-07-21 13:20:35 +00:00
|
|
|
miny = addval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2020-11-06 11:25:27 +11:00
|
|
|
else if (tex->filtersize != 1.0f) {
|
2009-07-21 13:20:35 +00:00
|
|
|
minx *= tex->filtersize;
|
|
|
|
miny *= tex->filtersize;
|
|
|
|
dxt[0] *= tex->filtersize;
|
|
|
|
dxt[1] *= tex->filtersize;
|
|
|
|
dyt[0] *= tex->filtersize;
|
|
|
|
dyt[1] *= tex->filtersize;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->imaflag & TEX_IMAROT) {
|
|
|
|
float t;
|
|
|
|
SWAP(float, minx, miny);
|
2012-07-07 22:51:57 +00:00
|
|
|
/* must rotate dxt/dyt 90 deg
|
2020-11-12 11:35:31 +11:00
|
|
|
* yet another blender problem is that swapping X/Y axes (or any tex projection switches)
|
2019-04-22 03:05:53 +10:00
|
|
|
* should do something similar, but it doesn't, it only swaps coords,
|
|
|
|
* so filter area will be incorrect in those cases. */
|
2009-07-21 13:20:35 +00:00
|
|
|
t = dxt[0];
|
|
|
|
dxt[0] = dxt[1];
|
|
|
|
dxt[1] = -t;
|
|
|
|
t = dyt[0];
|
|
|
|
dyt[0] = dyt[1];
|
|
|
|
dyt[1] = -t;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* side faces of unit-cube */
|
2011-04-02 02:08:33 +00:00
|
|
|
minx = (minx > 0.25f) ? 0.25f : ((minx < 1e-5f) ? 1e-5f : minx);
|
|
|
|
miny = (miny > 0.25f) ? 0.25f : ((miny < 1e-5f) ? 1e-5f : miny);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* repeat and clip */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->extend == TEX_REPEAT) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if ((tex->flag & (TEX_REPEAT_XMIR | TEX_REPEAT_YMIR)) == (TEX_REPEAT_XMIR | TEX_REPEAT_YMIR)) {
|
2009-07-21 13:20:35 +00:00
|
|
|
extflag = TXC_EXTD;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (tex->flag & TEX_REPEAT_XMIR) {
|
2009-07-21 13:20:35 +00:00
|
|
|
extflag = TXC_XMIR;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (tex->flag & TEX_REPEAT_YMIR) {
|
2009-07-21 13:20:35 +00:00
|
|
|
extflag = TXC_YMIR;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2009-07-21 13:20:35 +00:00
|
|
|
extflag = TXC_REPT;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-22 09:08:06 +10:00
|
|
|
else if (tex->extend == TEX_EXTEND) {
|
2009-07-21 13:20:35 +00:00
|
|
|
extflag = TXC_EXTD;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->extend == TEX_CHECKER) {
|
|
|
|
int xs = (int)floorf(fx), ys = (int)floorf(fy);
|
2012-07-07 22:51:57 +00:00
|
|
|
/* both checkers available, no boundary exceptions, checkerdist will eat aliasing */
|
2009-07-21 13:20:35 +00:00
|
|
|
if ((tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN)) {
|
|
|
|
fx -= xs;
|
|
|
|
fy -= ys;
|
|
|
|
}
|
2016-01-08 13:20:34 +05:00
|
|
|
else if ((tex->flag & TEX_CHECKER_ODD) == 0 && (tex->flag & TEX_CHECKER_EVEN) == 0) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2016-01-08 13:20:34 +05:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2016-01-08 13:20:34 +05:00
|
|
|
return retval;
|
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
else {
|
|
|
|
int xs1 = (int)floorf(fx - minx);
|
|
|
|
int ys1 = (int)floorf(fy - miny);
|
|
|
|
int xs2 = (int)floorf(fx + minx);
|
|
|
|
int ys2 = (int)floorf(fy + miny);
|
|
|
|
if ((xs1 != xs2) || (ys1 != ys2)) {
|
|
|
|
if (tex->flag & TEX_CHECKER_ODD) {
|
|
|
|
fx -= ((xs1 + ys) & 1) ? xs2 : xs1;
|
|
|
|
fy -= ((ys1 + xs) & 1) ? ys2 : ys1;
|
|
|
|
}
|
|
|
|
if (tex->flag & TEX_CHECKER_EVEN) {
|
|
|
|
fx -= ((xs1 + ys) & 1) ? xs1 : xs2;
|
|
|
|
fy -= ((ys1 + xs) & 1) ? ys1 : ys2;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-11-15 15:59:58 +00:00
|
|
|
if ((tex->flag & TEX_CHECKER_ODD) == 0 && ((xs + ys) & 1) == 0) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
if ((tex->flag & TEX_CHECKER_EVEN) == 0 && (xs + ys) & 1) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
fx -= xs;
|
|
|
|
fy -= ys;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2012-07-07 22:51:57 +00:00
|
|
|
/* scale around center, (0.5, 0.5) */
|
2020-11-06 11:25:27 +11:00
|
|
|
if (tex->checkerdist < 1.0f) {
|
|
|
|
const float omcd = 1.0f / (1.0f - tex->checkerdist);
|
2019-03-25 11:55:36 +11:00
|
|
|
fx = (fx - 0.5f) * omcd + 0.5f;
|
|
|
|
fy = (fy - 0.5f) * omcd + 0.5f;
|
2009-07-21 13:20:35 +00:00
|
|
|
minx *= omcd;
|
|
|
|
miny *= omcd;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->extend == TEX_CLIPCUBE) {
|
2020-11-06 11:25:27 +11:00
|
|
|
if ((fx + minx) < 0.0f || (fy + miny) < 0.0f || (fx - minx) > 1.0f || (fy - miny) > 1.0f ||
|
|
|
|
texvec[2] < -1.0f || texvec[2] > 1.0f) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
}
|
2020-11-06 12:30:59 +11:00
|
|
|
else if (ELEM(tex->extend, TEX_CLIP, TEX_CHECKER)) {
|
2020-11-06 11:25:27 +11:00
|
|
|
if ((fx + minx) < 0.0f || (fy + miny) < 0.0f || (fx - minx) > 1.0f || (fy - miny) > 1.0f) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
else {
|
|
|
|
if (tex->extend == TEX_EXTEND) {
|
2020-11-06 11:25:27 +11:00
|
|
|
fx = (fx > 1.0f) ? 1.0f : ((fx < 0.0f) ? 0.0f : fx);
|
|
|
|
fy = (fy > 1.0f) ? 1.0f : ((fy < 0.0f) ? 0.0f : fy);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
fx -= floorf(fx);
|
|
|
|
fy -= floorf(fy);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
intpol = tex->imaflag & TEX_INTERPOL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* struct common data */
|
2010-02-15 08:29:01 +00:00
|
|
|
copy_v2_v2(AFD.dxt, dxt);
|
|
|
|
copy_v2_v2(AFD.dyt, dyt);
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.intpol = intpol;
|
|
|
|
AFD.extflag = extflag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* brecht: added stupid clamping here, large dx/dy can give very large
|
|
|
|
* filter sizes which take ages to render, it may be better to do this
|
|
|
|
* more intelligently later in the code .. probably it's not noticeable */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (AFD.dxt[0] * AFD.dxt[0] + AFD.dxt[1] * AFD.dxt[1] > 2.0f * 2.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
mul_v2_fl(AFD.dxt, 2.0f / len_v2(AFD.dxt));
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (AFD.dyt[0] * AFD.dyt[0] + AFD.dyt[1] * AFD.dyt[1] > 2.0f * 2.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
mul_v2_fl(AFD.dyt, 2.0f / len_v2(AFD.dyt));
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* choice: */
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->imaflag & TEX_MIPMAP) {
|
|
|
|
ImBuf *previbuf, *curibuf;
|
|
|
|
float levf;
|
|
|
|
int maxlev;
|
2015-07-13 22:00:07 +10:00
|
|
|
ImBuf *mipmaps[IMB_MIPMAP_LEVELS + 1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-12 11:35:31 +11:00
|
|
|
/* Modify ellipse minor axis if too eccentric, use for area sampling as well
|
|
|
|
* scaling `dxt/dyt` as done in PBRT is not the same
|
|
|
|
* (as in `ewa_eval()`, scale by `sqrt(ibuf->x)` to maximize precision). */
|
2019-03-25 11:55:36 +11:00
|
|
|
const float ff = sqrtf(ibuf->x), q = ibuf->y / ff;
|
|
|
|
const float Ux = dxt[0] * ff, Vx = dxt[1] * q, Uy = dyt[0] * ff, Vy = dyt[1] * q;
|
|
|
|
const float A = Vx * Vx + Vy * Vy;
|
2020-11-06 11:25:27 +11:00
|
|
|
const float B = -2.0f * (Ux * Vx + Uy * Vy);
|
2019-03-25 11:55:36 +11:00
|
|
|
const float C = Ux * Ux + Uy * Uy;
|
|
|
|
const float F = A * C - B * B * 0.25f;
|
2009-07-21 13:20:35 +00:00
|
|
|
float a, b, th, ecc;
|
2014-08-18 19:37:13 +06:00
|
|
|
BLI_ewa_imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->texfilter == TXF_FELINE) {
|
|
|
|
float fProbes;
|
|
|
|
a *= ff;
|
|
|
|
b *= ff;
|
2012-10-23 13:28:22 +00:00
|
|
|
a = max_ff(a, 1.0f);
|
|
|
|
b = max_ff(b, 1.0f);
|
2020-11-06 11:25:27 +11:00
|
|
|
fProbes = 2.0f * (a / b) - 1.0f;
|
2017-09-27 11:13:03 +10:00
|
|
|
AFD.iProbes = round_fl_to_int(fProbes);
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.iProbes = MIN2(AFD.iProbes, tex->afmax);
|
2019-04-22 09:08:06 +10:00
|
|
|
if (AFD.iProbes < fProbes) {
|
2020-11-06 11:25:27 +11:00
|
|
|
b = 2.0f * a / (float)(AFD.iProbes + 1);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
AFD.majrad = a / ff;
|
|
|
|
AFD.minrad = b / ff;
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.theta = th;
|
2020-11-06 11:25:27 +11:00
|
|
|
AFD.dusc = 1.0f / ff;
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.dvsc = ff / (float)ibuf->y;
|
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else { /* EWA & area */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ecc > (float)tex->afmax) {
|
2009-07-21 13:20:35 +00:00
|
|
|
b = a / (float)tex->afmax;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
b *= ff;
|
|
|
|
}
|
2012-10-23 13:28:22 +00:00
|
|
|
maxd = max_ff(b, 1e-8f);
|
2012-07-29 16:59:51 +00:00
|
|
|
levf = ((float)M_LOG2E) * logf(maxd);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
curmap = 0;
|
|
|
|
maxlev = 1;
|
|
|
|
mipmaps[0] = ibuf;
|
2015-07-13 22:00:07 +10:00
|
|
|
while (curmap < IMB_MIPMAP_LEVELS) {
|
2009-07-21 13:20:35 +00:00
|
|
|
mipmaps[curmap + 1] = ibuf->mipmap[curmap];
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ibuf->mipmap[curmap]) {
|
2009-07-21 13:20:35 +00:00
|
|
|
maxlev++;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
curmap++;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* mipmap level */
|
2020-11-06 11:25:27 +11:00
|
|
|
if (levf < 0.0f) { /* original image only */
|
2009-07-21 13:20:35 +00:00
|
|
|
previbuf = curibuf = mipmaps[0];
|
2020-11-06 11:25:27 +11:00
|
|
|
levf = 0.0f;
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
else if (levf >= maxlev - 1) {
|
|
|
|
previbuf = curibuf = mipmaps[maxlev - 1];
|
2020-11-06 11:25:27 +11:00
|
|
|
levf = 0.0f;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (tex->texfilter == TXF_FELINE) {
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.iProbes = 1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-10-10 02:04:36 +06:00
|
|
|
const int lev = isnan(levf) ? 0 : (int)levf;
|
2009-07-21 13:20:35 +00:00
|
|
|
curibuf = mipmaps[lev];
|
|
|
|
previbuf = mipmaps[lev + 1];
|
|
|
|
levf -= floorf(levf);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* filter functions take care of interpolation themselves, no need to modify dxt/dyt here */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
if (texres->nor && ((tex->imaflag & TEX_NORMALMAP) == 0)) {
|
2012-07-07 22:51:57 +00:00
|
|
|
/* color & normal */
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(texres, curibuf, fx, fy, &AFD);
|
|
|
|
val1 = texres->tr + texres->tg + texres->tb;
|
|
|
|
filterfunc(&texr, curibuf, fx + dxt[0], fy + dxt[1], &AFD);
|
|
|
|
val2 = texr.tr + texr.tg + texr.tb;
|
|
|
|
filterfunc(&texr, curibuf, fx + dyt[0], fy + dyt[1], &AFD);
|
|
|
|
val3 = texr.tr + texr.tg + texr.tb;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* don't switch x or y! */
|
2009-07-21 13:20:35 +00:00
|
|
|
texres->nor[0] = val1 - val2;
|
|
|
|
texres->nor[1] = val1 - val3;
|
2012-07-07 22:51:57 +00:00
|
|
|
if (previbuf != curibuf) { /* interpolate */
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(&texr, previbuf, fx, fy, &AFD);
|
2012-07-07 22:51:57 +00:00
|
|
|
/* rgb */
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tr += levf * (texr.tr - texres->tr);
|
|
|
|
texres->tg += levf * (texr.tg - texres->tg);
|
|
|
|
texres->tb += levf * (texr.tb - texres->tb);
|
|
|
|
texres->ta += levf * (texr.ta - texres->ta);
|
2012-07-07 22:51:57 +00:00
|
|
|
/* normal */
|
2019-03-25 11:55:36 +11:00
|
|
|
val1 += levf * ((texr.tr + texr.tg + texr.tb) - val1);
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(&texr, previbuf, fx + dxt[0], fy + dxt[1], &AFD);
|
2019-03-25 11:55:36 +11:00
|
|
|
val2 += levf * ((texr.tr + texr.tg + texr.tb) - val2);
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(&texr, previbuf, fx + dyt[0], fy + dyt[1], &AFD);
|
2019-03-25 11:55:36 +11:00
|
|
|
val3 += levf * ((texr.tr + texr.tg + texr.tb) - val3);
|
2012-07-07 22:51:57 +00:00
|
|
|
texres->nor[0] = val1 - val2; /* vals have been interpolated above! */
|
2009-07-21 13:20:35 +00:00
|
|
|
texres->nor[1] = val1 - val3;
|
|
|
|
}
|
|
|
|
}
|
2012-07-07 22:51:57 +00:00
|
|
|
else { /* color */
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(texres, curibuf, fx, fy, &AFD);
|
2012-07-07 22:51:57 +00:00
|
|
|
if (previbuf != curibuf) { /* interpolate */
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(&texr, previbuf, fx, fy, &AFD);
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tr += levf * (texr.tr - texres->tr);
|
|
|
|
texres->tg += levf * (texr.tg - texres->tg);
|
|
|
|
texres->tb += levf * (texr.tb - texres->tb);
|
|
|
|
texres->ta += levf * (texr.ta - texres->ta);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-05 22:41:41 +05:00
|
|
|
if (tex->texfilter != TXF_EWA) {
|
2019-03-25 11:55:36 +11:00
|
|
|
alpha_clip_aniso(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, extflag, texres);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2016-01-05 22:41:41 +05:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else { /* no mipmap */
|
2012-07-07 22:51:57 +00:00
|
|
|
/* filter functions take care of interpolation themselves, no need to modify dxt/dyt here */
|
2009-07-21 13:20:35 +00:00
|
|
|
if (tex->texfilter == TXF_FELINE) {
|
2019-03-25 11:55:36 +11:00
|
|
|
const float ff = sqrtf(ibuf->x), q = ibuf->y / ff;
|
|
|
|
const float Ux = dxt[0] * ff, Vx = dxt[1] * q, Uy = dyt[0] * ff, Vy = dyt[1] * q;
|
|
|
|
const float A = Vx * Vx + Vy * Vy;
|
2020-11-06 11:25:27 +11:00
|
|
|
const float B = -2.0f * (Ux * Vx + Uy * Vy);
|
2019-03-25 11:55:36 +11:00
|
|
|
const float C = Ux * Ux + Uy * Uy;
|
|
|
|
const float F = A * C - B * B * 0.25f;
|
2009-07-21 13:20:35 +00:00
|
|
|
float a, b, th, ecc, fProbes;
|
2014-08-18 19:37:13 +06:00
|
|
|
BLI_ewa_imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
|
2009-07-21 13:20:35 +00:00
|
|
|
a *= ff;
|
|
|
|
b *= ff;
|
2012-10-23 13:28:22 +00:00
|
|
|
a = max_ff(a, 1.0f);
|
|
|
|
b = max_ff(b, 1.0f);
|
2020-11-06 11:25:27 +11:00
|
|
|
fProbes = 2.0f * (a / b) - 1.0f;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* no limit to number of Probes here */
|
2017-09-27 11:13:03 +10:00
|
|
|
AFD.iProbes = round_fl_to_int(fProbes);
|
2019-04-22 09:08:06 +10:00
|
|
|
if (AFD.iProbes < fProbes) {
|
2020-11-06 11:25:27 +11:00
|
|
|
b = 2.0f * a / (float)(AFD.iProbes + 1);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
AFD.majrad = a / ff;
|
|
|
|
AFD.minrad = b / ff;
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.theta = th;
|
2020-11-06 11:25:27 +11:00
|
|
|
AFD.dusc = 1.0f / ff;
|
2009-07-21 13:20:35 +00:00
|
|
|
AFD.dvsc = ff / (float)ibuf->y;
|
|
|
|
}
|
|
|
|
if (texres->nor && ((tex->imaflag & TEX_NORMALMAP) == 0)) {
|
2012-07-07 22:51:57 +00:00
|
|
|
/* color & normal */
|
2009-07-21 13:20:35 +00:00
|
|
|
filterfunc(texres, ibuf, fx, fy, &AFD);
|
|
|
|
val1 = texres->tr + texres->tg + texres->tb;
|
|
|
|
filterfunc(&texr, ibuf, fx + dxt[0], fy + dxt[1], &AFD);
|
|
|
|
val2 = texr.tr + texr.tg + texr.tb;
|
|
|
|
filterfunc(&texr, ibuf, fx + dyt[0], fy + dyt[1], &AFD);
|
|
|
|
val3 = texr.tr + texr.tg + texr.tb;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* don't switch x or y! */
|
2009-07-21 13:20:35 +00:00
|
|
|
texres->nor[0] = val1 - val2;
|
|
|
|
texres->nor[1] = val1 - val3;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
filterfunc(texres, ibuf, fx, fy, &AFD);
|
2016-01-05 22:41:41 +05:00
|
|
|
if (tex->texfilter != TXF_EWA) {
|
2019-03-25 11:55:36 +11:00
|
|
|
alpha_clip_aniso(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, extflag, texres);
|
2016-01-05 22:41:41 +05:00
|
|
|
}
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (tex->imaflag & TEX_CALCALPHA) {
|
2012-12-21 05:07:26 +00:00
|
|
|
texres->ta = texres->tin = texres->ta * max_fff(texres->tr, texres->tg, texres->tb);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2009-07-21 13:20:35 +00:00
|
|
|
texres->tin = texres->ta;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (tex->flag & TEX_NEGALPHA) {
|
2020-11-06 11:25:27 +11:00
|
|
|
texres->ta = 1.0f - texres->ta;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (texres->nor && (tex->imaflag & TEX_NORMALMAP)) { /* normal from color */
|
2012-07-07 22:51:57 +00:00
|
|
|
/* The invert of the red channel is to make
|
|
|
|
* the normal map compliant with the outside world.
|
|
|
|
* It needs to be done because in Blender
|
|
|
|
* the normal used in the renderer points inward. It is generated
|
|
|
|
* this way in calc_vertexnormals(). Should this ever change
|
|
|
|
* this negate must be removed. */
|
2020-11-06 11:25:27 +11:00
|
|
|
texres->nor[0] = -2.0f * (texres->tr - 0.5f);
|
|
|
|
texres->nor[1] = 2.0f * (texres->tg - 0.5f);
|
|
|
|
texres->nor[2] = 2.0f * (texres->tb - 0.5f);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-16 16:48:41 +11:00
|
|
|
/* de-premul, this is being pre-multiplied in shade_input_do_shade()
|
2019-04-22 03:05:53 +10:00
|
|
|
* TXF: this currently does not (yet?) work properly, destroys edge AA in clip/checker mode,
|
|
|
|
* so for now commented out also disabled in imagewraposa()
|
|
|
|
* to be able to compare results with blender's default texture filtering */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* brecht: tried to fix this, see "TXF alpha" comments */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-11 12:37:33 +00:00
|
|
|
/* do not de-premul for generated alpha, it is already in straight */
|
2019-03-25 11:55:36 +11:00
|
|
|
if (texres->ta != 1.0f && texres->ta > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
|
2020-11-06 11:25:27 +11:00
|
|
|
fx = 1.0f / texres->ta;
|
2009-07-21 13:20:35 +00:00
|
|
|
texres->tr *= fx;
|
|
|
|
texres->tg *= fx;
|
|
|
|
texres->tb *= fx;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-17 07:20:12 +00:00
|
|
|
BRICONTRGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-21 13:20:35 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2006-12-10 20:30:15 +00:00
|
|
|
|
2015-01-27 16:14:53 +05:00
|
|
|
int imagewraposa(Tex *tex,
|
|
|
|
Image *ima,
|
|
|
|
ImBuf *ibuf,
|
|
|
|
const float texvec[3],
|
|
|
|
const float DXT[2],
|
|
|
|
const float DYT[2],
|
|
|
|
TexResult *texres,
|
|
|
|
struct ImagePool *pool,
|
|
|
|
const bool skip_load_image)
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
{
|
|
|
|
TexResult texr;
|
2012-10-06 12:04:09 +00:00
|
|
|
float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[2], dyt[2];
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
float maxd, pixsize, val1, val2, val3;
|
2010-03-14 18:22:04 +00:00
|
|
|
int curmap, retval, imaprepeat, imapextend;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 03:05:53 +10:00
|
|
|
/* TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa()
|
|
|
|
* call, make a local copy here so that original vecs remain untouched. */
|
2012-10-06 12:04:09 +00:00
|
|
|
copy_v2_v2(dxt, DXT);
|
|
|
|
copy_v2_v2(dyt, DYT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* anisotropic filtering */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (tex->texfilter != TXF_BOX) {
|
2015-01-27 16:14:53 +05:00
|
|
|
return imagewraposa_aniso(tex, ima, ibuf, texvec, dxt, dyt, texres, pool, skip_load_image);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->tin = texres->ta = texres->tr = texres->tg = texres->tb = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2005-12-19 14:00:32 +00:00
|
|
|
/* we need to set retval OK, otherwise texture code generates normals itself... */
|
2020-01-14 19:38:28 +01:00
|
|
|
retval = texres->nor ? (TEX_RGB | TEX_NOR) : TEX_RGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* quick tests */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ibuf == NULL && ima == NULL) {
|
2005-12-19 14:00:32 +00:00
|
|
|
return retval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* hack for icon render */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (skip_load_image && !BKE_image_has_loaded_ibuf(ima)) {
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-01-21 08:49:42 +00:00
|
|
|
ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, pool);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
ima->flag |= IMA_USED_FOR_RENDER;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2011-04-21 15:53:30 +00:00
|
|
|
return retval;
|
2012-11-15 15:59:58 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* mipmap test */
|
2010-12-14 18:02:41 +00:00
|
|
|
image_mipmap_test(tex, ibuf);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-22 06:22:28 +00:00
|
|
|
if (ima) {
|
2019-05-18 20:52:20 +02:00
|
|
|
if ((tex->imaflag & TEX_USEALPHA) && (ima->alpha_mode != IMA_ALPHA_IGNORE)) {
|
2013-05-22 06:22:28 +00:00
|
|
|
if ((tex->imaflag & TEX_CALCALPHA) == 0) {
|
2014-04-01 11:34:00 +11:00
|
|
|
texres->talpha = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2013-05-22 06:22:28 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texr.talpha = texres->talpha;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->imaflag & TEX_IMAROT) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy = texvec[0];
|
|
|
|
fx = texvec[1];
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx = texvec[0];
|
|
|
|
fy = texvec[1];
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* pixel coordinates */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-21 05:07:26 +00:00
|
|
|
minx = min_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
|
|
|
|
maxx = max_fff(dxt[0], dyt[0], dxt[0] + dyt[0]);
|
|
|
|
miny = min_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
|
|
|
|
maxy = max_fff(dxt[1], dyt[1], dxt[1] + dyt[1]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-21 05:07:26 +00:00
|
|
|
/* tex_sharper has been removed */
|
|
|
|
minx = (maxx - minx) / 2.0f;
|
2019-03-25 11:55:36 +11:00
|
|
|
miny = (maxy - miny) / 2.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->imaflag & TEX_FILTER_MIN) {
|
2019-04-22 03:05:53 +10:00
|
|
|
/* Make sure the filtersize is minimal in pixels
|
|
|
|
* (normal, ref map can have miniature pixel dx/dy). */
|
2019-03-25 11:55:36 +11:00
|
|
|
float addval = (0.5f * tex->filtersize) / (float)MIN2(ibuf->x, ibuf->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (addval > minx) {
|
2019-03-25 11:55:36 +11:00
|
|
|
minx = addval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (addval > miny) {
|
2019-03-25 11:55:36 +11:00
|
|
|
miny = addval;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else if (tex->filtersize != 1.0f) {
|
2012-03-24 06:38:07 +00:00
|
|
|
minx *= tex->filtersize;
|
2019-03-25 11:55:36 +11:00
|
|
|
miny *= tex->filtersize;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
dxt[0] *= tex->filtersize;
|
|
|
|
dxt[1] *= tex->filtersize;
|
|
|
|
dyt[0] *= tex->filtersize;
|
|
|
|
dyt[1] *= tex->filtersize;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (tex->imaflag & TEX_IMAROT) {
|
2007-12-28 18:58:40 +00:00
|
|
|
SWAP(float, minx, miny);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (minx > 0.25f) {
|
2007-12-28 18:58:40 +00:00
|
|
|
minx = 0.25f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (minx < 0.00001f) {
|
2007-12-28 18:58:40 +00:00
|
|
|
minx = 0.00001f; /* side faces of unit-cube */
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (miny > 0.25f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
miny = 0.25f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (miny < 0.00001f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
miny = 0.00001f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
/* repeat and clip */
|
|
|
|
imaprepeat = (tex->extend == TEX_REPEAT);
|
|
|
|
imapextend = (tex->extend == TEX_EXTEND);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->extend == TEX_REPEAT) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->flag & (TEX_REPEAT_XMIR | TEX_REPEAT_YMIR)) {
|
2019-03-25 11:55:36 +11:00
|
|
|
imaprepeat = 0;
|
|
|
|
imapextend = 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->extend == TEX_CHECKER) {
|
2019-03-25 11:55:36 +11:00
|
|
|
int xs, ys, xs1, ys1, xs2, ys2, boundary;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
xs = (int)floor(fx);
|
2012-03-24 06:38:07 +00:00
|
|
|
ys = (int)floor(fy);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
/* both checkers available, no boundary exceptions, checkerdist will eat aliasing */
|
2019-03-25 11:55:36 +11:00
|
|
|
if ((tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN)) {
|
|
|
|
fx -= xs;
|
|
|
|
fy -= ys;
|
2007-01-14 11:51:52 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if ((tex->flag & TEX_CHECKER_ODD) == 0 && (tex->flag & TEX_CHECKER_EVEN) == 0) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2006-12-20 17:57:56 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
xs1 = (int)floor(fx - minx);
|
|
|
|
ys1 = (int)floor(fy - miny);
|
|
|
|
xs2 = (int)floor(fx + minx);
|
|
|
|
ys2 = (int)floor(fy + miny);
|
|
|
|
boundary = (xs1 != xs2) || (ys1 != ys2);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
if (boundary == 0) {
|
2016-01-08 13:20:34 +05:00
|
|
|
if ((tex->flag & TEX_CHECKER_ODD) == 0) {
|
|
|
|
if ((xs + ys) & 1) {
|
2012-10-07 09:48:59 +00:00
|
|
|
/* pass */
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2016-01-08 13:20:34 +05:00
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2016-01-08 13:20:34 +05:00
|
|
|
if ((tex->flag & TEX_CHECKER_EVEN) == 0) {
|
|
|
|
if ((xs + ys) & 1) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2016-01-08 13:20:34 +05:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2016-01-08 13:20:34 +05:00
|
|
|
return retval;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
fx -= xs;
|
|
|
|
fy -= ys;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->flag & TEX_CHECKER_ODD) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if ((xs1 + ys) & 1) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx -= xs2;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx -= xs1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if ((ys1 + xs) & 1) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy -= ys2;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2013-01-21 08:49:42 +00:00
|
|
|
fy -= ys1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-10-07 09:48:59 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->flag & TEX_CHECKER_EVEN) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if ((xs1 + ys) & 1) {
|
2013-01-21 08:49:42 +00:00
|
|
|
fx -= xs1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx -= xs2;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if ((ys1 + xs) & 1) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy -= ys1;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy -= ys2;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* scale around center, (0.5, 0.5) */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->checkerdist < 1.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx = (fx - 0.5f) / (1.0f - tex->checkerdist) + 0.5f;
|
|
|
|
fy = (fy - 0.5f) / (1.0f - tex->checkerdist) + 0.5f;
|
|
|
|
minx /= (1.0f - tex->checkerdist);
|
|
|
|
miny /= (1.0f - tex->checkerdist);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->extend == TEX_CLIPCUBE) {
|
|
|
|
if (fx + minx < 0.0f || fy + miny < 0.0f || fx - minx > 1.0f || fy - miny > 1.0f ||
|
|
|
|
texvec[2] < -1.0f || texvec[2] > 1.0f) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2019-03-25 11:55:36 +11:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
return retval;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-11-06 12:30:59 +11:00
|
|
|
else if (ELEM(tex->extend, TEX_CLIP, TEX_CHECKER)) {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (fx + minx < 0.0f || fy + miny < 0.0f || fx - minx > 1.0f || fy - miny > 1.0f) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2019-03-25 11:55:36 +11:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
return retval;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (imapextend) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (fx > 1.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx = 1.0f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (fx < 0.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx = 0.0f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (fx > 1.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx -= (int)(fx);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (fx < 0.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fx += 1 - (int)(fx);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (imapextend) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (fy > 1.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy = 1.0f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (fy < 0.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy = 0.0f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (fy > 1.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy -= (int)(fy);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else if (fy < 0.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy += 1 - (int)(fy);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
/* choice: */
|
|
|
|
if (tex->imaflag & TEX_MIPMAP) {
|
2013-01-21 08:49:42 +00:00
|
|
|
ImBuf *previbuf, *curibuf;
|
|
|
|
float bumpscale;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-29 16:59:51 +00:00
|
|
|
dx = minx;
|
|
|
|
dy = miny;
|
2013-01-21 08:49:42 +00:00
|
|
|
maxd = max_ff(dx, dy);
|
2019-04-22 09:08:06 +10:00
|
|
|
if (maxd > 0.5f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
maxd = 0.5f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
pixsize = 1.0f / (float)MIN2(ibuf->x, ibuf->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
bumpscale = pixsize / maxd;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (bumpscale > 1.0f) {
|
2019-03-25 11:55:36 +11:00
|
|
|
bumpscale = 1.0f;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
else {
|
2006-12-20 17:57:56 +00:00
|
|
|
bumpscale *= bumpscale;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
curmap = 0;
|
2006-12-20 17:57:56 +00:00
|
|
|
previbuf = curibuf = ibuf;
|
|
|
|
while (curmap < IMB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) {
|
2019-04-22 09:08:06 +10:00
|
|
|
if (maxd < pixsize) {
|
2019-04-17 06:17:24 +02:00
|
|
|
break;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2012-07-29 16:59:51 +00:00
|
|
|
previbuf = curibuf;
|
|
|
|
curibuf = ibuf->mipmap[curmap];
|
2019-03-25 11:55:36 +11:00
|
|
|
pixsize = 1.0f / (float)MIN2(curibuf->x, curibuf->y);
|
|
|
|
curmap++;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (previbuf != curibuf || (tex->imaflag & TEX_INTERPOL)) {
|
|
|
|
/* sample at least 1 pixel */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (minx < 0.5f / ibuf->x) {
|
2019-03-25 11:55:36 +11:00
|
|
|
minx = 0.5f / ibuf->x;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (miny < 0.5f / ibuf->y) {
|
2015-07-13 22:00:07 +10:00
|
|
|
miny = 0.5f / ibuf->y;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2015-07-13 22:00:07 +10:00
|
|
|
if (texres->nor && (tex->imaflag & TEX_NORMALMAP) == 0) {
|
|
|
|
/* a bit extra filter */
|
2019-05-01 11:09:22 +10:00
|
|
|
// minx*= 1.35f;
|
|
|
|
// miny*= 1.35f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
boxsample(
|
|
|
|
curibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);
|
|
|
|
val1 = texres->tr + texres->tg + texres->tb;
|
2006-12-20 17:57:56 +00:00
|
|
|
boxsample(curibuf,
|
|
|
|
fx - minx + dxt[0],
|
2019-03-25 11:55:36 +11:00
|
|
|
fy - miny + dxt[1],
|
2006-12-20 17:57:56 +00:00
|
|
|
fx + minx + dxt[0],
|
|
|
|
fy + miny + dxt[1],
|
2019-03-25 11:55:36 +11:00
|
|
|
&texr,
|
|
|
|
imaprepeat,
|
|
|
|
imapextend);
|
|
|
|
val2 = texr.tr + texr.tg + texr.tb;
|
2006-12-20 17:57:56 +00:00
|
|
|
boxsample(curibuf,
|
2019-03-25 11:55:36 +11:00
|
|
|
fx - minx + dyt[0],
|
|
|
|
fy - miny + dyt[1],
|
|
|
|
fx + minx + dyt[0],
|
|
|
|
fy + miny + dyt[1],
|
|
|
|
&texr,
|
|
|
|
imaprepeat,
|
|
|
|
imapextend);
|
|
|
|
val3 = texr.tr + texr.tg + texr.tb;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* don't switch x or y! */
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->nor[0] = (val1 - val2);
|
|
|
|
texres->nor[1] = (val1 - val3);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (previbuf != curibuf) { /* interpolate */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
boxsample(
|
|
|
|
previbuf, fx - minx, fy - miny, fx + minx, fy + miny, &texr, imaprepeat, imapextend);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* calc rgb */
|
2019-03-25 11:55:36 +11:00
|
|
|
dx = 2.0f * (pixsize - maxd) / pixsize;
|
|
|
|
if (dx >= 1.0f) {
|
|
|
|
texres->ta = texr.ta;
|
|
|
|
texres->tb = texr.tb;
|
|
|
|
texres->tg = texr.tg;
|
|
|
|
texres->tr = texr.tr;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
dy = 1.0f - dx;
|
|
|
|
texres->tb = dy * texres->tb + dx * texr.tb;
|
|
|
|
texres->tg = dy * texres->tg + dx * texr.tg;
|
|
|
|
texres->tr = dy * texres->tr + dx * texr.tr;
|
|
|
|
texres->ta = dy * texres->ta + dx * texr.ta;
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
val1 = dy * val1 + dx * (texr.tr + texr.tg + texr.tb);
|
|
|
|
boxsample(previbuf,
|
|
|
|
fx - minx + dxt[0],
|
|
|
|
fy - miny + dxt[1],
|
|
|
|
fx + minx + dxt[0],
|
|
|
|
fy + miny + dxt[1],
|
|
|
|
&texr,
|
|
|
|
imaprepeat,
|
|
|
|
imapextend);
|
|
|
|
val2 = dy * val2 + dx * (texr.tr + texr.tg + texr.tb);
|
|
|
|
boxsample(previbuf,
|
|
|
|
fx - minx + dyt[0],
|
|
|
|
fy - miny + dyt[1],
|
|
|
|
fx + minx + dyt[0],
|
|
|
|
fy + miny + dyt[1],
|
|
|
|
&texr,
|
|
|
|
imaprepeat,
|
|
|
|
imapextend);
|
|
|
|
val3 = dy * val3 + dx * (texr.tr + texr.tg + texr.tb);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->nor[0] = (val1 - val2); /* vals have been interpolated above! */
|
|
|
|
texres->nor[1] = (val1 - val3);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (dx < 1.0f) {
|
|
|
|
dy = 1.0f - dx;
|
|
|
|
texres->tb = dy * texres->tb + dx * texr.tb;
|
|
|
|
texres->tg = dy * texres->tg + dx * texr.tg;
|
|
|
|
texres->tr = dy * texres->tr + dx * texr.tr;
|
|
|
|
texres->ta = dy * texres->ta + dx * texr.ta;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->nor[0] *= bumpscale;
|
|
|
|
texres->nor[1] *= bumpscale;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
maxx = fx + minx;
|
|
|
|
minx = fx - minx;
|
|
|
|
maxy = fy + miny;
|
|
|
|
miny = fy - miny;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-10-15 12:29:02 +00:00
|
|
|
boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (previbuf != curibuf) { /* interpolate */
|
2010-10-15 12:29:02 +00:00
|
|
|
boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
fx = 2.0f * (pixsize - maxd) / pixsize;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (fx >= 1.0f) {
|
|
|
|
texres->ta = texr.ta;
|
|
|
|
texres->tb = texr.tb;
|
|
|
|
texres->tg = texr.tg;
|
|
|
|
texres->tr = texr.tr;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
fy = 1.0f - fx;
|
|
|
|
texres->tb = fy * texres->tb + fx * texr.tb;
|
|
|
|
texres->tg = fy * texres->tg + fx * texr.tg;
|
|
|
|
texres->tr = fy * texres->tr + fx * texr.tr;
|
|
|
|
texres->ta = fy * texres->ta + fx * texr.ta;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2006-12-20 17:57:56 +00:00
|
|
|
else {
|
2009-07-21 13:20:35 +00:00
|
|
|
const int intpol = tex->imaflag & TEX_INTERPOL;
|
2010-03-14 18:22:04 +00:00
|
|
|
if (intpol) {
|
2006-12-20 17:57:56 +00:00
|
|
|
/* sample 1 pixel minimum */
|
2019-04-22 09:08:06 +10:00
|
|
|
if (minx < 0.5f / ibuf->x) {
|
2006-12-20 17:57:56 +00:00
|
|
|
minx = 0.5f / ibuf->x;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
if (miny < 0.5f / ibuf->y) {
|
2006-12-20 17:57:56 +00:00
|
|
|
miny = 0.5f / ibuf->y;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
if (texres->nor && (tex->imaflag & TEX_NORMALMAP) == 0) {
|
|
|
|
boxsample(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);
|
|
|
|
val1 = texres->tr + texres->tg + texres->tb;
|
|
|
|
boxsample(ibuf,
|
|
|
|
fx - minx + dxt[0],
|
|
|
|
fy - miny + dxt[1],
|
|
|
|
fx + minx + dxt[0],
|
|
|
|
fy + miny + dxt[1],
|
|
|
|
&texr,
|
|
|
|
imaprepeat,
|
|
|
|
imapextend);
|
|
|
|
val2 = texr.tr + texr.tg + texr.tb;
|
|
|
|
boxsample(ibuf,
|
|
|
|
fx - minx + dyt[0],
|
|
|
|
fy - miny + dyt[1],
|
|
|
|
fx + minx + dyt[0],
|
|
|
|
fy + miny + dyt[1],
|
|
|
|
&texr,
|
|
|
|
imaprepeat,
|
|
|
|
imapextend);
|
|
|
|
val3 = texr.tr + texr.tg + texr.tb;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* don't switch x or y! */
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->nor[0] = (val1 - val2);
|
|
|
|
texres->nor[1] = (val1 - val3);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-22 09:08:06 +10:00
|
|
|
else {
|
2019-03-25 11:55:36 +11:00
|
|
|
boxsample(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->imaflag & TEX_CALCALPHA) {
|
2012-12-21 05:07:26 +00:00
|
|
|
texres->ta = texres->tin = texres->ta * max_fff(texres->tr, texres->tg, texres->tb);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2013-03-09 03:46:30 +00:00
|
|
|
else {
|
|
|
|
texres->tin = texres->ta;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (tex->flag & TEX_NEGALPHA) {
|
2019-03-25 11:55:36 +11:00
|
|
|
texres->ta = 1.0f - texres->ta;
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (texres->nor && (tex->imaflag & TEX_NORMALMAP)) {
|
2012-07-07 22:51:57 +00:00
|
|
|
/* qdn: normal from color
|
|
|
|
* The invert of the red channel is to make
|
|
|
|
* the normal map compliant with the outside world.
|
|
|
|
* It needs to be done because in Blender
|
|
|
|
* the normal used in the renderer points inward. It is generated
|
|
|
|
* this way in calc_vertexnormals(). Should this ever change
|
|
|
|
* this negate must be removed. */
|
2020-11-06 11:25:27 +11:00
|
|
|
texres->nor[0] = -2.0f * (texres->tr - 0.5f);
|
|
|
|
texres->nor[1] = 2.0f * (texres->tg - 0.5f);
|
|
|
|
texres->nor[2] = 2.0f * (texres->tb - 0.5f);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-16 16:48:41 +11:00
|
|
|
/* de-premul, this is being pre-multiplied in shade_input_do_shade() */
|
2013-04-11 12:37:33 +00:00
|
|
|
/* do not de-premul for generated alpha, it is already in straight */
|
2019-03-25 11:55:36 +11:00
|
|
|
if (texres->ta != 1.0f && texres->ta > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
|
2012-08-05 15:04:10 +00:00
|
|
|
mul_v3_fl(&texres->tr, 1.0f / texres->ta);
|
2007-11-23 14:48:26 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (ima) {
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-06-17 07:20:12 +00:00
|
|
|
BRICONTRGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2005-12-19 14:00:32 +00:00
|
|
|
return retval;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
2010-05-26 08:06:51 +00:00
|
|
|
|
2013-01-21 08:49:42 +00:00
|
|
|
void image_sample(
|
|
|
|
Image *ima, float fx, float fy, float dx, float dy, float result[4], struct ImagePool *pool)
|
2010-05-26 08:06:51 +00:00
|
|
|
{
|
|
|
|
TexResult texres;
|
2013-01-21 08:49:42 +00:00
|
|
|
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(ima, NULL, pool);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-08-05 15:04:10 +00:00
|
|
|
if (UNLIKELY(ibuf == NULL)) {
|
|
|
|
zero_v4(result);
|
2010-05-26 08:06:51 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
texres.talpha = true; /* boxsample expects to be initialized */
|
2012-08-05 15:04:10 +00:00
|
|
|
boxsample(ibuf, fx, fy, fx + dx, fy + dy, &texres, 0, 1);
|
|
|
|
copy_v4_v4(result, &texres.tr);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2019-03-25 11:55:36 +11:00
|
|
|
ima->flag |= IMA_USED_FOR_RENDER;
|
2012-11-15 15:59:58 +00:00
|
|
|
|
2013-01-21 08:49:42 +00:00
|
|
|
BKE_image_pool_release_ibuf(ima, ibuf, pool);
|
2010-05-26 08:06:51 +00:00
|
|
|
}
|
|
|
|
|
2012-08-05 15:04:10 +00:00
|
|
|
void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float result[4])
|
2010-05-26 08:06:51 +00:00
|
|
|
{
|
2012-08-05 15:04:10 +00:00
|
|
|
TexResult texres = {0};
|
2010-05-26 08:06:51 +00:00
|
|
|
afdata_t AFD;
|
2012-08-05 15:04:10 +00:00
|
|
|
|
2010-05-26 08:06:51 +00:00
|
|
|
AFD.dxt[0] = dx;
|
|
|
|
AFD.dxt[1] = dx;
|
|
|
|
AFD.dyt[0] = dy;
|
|
|
|
AFD.dyt[1] = dy;
|
2019-05-01 11:09:22 +10:00
|
|
|
// copy_v2_v2(AFD.dxt, dx);
|
|
|
|
// copy_v2_v2(AFD.dyt, dy);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2010-05-26 08:06:51 +00:00
|
|
|
AFD.intpol = 1;
|
|
|
|
AFD.extflag = TXC_EXTD;
|
2012-08-05 15:04:10 +00:00
|
|
|
|
2010-05-26 08:06:51 +00:00
|
|
|
ewa_eval(&texres, ibuf, fx, fy, &AFD);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-08-05 15:04:10 +00:00
|
|
|
copy_v4_v4(result, &texres.tr);
|
2010-09-03 03:30:20 +00:00
|
|
|
}
|