diff --git a/projects/particle_simulation/shaders/frag.spv b/projects/particle_simulation/shaders/frag.spv index d926fa4b4ad738f5aaca2f00fbb92a91d024fd12..2bda54b389e0b6a615e819f05c1ac07bbd714f86 100644 Binary files a/projects/particle_simulation/shaders/frag.spv and b/projects/particle_simulation/shaders/frag.spv differ diff --git a/projects/particle_simulation/shaders/shader.frag b/projects/particle_simulation/shaders/shader.frag index 215fa7887491199d67ee4e25746d5a8f0559626d..87ae41a7546b304b14d4be21e62e7ceb2a9759d1 100644 --- a/projects/particle_simulation/shaders/shader.frag +++ b/projects/particle_simulation/shaders/shader.frag @@ -8,11 +8,10 @@ layout(set=0, binding=0) uniform uColor { } Color; layout(set=0,binding=1) uniform uPosition{ - vec3 position; + vec2 position; } Position; void main() { -// outColor = Color.color; - outColor = vec4(1.0f, 0.0f,0.f,1.f); + outColor = Color.color; } \ No newline at end of file diff --git a/projects/particle_simulation/src/main.cpp b/projects/particle_simulation/src/main.cpp index c1c0b59e9368e72980884f1bcbda6527e81d5b80..1d5f4de5d4596fde46a972848d0e84c585446ee1 100644 --- a/projects/particle_simulation/src/main.cpp +++ b/projects/particle_simulation/src/main.cpp @@ -4,6 +4,25 @@ #include <vkcv/camera/CameraManager.hpp> #include <chrono> +uint32_t findMemoryType( vk::PhysicalDeviceMemoryProperties const & memoryProperties, + uint32_t typeBits, + vk::MemoryPropertyFlags requirementsMask ) +{ + uint32_t typeIndex = uint32_t( ~0 ); + for ( uint32_t i = 0; i < memoryProperties.memoryTypeCount; i++ ) + { + if ( ( typeBits & 1 ) && + ( ( memoryProperties.memoryTypes[i].propertyFlags & requirementsMask ) == requirementsMask ) ) + { + typeIndex = i; + break; + } + typeBits >>= 1; + } + assert( typeIndex != uint32_t( ~0 ) ); + return typeIndex; +} + int main(int argc, const char** argv) { const char* applicationName = "Particlesystem"; @@ -97,7 +116,7 @@ int main(int argc, const char** argv) { 1 ); - vkcv::Buffer<glm::vec4> position = core.createBuffer<glm::vec4>( + vkcv::Buffer<glm::vec2> position = core.createBuffer<glm::vec2>( vkcv::BufferType::UNIFORM, 1 ); @@ -120,6 +139,14 @@ int main(int argc, const char** argv) { auto start = std::chrono::system_clock::now(); + glm::vec4 colorData = glm::vec4(1.0f,1.0f,0.0f,1.0f); + + glm::vec2 pos = glm::vec2(1.f); + + window.e_mouseMove.add([&]( double offsetX, double offsetY) { + pos = glm::vec2(static_cast<float>(offsetX), static_cast<float>(offsetY)); + }); + while (window.isWindowOpen()) { window.pollEvents(); @@ -129,6 +156,10 @@ int main(int argc, const char** argv) { continue; } + color.fill(&colorData); + + position.fill(&pos); + auto end = std::chrono::system_clock::now(); auto deltatime = end - start; start = end; @@ -149,5 +180,6 @@ int main(int argc, const char** argv) { core.submitCommandStream(cmdStream); core.endFrame(); } + return 0; }