2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
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-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup render
|
2011-02-27 19:31:27 +00:00
|
|
|
*/
|
|
|
|
|
|
2024-01-22 15:58:18 +01:00
|
|
|
#include <algorithm>
|
2023-07-27 21:49:56 +10:00
|
|
|
#include <cfloat>
|
|
|
|
|
#include <cmath>
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <cstring>
|
2023-07-27 13:12:52 -07:00
|
|
|
#include <fcntl.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
|
|
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_imbuf.hh"
|
|
|
|
|
#include "IMB_imbuf_types.hh"
|
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"
|
Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).
However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.
This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.
Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).
Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.
Pull Request #110944
2023-08-09 11:39:20 +03:00
|
|
|
#include "BLI_math_color.h"
|
2024-01-15 16:38:41 +01:00
|
|
|
#include "BLI_math_interp.hh"
|
Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).
However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.
This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.
Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).
Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.
Pull Request #110944
2023-08-09 11:39:20 +03:00
|
|
|
#include "BLI_math_vector.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
|
|
|
|
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 */
|
2023-06-03 08:36:28 +10:00
|
|
|
static void ibuf_get_color(float col[4], 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
|
|
|
|
2023-05-18 10:19:01 +02:00
|
|
|
if (ibuf->float_buffer.data) {
|
2019-03-25 11:55:36 +11:00
|
|
|
if (ibuf->channels == 4) {
|
2023-05-18 10:19:01 +02:00
|
|
|
const float *fp = ibuf->float_buffer.data + 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) {
|
2023-05-18 10:19:01 +02:00
|
|
|
const float *fp = ibuf->float_buffer.data + 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 {
|
2023-05-18 10:19:01 +02:00
|
|
|
const float *fp = ibuf->float_buffer.data + ofs;
|
2019-03-25 11:55:36 +11:00
|
|
|
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 {
|
2023-05-18 10:19:01 +02:00
|
|
|
const uchar *rect = ibuf->byte_buffer.data + 4 * ofs;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-27 21:49:56 +10: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,
|
2023-07-27 21:49:56 +10:00
|
|
|
ImagePool *pool,
|
2015-01-27 16:14:53 +05:00
|
|
|
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
|
|
|
{
|
2022-06-20 17:10:27 +02:00
|
|
|
float fx, fy;
|
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
|
|
|
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->tin = texres->trgba[3] = texres->trgba[0] = texres->trgba[1] = texres->trgba[2] = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
retval = TEX_RGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* quick tests */
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ima == nullptr) {
|
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];
|
2023-07-27 13:10:42 +02:00
|
|
|
iuser->tile = BKE_image_get_tile_from_pos(ima, texvec, new_uv, nullptr);
|
2019-12-20 21:46:36 +01:00
|
|
|
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;
|
|
|
|
|
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf == nullptr || (ibuf->byte_buffer.data == nullptr && ibuf->float_buffer.data == nullptr))
|
|
|
|
|
{
|
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) {
|
2024-01-31 21:12:16 -05:00
|
|
|
std::swap(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
|
|
|
|
2023-07-27 21:49:56 +10:00
|
|
|
xs = int(floor(fx));
|
|
|
|
|
ys = int(floor(fy));
|
2019-03-25 11:55:36 +11:00
|
|
|
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
|
|
|
|
2023-07-27 21:49:56 +10: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
|
|
|
|
2023-02-12 14:37:16 +11:00
|
|
|
/* Keep this before interpolation #29761. */
|
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
|
|
|
|
2023-02-12 14:37:16 +11:00
|
|
|
/* Important that this value is wrapped #27782.
|
2011-06-28 12:48:39 +00:00
|
|
|
* this applies the modifications made by the checks above,
|
|
|
|
|
* back to the floating point values */
|
2023-07-27 21:49:56 +10:00
|
|
|
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 */
|
2022-01-28 13:28:31 +01:00
|
|
|
ibuf_get_color(texres->trgba, ibuf, x, y);
|
2011-06-28 12:48:39 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-09 03:46:30 +00:00
|
|
|
if (texres->talpha) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->tin = texres->trgba[3];
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (tex->imaflag & TEX_CALCALPHA) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = texres->tin = max_fff(texres->trgba[0], texres->trgba[1], texres->trgba[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 {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = texres->tin = 1.0;
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-09 03:46:30 +00:00
|
|
|
if (tex->flag & TEX_NEGALPHA) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = 1.0f - texres->trgba[3];
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-31 10:15:30 +10:00
|
|
|
/* De-pre-multiply, this is being pre-multiplied in #shade_input_do_shade()
|
|
|
|
|
* do not de-pre-multiply for generated alpha, it is already in straight. */
|
2022-01-28 13:28:31 +01:00
|
|
|
if (texres->trgba[3] != 1.0f && texres->trgba[3] > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
|
|
|
|
|
fx = 1.0f / texres->trgba[3];
|
|
|
|
|
texres->trgba[0] *= fx;
|
|
|
|
|
texres->trgba[1] *= fx;
|
|
|
|
|
texres->trgba[2] *= 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++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-29 10:56:33 +10:00
|
|
|
static float square_rctf(const rctf *rf)
|
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 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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-29 10:56:33 +10:00
|
|
|
static void boxsampleclip(ImBuf *ibuf, const rctf *rf, TexResult *texres)
|
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-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
|
|
|
|
2023-07-27 21:49:56 +10: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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
ibuf_get_color(texres->trgba, 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 {
|
2022-01-28 13:28:31 +01:00
|
|
|
div = texres->trgba[0] = texres->trgba[1] = texres->trgba[2] = texres->trgba[3] = 0.0;
|
2019-03-25 11:55:36 +11:00
|
|
|
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);
|
2022-01-28 13:28:31 +01:00
|
|
|
madd_v4_v4fl(texres->trgba, col, mulx);
|
2019-03-25 11:55:36 +11:00
|
|
|
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);
|
2022-01-28 13:28:31 +01:00
|
|
|
/* TODO(jbakker): No need to do manual optimization. Branching is slower than multiplying
|
|
|
|
|
* with 1. */
|
2019-03-25 11:55:36 +11:00
|
|
|
if (mulx == 1.0f) {
|
2022-01-28 13:28:31 +01:00
|
|
|
add_v4_v4(texres->trgba, col);
|
2019-03-25 11:55:36 +11:00
|
|
|
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 {
|
2022-01-28 13:28:31 +01:00
|
|
|
madd_v4_v4fl(texres->trgba, col, mulx);
|
2019-03-25 11:55:36 +11:00
|
|
|
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;
|
2022-01-28 14:01:25 +01:00
|
|
|
mul_v4_fl(texres->trgba, 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 {
|
2022-01-28 13:28:31 +01:00
|
|
|
zero_v4(texres->trgba);
|
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.
|
|
|
|
|
*/
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: actually minx etc isn't in the proper range...
|
|
|
|
|
* this due to filter size and offset vectors for bump. */
|
|
|
|
|
/* NOTE: talpha must be initialized. */
|
|
|
|
|
/* NOTE: even when 'imaprepeat' is set, this can only repeat once in any direction.
|
|
|
|
|
* 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) {
|
2023-07-27 21:49:56 +10: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 {
|
2023-07-27 21:49:56 +10: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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[0] = texres->trgba[2] = texres->trgba[1] = texres->trgba[3] = 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) {
|
2023-07-27 21:49:56 +10: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 {
|
2023-07-27 21:49:56 +10: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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[0] = texres->trgba[2] = texres->trgba[1] = texres->trgba[3] = 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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
tot = texres->trgba[0] = texres->trgba[2] = texres->trgba[1] = texres->trgba[3] = 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
|
|
|
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[0] += opp * texr.trgba[0];
|
|
|
|
|
texres->trgba[1] += opp * texr.trgba[1];
|
|
|
|
|
texres->trgba[2] += opp * texr.trgba[2];
|
2019-04-22 09:08:06 +10:00
|
|
|
if (texres->talpha) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] += opp * texr.trgba[3];
|
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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[0] /= tot;
|
|
|
|
|
texres->trgba[1] /= tot;
|
|
|
|
|
texres->trgba[2] /= tot;
|
2019-04-22 09:08:06 +10:00
|
|
|
if (texres->talpha) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] /= 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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = 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 */
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[0] *= alphaclip;
|
|
|
|
|
texres->trgba[1] *= alphaclip;
|
|
|
|
|
texres->trgba[2] *= alphaclip;
|
|
|
|
|
texres->trgba[3] *= 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 */
|
2023-07-27 13:10:42 +02:00
|
|
|
struct afdata_t {
|
2010-05-26 08:06:51 +00:00
|
|
|
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;
|
2023-07-27 13:10:42 +02:00
|
|
|
};
|
2010-05-26 08:06:51 +00:00
|
|
|
|
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;
|
2023-10-19 18:53:16 +11:00
|
|
|
} /* TXF alpha: clip = 1; } */
|
2012-07-07 22:51:57 +00:00
|
|
|
if (y < 0) {
|
|
|
|
|
y = 0;
|
2023-10-19 18:53:16 +11:00
|
|
|
} /* TXF alpha: clip = 1; } */
|
2012-07-07 22:51:57 +00:00
|
|
|
if (y >= ibuf->y) {
|
|
|
|
|
y = ibuf->y - 1;
|
2023-10-19 18:53:16 +11:00
|
|
|
} /* TXF alpha: clip = 1; } */
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-18 10:19:01 +02:00
|
|
|
if (ibuf->float_buffer.data) {
|
|
|
|
|
const float *fp = ibuf->float_buffer.data + (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 {
|
2023-05-18 10:19:01 +02:00
|
|
|
const uchar *rect = ibuf->byte_buffer.data + 4 * (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;
|
2023-07-27 21:49:56 +10:00
|
|
|
const int x1 = int(ufl), y1 = int(vfl), x2 = x1 + 1, y2 = y1 + 1;
|
2009-07-21 13:20:35 +00:00
|
|
|
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;
|
|
|
|
|
}
|
2023-07-27 21:49:56 +10:00
|
|
|
return ibuf_get_color_clip(col, ibuf, int(u), int(v), extflag);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
|
2023-08-10 16:02:53 +10:00
|
|
|
static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, const 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];
|
2023-07-27 21:49:56 +10:00
|
|
|
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;
|
2024-01-23 21:10:33 +01:00
|
|
|
xsam = std::clamp(xsam, minsam, ibuf->x * 2);
|
|
|
|
|
ysam = std::clamp(ysam, minsam, ibuf->y * 2);
|
2020-11-06 11:25:27 +11:00
|
|
|
xsd = 1.0f / xsam;
|
|
|
|
|
ysd = 1.0f / ysam;
|
2022-01-28 13:28:31 +01:00
|
|
|
texr->trgba[0] = texr->trgba[1] = texr->trgba[2] = texr->trgba[3] = 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;
|
2022-01-28 13:28:31 +01:00
|
|
|
texr->trgba[0] += tc[0];
|
|
|
|
|
texr->trgba[1] += tc[1];
|
|
|
|
|
texr->trgba[2] += tc[2];
|
|
|
|
|
texr->trgba[3] += texr->talpha ? tc[3] : 0.0f;
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
xsd *= ysd;
|
2022-01-28 13:28:31 +01:00
|
|
|
texr->trgba[0] *= xsd;
|
|
|
|
|
texr->trgba[1] *= xsd;
|
|
|
|
|
texr->trgba[2] *= xsd;
|
|
|
|
|
/* clipping can be ignored if alpha used, texr->trgba[3] already includes filtered edge */
|
|
|
|
|
texr->trgba[3] = texr->talpha ? texr->trgba[3] * xsd : (clip ? cw * xsd : 1.0f);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-27 13:10:42 +02:00
|
|
|
struct ReadEWAData {
|
2014-08-18 19:37:13 +06:00
|
|
|
ImBuf *ibuf;
|
2023-08-10 16:02:53 +10:00
|
|
|
const afdata_t *AFD;
|
2023-07-27 13:10:42 +02:00
|
|
|
};
|
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
|
|
|
}
|
|
|
|
|
|
2023-08-10 16:02:53 +10:00
|
|
|
static void ewa_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, const 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,
|
2022-01-28 13:28:31 +01:00
|
|
|
texr->trgba);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
|
2023-08-10 16:02:53 +10:00
|
|
|
static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, const 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)) /
|
2023-07-27 21:49:56 +10:00
|
|
|
(maxn ? float(maxn) : 1.0f);
|
2020-11-06 11:25:27 +11:00
|
|
|
float du = maxn ? cosf(AFD->theta) * ll : 0.0f;
|
|
|
|
|
float dv = maxn ? sinf(AFD->theta) * ll : 0.0f;
|
2022-01-14 10:47:50 +11: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);
|
2023-07-05 13:58:04 +10:00
|
|
|
float d; /* TXF alpha: `cw = 0.0f`. */
|
|
|
|
|
int n; /* TXF alpha: `clip = 0`. */
|
2023-06-28 12:21:56 +10:00
|
|
|
/* Have to use same scaling for du/dv here as for Ux/Vx/Uy/Vy (*after* D is calculated.) */
|
2009-07-21 13:20:35 +00:00
|
|
|
du *= AFD->dusc;
|
|
|
|
|
dv *= AFD->dvsc;
|
2022-01-28 13:28:31 +01:00
|
|
|
d = texr->trgba[0] = texr->trgba[2] = texr->trgba[1] = texr->trgba[3] = 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;
|
2023-07-27 13:10:42 +02:00
|
|
|
/* Can use ewa table here too. */
|
2019-04-18 07:21:26 +02:00
|
|
|
#if 0
|
|
|
|
|
const float wt = expf(n * n * D);
|
|
|
|
|
#else
|
2023-07-27 21:49:56 +10:00
|
|
|
const float wt = EWA_WTS[int(n * n * D)];
|
2019-04-18 07:21:26 +02:00
|
|
|
#endif
|
2021-06-24 15:56:58 +10:00
|
|
|
/* `const int out =` */ ibuf_get_color_clip_bilerp(
|
2019-03-25 11:55:36 +11:00
|
|
|
tc, ibuf, ibuf->x * u, ibuf->y * v, AFD->intpol, AFD->extflag);
|
2021-07-23 16:56:00 +10:00
|
|
|
/* TXF alpha: `clip |= out;`
|
|
|
|
|
* TXF alpha: `cw += out ? 0.0f : wt;` */
|
2022-01-28 13:28:31 +01:00
|
|
|
texr->trgba[0] += tc[0] * wt;
|
|
|
|
|
texr->trgba[1] += tc[1] * wt;
|
|
|
|
|
texr->trgba[2] += tc[2] * wt;
|
|
|
|
|
texr->trgba[3] += 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;
|
2022-01-28 13:28:31 +01:00
|
|
|
texr->trgba[0] *= d;
|
|
|
|
|
texr->trgba[1] *= d;
|
|
|
|
|
texr->trgba[2] *= d;
|
|
|
|
|
/* Clipping can be ignored if alpha used, `texr->trgba[3]` already includes filtered edge */
|
|
|
|
|
texr->trgba[3] = texr->talpha ? texr->trgba[3] * d :
|
|
|
|
|
1.0f; /* TXF alpha: `(clip ? cw*d : 1.0f);` */
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
|
|
|
|
#undef EWA_MAXIDX
|
|
|
|
|
|
2023-06-29 10:56:33 +10:00
|
|
|
static void alpha_clip_aniso(const ImBuf *ibuf,
|
|
|
|
|
float minx,
|
|
|
|
|
float miny,
|
|
|
|
|
float maxx,
|
|
|
|
|
float maxy,
|
|
|
|
|
int extflag,
|
|
|
|
|
TexResult *texres)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
|
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
|
2021-06-24 15:56:58 +10:00
|
|
|
* if this is actually correct for the all the filtering algorithms. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-10-07 22:52:53 +11:00
|
|
|
if (!ELEM(extflag, TXC_REPT, 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
|
|
|
|
2023-07-27 21:49:56 +10: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 */
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[0] *= alphaclip;
|
|
|
|
|
texres->trgba[1] *= alphaclip;
|
|
|
|
|
texres->trgba[2] *= alphaclip;
|
|
|
|
|
texres->trgba[3] *= 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);
|
|
|
|
|
}
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf->mipmap[0] == nullptr) {
|
2018-07-10 17:54:20 +02:00
|
|
|
BLI_thread_lock(LOCK_IMAGE);
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf->mipmap[0] == nullptr) {
|
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 */
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf->mipmap[0] == nullptr) {
|
2018-07-10 17:54:20 +02:00
|
|
|
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,
|
2023-07-27 21:49:56 +10:00
|
|
|
ImagePool *pool,
|
2015-01-27 16:14:53 +05:00
|
|
|
const bool skip_load_image)
|
2009-07-21 13:20:35 +00:00
|
|
|
{
|
|
|
|
|
TexResult texr;
|
|
|
|
|
float fx, fy, minx, maxx, miny, maxy;
|
2022-06-20 17:10:27 +02:00
|
|
|
float maxd;
|
2009-07-21 13:20:35 +00:00
|
|
|
int curmap, retval, intpol, extflag = 0;
|
|
|
|
|
afdata_t AFD;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-10 16:02:53 +10:00
|
|
|
void (*filterfunc)(TexResult *, ImBuf *, float, float, const 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
|
|
|
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->tin = texres->trgba[3] = texres->trgba[0] = texres->trgba[1] = texres->trgba[2] = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
retval = TEX_RGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* quick tests */
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf == nullptr && ima == nullptr) {
|
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
|
|
|
|
2023-07-27 13:10:42 +02:00
|
|
|
if ((ibuf == nullptr) ||
|
|
|
|
|
((ibuf->byte_buffer.data == nullptr) && (ibuf->float_buffer.data == nullptr)))
|
|
|
|
|
{
|
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) {
|
2022-06-20 17:10:27 +02:00
|
|
|
texres->talpha = true;
|
2013-05-09 14:01:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
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). */
|
2024-01-22 15:58:18 +01:00
|
|
|
const float addval = (0.5f * tex->filtersize) / float(std::min(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;
|
2024-01-31 21:12:16 -05:00
|
|
|
std::swap(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) {
|
2023-07-27 21:49:56 +10:00
|
|
|
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 {
|
2023-07-27 21:49:56 +10:00
|
|
|
int xs1 = int(floorf(fx - minx));
|
|
|
|
|
int ys1 = int(floorf(fy - miny));
|
|
|
|
|
int xs2 = int(floorf(fx + minx));
|
|
|
|
|
int ys2 = int(floorf(fy + miny));
|
2009-07-21 13:20:35 +00:00
|
|
|
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
|
|
|
|
2022-05-13 09:24:28 +10:00
|
|
|
/* NOTE(@brecht): added stupid clamping here, large dx/dy can give very large
|
2012-07-07 22:51:57 +00:00
|
|
|
* 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);
|
2023-11-07 16:33:19 +11:00
|
|
|
AFD.iProbes = std::min(AFD.iProbes, tex->afmax);
|
2019-04-22 09:08:06 +10:00
|
|
|
if (AFD.iProbes < fProbes) {
|
2023-07-27 21:49:56 +10: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;
|
2023-07-27 21:49:56 +10:00
|
|
|
AFD.dvsc = ff / float(ibuf->y);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-03-25 11:55:36 +11:00
|
|
|
else { /* EWA & area */
|
2023-07-27 21:49:56 +10:00
|
|
|
if (ecc > float(tex->afmax)) {
|
|
|
|
|
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);
|
2023-07-28 09:38:07 +10: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 {
|
2023-07-27 21:49:56 +10: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 */
|
2022-06-20 17:10:27 +02:00
|
|
|
filterfunc(texres, curibuf, fx, fy, &AFD);
|
|
|
|
|
if (previbuf != curibuf) { /* interpolate */
|
|
|
|
|
filterfunc(&texr, previbuf, fx, fy, &AFD);
|
|
|
|
|
texres->trgba[0] += levf * (texr.trgba[0] - texres->trgba[0]);
|
|
|
|
|
texres->trgba[1] += levf * (texr.trgba[1] - texres->trgba[1]);
|
|
|
|
|
texres->trgba[2] += levf * (texr.trgba[2] - texres->trgba[2]);
|
|
|
|
|
texres->trgba[3] += levf * (texr.trgba[3] - texres->trgba[3]);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
if (tex->texfilter != TXF_EWA) {
|
|
|
|
|
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-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) {
|
2023-07-27 21:49:56 +10: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;
|
2023-07-27 21:49:56 +10:00
|
|
|
AFD.dvsc = ff / float(ibuf->y);
|
2009-07-21 13:20:35 +00:00
|
|
|
}
|
2022-06-20 17:10:27 +02:00
|
|
|
filterfunc(texres, ibuf, fx, fy, &AFD);
|
|
|
|
|
if (tex->texfilter != TXF_EWA) {
|
|
|
|
|
alpha_clip_aniso(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, extflag, texres);
|
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) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = texres->tin = texres->trgba[3] *
|
|
|
|
|
max_fff(texres->trgba[0], texres->trgba[1], texres->trgba[2]);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->tin = texres->trgba[3];
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
|
if (tex->flag & TEX_NEGALPHA) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = 1.0f - texres->trgba[3];
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-01-29 11:47:42 +11:00
|
|
|
/* de-pre-multiply, 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,
|
2024-01-29 11:47:42 +11:00
|
|
|
* so for now commented out also disabled in #imagewraposa()
|
2019-04-22 03:05:53 +10:00
|
|
|
* 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
|
|
|
|
2024-01-29 11:47:42 +11:00
|
|
|
/* do not de-pre-multiply for generated alpha, it is already in straight */
|
2022-01-28 13:28:31 +01:00
|
|
|
if (texres->trgba[3] != 1.0f && texres->trgba[3] > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
|
|
|
|
|
fx = 1.0f / texres->trgba[3];
|
|
|
|
|
texres->trgba[0] *= fx;
|
|
|
|
|
texres->trgba[1] *= fx;
|
|
|
|
|
texres->trgba[2] *= fx;
|
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 (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,
|
2023-07-27 21:49:56 +10:00
|
|
|
ImagePool *pool,
|
2015-01-27 16:14:53 +05:00
|
|
|
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];
|
2022-06-20 17:10:27 +02:00
|
|
|
float maxd, pixsize;
|
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
|
|
|
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->tin = texres->trgba[3] = texres->trgba[0] = texres->trgba[1] = texres->trgba[2] = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
retval = TEX_RGB;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-12-20 17:57:56 +00:00
|
|
|
/* quick tests */
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf == nullptr && ima == nullptr) {
|
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
|
|
|
}
|
2023-07-27 13:10:42 +02:00
|
|
|
if (ibuf == nullptr || (ibuf->byte_buffer.data == nullptr && ibuf->float_buffer.data == nullptr))
|
|
|
|
|
{
|
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). */
|
2024-01-22 15:58:18 +01:00
|
|
|
float addval = (0.5f * tex->filtersize) / float(std::min(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) {
|
2024-01-31 21:12:16 -05:00
|
|
|
std::swap(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
|
|
|
|
2023-07-27 21:49:56 +10:00
|
|
|
xs = int(floor(fx));
|
|
|
|
|
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 {
|
|
|
|
|
|
2023-07-27 21:49:56 +10:00
|
|
|
xs1 = int(floor(fx - minx));
|
|
|
|
|
ys1 = int(floor(fy - miny));
|
|
|
|
|
xs2 = int(floor(fx + minx));
|
|
|
|
|
ys2 = int(floor(fy + miny));
|
2006-12-20 17:57:56 +00:00
|
|
|
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) {
|
2023-07-27 21:49:56 +10:00
|
|
|
fx -= int(fx);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
|
else if (fx < 0.0f) {
|
2023-07-27 21:49:56 +10: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) {
|
2023-07-27 21:49:56 +10:00
|
|
|
fy -= int(fy);
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
|
|
|
|
else if (fy < 0.0f) {
|
2023-07-27 21:49:56 +10: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
|
|
|
}
|
|
|
|
|
|
2021-06-24 15:56:58 +10:00
|
|
|
/* Choice: */
|
2019-03-25 11:55:36 +11:00
|
|
|
if (tex->imaflag & TEX_MIPMAP) {
|
2013-01-21 08:49:42 +00:00
|
|
|
ImBuf *previbuf, *curibuf;
|
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
|
|
|
|
2024-01-22 15:58:18 +01:00
|
|
|
pixsize = 1.0f / float(std::min(ibuf->x, ibuf->y));
|
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];
|
2024-01-22 15:58:18 +01:00
|
|
|
pixsize = 1.0f / float(std::min(curibuf->x, curibuf->y));
|
2019-03-25 11:55:36 +11:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
maxx = fx + minx;
|
|
|
|
|
minx = fx - minx;
|
|
|
|
|
maxy = fy + miny;
|
|
|
|
|
miny = fy - miny;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
if (previbuf != curibuf) { /* interpolate */
|
|
|
|
|
boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
fx = 2.0f * (pixsize - maxd) / pixsize;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
if (fx >= 1.0f) {
|
|
|
|
|
texres->trgba[3] = texr.trgba[3];
|
|
|
|
|
texres->trgba[2] = texr.trgba[2];
|
|
|
|
|
texres->trgba[1] = texr.trgba[1];
|
|
|
|
|
texres->trgba[0] = texr.trgba[0];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
fy = 1.0f - fx;
|
|
|
|
|
texres->trgba[2] = fy * texres->trgba[2] + fx * texr.trgba[2];
|
|
|
|
|
texres->trgba[1] = fy * texres->trgba[1] + fx * texr.trgba[1];
|
|
|
|
|
texres->trgba[0] = fy * texres->trgba[0] + fx * texr.trgba[0];
|
|
|
|
|
texres->trgba[3] = fy * texres->trgba[3] + fx * texr.trgba[3];
|
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
|
|
|
|
2022-06-20 17:10:27 +02:00
|
|
|
boxsample(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, 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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->imaflag & TEX_CALCALPHA) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = texres->tin = texres->trgba[3] *
|
|
|
|
|
max_fff(texres->trgba[0], texres->trgba[1], texres->trgba[2]);
|
2006-12-20 17:57:56 +00:00
|
|
|
}
|
2013-03-09 03:46:30 +00:00
|
|
|
else {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->tin = texres->trgba[3];
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:08:06 +10:00
|
|
|
if (tex->flag & TEX_NEGALPHA) {
|
2022-01-28 13:28:31 +01:00
|
|
|
texres->trgba[3] = 1.0f - texres->trgba[3];
|
2019-04-22 09:08:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-01-29 11:47:42 +11:00
|
|
|
/* de-pre-multiply, this is being pre-multiplied in shade_input_do_shade() */
|
|
|
|
|
/* do not de-pre-multiply for generated alpha, it is already in straight */
|
2022-01-28 13:28:31 +01:00
|
|
|
if (texres->trgba[3] != 1.0f && texres->trgba[3] > 1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
|
|
|
|
|
mul_v3_fl(texres->trgba, 1.0f / texres->trgba[3]);
|
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(
|
2023-07-27 21:49:56 +10:00
|
|
|
Image *ima, float fx, float fy, float dx, float dy, float result[4], ImagePool *pool)
|
2010-05-26 08:06:51 +00:00
|
|
|
{
|
|
|
|
|
TexResult texres;
|
2023-07-27 13:10:42 +02:00
|
|
|
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(ima, nullptr, pool);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2023-07-27 13:10:42 +02:00
|
|
|
if (UNLIKELY(ibuf == nullptr)) {
|
2012-08-05 15:04:10 +00:00
|
|
|
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);
|
2022-01-28 13:28:31 +01:00
|
|
|
copy_v4_v4(result, texres.trgba);
|
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
|
|
|
|
2022-01-28 13:28:31 +01:00
|
|
|
copy_v4_v4(result, texres.trgba);
|
2010-09-03 03:30:20 +00:00
|
|
|
}
|