Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control part drawing was wrong in some cases. #58

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 92 additions & 7 deletions data/aircrafts/yf22.3d
Original file line number Diff line number Diff line change
Expand Up @@ -842,33 +842,54 @@ begin_quads
normal -0.948683 0.000000 -0.316228
-0.900000 -3.200000 0.000000
-1.700000 -4.200000 2.300000
-1.700000 -5.100000 2.300000
-1.700000 -4.700000 2.300000
-1.000000 -5.800000 0.330000
normal -0.948683 0.000000 -0.316228
-0.900000 -3.200000 0.000000
-1.000000 -5.800000 0.330000
-1.000000 -6.200000 0.330000
-0.900000 -6.400000 0.000000
end_quads
texture_select yf22_vstab_outside_right
texture_orient_yz -3.200000 0.000000 3.200000 2.300000
begin_quads
normal 0.948683 0.000000 -0.316228
0.900000 -6.400000 0.000000
1.700000 -5.100000 2.300000
1.000000 -5.800000 0.330000
1.700000 -4.700000 2.300000
1.700000 -4.200000 2.300000
0.900000 -3.200000 0.000000
normal 0.948683 0.000000 -0.316228
0.900000 -3.200000 0.000000
0.900000 -6.400000 0.000000
1.000000 -6.200000 0.330000
1.000000 -5.800000 0.330000
end_quads
texture_select yf22_vstab_inside
texture_orient_yz -3.200000 0.000000 3.200000 2.300000
begin_quads
normal 0.948683 0.000000 0.316228
-0.900000 -6.400000 0.000000
-1.700000 -5.100000 2.300000
-1.700000 -4.200000 2.300000
-1.001140 -5.800006 0.329600
-1.699430 -4.699997 2.300200
-1.701141 -4.200006 2.299599
-0.898860 -3.199994 0.000400
normal 0.948683 0.000000 0.316228
-1.000000 -5.800000 0.330000
-0.900000 -3.200000 0.000000
-0.900000 -6.400000 0.000000
-1.000000 -6.200000 0.330000
normal -0.948683 0.000000 0.316228
0.900000 -3.200000 0.000000
1.700000 -4.200000 2.300000
1.700000 -5.100000 2.300000
1.700000 -4.700000 2.300000
1.000000 -5.800000 0.330000
normal -0.948683 0.000000 0.316228
0.900000 -3.200000 0.000000
1.000000 -5.800000 0.330000
1.000000 -6.200000 0.330000
0.900000 -6.400000 0.000000
end_quads
texture_off

# Thrust vain top left
color 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.100000 0.000000
texture_select yf22_engine_vain
Expand Down Expand Up @@ -1329,6 +1350,70 @@ begin_triangles
0.800000 -6.400000 0.000000
end_triangles
end_model shadow

# Left rudder
#rudder_top_new <x> <y> <z> <heading> <pitch> <bank> <t_min> <t_max>
rudder_top_new -1.698 -4.701 2.294 10.0 26.0 -21.9 -20.0 20.0
begin_model rudder_top
color 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.500000 0.300000 0.000000
texture_select yf22_vstab_outside_left
# Next 2 lignes must report "rudder_top_new" translate and rotate data
translate -1.698 -4.701 2.294
rotate 10.0 26.0 -21.9
begin_quads
normal -0.948683 0.000000 -0.316228
texcoord 0.469104 0.998306
0.000632 -0.000476 0.000284
texcoord 0.624950 0.997418
0.000031 -0.354475 -0.185961
texcoord 0.970536 0.146853
0.000828 -0.354515 -2.548353
texcoord 0.814692 0.147742
0.000825 -0.000520 -2.362107
#inside
normal 0.948683 0.000000 -0.316228
texcoord 0.970536 0.146853
0.000828 -0.354515 -2.548353
texcoord 0.624950 0.997418
0.000031 -0.354475 -0.185961
texcoord 0.469104 0.998306
0.000632 -0.000476 0.000284
texcoord 0.814692 0.147742
0.000825 -0.000520 -2.362107
end_quads
end_model rudder_top

# Right rudder
#rudder_top_new <x> <y> <z> <heading> <pitch> <bank> <t_min> <t_max>
rudder_top_new 1.698 -4.701 2.294 -10.0 26.0 21.9 -20.0 20.0
begin_model rudder_top
texture_select yf22_vstab_outside_right
# Next 2 lignes must report "rudder_top_new" translate and rotate data
translate 1.698 -4.701 2.294
rotate -10.0 26.0 21.9
begin_quads
normal -0.948683 0.000000 0.316228
texcoord 0.469104 0.998306
0.000570 0.014003 0.000200
texcoord 0.624950 0.997418
-0.000034 -0.339996 -0.186045
texcoord 0.970536 0.146853
-0.001433 -0.340036 -2.548437
texcoord 0.814692 0.147742
-0.001433 0.013959 -2.362191
#outside
normal 0.948683 0.000000 -0.316228
texcoord 0.970536 0.146853
-0.001433 -0.340036 -2.548437
texcoord 0.624950 0.997418
-0.000034 -0.339996 -0.186045
texcoord 0.469104 0.998306
0.000570 0.014003 0.000200
texcoord 0.814692 0.147742
-0.001433 0.013959 -2.362191
end_quads
end_model rudder_top

# Left Aileron
# x y z h p b t_min t_max
aileron_left_new -2.8 -3.47 0.0 19.95 0.0 0.0 -22.5 22.5
Expand Down
66 changes: 43 additions & 23 deletions src/sardraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,29 +1201,49 @@ static void SARDrawPart(
/* Begin drawing by part type */
switch(part->type)
{
#define DO_DRAW_CONTROL_PART { \
glTranslatef( \
pos_cen->x, pos_cen->z, -pos_cen->y \
); \
theta = dir_cen->heading + heading_mod; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
0.0f, 1.0f, 0.0f \
); \
theta = dir_cen->pitch + pitch_mod; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
1.0f, 0.0f, 0.0f \
); \
theta = dir_cen->bank + bank_mod; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
0.0f, 0.0f, 1.0f \
); \
SARVisualModelCallList(vmodel); \
#define DO_DRAW_CONTROL_PART { \
/* First, move control part to the right place */ \
glTranslatef( \
pos_cen->x, pos_cen->z, -pos_cen->y \
); \
theta = dir_cen->heading; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
0.0f, 1.0f, 0.0f \
); \
theta = dir_cen->pitch; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
1.0f, 0.0f, 0.0f \
); \
theta = dir_cen->bank; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
0.0f, 0.0f, 1.0f \
); \
/* Then, apply modification angle */ \
theta = heading_mod; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
0.0f, 1.0f, 0.0f \
); \
theta = pitch_mod; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
1.0f, 0.0f, 0.0f \
); \
theta = bank_mod; \
if(theta != 0.0f) \
glRotatef( \
(GLfloat)-SFMRadiansToDegrees(theta), \
0.0f, 0.0f, 1.0f \
); \
SARVisualModelCallList(vmodel); \
}

case SAR_OBJ_PART_TYPE_AILERON_LEFT:
Expand Down
Loading