restructured project
This commit is contained in:
parent
62b90b7077
commit
5762d02b48
|
@ -1,16 +1,5 @@
|
|||
# CMakeList.txt : CMake project for EulerFluid, include source and define
|
||||
# project specific logic here.
|
||||
#
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
set(BUILD_EULER_FLUID ON CACHE BOOL "Build Euler Fluid Project")
|
||||
|
||||
# Add source to this project's executable.
|
||||
add_executable (EulerFluid "main.cpp" "Application.hpp" "Application.cpp" "VectorField.hpp" "VectorField.cpp" "FluidField.hpp" "FluidField.cpp")
|
||||
|
||||
target_include_directories(EulerFluid PUBLIC ${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(EulerFluid PUBLIC ${SDL2_LIBRARIES})
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(EulerFluid PUBLIC _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# TODO: Add tests and install targets if needed.
|
||||
if(${BUILD_EULER_FLUID})
|
||||
add_subdirectory(EulerFluid)
|
||||
endif()
|
|
@ -88,7 +88,7 @@ void Application::Update()
|
|||
before = std::chrono::steady_clock::now();
|
||||
|
||||
field->VelocityStep(0.002, frametime);
|
||||
field->DensityStep(0.001, frametime);
|
||||
field->DensityStep(0.0005, frametime);
|
||||
}
|
||||
|
||||
void Application::Render()
|
16
src/EulerFluid/CMakeLists.txt
Normal file
16
src/EulerFluid/CMakeLists.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
# CMakeList.txt : CMake project for EulerFluid, include source and define
|
||||
# project specific logic here.
|
||||
#
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
|
||||
# Add source to this project's executable.
|
||||
add_executable (EulerFluid "main.cpp" "Application.hpp" "Application.cpp" "VectorField.hpp" "VectorField.cpp" "FluidField.hpp" "FluidField.cpp")
|
||||
|
||||
target_include_directories(EulerFluid PUBLIC ${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(EulerFluid PUBLIC ${SDL2_LIBRARIES})
|
||||
|
||||
if(MSVC)
|
||||
target_compile_definitions(EulerFluid PUBLIC _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# TODO: Add tests and install targets if needed.
|
|
@ -215,7 +215,7 @@ void FluidField::VelocityStep(double visc, double dt)
|
|||
AdvectVelocity(dt);
|
||||
Project();
|
||||
|
||||
vel->RecalculateMagnitude();
|
||||
// vel->RecalculateMagnitude();
|
||||
}
|
||||
|
||||
void FluidField::Project()
|
|
@ -62,14 +62,15 @@ void VectorField::RecalculateMagnitude()
|
|||
{
|
||||
double u = horizontal[y * this->width + x];
|
||||
double v = vertical[y * this->width + x];
|
||||
double magnitude = u + v;
|
||||
double magnitude = u*u + v*v;
|
||||
|
||||
biggestMagnitude += (biggestMagnitude < magnitude) * (magnitude - biggestMagnitude);
|
||||
biggestMagnitude = std::max(biggestMagnitude, magnitude);
|
||||
}
|
||||
}
|
||||
|
||||
if (biggestMagnitude == 0.0) // should use an epsilon probably
|
||||
biggestMagnitude = 1.0;
|
||||
|
||||
biggestMagnitude = sqrt(biggestMagnitude * 5.0);
|
||||
biggestMagnitude = sqrt(biggestMagnitude);
|
||||
biggestMagnitude = 0.5f;
|
||||
}
|
Loading…
Reference in a new issue