Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions external/ImFileDialog/ImFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <imgui.h>
#include <imgui_internal.h>

#include "../../source/Gui/TranslationService.h"

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

Expand Down Expand Up @@ -1097,7 +1099,7 @@ namespace ifd {
if (m_zoom == 1.0f) {
if (ImGui::BeginTable("##contentTable", 3, /*ImGuiTableFlags_Resizable |*/ ImGuiTableFlags_Sortable, ImVec2(0, -FLT_MIN))) {
// header
ImGui::TableSetupColumn("Name##filename", ImGuiTableColumnFlags_WidthStretch, 0.0f -1.0f, 0);
ImGui::TableSetupColumn((std::string(_("Name")) + "##filename").c_str(), ImGuiTableColumnFlags_WidthStretch, 0.0f -1.0f, 0);
ImGui::TableSetupColumn("Date modified##filedate", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, 0.0f, 1);
ImGui::TableSetupColumn("Size##filesize", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, 0.0f, 2);
ImGui::TableSetupScrollFreeze(0, 1);
Expand Down Expand Up @@ -1215,7 +1217,7 @@ namespace ifd {
if (openAreYouSureDlg)
ImGui::OpenPopup("Are you sure?##delete");
if (openNewFileDlg)
ImGui::OpenPopup("Enter file name##newfile");
ImGui::OpenPopup((std::string(_("Enter file name")) + "##newfile").c_str());
if (openNewDirectoryDlg)
ImGui::OpenPopup("Enter directory name##newdir");
if (ImGui::BeginPopupModal("Are you sure?##delete")) {
Expand All @@ -1236,7 +1238,7 @@ namespace ifd {
}
ImGui::EndPopup();
}
if (ImGui::BeginPopupModal("Enter file name##newfile")) {
if (ImGui::BeginPopupModal((std::string(_("Enter file name")) + "##newfile").c_str())) {
ImGui::PushItemWidth(250.0f);
ImGui::InputText("##newfilename", m_newEntryBuffer, 1024); // TODO: remove hardcoded literals
ImGui::PopItemWidth();
Expand All @@ -1252,26 +1254,26 @@ namespace ifd {
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
if (ImGui::Button("Cancel")) {
if (ImGui::Button(_("Cancel"))) {
m_newEntryBuffer[0] = 0;
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
if (ImGui::BeginPopupModal("Enter directory name##newdir")) {
if (ImGui::BeginPopupModal((std::string(_("Enter directory name")) + "##newdir").c_str())) {
ImGui::PushItemWidth(250.0f);
ImGui::InputText("##newfilename", m_newEntryBuffer, 1024); // TODO: remove hardcoded literals
ImGui::InputText("##newfilename", m_newEntryBuffer, 1024);
ImGui::PopItemWidth();

if (ImGui::Button("OK")) {
if (ImGui::Button(_("OK"))) {
std::error_code ec;
std::filesystem::create_directory(m_currentDirectory / std::string(m_newEntryBuffer), ec);
m_setDirectory(m_currentDirectory, false); // refresh
m_newEntryBuffer[0] = 0;
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
if (ImGui::Button("Cancel")) {
if (ImGui::Button(_("Cancel"))) {
ImGui::CloseCurrentPopup();
m_newEntryBuffer[0] = 0;
}
Expand Down Expand Up @@ -1325,7 +1327,7 @@ namespace ifd {
ImGui::SameLine();
ImGui::PopStyleColor();

if (ImGui::InputTextEx("##searchTB", "Search", m_searchBuffer, 128, ImVec2(-FLT_MIN, GUI_ELEMENT_SIZE), 0)) // TODO: no hardcoded literals
if (ImGui::InputTextEx("##searchTB", _("Search"), m_searchBuffer, 128, ImVec2(-FLT_MIN, GUI_ELEMENT_SIZE), 0)) // TODO: no hardcoded literals
m_setDirectory(m_currentDirectory, false); // refresh


Expand Down Expand Up @@ -1367,9 +1369,9 @@ namespace ifd {

/***** BOTTOM BAR *****/
if (m_type != IFD_DIALOG_DIRECTORY) {
ImGui::Text("File name:");
ImGui::Text("%s", _("File name:"));
ImGui::SameLine();
if (ImGui::InputTextEx("##file_input", "Filename", reinterpret_cast<char*>(m_inputTextbox), 1024, ImVec2((m_type != IFD_DIALOG_DIRECTORY) ? -250.0f : -FLT_MIN, 0), ImGuiInputTextFlags_EnterReturnsTrue)) {
if (ImGui::InputTextEx("##file_input", _("Filename"), reinterpret_cast<char*>(m_inputTextbox), 1024, ImVec2((m_type != IFD_DIALOG_DIRECTORY) ? -250.0f : -FLT_MIN, 0), ImGuiInputTextFlags_EnterReturnsTrue)) {
bool success = m_finalize(std::u8string(m_inputTextbox));
#ifdef _WIN32
if (!success)
Expand All @@ -1385,7 +1387,7 @@ namespace ifd {
// buttons

ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 250);
if (ImGui::Button(m_type == IFD_DIALOG_SAVE ? "Save" : "Open", ImVec2(250 / 2 - ImGui::GetStyle().ItemSpacing.x, 0.0f))) {
if (ImGui::Button(m_type == IFD_DIALOG_SAVE ? _("Save") : _("Open"), ImVec2(250 / 2 - ImGui::GetStyle().ItemSpacing.x, 0.0f))) {
std::u8string filename(m_inputTextbox);
bool success = false;
if (!filename.empty() || m_type == IFD_DIALOG_DIRECTORY)
Expand All @@ -1396,7 +1398,7 @@ namespace ifd {
#endif
}
ImGui::SameLine();
if (ImGui::Button("Cancel", ImVec2(-FLT_MIN, 0.0f)))
if (ImGui::Button(_("Cancel"), ImVec2(-FLT_MIN, 0.0f)))
m_finalize();
}
}
Expand Down
2 changes: 1 addition & 1 deletion external/vcpkg
Submodule vcpkg updated 6078 files
50 changes: 19 additions & 31 deletions source/EngineImpl/GeometryKernelsService.cu
Original file line number Diff line number Diff line change
Expand Up @@ -70,50 +70,38 @@ NumRenderObjects GeometryKernelsService::getNumRenderObjects(SettingsForSimulati
float2 const visibleBottomRight{visibleWorldRect.bottomRight.x, visibleWorldRect.bottomRight.y};
GeometryExtractionContext const context{visibleTopLeft, visibleBottomRight, computeCullingMargin(settings)};

NumRenderObjects result;
setValueToDevice(_numObjects, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractObjectData, data, nullptr, _numObjects, context);
cudaDeviceSynchronize();
result.objects = copyToHost(_numObjects);

setValueToDevice(_numFluidParticles, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractFluidParticleData, data, nullptr, _numFluidParticles, context);
cudaDeviceSynchronize();
result.fluidParticles = copyToHost(_numFluidParticles);

setValueToDevice(_numSelectedObjects, static_cast<uint64_t>(0));
setValueToDevice(_numLineIndices, static_cast<uint64_t>(0));
setValueToDevice(_numTriangleIndices, static_cast<uint64_t>(0));
setValueToDevice(_numSelectedConnectionVertices, static_cast<uint64_t>(0));
setValueToDevice(_numAttackEventVertices, static_cast<uint64_t>(0));
setValueToDevice(_numDetonationEventVertices, static_cast<uint64_t>(0));
setValueToDevice(_numLocations, static_cast<uint64_t>(0));

KERNEL_CALL(cudaExtractObjectData, data, nullptr, _numObjects, context);
KERNEL_CALL(cudaExtractFluidParticleData, data, nullptr, _numFluidParticles, context);
KERNEL_CALL(cudaExtractSelectedObjectData, data, nullptr, _numSelectedObjects, context);
cudaDeviceSynchronize();
result.selectedObjects = copyToHost(_numSelectedObjects);

setValueToDevice(_numLineIndices, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractLineIndices, data, nullptr, _numLineIndices, context);
cudaDeviceSynchronize();
result.lineIndices = copyToHost(_numLineIndices);

setValueToDevice(_numTriangleIndices, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractTriangleIndices, data, nullptr, _numTriangleIndices, context);
cudaDeviceSynchronize();
result.triangleIndices = copyToHost(_numTriangleIndices);

setValueToDevice(_numSelectedConnectionVertices, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractSelectedConnectionData, data, nullptr, _numSelectedConnectionVertices, context);
cudaDeviceSynchronize();
result.connectionArrowVertices = copyToHost(_numSelectedConnectionVertices);

setValueToDevice(_numAttackEventVertices, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractAttackEventData, data, nullptr, _numAttackEventVertices, context);
cudaDeviceSynchronize();
result.attackEventVertices = copyToHost(_numAttackEventVertices);

setValueToDevice(_numDetonationEventVertices, static_cast<uint64_t>(0));
KERNEL_CALL(cudaExtractDetonationEventData, data, nullptr, _numDetonationEventVertices, context);
cudaDeviceSynchronize();
result.detonationEventVertices = copyToHost(_numDetonationEventVertices);

setValueToDevice(_numLocations, static_cast<uint64_t>(0));
KERNEL_CALL_1_1(cudaExtractLocationData, data, nullptr, _numLocations, visibleTopLeft);
cudaDeviceSynchronize();

NumRenderObjects result;
result.objects = copyToHost(_numObjects);
result.fluidParticles = copyToHost(_numFluidParticles);
result.selectedObjects = copyToHost(_numSelectedObjects);
result.lineIndices = copyToHost(_numLineIndices);
result.triangleIndices = copyToHost(_numTriangleIndices);
result.connectionArrowVertices = copyToHost(_numSelectedConnectionVertices);
result.attackEventVertices = copyToHost(_numAttackEventVertices);
result.detonationEventVertices = copyToHost(_numDetonationEventVertices);
result.locations = copyToHost(_numLocations);

return result;
Expand Down
13 changes: 10 additions & 3 deletions source/EngineImpl/SimulationCudaFacade.cu
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ _SimulationCudaFacade::_SimulationCudaFacade(uint64_t timestep, SettingsForSimul
SimulationKernelsService::get().init();

// Default array sizes for empty simulation (will be resized later if not sufficient)
_cudaSimulationData->resizeObjectsAndTempObjects({100000, 100000, 10000000});
_cudaSimulationData->resizeObjectsAndTempObjects({50000, 50000, 5000000});
_cudaPreviewData->resizeObjectsAndTempObjects(PreviewCapacityGpu);

auto memory = CudaMemoryManager::getInstance().getSizeOfAcquiredMemory();
Expand Down Expand Up @@ -157,8 +157,10 @@ void _SimulationCudaFacade::copyBuffersFromCudaToOpenGL(GeometryBuffers const& g
_cudaGeometryBuffers->copyToOpenGL(geometryBuffers, numRenderObjects);
}

GeometryKernelsService::get().restorePositions(_settings, simulationData);
syncAndCheck();
if (_settings.simulationParameters.borderlessRendering.value) {
GeometryKernelsService::get().restorePositions(_settings, simulationData);
syncAndCheck();
}
}

void _SimulationCudaFacade::calcTimesteps(uint64_t timesteps, bool forceUpdateStatistics)
Expand Down Expand Up @@ -680,6 +682,11 @@ void _SimulationCudaFacade::initCuda()
CudaContextState::get().reset();

log(Priority::Important, "device " + std::to_string(_gpuInfo.deviceNumber) + " selected");
size_t freeMem, totalMem;
if (cudaMemGetInfo(&freeMem, &totalMem) == cudaSuccess) {
log(Priority::Important, "GPU memory: " + std::to_string(totalMem / (1024 * 1024)) + " MB total, "
+ std::to_string(freeMem / (1024 * 1024)) + " MB free");
}
}

auto _SimulationCudaFacade::checkAndReturnGpuInfo() -> GpuInfo
Expand Down
2 changes: 1 addition & 1 deletion source/EngineKernels/Array.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Const
{
constexpr float ArrayFillPercentage = 2.0f / 4.0f;
constexpr float ArrayResizePercentage = 3.0f;
constexpr float ArrayResizePercentage = 2.0f;
}

template <typename T>
Expand Down
4 changes: 2 additions & 2 deletions source/EngineKernels/SimulationData.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void SimulationData::init(int2 const& worldSize_, uint64_t timestep_)
CHECK_FOR_DEVICE_ERRORS(cudaMemset(externalEnergyInflowPerConstructorByColor, 0, sizeof(float) * MAX_COLORS));

processMemory.init();
primaryNumberGen.init(40312357); //some array size for random numbers (~ 160 MB)
secondaryNumberGen.init(1536941); //some array size for random numbers (~ 6 MB)
primaryNumberGen.init(5000000); //some array size for random numbers
secondaryNumberGen.init(500000); //some array size for random numbers

structuralOperations.init();
for (int i = 0; i < CellType_Count; ++i) {
Expand Down
6 changes: 3 additions & 3 deletions source/Gui/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
#include "StyleRepository.h"

AboutDialog::AboutDialog()
: AlienDialog("About")
: AlienDialog(_("About"))
{}

void AboutDialog::processIntern()
{
ImGui::Text(
"Artificial Life Environment, version %s\n\nis an open source project initiated and maintained by\nChristian Heinemann.",
_("Artificial Life Environment, version %s\n\nis an open source project initiated and maintained by\nChristian Heinemann."),
Const::ProgramVersion.c_str());

ImGui::Dummy({0, ImGui::GetContentRegionAvail().y - scale(50.0f)});
AlienGui::Separator();

if (AlienGui::Button("OK")) {
if (AlienGui::Button(_("OK"))) {
close();
}
ImGui::SetItemDefaultFocus();
Expand Down
22 changes: 11 additions & 11 deletions source/Gui/ActivateUserDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ void ActivateUserDialog::open(std::string const& userName, std::string const& pa
}

ActivateUserDialog::ActivateUserDialog()
: AlienDialog("Activate user")
: AlienDialog(_("Activate user"))
{}

void ActivateUserDialog::processIntern()
{
AlienGui::Text("Please enter the confirmation code sent to your email address.");
AlienGui::Text(_("Please enter the confirmation code sent to your email address."));
AlienGui::HelpMarker(
"Please check your spam folder if you did not find an email. If you did not receive an email there, try signing up with possibly another "
"email address. If this still does not work, please contact info@alien-project.org.");
_("Please check your spam folder if you did not find an email. If you did not receive an email there, try signing up with possibly another "
"email address. If this still does not work, please contact info@alien-project.org."));
AlienGui::Separator();
AlienGui::InputText(AlienGui::InputTextParameters().hint("Code (case sensitive)").textWidth(0), _confirmationCode);
AlienGui::InputText(AlienGui::InputTextParameters().hint(_("Code (case sensitive)")).textWidth(0), _confirmationCode);

AlienGui::Separator();

ImGui::BeginDisabled(_confirmationCode.empty());
if (AlienGui::Button("OK")) {
if (AlienGui::Button(_("OK"))) {
close();
onActivateUser();
}
Expand All @@ -52,12 +52,12 @@ void ActivateUserDialog::processIntern()
AlienGui::VerticalSeparator();

ImGui::SameLine();
if (AlienGui::Button("Resend")) {
if (AlienGui::Button(_("Resend"))) {
CreateUserDialog::get().onCreateUser();
}

ImGui::SameLine();
if (AlienGui::Button("Resend to other email address")) {
if (AlienGui::Button(_("Resend to other email address"))) {
close();
CreateUserDialog::get().open(_userName, _password, _userInfo);
}
Expand All @@ -66,7 +66,7 @@ void ActivateUserDialog::processIntern()
AlienGui::VerticalSeparator();

ImGui::SameLine();
if (AlienGui::Button("Cancel")) {
if (AlienGui::Button(_("Cancel"))) {
close();
}
}
Expand All @@ -79,10 +79,10 @@ void ActivateUserDialog::onActivateUser()
result |= NetworkService::get().login(errorCode, _userName, _password, _userInfo);
}
if (!result) {
GenericMessageDialog::get().information("Error", "An error occurred on the server. Your entered code may be incorrect.\nPlease try to register again.");
GenericMessageDialog::get().information(_("Error"), _("An error occurred on the server. Your entered code may be incorrect.\nPlease try to register again."));
} else {
GenericMessageDialog::get().information(
"Information",
_("Information"),
"The user '" + _userName
+ "' has been successfully created.\nYou are logged in and are now able to upload your own simulations\nor upvote others by likes.");
BrowserWindow::get().onRefresh();
Expand Down
Loading