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


C++ PoolVector::push_back方法代码示例

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


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

示例1:

PoolVector<Plane> Geometry::build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis) {

	PoolVector<Plane> planes;

	Vector3 axis;
	axis[p_axis] = 1.0;

	Vector3 axis_neg;
	axis_neg[(p_axis + 1) % 3] = 1.0;
	axis_neg[(p_axis + 2) % 3] = 1.0;
	axis_neg[p_axis] = -1.0;

	for (int i = 0; i < p_sides; i++) {

		Vector3 normal;
		normal[(p_axis + 1) % 3] = Math::cos(i * (2.0 * Math_PI) / p_sides);
		normal[(p_axis + 2) % 3] = Math::sin(i * (2.0 * Math_PI) / p_sides);

		planes.push_back(Plane(normal, p_radius));

		for (int j = 1; j <= p_lats; j++) {

			Vector3 angle = normal.linear_interpolate(axis, j / (real_t)p_lats).normalized();
			Vector3 pos = axis * p_height * 0.5 + angle * p_radius;
			planes.push_back(Plane(pos, angle));
			planes.push_back(Plane(pos * axis_neg, angle * axis_neg));
		}
	}

	return planes;
}
开发者ID:Alex-doc,项目名称:godot,代码行数:31,代码来源:geometry.cpp

示例2: _update_areas_display

void GridMapEditor::_update_areas_display() {
	if (!node) {
		return;
	}

	_clear_areas();
	List<int> areas;
	node->get_area_list(&areas);

	Transform global_xf = node->get_global_transform();

	for(List<int>::Element *E=areas.front();E;E=E->next()) {

		int area = E->get();
		Color color;
		if (node->area_is_exterior_portal(area))
			color=Color(1,1,1,0.2);
		else
			color.set_hsv(Math::fmod(area*0.37,1),Math::fmod(area*0.75,1),1.0,0.2);
		RID material = VisualServer::get_singleton()->fixed_material_create();
		VisualServer::get_singleton()->fixed_material_set_param( material, VS::FIXED_MATERIAL_PARAM_DIFFUSE,color );
		VisualServer::get_singleton()->fixed_material_set_param( material, VS::FIXED_MATERIAL_PARAM_EMISSION,0.5 );
		VisualServer::get_singleton()->fixed_material_set_flag( material, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );


		RID mesh = VisualServer::get_singleton()->mesh_create();

		PoolVector<Plane> planes;
		for(int i=0;i<3;i++) {

			Vector3 axis;
			axis[i]=1.0;
			planes.push_back(Plane(axis,1));
			planes.push_back(Plane(-axis,0));
		}

		VisualServer::get_singleton()->mesh_add_surface_from_planes(mesh,planes);
		VisualServer::get_singleton()->mesh_surface_set_material(mesh,0,material,true);

		AreaDisplay ad;
		ad.mesh=mesh;
		ad.instance = VisualServer::get_singleton()->instance_create2(mesh,node->get_world()->get_scenario());
		Transform xform;
		Rect3 aabb = node->area_get_bounds(area);
		xform.origin=aabb.pos * node->get_cell_size();
		xform.basis.scale(aabb.size * node->get_cell_size());
		VisualServer::get_singleton()->instance_set_transform(ad.instance,global_xf * xform);
		this->areas.push_back(ad);

	}

}
开发者ID:baekdahl,项目名称:godot,代码行数:52,代码来源:grid_map_editor_plugin.cpp

示例3:

PoolVector<int> BitmapFont::_get_kernings() const {

	PoolVector<int> kernings;

	for (Map<KerningPairKey, int>::Element *E = kerning_map.front(); E; E = E->next()) {

		kernings.push_back(E->key().A);
		kernings.push_back(E->key().B);
		kernings.push_back(E->get());
	}

	return kernings;
}
开发者ID:GalanCM,项目名称:godot,代码行数:13,代码来源:font.cpp

示例4: _create_mesh_array

void PlaneMesh::_create_mesh_array(Array &p_arr) const {
	int i, j, prevrow, thisrow, point;
	float x, z;

	Size2 start_pos = size * -0.5;

	PoolVector<Vector3> points;
	PoolVector<Vector3> normals;
	PoolVector<float> tangents;
	PoolVector<Vector2> uvs;
	PoolVector<int> indices;
	point = 0;

#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
	tangents.push_back(m_x);            \
	tangents.push_back(m_y);            \
	tangents.push_back(m_z);            \
	tangents.push_back(m_d);

	/* top + bottom */
	z = start_pos.y;
	thisrow = point;
	prevrow = 0;
	for (j = 0; j <= (subdivide_d + 1); j++) {
		x = start_pos.x;
		for (i = 0; i <= (subdivide_w + 1); i++) {
			float u = i;
			float v = j;
			u /= (subdivide_w + 1.0);
			v /= (subdivide_d + 1.0);

			points.push_back(Vector3(-x, 0.0, -z));
			normals.push_back(Vector3(0.0, 1.0, 0.0));
			ADD_TANGENT(1.0, 0.0, 0.0, -1.0);
			uvs.push_back(Vector2(u, v));
			point++;

			if (i > 0 && j > 0) {
				indices.push_back(prevrow + i - 1);
				indices.push_back(prevrow + i);
				indices.push_back(thisrow + i - 1);
				indices.push_back(prevrow + i);
				indices.push_back(thisrow + i);
				indices.push_back(thisrow + i - 1);
			};

			x += size.x / (subdivide_w + 1.0);
		};

		z += size.y / (subdivide_d + 1.0);
		prevrow = thisrow;
		thisrow = point;
	};

	p_arr[VS::ARRAY_VERTEX] = points;
	p_arr[VS::ARRAY_NORMAL] = normals;
	p_arr[VS::ARRAY_TANGENT] = tangents;
	p_arr[VS::ARRAY_TEX_UV] = uvs;
	p_arr[VS::ARRAY_INDEX] = indices;
}
开发者ID:brakhane,项目名称:godot,代码行数:60,代码来源:primitive_meshes.cpp

示例5:

PoolVector<Face3> Portal::get_faces(uint32_t p_usage_flags) const {

	if (!(p_usage_flags & FACES_ENCLOSING))
		return PoolVector<Face3>();

	Vector<Point2> shape = get_shape();
	if (shape.size() == 0)
		return PoolVector<Face3>();

	Vector2 center;
	for (int i = 0; i < shape.size(); i++) {

		center += shape[i];
	}

	PoolVector<Face3> ret;
	center /= shape.size();

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

		int n = (i + 1) % shape.size();

		Face3 f;
		f.vertex[0] = Vector3(center.x, center.y, 0);
		f.vertex[1] = Vector3(shape[i].x, shape[i].y, 0);
		f.vertex[2] = Vector3(shape[n].x, shape[n].y, 0);
		ret.push_back(f);
	}

	return ret;
}
开发者ID:KellyThomas,项目名称:godot,代码行数:31,代码来源:portal.cpp

示例6:

PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {

	ERR_FAIL_COND_V(!points.has(p_from_id),PoolVector<Vector3>());
	ERR_FAIL_COND_V(!points.has(p_to_id),PoolVector<Vector3>());


	pass++;

	Point* a = points[p_from_id];
	Point* b = points[p_to_id];

	if (a==b) {
		PoolVector<Vector3> ret;
		ret.push_back(a->pos);
		return ret;
	}


	Point *begin_point=a;
	Point *end_point=b;

	bool found_route=_solve(begin_point,end_point);

	if (!found_route)
		return PoolVector<Vector3>();

	//midpoints
	Point *p=end_point;
	int pc=1; //begin point
	while(p!=begin_point) {
		pc++;
		p=p->prev_point;
	}

	PoolVector<Vector3> path;
	path.resize(pc);

	{
		PoolVector<Vector3>::Write w = path.write();

		Point *p=end_point;
		int idx=pc-1;
		while(p!=begin_point) {
			w[idx--]=p->pos;
			p=p->prev_point;
		}

		w[0]=p->pos; //assign first

	}

	return path;

}
开发者ID:pkowal1982,项目名称:godot,代码行数:54,代码来源:a_star.cpp

示例7: base


//.........这里部分代码省略.........
	last_mouseover=Vector3(-1,-1,-1);

	selection_mesh = VisualServer::get_singleton()->mesh_create();
	duplicate_mesh = VisualServer::get_singleton()->mesh_create();

	{
		//selection mesh create


		PoolVector<Vector3> lines;
		PoolVector<Vector3> triangles;

		for (int i=0;i<6;i++) {


			Vector3 face_points[4];

			for (int j=0;j<4;j++) {

				float v[3];
				v[0]=1.0;
				v[1]=1-2*((j>>1)&1);
				v[2]=v[1]*(1-2*(j&1));

				for (int k=0;k<3;k++) {

					if (i<3)
						face_points[j][(i+k)%3]=v[k]*(i>=3?-1:1);
					else
						face_points[3-j][(i+k)%3]=v[k]*(i>=3?-1:1);
				}
			}

			triangles.push_back(face_points[0]*0.5+Vector3(0.5,0.5,0.5));
			triangles.push_back(face_points[1]*0.5+Vector3(0.5,0.5,0.5));
			triangles.push_back(face_points[2]*0.5+Vector3(0.5,0.5,0.5));

			triangles.push_back(face_points[2]*0.5+Vector3(0.5,0.5,0.5));
			triangles.push_back(face_points[3]*0.5+Vector3(0.5,0.5,0.5));
			triangles.push_back(face_points[0]*0.5+Vector3(0.5,0.5,0.5));
		}

		for(int i=0;i<12;i++) {

			Rect3 base(Vector3(0,0,0),Vector3(1,1,1));
			Vector3 a,b;
			base.get_edge(i,a,b);
			lines.push_back(a);
			lines.push_back(b);
		}

		Array d;
		d.resize(VS::ARRAY_MAX);

		inner_mat = VisualServer::get_singleton()->fixed_material_create();
		VisualServer::get_singleton()->fixed_material_set_param(inner_mat,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0.7,0.7,1.0,0.3));
		VisualServer::get_singleton()->material_set_flag(inner_mat,VS::MATERIAL_FLAG_ONTOP,true);
		VisualServer::get_singleton()->material_set_flag(inner_mat,VS::MATERIAL_FLAG_UNSHADED,true);
		VisualServer::get_singleton()->fixed_material_set_flag( inner_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );


		d[VS::ARRAY_VERTEX]=triangles;
		VisualServer::get_singleton()->mesh_add_surface(selection_mesh,VS::PRIMITIVE_TRIANGLES,d);
		VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh,0,inner_mat);

		outer_mat = VisualServer::get_singleton()->fixed_material_create();
开发者ID:baekdahl,项目名称:godot,代码行数:67,代码来源:grid_map_editor_plugin.cpp

示例8: _jobject_to_variant

Variant _jobject_to_variant(JNIEnv *env, jobject obj) {

	if (obj == NULL) {
		return Variant();
	}

	jclass c = env->GetObjectClass(obj);
	bool array;
	String name = _get_class_name(env, c, &array);
	//print_line("name is " + name + ", array "+Variant(array));

	print_line("ARGNAME: " + name);
	if (name == "java.lang.String") {

		return String::utf8(env->GetStringUTFChars((jstring)obj, NULL));
	};

	if (name == "[Ljava.lang.String;") {

		jobjectArray arr = (jobjectArray)obj;
		int stringCount = env->GetArrayLength(arr);
		//print_line("String array! " + String::num(stringCount));
		PoolVector<String> sarr;

		for (int i = 0; i < stringCount; i++) {
			jstring string = (jstring)env->GetObjectArrayElement(arr, i);
			sarr.push_back(String::utf8(env->GetStringUTFChars(string, NULL)));
			env->DeleteLocalRef(string);
		}

		return sarr;
	};

	if (name == "java.lang.Boolean") {

		jmethodID boolValue = env->GetMethodID(c, "booleanValue", "()Z");
		bool ret = env->CallBooleanMethod(obj, boolValue);
		return ret;
	};

	if (name == "java.lang.Integer") {

		jclass nclass = env->FindClass("java/lang/Number");
		jmethodID intValue = env->GetMethodID(nclass, "intValue", "()I");
		int ret = env->CallIntMethod(obj, intValue);
		return ret;
	};

	if (name == "[I") {

		jintArray arr = (jintArray)obj;
		int fCount = env->GetArrayLength(arr);
		PoolVector<int> sarr;
		sarr.resize(fCount);

		PoolVector<int>::Write w = sarr.write();
		env->GetIntArrayRegion(arr, 0, fCount, w.ptr());
		w = PoolVector<int>::Write();
		return sarr;
	};

	if (name == "[B") {

		jbyteArray arr = (jbyteArray)obj;
		int fCount = env->GetArrayLength(arr);
		PoolVector<uint8_t> sarr;
		sarr.resize(fCount);

		PoolVector<uint8_t>::Write w = sarr.write();
		env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr()));
		w = PoolVector<uint8_t>::Write();
		return sarr;
	};

	if (name == "java.lang.Float" || name == "java.lang.Double") {

		jclass nclass = env->FindClass("java/lang/Number");
		jmethodID doubleValue = env->GetMethodID(nclass, "doubleValue", "()D");
		double ret = env->CallDoubleMethod(obj, doubleValue);
		return ret;
	};

	if (name == "[D") {

		jdoubleArray arr = (jdoubleArray)obj;
		int fCount = env->GetArrayLength(arr);
		PoolRealArray sarr;
		sarr.resize(fCount);

		PoolRealArray::Write w = sarr.write();

		for (int i = 0; i < fCount; i++) {

			double n;
			env->GetDoubleArrayRegion(arr, i, 1, &n);
			w.ptr()[i] = n;
		};
		return sarr;
	};

//.........这里部分代码省略.........
开发者ID:suptoasty,项目名称:godot,代码行数:101,代码来源:java_glue.cpp

示例9: _get

bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const {

	if (_is_generated())
		return false;

	String sname = p_name;

	if (p_name == "blend_shape/names") {

		PoolVector<String> sk;
		for (int i = 0; i < blend_shapes.size(); i++)
			sk.push_back(blend_shapes[i]);
		r_ret = sk;
		return true;
	} else if (p_name == "blend_shape/mode") {

		r_ret = get_blend_shape_mode();
		return true;
	} else if (sname.begins_with("surface_")) {

		int sl = sname.find("/");
		if (sl == -1)
			return false;
		int idx = sname.substr(8, sl - 8).to_int() - 1;
		String what = sname.get_slicec('/', 1);
		if (what == "material")
			r_ret = surface_get_material(idx);
		else if (what == "name")
			r_ret = surface_get_name(idx);
		return true;
	} else if (!sname.begins_with("surfaces"))
		return false;

	int idx = sname.get_slicec('/', 1).to_int();
	ERR_FAIL_INDEX_V(idx, surfaces.size(), false);

	Dictionary d;

	d["array_data"] = VS::get_singleton()->mesh_surface_get_array(mesh, idx);
	d["vertex_count"] = VS::get_singleton()->mesh_surface_get_array_len(mesh, idx);
	d["array_index_data"] = VS::get_singleton()->mesh_surface_get_index_array(mesh, idx);
	d["index_count"] = VS::get_singleton()->mesh_surface_get_array_index_len(mesh, idx);
	d["primitive"] = VS::get_singleton()->mesh_surface_get_primitive_type(mesh, idx);
	d["format"] = VS::get_singleton()->mesh_surface_get_format(mesh, idx);
	d["aabb"] = VS::get_singleton()->mesh_surface_get_aabb(mesh, idx);

	Vector<AABB> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx);
	Array arr;
	for (int i = 0; i < skel_aabb.size(); i++) {
		arr[i] = skel_aabb[i];
	}
	d["skeleton_aabb"] = arr;

	Vector<PoolVector<uint8_t> > blend_shape_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh, idx);

	Array md;
	for (int i = 0; i < blend_shape_data.size(); i++) {
		md.push_back(blend_shape_data[i]);
	}

	d["blend_shape_data"] = md;

	Ref<Material> m = surface_get_material(idx);
	if (m.is_valid())
		d["material"] = m;
	String n = surface_get_name(idx);
	if (n != "")
		d["name"] = n;

	r_ret = d;

	return true;
}
开发者ID:luchete80,项目名称:GodotGUI,代码行数:73,代码来源:mesh.cpp

示例10: godot_pool_byte_array_push_back

void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data) {
	PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
	self->push_back(p_data);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:4,代码来源:pool_arrays.cpp

示例11: godot_pool_color_array_push_back

void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data) {
	PoolVector<Color> *self = (PoolVector<Color> *)p_self;
	Color &s = *(Color *)p_data;
	self->push_back(s);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:5,代码来源:pool_arrays.cpp

示例12: image_compress_cvtt


//.........这里部分代码省略.........

		const uint16_t *source_data = reinterpret_cast<const uint16_t *>(&rb[0]);
		int pixel_element_count = w * h * 3;
		for (int i = 0; i < pixel_element_count; i++) {
			if ((source_data[i] & 0x8000) != 0 && (source_data[i] & 0x7fff) != 0) {
				is_signed = true;
				break;
			}
		}

		target_format = is_signed ? Image::FORMAT_BPTC_RGBF : Image::FORMAT_BPTC_RGBFU;
	} else {
		p_image->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert
	}

	PoolVector<uint8_t>::Read rb = p_image->get_data().read();

	PoolVector<uint8_t> data;
	int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps());
	int mm_count = p_image->has_mipmaps() ? Image::get_image_required_mipmaps(w, h, target_format) : 0;
	data.resize(target_size);
	int shift = Image::get_format_pixel_rshift(target_format);

	PoolVector<uint8_t>::Write wb = data.write();

	int dst_ofs = 0;

	CVTTCompressionJobQueue job_queue;
	job_queue.job_params.is_hdr = is_hdr;
	job_queue.job_params.is_signed = is_signed;
	job_queue.job_params.options = options;
	job_queue.job_params.bytes_per_pixel = is_hdr ? 6 : 4;

#ifdef NO_THREADS
	int num_job_threads = 0;
#else
	int num_job_threads = OS::get_singleton()->can_use_threads() ? (OS::get_singleton()->get_processor_count() - 1) : 0;
#endif

	PoolVector<CVTTCompressionRowTask> tasks;

	for (int i = 0; i <= mm_count; i++) {

		int bw = w % 4 != 0 ? w + (4 - w % 4) : w;
		int bh = h % 4 != 0 ? h + (4 - h % 4) : h;

		int src_ofs = p_image->get_mipmap_offset(i);

		const uint8_t *in_bytes = &rb[src_ofs];
		uint8_t *out_bytes = &wb[dst_ofs];

		for (int y_start = 0; y_start < h; y_start += 4) {
			int y_end = y_start + 4;

			CVTTCompressionRowTask row_task;
			row_task.width = w;
			row_task.height = h;
			row_task.y_start = y_start;
			row_task.in_mm_bytes = in_bytes;
			row_task.out_mm_bytes = out_bytes;

			if (num_job_threads > 0) {
				tasks.push_back(row_task);
			} else {
				_digest_row_task(job_queue.job_params, row_task);
			}

			out_bytes += 16 * (bw / 4);
		}

		dst_ofs += (MAX(4, bw) * MAX(4, bh)) >> shift;
		w = MAX(w / 2, 1);
		h = MAX(h / 2, 1);
	}

	if (num_job_threads > 0) {
		PoolVector<Thread *> threads;
		threads.resize(num_job_threads);

		PoolVector<Thread *>::Write threads_wb = threads.write();

		PoolVector<CVTTCompressionRowTask>::Read tasks_rb = tasks.read();

		job_queue.job_tasks = &tasks_rb[0];
		job_queue.current_task = 0;
		job_queue.num_tasks = static_cast<uint32_t>(tasks.size());

		for (int i = 0; i < num_job_threads; i++) {
			threads_wb[i] = Thread::create(_digest_job_queue, &job_queue);
		}
		_digest_job_queue(&job_queue);

		for (int i = 0; i < num_job_threads; i++) {
			Thread::wait_to_finish(threads_wb[i]);
			memdelete(threads_wb[i]);
		}
	}

	p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}
开发者ID:DSeanLaw,项目名称:godot,代码行数:101,代码来源:image_compress_cvtt.cpp

示例13: godot_pool_string_array_push_back

void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data) {
	PoolVector<String> *self = (PoolVector<String> *)p_self;
	String &s = *(String *)p_data;
	self->push_back(s);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:5,代码来源:pool_arrays.cpp

示例14: _action_pressed

void EditorFileDialog::_action_pressed() {

	if (mode == MODE_OPEN_FILES) {

		String fbase = dir_access->get_current_dir();

		PoolVector<String> files;
		for (int i = 0; i < item_list->get_item_count(); i++) {
			if (item_list->is_selected(i))
				files.push_back(fbase.plus_file(item_list->get_item_text(i)));
		}

		if (files.size()) {
			_save_to_recent();
			emit_signal("files_selected", files);
			hide();
		}

		return;
	}

	String f = dir_access->get_current_dir().plus_file(file->get_text());

	if ((mode == MODE_OPEN_ANY || mode == MODE_OPEN_FILE) && dir_access->file_exists(f)) {
		_save_to_recent();
		emit_signal("file_selected", f);
		hide();
	} else if (mode == MODE_OPEN_ANY || mode == MODE_OPEN_DIR) {

		String path = dir_access->get_current_dir();

		path = path.replace("\\", "/");

		for (int i = 0; i < item_list->get_item_count(); i++) {
			if (item_list->is_selected(i)) {
				Dictionary d = item_list->get_item_metadata(i);
				if (d["dir"]) {
					path = path.plus_file(d["name"]);

					break;
				}
			}
		}

		_save_to_recent();
		emit_signal("dir_selected", path);
		hide();
	}

	if (mode == MODE_SAVE_FILE) {

		bool valid = false;

		if (filter->get_selected() == filter->get_item_count() - 1) {
			valid = true; //match none
		} else if (filters.size() > 1 && filter->get_selected() == 0) {
			// match all filters
			for (int i = 0; i < filters.size(); i++) {

				String flt = filters[i].get_slice(";", 0);
				for (int j = 0; j < flt.get_slice_count(","); j++) {

					String str = flt.get_slice(",", j).strip_edges();
					if (f.match(str)) {
						valid = true;
						break;
					}
				}
				if (valid)
					break;
			}
		} else {
			int idx = filter->get_selected();
			if (filters.size() > 1)
				idx--;
			if (idx >= 0 && idx < filters.size()) {

				String flt = filters[idx].get_slice(";", 0);
				int filterSliceCount = flt.get_slice_count(",");
				for (int j = 0; j < filterSliceCount; j++) {

					String str = (flt.get_slice(",", j).strip_edges());
					if (f.match(str)) {
						valid = true;
						break;
					}
				}

				if (!valid && filterSliceCount > 0) {
					String str = (flt.get_slice(",", 0).strip_edges());
					f += str.substr(1, str.length() - 1);
					_request_single_thumbnail(get_current_dir().plus_file(f.get_file()));
					file->set_text(f.get_file());
					valid = true;
				}
			} else {
				valid = true;
			}
		}

//.........这里部分代码省略.........
开发者ID:Zylann,项目名称:godot,代码行数:101,代码来源:editor_file_dialog.cpp

示例15:

void CPUParticles2D::_update_mesh_texture() {

	Size2 tex_size;
	if (texture.is_valid()) {
		tex_size = texture->get_size();
	} else {
		tex_size = Size2(1, 1);
	}
	PoolVector<Vector2> vertices;
	vertices.push_back(-tex_size * 0.5);
	vertices.push_back(-tex_size * 0.5 + Vector2(tex_size.x, 0));
	vertices.push_back(-tex_size * 0.5 + Vector2(tex_size.x, tex_size.y));
	vertices.push_back(-tex_size * 0.5 + Vector2(0, tex_size.y));
	PoolVector<Vector2> uvs;
	uvs.push_back(Vector2(0, 0));
	uvs.push_back(Vector2(1, 0));
	uvs.push_back(Vector2(1, 1));
	uvs.push_back(Vector2(0, 1));
	PoolVector<Color> colors;
	colors.push_back(Color(1, 1, 1, 1));
	colors.push_back(Color(1, 1, 1, 1));
	colors.push_back(Color(1, 1, 1, 1));
	colors.push_back(Color(1, 1, 1, 1));
	PoolVector<int> indices;
	indices.push_back(0);
	indices.push_back(1);
	indices.push_back(2);
	indices.push_back(2);
	indices.push_back(3);
	indices.push_back(0);

	Array arr;
	arr.resize(VS::ARRAY_MAX);
	arr[VS::ARRAY_VERTEX] = vertices;
	arr[VS::ARRAY_TEX_UV] = uvs;
	arr[VS::ARRAY_COLOR] = colors;
	arr[VS::ARRAY_INDEX] = indices;

	VS::get_singleton()->mesh_clear(mesh);
	VS::get_singleton()->mesh_add_surface_from_arrays(mesh, VS::PRIMITIVE_TRIANGLES, arr);
}
开发者ID:timoschwarzer,项目名称:godot,代码行数:41,代码来源:cpu_particles_2d.cpp


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