Added missing SurfaceMaterial::copy

This commit is contained in:
Michaël Lemaire 2015-10-15 20:28:05 +02:00
parent 2b3ecc7e35
commit cafa9b4c74
3 changed files with 15 additions and 5 deletions

View file

@ -52,6 +52,16 @@ void SurfaceMaterial::load(PackStream* stream)
stream->read(&receive_shadows); stream->read(&receive_shadows);
} }
void SurfaceMaterial::copy(SurfaceMaterial *destination) const
{
*destination->base = *base;
destination->hardness = hardness;
destination->reflection = reflection;
destination->shininess = shininess;
destination->receive_shadows = receive_shadows;
destination->validate();
}
void SurfaceMaterial::validate() void SurfaceMaterial::validate()
{ {
} }

View file

@ -17,7 +17,7 @@ public:
void save(PackStream* stream) const; void save(PackStream* stream) const;
void load(PackStream* stream); void load(PackStream* stream);
void copy(SurfaceMaterial *destination) const;
void validate(); void validate();
public: public:

View file

@ -21,7 +21,7 @@ TEST(SpaceSegment, iterateOnGrid)
SpaceSegment segment(Vector3(0.5, 1.5, 0.0), Vector3(2.5, 0.5, 0.0)); SpaceSegment segment(Vector3(0.5, 1.5, 0.0), Vector3(2.5, 0.5, 0.0));
segment.iterateOnGrid(it); segment.iterateOnGrid(it);
ASSERT_EQ(4, it.locations.size()); ASSERT_EQ(4, (int)it.locations.size());
EXPECT_VECTOR3_COORDS(it.locations[0], 0.0, 1.0, 0.0); EXPECT_VECTOR3_COORDS(it.locations[0], 0.0, 1.0, 0.0);
EXPECT_VECTOR3_COORDS(it.locations[1], 1.0, 1.0, 0.0); EXPECT_VECTOR3_COORDS(it.locations[1], 1.0, 1.0, 0.0);
EXPECT_VECTOR3_COORDS(it.locations[2], 1.0, 0.0, 0.0); EXPECT_VECTOR3_COORDS(it.locations[2], 1.0, 0.0, 0.0);
@ -34,7 +34,7 @@ TEST(SpaceSegment, iterateOnGrid_Corner)
SpaceSegment segment(Vector3(0.5, 0.5, 0.5), Vector3(2.5, 2.5, 2.5)); SpaceSegment segment(Vector3(0.5, 0.5, 0.5), Vector3(2.5, 2.5, 2.5));
segment.iterateOnGrid(it); segment.iterateOnGrid(it);
ASSERT_EQ(7, it.locations.size()); ASSERT_EQ(7, (int)it.locations.size());
EXPECT_VECTOR3_COORDS(it.locations[0], 0.0, 0.0, 0.0); EXPECT_VECTOR3_COORDS(it.locations[0], 0.0, 0.0, 0.0);
EXPECT_VECTOR3_COORDS(it.locations[3], 1.0, 1.0, 1.0); EXPECT_VECTOR3_COORDS(it.locations[3], 1.0, 1.0, 1.0);
EXPECT_VECTOR3_COORDS(it.locations[6], 2.0, 2.0, 2.0); EXPECT_VECTOR3_COORDS(it.locations[6], 2.0, 2.0, 2.0);
@ -46,7 +46,7 @@ TEST(SpaceSegment, iterateOnGrid_OneCell)
SpaceSegment segment(Vector3(8.1, 8.2, 8.9), Vector3(8.9, 8.3, 8.6)); SpaceSegment segment(Vector3(8.1, 8.2, 8.9), Vector3(8.9, 8.3, 8.6));
segment.iterateOnGrid(it); segment.iterateOnGrid(it);
ASSERT_EQ(1, it.locations.size()); ASSERT_EQ(1, (int)it.locations.size());
EXPECT_VECTOR3_COORDS(it.locations[0], 8.0, 8.0, 8.0); EXPECT_VECTOR3_COORDS(it.locations[0], 8.0, 8.0, 8.0);
} }
@ -56,6 +56,6 @@ TEST(SpaceSegment, iterateOnGrid_Negative)
SpaceSegment segment(Vector3(-8.1, -8.2, -8.9), Vector3(-8.9, -8.3, -8.6)); SpaceSegment segment(Vector3(-8.1, -8.2, -8.9), Vector3(-8.9, -8.3, -8.6));
segment.iterateOnGrid(it); segment.iterateOnGrid(it);
ASSERT_EQ(1, it.locations.size()); ASSERT_EQ(1, (int)it.locations.size());
EXPECT_VECTOR3_COORDS(it.locations[0], -9.0, -9.0, -9.0); EXPECT_VECTOR3_COORDS(it.locations[0], -9.0, -9.0, -9.0);
} }