mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 08:00:14 +00:00
Improve targeting, minimap, and bridge collisions
This commit is contained in:
parent
a7c0b4320b
commit
38c9fdad6b
10 changed files with 142 additions and 24 deletions
|
|
@ -141,6 +141,7 @@ bool Minimap::initialize(int size) {
|
|||
uniform sampler2D uComposite;
|
||||
uniform vec2 uPlayerUV;
|
||||
uniform float uRotation;
|
||||
uniform float uArrowRotation;
|
||||
uniform float uZoomRadius;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
|
@ -158,6 +159,12 @@ bool Minimap::initialize(int size) {
|
|||
return (u >= 0.0) && (v >= 0.0) && (u + v <= 1.0);
|
||||
}
|
||||
|
||||
vec2 rot2(vec2 v, float ang) {
|
||||
float c = cos(ang);
|
||||
float s = sin(ang);
|
||||
return vec2(v.x * c - v.y * s, v.x * s + v.y * c);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 centered = TexCoord - 0.5;
|
||||
float dist = length(centered);
|
||||
|
|
@ -185,7 +192,7 @@ bool Minimap::initialize(int size) {
|
|||
}
|
||||
|
||||
// Player arrow at center (always points up = forward)
|
||||
vec2 ap = centered;
|
||||
vec2 ap = rot2(centered, -uArrowRotation);
|
||||
vec2 tip = vec2(0.0, 0.035);
|
||||
vec2 lt = vec2(-0.018, -0.016);
|
||||
vec2 rt = vec2(0.018, -0.016);
|
||||
|
|
@ -490,9 +497,18 @@ void Minimap::renderQuad(const Camera& playerCamera, const glm::vec3& centerWorl
|
|||
// renderX = wowY (west), renderY = wowX (north)
|
||||
// Facing north: fwd=(0,1,0) → bearing=0
|
||||
// Facing east: fwd=(-1,0,0) → bearing=π/2
|
||||
glm::vec3 fwd = playerCamera.getForward();
|
||||
float rotation = std::atan2(-fwd.x, fwd.y);
|
||||
float rotation = 0.0f;
|
||||
if (rotateWithCamera) {
|
||||
glm::vec3 fwd = playerCamera.getForward();
|
||||
rotation = std::atan2(-fwd.x, fwd.y);
|
||||
}
|
||||
quadShader->setUniform("uRotation", rotation);
|
||||
float arrowRotation = 0.0f;
|
||||
if (!rotateWithCamera) {
|
||||
glm::vec3 fwd = playerCamera.getForward();
|
||||
arrowRotation = std::atan2(-fwd.x, fwd.y);
|
||||
}
|
||||
quadShader->setUniform("uArrowRotation", arrowRotation);
|
||||
|
||||
quadShader->setUniform("uComposite", 0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue