Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_ocean.c
| Show All 24 Lines | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_math_inline.h" | #include "BLI_math_inline.h" | ||||
| #include "BLI_task.h" | #include "BLI_task.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "DNA_customdata_types.h" | #include "DNA_customdata_types.h" | ||||
| #include "DNA_defaults.h" | |||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| /* Modifier Code */ | /* Modifier Code */ | ||||
| static void initData(ModifierData *md) | static void initData(ModifierData *md) | ||||
| { | { | ||||
| #ifdef WITH_OCEANSIM | #ifdef WITH_OCEANSIM | ||||
| OceanModifierData *omd = (OceanModifierData *)md; | OceanModifierData *omd = (OceanModifierData *)md; | ||||
| /* Render resolution */ | BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(omd, modifier)); | ||||
| omd->resolution = 7; | |||||
| /* Display resolution for the non-render case */ | |||||
| omd->viewport_resolution = 7; | |||||
| omd->spatial_size = 50; | MEMCPY_STRUCT_AFTER(omd, DNA_struct_default_get(OceanModifierData), modifier); | ||||
| omd->wave_alignment = 0.0; | |||||
| omd->wind_velocity = 30.0; | |||||
| omd->damp = 0.5; | |||||
| omd->smallest_wave = 0.01; | |||||
| omd->wave_direction = 0.0; | |||||
| omd->depth = 200.0; | |||||
| omd->wave_scale = 1.0; | |||||
| omd->chop_amount = 1.0; | |||||
| omd->foam_coverage = 0.0; | |||||
| omd->seed = 0; | |||||
| omd->time = 1.0; | |||||
| omd->spectrum = MOD_OCEAN_SPECTRUM_PHILLIPS; | |||||
| omd->sharpen_peak_jonswap = 0.0f; | |||||
| omd->fetch_jonswap = 120.0f; | |||||
| omd->size = 1.0; | |||||
| omd->repeat_x = 1; | |||||
| omd->repeat_y = 1; | |||||
| BKE_modifier_path_init(omd->cachepath, sizeof(omd->cachepath), "cache_ocean"); | BKE_modifier_path_init(omd->cachepath, sizeof(omd->cachepath), "cache_ocean"); | ||||
| omd->cached = 0; | |||||
| omd->bakestart = 1; | |||||
| omd->bakeend = 250; | |||||
| omd->oceancache = NULL; | |||||
| omd->foam_fade = 0.98; | |||||
| omd->foamlayername[0] = '\0'; /* layer name empty by default */ | |||||
| omd->spraylayername[0] = '\0'; /* layer name empty by default */ | |||||
| omd->ocean = BKE_ocean_add(); | omd->ocean = BKE_ocean_add(); | ||||
| BKE_ocean_init_from_modifier(omd->ocean, omd, omd->viewport_resolution); | BKE_ocean_init_from_modifier(omd->ocean, omd, omd->viewport_resolution); | ||||
| simulate_ocean_modifier(omd); | simulate_ocean_modifier(omd); | ||||
| #else /* WITH_OCEANSIM */ | #else /* WITH_OCEANSIM */ | ||||
| /* unused */ | UNUSED_VARS(md); | ||||
| (void)md; | |||||
| #endif /* WITH_OCEANSIM */ | #endif /* WITH_OCEANSIM */ | ||||
| } | } | ||||
| static void freeData(ModifierData *md) | static void freeData(ModifierData *md) | ||||
| { | { | ||||
| #ifdef WITH_OCEANSIM | #ifdef WITH_OCEANSIM | ||||
| OceanModifierData *omd = (OceanModifierData *)md; | OceanModifierData *omd = (OceanModifierData *)md; | ||||
| ▲ Show 20 Lines • Show All 645 Lines • Show Last 20 Lines | |||||