2011-02-18 14:05:18 +01:00
|
|
|
/*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02: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
|
2008-04-17 00:40:48 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02:00
|
|
|
*/
|
2012-02-17 19:59:41 +01:00
|
|
|
#ifndef __BKE_TEXTURE_H__
|
|
|
|
#define __BKE_TEXTURE_H__
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2011-02-18 14:05:18 +01:00
|
|
|
/** \file BKE_texture.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \since March 2001
|
|
|
|
* \author nzc
|
|
|
|
*/
|
|
|
|
|
2010-10-05 02:05:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-01-29 17:32:06 +01:00
|
|
|
struct bNode;
|
2009-10-09 11:50:49 +02:00
|
|
|
struct Brush;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct ColorBand;
|
2014-05-03 11:51:53 +02:00
|
|
|
struct FreestyleLineStyle;
|
2017-02-06 12:23:03 +01:00
|
|
|
struct ImagePool;
|
2009-10-09 11:50:49 +02:00
|
|
|
struct Lamp;
|
2013-02-05 13:46:15 +01:00
|
|
|
struct Main;
|
2009-10-09 11:50:49 +02:00
|
|
|
struct Material;
|
|
|
|
struct MTex;
|
2011-11-13 13:17:27 +01:00
|
|
|
struct OceanTex;
|
2011-02-12 17:06:27 +01:00
|
|
|
struct ParticleSettings;
|
* Volumetrics
Removed all the old particle rendering code and options I had in there
before, in order to make way for...
A new procedural texture: 'Point Density'
Point Density is a 3d texture that find the density of a group of 'points'
in space and returns that in the texture as an intensity value. Right now,
its at an early stage and it's only enabled for particles, but it would be
cool to extend it later for things like object vertices, or point cache
files from disk - i.e. to import point cloud data into Blender for
rendering volumetrically.
Currently there are just options for an Object and its particle system
number, this is the particle system that will get cached before rendering,
and then used for the texture's density estimation.
It works totally consistent with as any other procedural texture, so
previously where I've mapped a clouds texture to volume density to make
some of those test renders, now I just map a point density texture to
volume density.
Here's a version of the same particle smoke test file from before, updated
to use the point density texture instead:
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test02.blend
There are a few cool things about implementing this as a texture:
- The one texture (and cache) can be instanced across many different
materials:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_instanced.png
This means you can calculate and bake one particle system, but render it
multiple times across the scene, with different material settings, at no
extra memory cost.
Right now, the particles are cached in world space, so you have to map it
globally, and if you want it offset, you have to do it in the material (as
in the file above). I plan to add an option to bake in local space, so you
can just map the texture to local and it just works.
- It also works for solid surfaces too, it just gets the density at that
particular point on the surface, eg:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_solid.mov
- You can map it to whatever you want, not only density but the various
emissions and colours as well. I'd like to investigate using the other
outputs in the texture too (like the RGB or normal outputs), perhaps with
options to colour by particle age, generating normals for making particle
'dents' in a surface, whatever!
2008-09-28 10:00:22 +02:00
|
|
|
struct PointDensity;
|
2009-10-09 11:50:49 +02:00
|
|
|
struct Tex;
|
|
|
|
struct TexMapping;
|
2013-10-20 15:01:07 +02:00
|
|
|
struct TexResult;
|
2009-10-09 11:50:49 +02:00
|
|
|
struct World;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
/* in ColorBand struct */
|
2006-09-18 17:32:11 +02:00
|
|
|
#define MAXCOLORBAND 32
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
|
2015-03-28 17:16:55 +01:00
|
|
|
void BKE_texture_free(struct Tex *tex);
|
|
|
|
void BKE_texture_default(struct Tex *tex);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_texture_copy_data(struct Main *bmain, struct Tex *tex_dst, const struct Tex *tex_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Tex *BKE_texture_copy(struct Main *bmain, const struct Tex *tex);
|
2015-03-28 17:16:55 +01:00
|
|
|
struct Tex *BKE_texture_add(struct Main *bmain, const char *name);
|
|
|
|
struct Tex *BKE_texture_localize(struct Tex *tex);
|
2016-07-20 19:49:45 +02:00
|
|
|
void BKE_texture_make_local(struct Main *bmain, struct Tex *tex, const bool lib_local);
|
2015-03-28 17:16:55 +01:00
|
|
|
void BKE_texture_type_set(struct Tex *tex, int type);
|
|
|
|
|
|
|
|
void BKE_texture_mtex_default(struct MTex *mtex);
|
|
|
|
struct MTex *BKE_texture_mtex_add(void);
|
|
|
|
struct MTex *BKE_texture_mtex_add_id(struct ID *id, int slot);
|
2013-04-03 17:04:24 +02:00
|
|
|
/* UNUSED */
|
|
|
|
// void autotexname(struct Tex *tex);
|
2009-10-09 11:50:49 +02:00
|
|
|
|
|
|
|
struct Tex *give_current_object_texture(struct Object *ob);
|
2014-05-03 11:51:53 +02:00
|
|
|
struct Tex *give_current_linestyle_texture(struct FreestyleLineStyle *linestyle);
|
2009-10-09 11:50:49 +02:00
|
|
|
struct Tex *give_current_brush_texture(struct Brush *br);
|
2011-02-12 15:38:34 +01:00
|
|
|
struct Tex *give_current_particle_texture(struct ParticleSettings *part);
|
2002-10-30 03:07:20 +01:00
|
|
|
|
2014-04-01 02:34:00 +02:00
|
|
|
bool give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act);
|
2012-05-12 22:39:39 +02:00
|
|
|
void set_active_mtex(struct ID *id, short act);
|
2009-10-12 18:00:39 +02:00
|
|
|
|
2009-10-12 15:12:45 +02:00
|
|
|
void set_current_brush_texture(struct Brush *br, struct Tex *tex);
|
2014-05-03 11:51:53 +02:00
|
|
|
void set_current_linestyle_texture(struct FreestyleLineStyle *linestyle, struct Tex *tex);
|
2011-02-12 15:38:34 +01:00
|
|
|
void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex);
|
2009-10-12 15:12:45 +02:00
|
|
|
|
2015-03-28 17:16:55 +01:00
|
|
|
struct TexMapping *BKE_texture_mapping_add(int type);
|
|
|
|
void BKE_texture_mapping_default(struct TexMapping *texmap, int type);
|
|
|
|
void BKE_texture_mapping_init(struct TexMapping *texmap);
|
|
|
|
|
|
|
|
struct ColorMapping *BKE_texture_colormapping_add(void);
|
|
|
|
void BKE_texture_colormapping_default(struct ColorMapping *colormap);
|
2006-01-04 13:13:13 +01:00
|
|
|
|
2015-07-18 22:36:09 +02:00
|
|
|
void BKE_texture_pointdensity_init_data(struct PointDensity *pd);
|
2015-03-28 17:16:55 +01:00
|
|
|
void BKE_texture_pointdensity_free_data(struct PointDensity *pd);
|
|
|
|
void BKE_texture_pointdensity_free(struct PointDensity *pd);
|
|
|
|
struct PointDensity *BKE_texture_pointdensity_add(void);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
struct PointDensity *BKE_texture_pointdensity_copy(const struct PointDensity *pd, const int flag);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
|
2013-06-02 05:59:19 +02:00
|
|
|
bool BKE_texture_dependsOnTime(const struct Tex *texture);
|
2015-02-23 08:22:09 +01:00
|
|
|
bool BKE_texture_is_image_user(const struct Tex *tex);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 23:05:47 +01:00
|
|
|
|
2017-02-06 12:23:03 +01:00
|
|
|
void BKE_texture_get_value_ex(
|
|
|
|
const struct Scene *scene, struct Tex *texture,
|
|
|
|
float *tex_co, struct TexResult *texres,
|
|
|
|
struct ImagePool *pool,
|
|
|
|
bool use_color_management);
|
|
|
|
|
2015-03-21 12:10:43 +01:00
|
|
|
void BKE_texture_get_value(
|
|
|
|
const struct Scene *scene, struct Tex *texture,
|
|
|
|
float *tex_co, struct TexResult *texres, bool use_color_management);
|
2013-10-20 15:01:07 +02:00
|
|
|
|
2017-05-30 15:40:14 +02:00
|
|
|
void BKE_texture_fetch_images_for_pool(struct Tex *texture, struct ImagePool *pool);
|
|
|
|
|
2010-10-05 02:05:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
#endif
|
2002-10-30 03:07:20 +01:00
|
|
|
|