当前位置: 首页>>代码示例>>C++>>正文


C++ DVector::get方法代码示例

本文整理汇总了C++中DVector::get方法的典型用法代码示例。如果您正苦于以下问题:C++ DVector::get方法的具体用法?C++ DVector::get怎么用?C++ DVector::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DVector的用法示例。


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

示例1: set_vertexarray_to_dvectors

void set_vertexarray_to_dvectors(sf::VertexArray &va, DVector &xs, DVector &ys) {
	unsigned int i;
	vector<double>::const_iterator xit, yit;

	for (i = 0, xit = xs.get().begin(), yit = ys.get().begin();
		 i < va.getVertexCount() && xit != xs.get().end() && yit != ys.get().end();
		 i++, xit++, yit++) {
		va[i].position = sf::Vector2f(*xit, *yit);
	}
}
开发者ID:vwood,项目名称:7drl-2013,代码行数:10,代码来源:test_main.cpp

示例2: memnew

Ref<Shape> Mesh::create_trimesh_shape() const {

	DVector<Face3> faces = get_faces();
	if (faces.size()==0)
		return Ref<Shape>();

	DVector<Vector3> face_points;
	face_points.resize( faces.size()*3 );

	for (int i=0;i<face_points.size();i++) {

		Face3 f = faces.get( i/3 );
		face_points.set(i, f.vertex[i%3] );
	}

	Ref<ConcavePolygonShape> shape = memnew( ConcavePolygonShape );
	shape->set_faces(face_points);
	return shape;
}
开发者ID:NosicLin,项目名称:godot,代码行数:19,代码来源:mesh.cpp

示例3: _handle_udp

/***
 * Manage UDP packets
 */
void NetGameServer::_handle_udp() {
	DVector<uint8_t> raw;
	NetGameServerConnection *cd;

	// Flush packets queue
	while(udp_queue.size() > 0) {
		// Only this thread removes from the queue
		// it is safe to lock here
		udp_mutex->lock();
		QueuedPacket *qp = udp_queue.get(0);
		udp_queue.remove(0);
		udp_mutex->unlock();

		NetGameServerConnection *cd = _get_client(qp->id);
		if(cd != NULL) {
			udp_server->set_send_address(cd->udp_host,
							cd->udp_port);
			udp_server->put_packet_buffer(cd->build_pkt(qp));
		}
		memdelete(qp);
	}

	// Handle incoming packets
	if(udp_server->get_available_packet_count() > 0) {
		udp_server->get_packet_buffer(raw);

		if(raw.size() < 1) {
			WARN_PRINT("Invalid UDP Packet!");
			return;
		}

		cd = _get_client(raw.get(0));
		if(cd == NULL) {
			WARN_PRINT("Invalid UDP Auth!");
			return;
		}

		cd->handle_udp(raw,
				udp_server->get_packet_address(),
				udp_server->get_packet_port());
	}
}
开发者ID:Faless,项目名称:netgame-godot,代码行数:45,代码来源:net_game_server.cpp

示例4: _fix_node

Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>,Ref<Shape> > &collision_map,uint32_t p_flags,Set<Ref<ImageTexture> >& image_map) {

	// children first..
	for(int i=0;i<p_node->get_child_count();i++) {


		Node *r = _fix_node(p_node->get_child(i),p_root,collision_map,p_flags,image_map);
		if (!r) {
			print_line("was erased..");
			i--; //was erased
		}
	}

	String name = p_node->get_name();

	bool isroot = p_node==p_root;


	if (!isroot && p_flags&SCENE_FLAG_REMOVE_NOIMP && _teststr(name,"noimp")) {

		memdelete(p_node);
		return NULL;
	}

	{

		List<PropertyInfo> pl;
		p_node->get_property_list(&pl);
		for(List<PropertyInfo>::Element *E=pl.front();E;E=E->next()) {

			if (E->get().type==Variant::OBJECT || E->get().type==Variant::ARRAY || E->get().type==Variant::DICTIONARY) {
				_find_resources(p_node->get(E->get().name),image_map);
			}
		}

	}




	if (p_flags&SCENE_FLAG_CREATE_BILLBOARDS && p_node->cast_to<MeshInstance>()) {

		MeshInstance *mi = p_node->cast_to<MeshInstance>();

		bool bb=false;

		if ((_teststr(name,"bb"))) {
			bb=true;
		} else if (mi->get_mesh().is_valid() && (_teststr(mi->get_mesh()->get_name(),"bb"))) {
			bb=true;

		}

		if (bb) {
			mi->set_flag(GeometryInstance::FLAG_BILLBOARD,true);
			if (mi->get_mesh().is_valid()) {

				Ref<Mesh> m = mi->get_mesh();
				for(int i=0;i<m->get_surface_count();i++) {

					Ref<FixedMaterial> fm = m->surface_get_material(i);
					if (fm.is_valid()) {
						fm->set_flag(Material::FLAG_UNSHADED,true);
						fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
						fm->set_hint(Material::HINT_NO_DEPTH_DRAW,true);
						fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
					}
				}
			}
		}
	}

	if (p_flags&SCENE_FLAG_REMOVE_NOIMP && p_node->cast_to<AnimationPlayer>()) {
		//remove animations referencing non-importable nodes
		AnimationPlayer *ap = p_node->cast_to<AnimationPlayer>();

		List<StringName> anims;
		ap->get_animation_list(&anims);
		for(List<StringName>::Element *E=anims.front();E;E=E->next()) {

			Ref<Animation> anim=ap->get_animation(E->get());
			ERR_CONTINUE(anim.is_null());
			for(int i=0;i<anim->get_track_count();i++) {
				NodePath path = anim->track_get_path(i);

				for(int j=0;j<path.get_name_count();j++) {
					String node = path.get_name(j);
					if (_teststr(node,"noimp")) {
						anim->remove_track(i);
						i--;
						break;
					}
				}
			}

		}
	}


	if (p_flags&SCENE_FLAG_CREATE_IMPOSTORS && p_node->cast_to<MeshInstance>()) {
//.........这里部分代码省略.........
开发者ID:9cat,项目名称:godot,代码行数:101,代码来源:editor_scene_import_plugin.cpp


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