2011-08-28 23:24:34 +00:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2012-03-18 09:27:36 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2011-08-28 23:24:34 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup RNA
|
2011-08-28 23:24:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <stdlib.h>
|
2011-08-28 23:24:34 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
2013-03-04 18:36:37 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2011-08-28 23:24:34 +00:00
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
2012-09-22 14:07:55 +00:00
|
|
|
#include "rna_internal.h" /* own include */
|
|
|
|
|
|
2011-08-28 23:24:34 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
|
|
|
|
# include "BKE_context.h"
|
|
|
|
|
# include "BKE_global.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
# include "DNA_scene_types.h"
|
|
|
|
|
# include "IMB_imbuf.h"
|
|
|
|
|
# include "IMB_imbuf_types.h"
|
2011-08-28 23:24:34 +00:00
|
|
|
# include "RE_pipeline.h"
|
2020-11-09 15:42:38 +01:00
|
|
|
# include "RE_texture.h"
|
2011-08-28 23:24:34 +00:00
|
|
|
|
2014-03-16 03:24:05 +11:00
|
|
|
static void texture_evaluate(struct Tex *tex, float value[3], float r_color[4])
|
2011-09-06 10:49:55 +00:00
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
Fix #36058: Displace Modifier errors using a baked Image and displace baking inconsistency between 2.67/2.68RC and previous versions
This was in fact really nasty bug, caused by multitex_nodes
function using global variable R (which is a copy of current
renderer). this variable is not initialized to anything
meaningful for until first rendering (preview or final)
happened.
Since multitex_nodes might be used outside of render pipeline,
made it so whether CM is on or off as an argument to functions
multitex_ext_safe and multitex_ext. Now multitex_nodes() is
only shall be used for stuff happening from render pipeline!
Also needed to make some changes to other places, so all the
usages of texture sampling knows for the fact whether CM is
on or off.
And one more change is related on behavior of dispalcement,
wave, warp, weightvg modifiers and smoke. They'll be always
using CM off since texture is used for influence, not for
color.
It's rather bigger patch, but it's mostly straightforward
changes, which we really need to be done.
Reviewed by Brecht, thanks!
2013-07-15 14:47:58 +00:00
|
|
|
|
|
|
|
|
/* TODO(sergey): always use color management now. */
|
2016-03-03 15:59:20 +05:00
|
|
|
multitex_ext(tex, value, NULL, NULL, 1, &texres, 0, NULL, true, false);
|
2011-09-06 10:49:55 +00:00
|
|
|
|
2014-03-16 03:24:05 +11:00
|
|
|
r_color[0] = texres.tr;
|
|
|
|
|
r_color[1] = texres.tg;
|
|
|
|
|
r_color[2] = texres.tb;
|
|
|
|
|
r_color[3] = texres.tin;
|
2011-09-06 10:49:55 +00:00
|
|
|
}
|
|
|
|
|
|
2011-08-28 23:24:34 +00:00
|
|
|
#else
|
|
|
|
|
|
2011-09-06 10:49:55 +00:00
|
|
|
void RNA_api_texture(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "evaluate", "texture_evaluate");
|
2011-09-06 10:49:55 +00:00
|
|
|
RNA_def_function_ui_description(func, "Evaluate the texture at the coordinates given");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2011-09-06 10:49:55 +00:00
|
|
|
|
|
|
|
|
/* return location and normal */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_float_vector(
|
|
|
|
|
func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
|
2011-09-06 10:49:55 +00:00
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-28 23:24:34 +00:00
|
|
|
#endif
|