mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: desaturate quest markers for trivial (gray) quests
Trivial/low-level quests now show gray '!' / '?' markers instead of yellow, matching the in-game distinction between available and trivial quests. Add grayscale parameter to QuestMarkerRenderer::setMarker and the push-constant block; application sets grayscale=1.0 for trivial markers and 0.0 for all others.
This commit is contained in:
parent
19eb7a1fb7
commit
6928b8ddf6
4 changed files with 16 additions and 7 deletions
|
|
@ -5,6 +5,7 @@ layout(set = 1, binding = 0) uniform sampler2D markerTexture;
|
||||||
layout(push_constant) uniform Push {
|
layout(push_constant) uniform Push {
|
||||||
mat4 model;
|
mat4 model;
|
||||||
float alpha;
|
float alpha;
|
||||||
|
float grayscale; // 0 = full colour, 1 = fully desaturated (trivial quests)
|
||||||
} push;
|
} push;
|
||||||
|
|
||||||
layout(location = 0) in vec2 TexCoord;
|
layout(location = 0) in vec2 TexCoord;
|
||||||
|
|
@ -14,5 +15,7 @@ layout(location = 0) out vec4 outColor;
|
||||||
void main() {
|
void main() {
|
||||||
vec4 texColor = texture(markerTexture, TexCoord);
|
vec4 texColor = texture(markerTexture, TexCoord);
|
||||||
if (texColor.a < 0.1) discard;
|
if (texColor.a < 0.1) discard;
|
||||||
outColor = vec4(texColor.rgb, texColor.a * push.alpha);
|
float lum = dot(texColor.rgb, vec3(0.299, 0.587, 0.114));
|
||||||
|
vec3 rgb = mix(texColor.rgb, vec3(lum), push.grayscale);
|
||||||
|
outColor = vec4(rgb, texColor.a * push.alpha);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -35,8 +35,10 @@ public:
|
||||||
* @param position World position (NPC base position)
|
* @param position World position (NPC base position)
|
||||||
* @param markerType 0=available(!), 1=turnin(?), 2=incomplete(?)
|
* @param markerType 0=available(!), 1=turnin(?), 2=incomplete(?)
|
||||||
* @param boundingHeight NPC bounding height (optional, default 2.0f)
|
* @param boundingHeight NPC bounding height (optional, default 2.0f)
|
||||||
|
* @param grayscale 0 = full colour, 1 = desaturated grey (trivial/low-level quests)
|
||||||
*/
|
*/
|
||||||
void setMarker(uint64_t guid, const glm::vec3& position, int markerType, float boundingHeight = 2.0f);
|
void setMarker(uint64_t guid, const glm::vec3& position, int markerType,
|
||||||
|
float boundingHeight = 2.0f, float grayscale = 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a quest marker
|
* Remove a quest marker
|
||||||
|
|
@ -61,6 +63,7 @@ private:
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
int type; // 0=available, 1=turnin, 2=incomplete
|
int type; // 0=available, 1=turnin, 2=incomplete
|
||||||
float boundingHeight = 2.0f;
|
float boundingHeight = 2.0f;
|
||||||
|
float grayscale = 0.0f; // 0 = colour, 1 = desaturated (trivial quests)
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<uint64_t, Marker> markers_;
|
std::unordered_map<uint64_t, Marker> markers_;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ namespace wowee { namespace rendering {
|
||||||
|
|
||||||
// Push constant layout matching quest_marker.vert.glsl / quest_marker.frag.glsl
|
// Push constant layout matching quest_marker.vert.glsl / quest_marker.frag.glsl
|
||||||
struct QuestMarkerPushConstants {
|
struct QuestMarkerPushConstants {
|
||||||
glm::mat4 model; // 64 bytes, used by vertex shader
|
glm::mat4 model; // 64 bytes, used by vertex shader
|
||||||
float alpha; // 4 bytes, used by fragment shader
|
float alpha; // 4 bytes, used by fragment shader
|
||||||
|
float grayscale; // 4 bytes: 0=colour, 1=desaturated (trivial quests)
|
||||||
};
|
};
|
||||||
|
|
||||||
QuestMarkerRenderer::QuestMarkerRenderer() {
|
QuestMarkerRenderer::QuestMarkerRenderer() {
|
||||||
|
|
@ -340,8 +341,9 @@ void QuestMarkerRenderer::loadTextures(pipeline::AssetManager* assetManager) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestMarkerRenderer::setMarker(uint64_t guid, const glm::vec3& position, int markerType, float boundingHeight) {
|
void QuestMarkerRenderer::setMarker(uint64_t guid, const glm::vec3& position, int markerType,
|
||||||
markers_[guid] = {position, markerType, boundingHeight};
|
float boundingHeight, float grayscale) {
|
||||||
|
markers_[guid] = {position, markerType, boundingHeight, grayscale};
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestMarkerRenderer::removeMarker(uint64_t guid) {
|
void QuestMarkerRenderer::removeMarker(uint64_t guid) {
|
||||||
|
|
@ -436,10 +438,11 @@ void QuestMarkerRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSe
|
||||||
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout_,
|
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout_,
|
||||||
1, 1, &texDescSets_[marker.type], 0, nullptr);
|
1, 1, &texDescSets_[marker.type], 0, nullptr);
|
||||||
|
|
||||||
// Push constants: model matrix + alpha
|
// Push constants: model matrix + alpha + grayscale tint
|
||||||
QuestMarkerPushConstants push{};
|
QuestMarkerPushConstants push{};
|
||||||
push.model = model;
|
push.model = model;
|
||||||
push.alpha = fadeAlpha;
|
push.alpha = fadeAlpha;
|
||||||
|
push.grayscale = marker.grayscale;
|
||||||
|
|
||||||
vkCmdPushConstants(cmd, pipelineLayout_,
|
vkCmdPushConstants(cmd, pipelineLayout_,
|
||||||
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
|
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue