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:
authorLukas Toenne <lukas.toenne@googlemail.com>2011-11-13 16:17:27 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2011-11-13 16:17:27 +0400
commit11c83d843206648a33bcc8b4d754577ec0a51d2a (patch)
tree58af33c372ba5d77f68d6ed7b37e5aecd6e6c678 /source/blender/blenkernel/BKE_ocean.h
parentb1019a56b54294fc91293c5c43ef46d54950ae84 (diff)
Ocean Sim modifier patch
by Matt Ebb, Hamed Zaghaghi This adds a new Modifier "Ocean" to simulate large-scale wave motion. Details can be found in the wiki documentation [1], the project homepage [2] and the patch tracker [3] The modifier is disabled by default for now. To enable it, the WITH_OCEANSIM (cmake) / WITH_BF_OCEANSIM (scons) flags have to be set. The code depends on fftw3, so this also has to be enabled. [1] http://wiki.blender.org/index.php/Doc:2.6/Manual/Modifiers/Simulation/Ocean [2] http://www.savetheoceansim.com [3] http://projects.blender.org/tracker/?group_id=9&atid=127&func=detail&aid=28338
Diffstat (limited to 'source/blender/blenkernel/BKE_ocean.h')
-rw-r--r--source/blender/blenkernel/BKE_ocean.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h
new file mode 100644
index 00000000000..c1f228fe186
--- /dev/null
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -0,0 +1,108 @@
+/*
+ * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributors: Matt Ebb
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BKE_OCEAN_H
+#define BKE_OCEAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct OceanResult {
+ float disp[3];
+ float normal[3];
+ float foam;
+
+ /* raw eigenvalues/vectors */
+ float Jminus;
+ float Jplus;
+ float Eminus[3];
+ float Eplus[3];
+} OceanResult;
+
+
+typedef struct OceanCache {
+ struct ImBuf **ibufs_disp;
+ struct ImBuf **ibufs_foam;
+ struct ImBuf **ibufs_norm;
+
+ char *bakepath;
+
+ /* precalculated for time range */
+ float *time;
+
+ /* constant for time range */
+ float wave_scale;
+ float chop_amount;
+ float foam_coverage;
+ float foam_fade;
+
+ int start;
+ int end;
+ int duration;
+ int resolution_x;
+ int resolution_y;
+
+ int baked;
+} OceanCache;
+
+
+#define OCEAN_NOT_CACHED 0
+#define OCEAN_CACHING 1
+#define OCEAN_CACHED 2
+
+
+struct Ocean *BKE_add_ocean(void);
+void BKE_free_ocean_data(struct Ocean *oc);
+void BKE_free_ocean(struct Ocean *oc);
+
+void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp,
+ float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed);
+void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount);
+
+/* sampling the ocean surface */
+float BKE_ocean_jminus_to_foam(float jminus, float coverage);
+void BKE_ocean_eval_uv(struct Ocean * oc, struct OceanResult *ocr, float u, float v);
+void BKE_ocean_eval_uv_catrom(struct Ocean * oc, struct OceanResult *ocr, float u, float v);
+void BKE_ocean_eval_xz(struct Ocean * oc, struct OceanResult *ocr, float x, float z);
+void BKE_ocean_eval_xz_catrom(struct Ocean * oc, struct OceanResult *ocr, float x, float z);
+void BKE_ocean_eval_ij(struct Ocean * oc, struct OceanResult *ocr, int i, int j);
+
+
+/* ocean cache handling */
+struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale,
+ float chop_amount, float foam_coverage, float foam_fade, int resolution);
+void BKE_simulate_ocean_cache(struct OceanCache *och, int frame);
+
+void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data);
+void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v);
+void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j);
+
+void BKE_free_ocean_cache(struct OceanCache *och);
+#ifdef __cplusplus
+}
+#endif
+
+#endif