• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Transformable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Transformable的典型用法代码示例。如果您正苦于以下问题:C++ Transformable类的具体用法?C++ Transformable怎么用?C++ Transformable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Transformable类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TEST

TEST(Transformable_objects, have_a_left_and_right_direction_along_the_x_axis)
{
	Transformable t;	

	EXPECT_EQ( Transformable::X_AXIS, t.left());
	EXPECT_EQ(-Transformable::X_AXIS, t.right());
}
开发者ID:meuter,项目名称:tiny,代码行数:7,代码来源:transformable_tests.cpp


示例2: unserialize

unsigned long Serialization::unserialize(const std::vector<char> &buf, Transformable &tr_data, unsigned long start_loc)
{
	// delete all existing items
	tr_data.clear();
	unsigned long names_arg_sz;
	unsigned long n_rec;
	unsigned long bytes_read;
	size_t i_start = 0;
	// get size of names record
	i_start = start_loc;
	w_memcpy_s(&names_arg_sz, sizeof(names_arg_sz), buf.data()+i_start, sizeof(names_arg_sz));
	i_start += sizeof(names_arg_sz);
	unique_ptr<char[]> names_buf(new char[names_arg_sz]);
	w_memcpy_s(names_buf.get(), sizeof(char)*names_arg_sz,  buf.data()+i_start, sizeof(char)*names_arg_sz);
	i_start += sizeof(char)*names_arg_sz;
	w_memcpy_s(&n_rec, sizeof(n_rec),  buf.data()+i_start, sizeof(n_rec));
	i_start += sizeof(n_rec);
	// build transformable data set
	double *value_ptr = (double *) ( buf.data()+i_start);
	vector<string> names_vec;
	tokenize(strip_cp(string(names_buf.get(), names_arg_sz)), names_vec);
	assert(names_vec.size() == n_rec);
	for (unsigned long i=0; i< n_rec; ++i)
	{
		tr_data.insert(names_vec[i], *(value_ptr+i));
	}
	bytes_read = i_start + n_rec * sizeof(double);
	return bytes_read;
}
开发者ID:odellus,项目名称:pestpp,代码行数:29,代码来源:Serializeation.cpp


示例3: rayGridIntersections

CollisionEvent CollisionGrid::cast(const ray& r, CollisionObject* ignore) {
	CollisionEvent e;
	e.intersected = false;
	std::list<vec2> grid_list;
	rayGridIntersections(r, grid_list);
	for(std::list<vec2>::iterator g = grid_list.begin(); g != grid_list.end(); g++) {
		int len = grid_list.size();
		int x = (*g)[0];
		int y = (*g)[1];
		if(x < 0) continue;
		if(x >= size_x) continue;
		if(y < 0) continue;
		if(y >= size_y) continue;

		std::list<CollisionObject*>& lst = grid[x+y*size_x];
		for(std::list<CollisionObject*>::iterator obj = lst.begin(); obj != lst.end(); obj++) {
			if(ignore == (*obj)) continue;
			Transformable* t = (Transformable*)((*obj)->script)->getLink(LINK_TRANSFORMABLE);
			vec3 p = t->getPosition();
			float radius = (*obj)->radius;
			vec2 closestP;
			float distance;
			if(!rayCircleIntersection(r, vec2(p[0], p[2]), radius, closestP, distance)) {
				continue;
			} else {
				e.distance = distance;
				e.intersected = true;
				e.obj_script = (*obj)->script;
				e.obj_type = (*obj)->type;
				return e;
			}
		}
	}
	return e;
}
开发者ID:AlexanderDzhoganov,项目名称:RIGE--RIGE-Is-A-Games-Engine-,代码行数:35,代码来源:collision_lib.cpp


示例4:

Transformable
ServerFont::EmbeddedTransformation() const
{
	// TODO: cache this?
	Transformable transform;

	transform.ShearBy(B_ORIGIN, (90.0 - fShear) * M_PI / 180.0, 0.0);
	transform.RotateBy(B_ORIGIN, -fRotation * M_PI / 180.0);

	return transform;
}
开发者ID:,项目名称:,代码行数:11,代码来源:


示例5: reverse

void TranScale::reverse(Transformable &data)
{
	Transformable::iterator data_iter, data_end = data.end();
	for (map<string,double>::const_iterator b=items.begin(), e=items.end();
		b!=e; ++b) {
		data_iter = data.find(b->first);
		if (data_iter != data_end)
		{
			(*data_iter).second /= b->second;
		}
	}
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例6: forward

///////////////// TranOffset Methods /////////////////
void TranOffset::forward(Transformable &data)
{
	Transformable::iterator data_iter, data_end = data.end();
	for (map<string,double>::const_iterator b=items.begin(), e=items.end();
		b!=e; ++b) {
		data_iter = data.find(b->first);
		if (data_iter != data_end)
		{
			(*data_iter).second += (*b).second;
		}
	}
}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例7: pow

void TranLog10::reverse(Transformable &data)
{
	Transformable::iterator data_iter, data_end = data.end();
	for (set<string>::const_iterator b=items.begin(), e=items.end(); b!=e; ++b)
	{
		data_iter = data.find(*b);
		if (data_iter != data_end)
		{
			(*data_iter).second = pow(10.0, (*data_iter).second);
		}
	}
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例8:

// BoundingBox
BRect
Painter::BoundingBox(const char* utf8String, uint32 length,
					 const BPoint& baseLine) const
{
	Transformable transform;
	transform.TranslateBy(baseLine);

	BRect dummy;
	return fTextRenderer->RenderString(utf8String,
									length,
									fFontRendererSolid,
									fFontRendererBin,
									transform, dummy, true);
}
开发者ID:mmanley,项目名称:Antares,代码行数:15,代码来源:Painter.cpp


示例9:

void
VectorPath::ApplyTransform(const Transformable& transform)
{
	if (transform.IsIdentity())
		return;

	for (int32 i = 0; i < fPointCount; i++) {
		transform.Transform(&(fPath[i].point));
		transform.Transform(&(fPath[i].point_out));
		transform.Transform(&(fPath[i].point_in));
	}

	_NotifyPathChanged();
}
开发者ID:mmanley,项目名称:Antares,代码行数:14,代码来源:VectorPath.cpp


示例10: add

void CollisionGrid::add(Script* script, int type, float radius) {
	Transformable* t = (Transformable*)script->getLink(LINK_TRANSFORMABLE);
	if(!t) return;

	vec3 pos = t->getPosition();
	int x = pos[0], y = pos[2];
	CollisionObject* obj = new CollisionObject;
	obj->script = script;
	obj->type = type;
	obj->radius = radius;
	objects.push_back(obj);
	script->setCollisionObject(obj);
	update(0.f);
}
开发者ID:AlexanderDzhoganov,项目名称:RIGE--RIGE-Is-A-Games-Engine-,代码行数:14,代码来源:collision_lib.cpp


示例11: update

void CollisionGrid::update(float frameDelta) {
//if(!grid) return;

	for(boost::unordered_map<int, std::list<CollisionObject*> >::iterator lst = grid.begin(); lst != grid.end(); lst++) {
		lst->second.clear();
	}

//	memset(walk_grid, 0, sizeof(bool)*size_x*size_y);

	for(std::list<CollisionObject*>::iterator obj = objects.begin(); obj != objects.end(); obj++) {
		Transformable* t = (Transformable*)((*obj)->script->getLink(LINK_TRANSFORMABLE));
		vec3 p = t->getPosition();
		float r = (*obj)->radius;
		int x = p[0], y = p[2];
		walk_grid[x+y*size_x] = 1;
		grid[x+y*size_x].push_back(*obj);
	}
}
开发者ID:AlexanderDzhoganov,项目名称:RIGE--RIGE-Is-A-Games-Engine-,代码行数:18,代码来源:collision_lib.cpp



注:本文中的Transformable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Transformation类代码示例发布时间:2022-05-31
下一篇:
C++ TransformUnrecPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap