[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17818] branches/sim_physics/source/ blender/render/intern: and the new voxel data files..

Matt Ebb matt at mke3.net
Sat Dec 13 06:43:10 CET 2008


Revision: 17818
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17818
Author:   broken
Date:     2008-12-13 06:43:10 +0100 (Sat, 13 Dec 2008)

Log Message:
-----------
and the new voxel data files..

Added Paths:
-----------
    branches/sim_physics/source/blender/render/intern/include/voxeldata.h
    branches/sim_physics/source/blender/render/intern/source/voxeldata.c

Added: branches/sim_physics/source/blender/render/intern/include/voxeldata.h
===================================================================
--- branches/sim_physics/source/blender/render/intern/include/voxeldata.h	                        (rev 0)
+++ branches/sim_physics/source/blender/render/intern/include/voxeldata.h	2008-12-13 05:43:10 UTC (rev 17818)
@@ -0,0 +1,45 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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
+ * of the License, or (at your option) any later version.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * 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): Raul Fernandez Hernandez (Farsthary), Matt Ebb.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef VOXELDATA_H
+#define VOXELDATA_H 
+
+/**
+ * Load voxel data for all point density textures in the scene
+ */
+
+struct Render;
+struct TexResult;
+
+int _I(int x,int y,int z,int n);
+void make_voxeldata(struct Render *re);
+void free_voxeldata(struct Render *re);
+int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres);
+
+
+#endif /* VOXELDATA_H */

Added: branches/sim_physics/source/blender/render/intern/source/voxeldata.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/voxeldata.c	                        (rev 0)
+++ branches/sim_physics/source/blender/render/intern/source/voxeldata.c	2008-12-13 05:43:10 UTC (rev 17818)
@@ -0,0 +1,444 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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
+ * of the License, or (at your option) any later version.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * 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): Raul Fernandez Hernandez (Farsthary), Matt Ebb.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_arithb.h"
+#include "BLI_blenlib.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+
+#include "DNA_texture_types.h"
+#include "render_types.h"
+#include "renderdatabase.h"
+#include "texture.h"
+
+/*---------------------------Utils----------------------------------------*/
+int _I(int x,int y,int z,int n)
+{
+	return (z*(n)+y)*(n)+x;
+}
+
+float Linear(float xx,float yy,float zz,float *x0,int n)
+{
+	float sx1,sx0,sy1,sy0,sz1,sz0,v0,v1;
+	int i0,i1,j0,j1,k0,k1;
+	
+	if (xx<0.5) xx=0.5f; if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