|
|
@ -14,6 +14,7 @@ |
|
|
|
#include "constraints.hpp" |
|
|
|
#include "constraints.hpp" |
|
|
|
#include "timer.hpp" |
|
|
|
#include "timer.hpp" |
|
|
|
#include "grabber.hpp" |
|
|
|
#include "grabber.hpp" |
|
|
|
|
|
|
|
#include "stb_image.h" |
|
|
|
|
|
|
|
|
|
|
|
struct SizesUniformData { |
|
|
|
struct SizesUniformData { |
|
|
|
uint32_t vertexCount; |
|
|
|
uint32_t vertexCount; |
|
|
@ -102,11 +103,9 @@ Application::Application() { |
|
|
|
simulationPropertiesBuffer->access<SimulationUniformData>() = simulationUniformData; |
|
|
|
simulationPropertiesBuffer->access<SimulationUniformData>() = simulationUniformData; |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
int w = 128, h = 128; |
|
|
|
int w, h; |
|
|
|
|
|
|
|
stbi_uc* data = stbi_load("textures/rocky_diff.jpg", &w, &h, nullptr, STBI_rgb_alpha); |
|
|
|
VkDeviceSize imageSize = w * h * 4; |
|
|
|
VkDeviceSize imageSize = w * h * 4; |
|
|
|
u_char* data = new u_char[imageSize]; |
|
|
|
|
|
|
|
memset(data, 0xFF, imageSize); |
|
|
|
|
|
|
|
memset(data, 0x44, 3); |
|
|
|
|
|
|
|
firstImage = make_unique<Image>(data, imageSize, w, h, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT); |
|
|
|
firstImage = make_unique<Image>(data, imageSize, w, h, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT); |
|
|
|
firstImage->createView(VK_IMAGE_ASPECT_COLOR_BIT); |
|
|
|
firstImage->createView(VK_IMAGE_ASPECT_COLOR_BIT); |
|
|
|
firstImage->createSampler(); |
|
|
|
firstImage->createSampler(); |
|
|
@ -179,7 +178,7 @@ void Application::createMeshBuffers() { |
|
|
|
Mesh sphere("models/icosphere.ply"); |
|
|
|
Mesh sphere("models/icosphere.ply"); |
|
|
|
Mesh bunny("models/bunny_medium.ply"); |
|
|
|
Mesh bunny("models/bunny_medium.ply"); |
|
|
|
|
|
|
|
|
|
|
|
auto body = std::make_unique<SoftBody>(&sphere, 1.f / 50); |
|
|
|
auto body = std::make_unique<SoftBody>(&sphere, 1.f / 100); |
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < 2; i++){ |
|
|
|
for (size_t i = 0; i < 2; i++){ |
|
|
|
auto copy = std::make_unique<SoftBody>(*body.get()); |
|
|
|
auto copy = std::make_unique<SoftBody>(*body.get()); |
|
|
|