Blender  V2.93
rna_texture_api.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include "BLI_utildefines.h"
26 
27 #include "RNA_define.h"
28 
29 #include "rna_internal.h" /* own include */
30 
31 #ifdef RNA_RUNTIME
32 
33 # include "BKE_context.h"
34 # include "BKE_global.h"
35 # include "DNA_scene_types.h"
36 # include "IMB_imbuf.h"
37 # include "IMB_imbuf_types.h"
38 # include "RE_pipeline.h"
39 # include "RE_texture.h"
40 
41 static void texture_evaluate(struct Tex *tex, float value[3], float r_color[4])
42 {
43  TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
44 
45  /* TODO(sergey): always use color management now. */
46  multitex_ext(tex, value, NULL, NULL, 1, &texres, 0, NULL, true, false);
47 
48  r_color[0] = texres.tr;
49  r_color[1] = texres.tg;
50  r_color[2] = texres.tb;
51  r_color[3] = texres.tin;
52 }
53 
54 #else
55 
57 {
58  FunctionRNA *func;
59  PropertyRNA *parm;
60 
61  func = RNA_def_function(srna, "evaluate", "texture_evaluate");
62  RNA_def_function_ui_description(func, "Evaluate the texture at the coordinates given");
63 
64  parm = RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
66 
67  /* return location and normal */
68  parm = RNA_def_float_vector(
69  func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
71  RNA_def_function_output(func, parm);
72 }
73 
74 #endif
Contains defines and structs used throughout the imbuf module.
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4327
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3851
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
void RNA_api_texture(StructRNA *srna)
float tb
Definition: RE_texture.h:84
float tin
Definition: RE_texture.h:84
float tr
Definition: RE_texture.h:84
float tg
Definition: RE_texture.h:84
int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, const short thread, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)