Пример #1
0
TEST(Transformable_objects, can_be_scaled)
{
	Transformable t;

	EXPECT_EQ(vec3(1,1,1), t.scaling());
	t.scaleTo(vec3(2,3,4));
	EXPECT_EQ(vec3(2,3,4), t.scaling());
	t.scaleTo(-2,-5,-9);
	EXPECT_EQ(vec3(-2,-5,-9), t.scaling());
	t.scaleTo(2,3,4);
	t.scale(4,2,3);
	EXPECT_EQ(vec3(8,6,12), t.scaling());
	t.scale(vec3(1.0f/4.0f, 1.0f/2.0f, 1.0f/3.0f));
	EXPECT_EQ(vec3(2,3,4), t.scaling());
}
Пример #2
0
bool CMD_scale(
		u32		n_args,
		char	**args
	)
{
	Transformable *t;
	f32 f[3];

	if (!Command::checkArgCount(4, n_args, args))
		return false;

	if (!(t = fetchTransformable(args[0])))
		return false;

	if (!parseFloats(3, f, &args[1]))
		return false;

	t->scale(f[0], f[1], f[2]);

	return true;
}