Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2009-08-13 09:21:25 +0400
committerMatt Ebb <matt@mke3.net>2009-08-13 09:21:25 +0400
commit5a21bc578cc392b9f21ee5355f4062075f45f907 (patch)
tree3e05ca77ef3d1be07b22433275df09cad6f4a405 /source/blender/blenkernel/intern/texture.c
parent44ca632ce77edbbb0a85f5ca8dde26c68f9efbd1 (diff)
parent7da0d1a71efee9b360eb344e7bfaa9b5f0f4ece5 (diff)
* First commit merging 2.4-based sim_physics in to volume25 branch.
Integration is still very rough around the edges and WIP, but it works, and can render smoke (using new Smoke format in Voxel Data texture) --> http://vimeo.com/6030983 More to come, but this makes things much easier to work on for me :)
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r--source/blender/blenkernel/intern/texture.c110
1 files changed, 109 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index eeffbfe5ef6..234078f66ae 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -43,6 +43,7 @@
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
+#include "BLI_kdopbvh.h"
#include "DNA_texture_types.h"
#include "DNA_key_types.h"
@@ -417,6 +418,8 @@ void free_texture(Tex *tex)
free_plugin_tex(tex->plugin);
if(tex->coba) MEM_freeN(tex->coba);
if(tex->env) BKE_free_envmap(tex->env);
+ if(tex->pd) BKE_free_pointdensity(tex->pd);
+ if(tex->vd) BKE_free_voxeldata(tex->vd);
BKE_previewimg_free(&tex->preview);
BKE_icon_delete((struct ID*)tex);
tex->id.icon_id = 0;
@@ -486,6 +489,15 @@ void default_tex(Tex *tex)
tex->env->depth=0;
}
+ if (tex->pd) {
+ tex->pd->radius = 0.3f;
+ tex->pd->falloff_type = TEX_PD_FALLOFF_STD;
+ }
+
+ if (tex->vd) {
+ tex->vd->resol[0] = tex->vd->resol[1] = tex->vd->resol[2] = 0;
+ tex->vd->interp_type=0;
+ }
pit = tex->plugin;
if (pit) {
varstr= pit->varstr;
@@ -739,7 +751,7 @@ void autotexname(Tex *tex)
{
char texstr[20][12]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend",
"Stucci", "Noise" , "Image", "Plugin", "EnvMap" , "Musgrave",
- "Voronoi", "DistNoise", "", "", "", "", "", ""};
+ "Voronoi", "DistNoise", "Point Density", "Voxel Data", "", "", "", ""};
Image *ima;
char di[FILE_MAXDIR], fi[FILE_MAXFILE];
@@ -888,6 +900,102 @@ void BKE_free_envmap(EnvMap *env)
}
/* ------------------------------------------------------------------------- */
+
+PointDensity *BKE_add_pointdensity(void)
+{
+ PointDensity *pd;
+
+ pd= MEM_callocN(sizeof(PointDensity), "pointdensity");
+ pd->flag = 0;
+ pd->radius = 0.3f;
+ pd->falloff_type = TEX_PD_FALLOFF_STD;
+ pd->falloff_softness = 2.0;
+ pd->source = TEX_PD_PSYS;
+ pd->point_tree = NULL;
+ pd->point_data = NULL;
+ pd->noise_size = 0.5f;
+ pd->noise_depth = 1;
+ pd->noise_fac = 1.0f;
+ pd->noise_influence = TEX_PD_NOISE_STATIC;
+ pd->coba = add_colorband(1);
+ pd->speed_scale = 1.0f;
+ pd->totpoints = 0;
+ pd->coba = add_colorband(1);
+ return pd;
+}
+
+PointDensity *BKE_copy_pointdensity(PointDensity *pd)
+{
+ PointDensity *pdn;
+
+ pdn= MEM_dupallocN(pd);
+ pdn->point_tree = NULL;
+ pdn->point_data = NULL;
+ if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
+
+ return pdn;
+}
+
+void BKE_free_pointdensitydata(PointDensity *pd)
+{
+ if (pd->point_tree) {
+ BLI_bvhtree_free(pd->point_tree);
+ pd->point_tree = NULL;
+ }
+ if (pd->point_data) {
+ MEM_freeN(pd->point_data);
+ pd->point_data = NULL;
+ }
+ if(pd->coba) MEM_freeN(pd->coba);
+}
+
+void BKE_free_pointdensity(PointDensity *pd)
+{
+ BKE_free_pointdensitydata(pd);
+ MEM_freeN(pd);
+}
+
+
+void BKE_free_voxeldatadata(struct VoxelData *vd)
+{
+ if (vd->dataset) {
+ MEM_freeN(vd->dataset);
+ vd->dataset = NULL;
+ }
+
+}
+
+void BKE_free_voxeldata(struct VoxelData *vd)
+{
+ BKE_free_voxeldatadata(vd);
+ MEM_freeN(vd);
+}
+
+struct VoxelData *BKE_add_voxeldata(void)
+{
+ VoxelData *vd;
+
+ vd= MEM_callocN(sizeof(struct VoxelData), "voxeldata");
+ vd->dataset = NULL;
+ vd->resol[0] = vd->resol[1] = vd->resol[2] = 1;
+ vd->interp_type= TEX_VD_NEARESTNEIGHBOR;
+ vd->int_multiplier = 1.0;
+
+ return vd;
+ }
+
+struct VoxelData *BKE_copy_voxeldata(struct VoxelData *vd)
+{
+ VoxelData *vdn;
+
+ vdn= MEM_dupallocN(vd);
+ vdn->dataset = NULL;
+
+ return vdn;
+}
+
+
+/* ------------------------------------------------------------------------- */
int BKE_texture_dependsOnTime(const struct Tex *texture)
{
if(texture->plugin) {