#include "PacketTest.hpp"
+#include "geometry/const.hpp"
#include "model/Model.hpp"
#include "world/Entity.hpp"
Entity write_entity;
write_entity.ID(534574);
EntityState write_state;
- write_state.chunk_pos = { 7, 2, -3 };
- write_state.block_pos = { 1.5f, 0.9f, 12.0f };
+ write_state.pos = { { 7, 2, -3 }, { 1.5f, 0.9f, 12.0f } };
write_state.velocity = { 0.025f, 0.001f, 0.0f };
- write_state.orient = { 1.0f, 0.0f, 0.0f, 0.0f };
+ write_state.orient = normalize(glm::quat(0.863f, 0.0f, 0.505f, 0.0f));
write_state.pitch = 0.3f;
write_state.yaw = -2.3f;
write_entity.SetState(write_state);
AssertPacket("PlayerUpdate", 4, 50, pack);
EntityState write_state;
- write_state.chunk_pos = { 7, 2, -3 };
- write_state.block_pos = { 1.5f, 0.9f, 12.0f };
+ write_state.pos = { { 7, 2, -3 }, { 1.5f, 0.9f, 12.0f } };
write_state.velocity = { 0.025f, 0.001f, 0.0f };
- write_state.orient = { 1.0f, 0.0f, 0.0f, 0.0f };
+ write_state.orient = { 0.0f, 0.0f, 1.0f, 0.0f };
glm::vec3 write_movement(0.5f, -1.0f, 1.0f);
uint8_t write_actions = 0x05;
uint8_t write_slot = 3;
model.Enumerate();
model.Instantiate(write_entity.GetModel());
EntityState write_state;
- write_state.chunk_pos = { 7, 2, -3 };
- write_state.block_pos = { 1.5f, 0.9f, 12.0f };
+ write_state.pos = { { 7, 2, -3 }, { 1.5f, 0.9f, 12.0f } };
write_state.velocity = { 0.025f, 0.001f, 0.0f };
- write_state.orient = { 1.0f, 0.0f, 0.0f, 0.0f };
write_state.pitch = 0.3f;
write_state.yaw = -2.3f;
write_entity.SetState(write_state);
Entity write_entity;
write_entity.ID(8567234);
EntityState write_state;
- write_state.chunk_pos = { 7, 2, -3 };
- write_state.block_pos = { 1.5f, 0.9f, 12.0f };
+ write_state.pos = { { 7, 2, -3 }, { 1.5f, 0.9f, 12.0f } };
write_state.velocity = { 0.025f, 0.001f, 0.0f };
- write_state.orient = { 1.0f, 0.0f, 0.0f, 0.0f };
write_state.pitch = 0.3f;
write_state.yaw = -2.3f;
write_entity.SetState(write_state);
Entity write_entity;
EntityState write_state;
- write_state.chunk_pos = { 7, 2, -3 };
- write_state.block_pos = { 1.5f, 0.9f, 12.0f };
+ write_state.pos = { { 7, 2, -3 }, { 1.5f, 0.9f, 12.0f } };
write_state.velocity = { 0.025f, 0.001f, 0.0f };
- write_state.orient = { 1.0f, 0.0f, 0.0f, 0.0f };
write_state.pitch = 0.3f;
write_state.yaw = -2.3f;
write_entity.SetState(write_state);
) {
AssertEqual(
message + ": bad chunk position",
- expected.chunk_pos, actual.chunk_pos
+ expected.pos.chunk, actual.pos.chunk
);
AssertEqual(
message + ": bad block position",
- expected.block_pos, actual.block_pos, 16.0f/65535.0f // that's about the max accuracy that packing's going to give us
+ expected.pos.block, actual.pos.block, 16.0f/65535.0f // that's about the max accuracy that packing's going to give us
);
AssertEqual(
message + ": bad velocity",
) {
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
message + " (W component)",
- expected.w, actual.w, numeric_limits<float>::epsilon()
+ expected.w, actual.w, (1.0f / 32767.0f)
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
message + " (X component)",
- expected.x, actual.x, numeric_limits<float>::epsilon()
+ expected.x, actual.x, (1.0f / 32767.0f)
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
message + " (Y component)",
- expected.y, actual.y, numeric_limits<float>::epsilon()
+ expected.y, actual.y, (1.0f / 32767.0f)
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
message + " (Z component)",
- expected.z, actual.z, numeric_limits<float>::epsilon()
+ expected.z, actual.z, (1.0f / 32767.0f)
);
}