Ajuste torax y segmentos abdomen para simular libelula real

This commit is contained in:
luisgulo 2026-10-09 18:32:45 +02:00
parent 25846ab79d
commit 222871e1da

View File

@ -507,6 +507,46 @@ def draw_map(time_counter):
def draw_dragonfly(wing_angle, caught_insect=None): def draw_dragonfly(wing_angle, caught_insect=None):
glColor3f(*COLOR_DRAGONFLY) glColor3f(*COLOR_DRAGONFLY)
# Tórax y segmentos del abdomen sólidos con separación
glBegin(GL_QUADS)
# Tórax sólido
glVertex3f(-0.35, 0.5, 0)
glVertex3f(0.35, 0.5, 0)
glVertex3f(0.35, -0.5, 0)
glVertex3f(-0.35, -0.5, 0)
# Segmento 1 del abdomen
glVertex3f(-0.25, -0.6, 0)
glVertex3f(0.25, -0.6, 0)
glVertex3f(0.22, -0.95, 0)
glVertex3f(-0.22, -0.95, 0)
# Segmento 2 del abdomen
glVertex3f(-0.21, -1.05, 0)
glVertex3f(0.21, -1.05, 0)
glVertex3f(0.18, -1.35, 0)
glVertex3f(-0.18, -1.35, 0)
# Segmento 3 del abdomen
glVertex3f(-0.17, -1.45, 0)
glVertex3f(0.17, -1.45, 0)
glVertex3f(0.14, -1.75, 0)
glVertex3f(-0.14, -1.75, 0)
# Segmento 4 del abdomen
glVertex3f(-0.13, -1.85, 0)
glVertex3f(0.13, -1.85, 0)
glVertex3f(0.1, -2.15, 0)
glVertex3f(-0.1, -2.15, 0)
# Segmento final del abdomen
glVertex3f(-0.09, -2.25, 0)
glVertex3f(0.09, -2.25, 0)
glVertex3f(0.06, -2.6, 0)
glVertex3f(-0.06, -2.6, 0)
glEnd()
# Líneas secundarias, patas y contornos
glBegin(GL_LINES) glBegin(GL_LINES)
glVertex3f(0, 1.5, 0) glVertex3f(0, 1.5, 0)
glVertex3f(0, -3.0, 0) glVertex3f(0, -3.0, 0)
@ -525,6 +565,7 @@ def draw_dragonfly(wing_angle, caught_insect=None):
glVertex3f(0.1, -0.3, -0.6) glVertex3f(0.1, -0.3, -0.6)
glEnd() glEnd()
# Cabeza (Círculo)
glBegin(GL_LINE_LOOP) glBegin(GL_LINE_LOOP)
for i in range(8): for i in range(8):
angle = 2.0 * math.pi * i / 8 angle = 2.0 * math.pi * i / 8
@ -534,6 +575,7 @@ def draw_dragonfly(wing_angle, caught_insect=None):
rad_wing = math.radians(wing_angle) rad_wing = math.radians(wing_angle)
w_z = math.sin(rad_wing) * 1.2 if wing_angle != 0 else 0.0 w_z = math.sin(rad_wing) * 1.2 if wing_angle != 0 else 0.0
# Alas delanteras y traseras
glBegin(GL_LINE_LOOP) glBegin(GL_LINE_LOOP)
glVertex3f(0, 0.6, 0) glVertex3f(0, 0.6, 0)
glVertex3f(-4.5, 1.0, w_z) glVertex3f(-4.5, 1.0, w_z)
@ -563,7 +605,6 @@ def draw_dragonfly(wing_angle, caught_insect=None):
glTranslatef(0.0, 0.2, -0.6) glTranslatef(0.0, 0.2, -0.6)
caught_insect.draw(attached=True) caught_insect.draw(attached=True)
glPopMatrix() glPopMatrix()
# ========================================== # ==========================================
# INTERFAZ 2D / HUD Y PANTALLA INICIAL # INTERFAZ 2D / HUD Y PANTALLA INICIAL
# ========================================== # ==========================================