MCPcopy Create free account
hub / github.com/davemoore22/sorcery / _draw_vertex_array

Method _draw_vertex_array

src/core/render.cpp:1077–1115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1075 _draw_vertex_array(vm0.right_side_wall, scale, pos);
1076 _draw_vertex_array(vm0.right_side_door, scale, pos);
1077 }
1078 if (_has_secret_door(tm0, _get_right_side(player_facing))) {
1079 _draw_vertex_array(vm0.right_side_wall, scale, pos);
1080 if (_ctx.game->state->get_lit())
1081 _draw_vertex_array(vm0.right_side_door, scale, pos);
1082 }
1083 }
1084 }
1085}
1086
1087auto Sorcery::Render::_draw_vertex_array(const VertexArray &array,
1088 const float scale, const ImVec2 pos)
1089 -> void {
1090
1091 // Work out the Quad (Rect) on the Screen where we are going to draw!
1092 const ImVec2 p1{pos.x + (array.data[0].position.x * scale),
1093 pos.y + (array.data[0].position.y * scale)};
1094 const ImVec2 p2{pos.x + (array.data[1].position.x * scale),
1095 pos.y + (array.data[1].position.y * scale)};
1096 const ImVec2 p3{pos.x + (array.data[2].position.x * scale),
1097 pos.y + (array.data[2].position.y * scale)};
1098 const ImVec2 p4{pos.x + (array.data[3].position.x * scale),
1099 pos.y + (array.data[3].position.y * scale)};
1100
1101 // Then work out the Source Quad (Rect)
1102 const ImVec2 uv_0{array.data[0].tex_coord.x / _source_size.x,
1103 array.data[0].tex_coord.y / _source_size.y};
1104 const ImVec2 uv_1{array.data[1].tex_coord.x / _source_size.x,
1105 array.data[1].tex_coord.y / _source_size.y};
1106 const ImVec2 uv_2{array.data[2].tex_coord.x / _source_size.x,
1107 array.data[2].tex_coord.y / _source_size.y};
1108 const ImVec2 uv_3{array.data[3].tex_coord.x / _source_size.x,
1109 array.data[3].tex_coord.y / _source_size.y};
1110
1111 VertexArray adjusted;
1112 adjusted.data[0].position = p1;
1113 adjusted.data[1].position = p2;
1114 adjusted.data[2].position = p3;
1115 adjusted.data[3].position = p4;
1116 adjusted.data[0].tex_coord = uv_0;
1117 adjusted.data[1].tex_coord = uv_1;
1118 adjusted.data[2].tex_coord = uv_2;

Callers

nothing calls this directly

Calls 1

draw_view_imageMethod · 0.80

Tested by

no test coverage detected