From 199e2981e326af0809e230328b56be83cc4fd5fb Mon Sep 17 00:00:00 2001 From: turanszkij Date: Sun, 17 Dec 2017 15:01:12 +0100 Subject: [PATCH] color picker hotfix + minor content update --- WickedEngine/wiVersion.cpp | 2 +- WickedEngine/wiWidget.cpp | 45 ++++++++++++++++++------------------- models/Emitter/flare.wimf | Bin 139786 -> 139790 bytes 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 999c3bc02..514226680 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 14; // minor bug fixes, alterations, refactors, updates - const int revision = 0; + const int revision = 1; long GetVersion() diff --git a/WickedEngine/wiWidget.cpp b/WickedEngine/wiWidget.cpp index fe1610d8a..f145c5460 100644 --- a/WickedEngine/wiWidget.cpp +++ b/WickedEngine/wiWidget.cpp @@ -1602,6 +1602,8 @@ void wiColorPicker::Render(wiGUI* gui) static wiGraphicsTypes::GPUBuffer vb_preview; static wiGraphicsTypes::GraphicsPSO PSO; + static std::vector vertices_saturation(0); + static bool buffersComplete = false; if (!buffersComplete) { @@ -1610,30 +1612,21 @@ void wiColorPicker::Render(wiGUI* gui) HRESULT hr = S_OK; // saturation { - static std::vector vertices(0); - if (vb_saturation.IsValid() && !vertices.empty()) - { - vertices[0].col = hue_color; - wiRenderer::GetDevice()->UpdateBuffer(&vb_saturation, vertices.data(), threadID, vb_saturation.GetDesc().ByteWidth); - } - else - { - vertices.push_back({ XMFLOAT4(0,0,0,0),XMFLOAT4(1,0,0,1) }); // hue - vertices.push_back({ XMFLOAT4(0,0,0,0),XMFLOAT4(1,1,1,1) }); // white - vertices.push_back({ XMFLOAT4(0,0,0,0),XMFLOAT4(0,0,0,1) }); // black - wiMath::ConstructTriangleEquilateral(__colorpicker_radius_triangle, vertices[0].pos, vertices[1].pos, vertices[2].pos); + vertices_saturation.push_back({ XMFLOAT4(0,0,0,0),XMFLOAT4(1,0,0,1) }); // hue + vertices_saturation.push_back({ XMFLOAT4(0,0,0,0),XMFLOAT4(1,1,1,1) }); // white + vertices_saturation.push_back({ XMFLOAT4(0,0,0,0),XMFLOAT4(0,0,0,1) }); // black + wiMath::ConstructTriangleEquilateral(__colorpicker_radius_triangle, vertices_saturation[0].pos, vertices_saturation[1].pos, vertices_saturation[2].pos); - GPUBufferDesc desc; - desc.BindFlags = BIND_VERTEX_BUFFER; - desc.ByteWidth = (UINT)(vertices.size() * sizeof(Vertex)); - desc.CPUAccessFlags = CPU_ACCESS_WRITE; - desc.MiscFlags = 0; - desc.StructureByteStride = 0; - desc.Usage = USAGE_DYNAMIC; - SubresourceData data; - data.pSysMem = vertices.data(); - hr = wiRenderer::GetDevice()->CreateBuffer(&desc, &data, &vb_saturation); - } + GPUBufferDesc desc; + desc.BindFlags = BIND_VERTEX_BUFFER; + desc.ByteWidth = (UINT)(vertices_saturation.size() * sizeof(Vertex)); + desc.CPUAccessFlags = CPU_ACCESS_WRITE; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; + desc.Usage = USAGE_DYNAMIC; + SubresourceData data; + data.pSysMem = vertices_saturation.data(); + hr = wiRenderer::GetDevice()->CreateBuffer(&desc, &data, &vb_saturation); } // hue { @@ -1735,6 +1728,12 @@ void wiColorPicker::Render(wiGUI* gui) // render saturation triangle { + if (vb_saturation.IsValid() && !vertices_saturation.empty()) + { + vertices_saturation[0].col = hue_color; + wiRenderer::GetDevice()->UpdateBuffer(&vb_saturation, vertices_saturation.data(), threadID, vb_saturation.GetDesc().ByteWidth); + } + cb.mTransform = XMMatrixTranspose( XMMatrixRotationZ(-angle) * XMMatrixTranslation(translation.x + __colorpicker_center, translation.y + __colorpicker_center, 0) * diff --git a/models/Emitter/flare.wimf b/models/Emitter/flare.wimf index d4fb0e6cca64156324b02a786e2699bf98095e26..02c8313219e18a23c396f74f8ec7387098d600f6 100644 GIT binary patch delta 79 zcmV-V0I>gx#0ZYW2muYT0bBx?a2x^-myIR?2$ORHJp_Q3kv@~O0(Aue00003lWzef lgHHp8PXhtBPXhv#7Xbs20U4KH90CcKz#9T!w`UsyqXvB{6C XQv(6FQv(8(7nf2T0)w|}8v>&Sq)`)J