Blender V5.3
BKE_ocean.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <stdbool.h>
8
9namespace blender {
10
14
16
18 float disp[3];
19 float normal[3];
20 float foam;
21
22 /* raw eigenvalues/vectors */
23 float Jminus;
24 float Jplus;
25 float Eminus[3];
26 float Eplus[3];
27};
28
29struct OceanCache {
30 struct ImBuf **ibufs_disp;
31 struct ImBuf **ibufs_foam;
32 struct ImBuf **ibufs_norm;
33 /* spray is Eplus */
35 /* spray_inverse is Eminus */
37
38 const char *bakepath;
39 const char *relbase;
40
41 /* precalculated for time range */
42 float *time;
43
44 /* constant for time range */
48 float foam_fade;
49
50 int start;
51 int end;
55
56 int baked;
57};
58
59struct Ocean *BKE_ocean_add();
60void BKE_ocean_free_data(struct Ocean *oc);
61void BKE_ocean_free(struct Ocean *oc);
62bool BKE_ocean_ensure(struct OceanModifierData *omd, int resolution);
67 struct OceanModifierData const *omd,
68 int resolution);
69
73bool BKE_ocean_is_valid(const struct Ocean *o);
74
78bool BKE_ocean_init(struct Ocean *o,
79 int M,
80 int N,
81 float Lx,
82 float Lz,
83 float V,
84 float l,
85 float A,
86 float w,
87 float damp,
88 float alignment,
89 float depth,
90 float time,
91 int spectrum,
92 float fetch_jonswap,
93 float sharpen_peak_jonswap,
94 short do_height_field,
95 short do_chop,
96 short do_spray,
97 short do_normals,
98 short do_jacobian,
99 int seed);
100void BKE_ocean_simulate(struct Ocean *o, float t, float scale, float chop_amount);
101
102float BKE_ocean_jminus_to_foam(float jminus, float coverage);
106void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u, float v);
110void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u, float v);
111void BKE_ocean_eval_xz(struct Ocean *oc, struct OceanResult *ocr, float x, float z);
112void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x, float z);
117void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j);
118
122struct OceanCache *BKE_ocean_init_cache(const char *bakepath,
123 const char *relbase,
124 int start,
125 int end,
126 float wave_scale,
127 float chop_amount,
128 float foam_coverage,
129 float foam_fade,
130 int resolution);
131void BKE_ocean_simulate_cache(struct OceanCache *och, int frame);
132
133void BKE_ocean_bake(struct Ocean *o,
134 struct OceanCache *och,
135 void (*update_cb)(void *, float progress, int *cancel),
136 void *update_cb_data);
138 struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v);
139void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j);
140
141void BKE_ocean_free_cache(struct OceanCache *och);
143
144/* `ocean_spectrum.cc` */
145
151float BLI_ocean_spectrum_piersonmoskowitz(const struct Ocean *oc, float kx, float kz);
156float BLI_ocean_spectrum_texelmarsenarsloe(const struct Ocean *oc, float kx, float kz);
165float BLI_ocean_spectrum_jonswap(const struct Ocean *oc, float kx, float kz);
166
167} // namespace blender
#define A
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
float3x3 scale(float3x3 mat, float2 scale)
#define M
#define N
BMesh Iterators.
void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u, float v)
Definition ocean.cc:1573
float BKE_ocean_jminus_to_foam(float jminus, float coverage)
Definition ocean.cc:1565
void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u, float v)
Definition ocean.cc:1570
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void BKE_ocean_free_modifier_cache(struct OceanModifierData *omd)
Definition ocean.cc:1682
void BKE_ocean_free(struct Ocean *oc)
Definition ocean.cc:1618
void BKE_ocean_eval_xz(struct Ocean *oc, struct OceanResult *ocr, float x, float z)
Definition ocean.cc:1575
void BKE_ocean_bake(struct Ocean *o, struct OceanCache *och, void(*update_cb)(void *, float progress, int *cancel), void *update_cb_data)
Definition ocean.cc:1664
ATTR_WARN_UNUSED_RESULT const BMVert * v
void BKE_ocean_free_data(struct Ocean *oc)
Definition ocean.cc:1616
struct OceanCache * BKE_ocean_init_cache(const char *bakepath, const char *relbase, int start, int end, float wave_scale, float chop_amount, float foam_coverage, float foam_fade, int resolution)
Definition ocean.cc:1647
void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j)
Definition ocean.cc:1579
float BLI_ocean_spectrum_texelmarsenarsloe(const struct Ocean *oc, float kx, float kz)
float BLI_ocean_spectrum_piersonmoskowitz(const struct Ocean *oc, float kx, float kz)
float BLI_ocean_spectrum_jonswap(const struct Ocean *oc, float kx, float kz)
void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x, float z)
Definition ocean.cc:1577
bool BKE_ocean_init_from_modifier(struct Ocean *ocean, struct OceanModifierData const *omd, int resolution)
void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v)
Definition ocean.cc:1637
bool BKE_ocean_is_valid(const struct Ocean *o)
void BKE_ocean_free_cache(struct OceanCache *och)
Definition ocean.cc:1628
void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j)
Definition ocean.cc:1642
void BKE_ocean_simulate_cache(struct OceanCache *och, int frame)
Definition ocean.cc:1662
bool BKE_ocean_ensure(struct OceanModifierData *omd, int resolution)
void BKE_ocean_simulate(struct Ocean *o, float t, float scale, float chop_amount)
Definition ocean.cc:1581
struct Ocean * BKE_ocean_add()
Definition ocean.cc:1583
bool BKE_ocean_init(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, int spectrum, float fetch_jonswap, float sharpen_peak_jonswap, short do_height_field, short do_chop, short do_spray, short do_normals, short do_jacobian, int seed)
Definition ocean.cc:1590
struct ImBuf ** ibufs_spray
Definition BKE_ocean.h:34
struct ImBuf ** ibufs_spray_inverse
Definition BKE_ocean.h:36
const char * relbase
Definition BKE_ocean.h:39
const char * bakepath
Definition BKE_ocean.h:38
struct ImBuf ** ibufs_disp
Definition BKE_ocean.h:30
struct ImBuf ** ibufs_norm
Definition BKE_ocean.h:32
struct ImBuf ** ibufs_foam
Definition BKE_ocean.h:31
CCL_NAMESPACE_BEGIN struct Window V