Skip to content

Commit

Permalink
Merge pull request #228 from klingbolt/anim_speed
Browse files Browse the repository at this point in the history
Anim speed
  • Loading branch information
AsherGlick authored Dec 5, 2023
2 parents 78f6c40 + 58ede8c commit c3104c7
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 12 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" Name="mycategory">
</MarkerCategory>

<POIs>
<Trail AnimSpeed="0.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="1.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="0.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="1.000000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-3.140000" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
<Trail AnimSpeed="-123.456001" Type="mycategory" MapID="50" TrailData="temp_name_of_trail.trl"/>
</POIs>
</OverlayData>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" Name="mycategory">
</MarkerCategory>

<POIs>
<Trail AnimSpeed="0" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="1.0" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="123.456" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="0" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="1" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="123.456" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="-3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimSpeed="-123.456" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="-3.14" TrailData="trail.trl" Type="mycategory" />
<Trail AnimationSpeed="-123.456" TrailData="trail.trl" Type="mycategory" />
</POIs>
</OverlayData>
6 changes: 6 additions & 0 deletions xml_converter/intigration_tests/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ class Testcase:
expected_output_xml_path="./expected_outputs/xml_profession_filter",
expected_output_proto_path="./expected_outputs/proto_profession_filter",
),
Testcase(
name="animation_speed",
xml_input_paths=["./inputs/xml_animation_speed"],
expected_output_xml_path="./expected_outputs/xml_animation_speed",
expected_output_proto_path="./expected_outputs/proto_animation_speed"
),
Testcase(
name="cull_chirality",
xml_input_paths=["./inputs/xml_cull_chirality"],
Expand Down
20 changes: 8 additions & 12 deletions xml_converter/src/attribute/trail_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void xml_attribute_to_trail_data(
errors->push_back(new XMLAttributeValueError("No trail file found at " + trail_path, input));
return;
}

char version[4];
trail_data_file.read(version, 4);
// Validate the version number. Currently supports versions [0]
Expand All @@ -57,20 +58,15 @@ void xml_attribute_to_trail_data(
*map_id_value = *reinterpret_cast<uint32_t*>(map_id_char);
*is_map_id_set = true;

while (trail_data_file.tellg() > 0) {
char point_x[4];
trail_data_file.read(point_x, 4);
trail_data.points_x.push_back(*reinterpret_cast<float*>(point_x));
char point_y[4];
trail_data_file.read(point_y, 4);
trail_data.points_y.push_back(*reinterpret_cast<float*>(point_y));
char point_z[4];
trail_data_file.read(point_z, 4);
trail_data.points_z.push_back(*reinterpret_cast<float*>(point_z));
char points[12];
while (trail_data_file.read(points, 12)) {
trail_data.points_x.push_back(*reinterpret_cast<float*>(points));
trail_data.points_y.push_back(*reinterpret_cast<float*>(points + 4));
trail_data.points_z.push_back(*reinterpret_cast<float*>(points + 8));
}

if (trail_data.points_x.size() != trail_data.points_y.size() || trail_data.points_x.size() != trail_data.points_z.size()) {
errors->push_back(new XMLAttributeValueError("Unexpected number of bits in trail file. Does not have equal number of X, Y, and Z coordinates." + trail_path, input));
if (trail_data_file.gcount() != 0) {
errors->push_back(new XMLAttributeValueError("Unexpected number of bytes in trail file." + trail_path, input));
}

trail_data_file.close();
Expand Down

0 comments on commit c3104c7

Please sign in to comment.