load test texture

feature/softbody-runtime-control
Benjamin Kraft 3 months ago
parent 08f02a3504
commit 4ccad6fe71
  1. 7988
      lib/stb_image.h
  2. 9
      src/application.cpp
  3. 2
      src/stb_image.cpp
  4. BIN
      textures/rocky_diff.jpg

File diff suppressed because it is too large Load Diff

@ -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());

@ -0,0 +1,2 @@
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Loading…
Cancel
Save