示例#1
0
void EditorFileSystem::_scan_scenes() {

	ERR_FAIL_COND(!scanning || scandir);

	//read .fscache
	HashMap<String,FileCache> file_cache;
	HashMap<String,DirCache> dir_cache;
	DirCache *dc=NULL;
	String cpath;

	sources_changed.clear();



	String project=Globals::get_singleton()->get_resource_path();
	FileAccess *f =FileAccess::open(project+"/.fscache",FileAccess::READ);

	if (f) {
		//read the disk cache
		while(!f->eof_reached()) {

			String l = f->get_line().strip_edges();
			if (l==String())
				continue;

			if (l.begins_with("::")) {
				Vector<String> split = l.split("::");
				ERR_CONTINUE( split.size() != 3);
				String name = split[1];

				dir_cache[name]=DirCache();
				dc=&dir_cache[name];
				dc->modification_time=split[2].to_int64();

				if (name!="res://") {

					cpath=name+"/";

					int sp=name.find_last("/");
					if (sp==5)
						sp=6;
					String pd = name.substr(0,sp);
					DirCache *dcp = dir_cache.getptr(pd);
					ERR_CONTINUE(!dcp);
					dcp->subdirs.insert(name.get_file());
				} else {

					cpath=name;
				}


			} else {
				Vector<String> split = l.split("::");
				ERR_CONTINUE( split.size() != 4);
				String name = split[0];
				String file;

				if (!name.begins_with("res://")) {
					file=name;
					name=cpath+name;
				} else {
					file=name.get_file();
				}

				FileCache fc;
				fc.type=split[1];
				fc.modification_time=split[2].to_int64();
				String meta = split[3].strip_edges();
				fc.meta.enabled=false;
				if (meta.find("<>")!=-1){
					Vector<String> spl = meta.split("<>");
					int sc = spl.size()-1;
					if (sc%3==0){
						fc.meta.enabled=true;
						fc.meta.import_editor=spl[0];
						fc.meta.sources.resize(sc/3);
						for(int i=0;i<fc.meta.sources.size();i++) {
							fc.meta.sources[i].path=spl[1+i*3+0];
							fc.meta.sources[i].md5=spl[1+i*3+1];
							fc.meta.sources[i].modified_time=spl[1+i*3+2].to_int64();
						}

					}

				}
				file_cache[name]=fc;

				ERR_CONTINUE(!dc);
				dc->files.insert(file);
			}

		}

		f->close();
		memdelete(f);
	}






	total=0;
	DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
	//da->change_dir( Globals::get_singleton()->get_resource_path() );


	List<String> extensionsl;
	ResourceLoader::get_recognized_extensions_for_type("",&extensionsl);
	Set<String> extensions;
	for(List<String>::Element *E = extensionsl.front();E;E=E->next()) {

		extensions.insert(E->get());
	}

	EditorProgressBG scan_progress("efs","ScanFS",100);

	md_count=0;
	scandir=_scan_dir(da,extensions,"",0,1,"",file_cache,dir_cache,scan_progress);
	memdelete(da);
	if (abort_scan && scandir) {
		memdelete(scandir);
		scandir=NULL;

	}


	//save back the findings
	f=FileAccess::open(project+"/.fscache",FileAccess::WRITE);
	_save_type_cache_fs(scandir,f);
	f->close();
	memdelete(f);

	scanning=false;

}
示例#2
0
void SurfaceTool::generate_tangents() {

	ERR_FAIL_COND(!(format&Mesh::ARRAY_FORMAT_TEX_UV));

#if 0

	int len=vertex_array.size();
	vertex_array.write_lock();
	Vertex *vertexptr=vertex_array.write();

	for (int i=0;i<len/3;i++) {


		Vector3 v1 = vertexptr[i*3+0].vertex;
		Vector3 v2 = vertexptr[i*3+1].vertex;
		Vector3 v3 = vertexptr[i*3+2].vertex;

		Vector3 w1 = vertexptr[i*3+0].uv[0];
		Vector3 w2 = vertexptr[i*3+1].uv[0];
		Vector3 w3 = vertexptr[i*3+2].uv[0];


		float x1 = v2.x - v1.x;
		float x2 = v3.x - v1.x;
		float y1 = v2.y - v1.y;
		float y2 = v3.y - v1.y;
		float z1 = v2.z - v1.z;
		float z2 = v3.z - v1.z;

		float s1 = w2.x - w1.x;
		float s2 = w3.x - w1.x;
		float t1 = w2.y - w1.y;
		float t2 = w3.y - w1.y;

		float r  = (s1 * t2 - s2 * t1);

		Vector3 binormal,tangent;

		if (r==0) {
			binormal=Vector3(0,0,0);
			tangent=Vector3(0,0,0);
		} else {
			tangent = Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
			(t2 * z1 - t1 * z2) * r);
			binormal = Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r,
			(s1 * z2 - s2 * z1) * r);
		}

		tangent.normalize();
		binormal.normalize();
		Vector3 normal=Plane( v1, v2, v3 ).normal;

		Vector3 tangentp = tangent - normal * normal.dot( tangent );
		Vector3 binormalp = binormal - normal * (normal.dot(binormal)) - tangent * (tangent.dot(binormal));

		tangentp.normalize();
		binormalp.normalize();


		for (int j=0;j<3;j++) {
			vertexptr[i*3+j].normal=normal;
			vertexptr[i*3+j].binormal=binormalp;
			vertexptr[i*3+j].tangent=tangentp;
		}
	}

	format|=Surface::ARRAY_FORMAT_TANGENT;
	printf("adding tangents to the format\n");

	vertex_array.write_unlock();
#endif
}
示例#3
0
void PhysicsServerSW::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) {

	ShapeSW *shape = shape_owner.get(p_shape);
	ERR_FAIL_COND(!shape);
	shape->set_custom_bias(p_bias);
}
示例#4
0
void TranslationServer::set_locale(const String& p_locale) {

	ERR_EXPLAIN("Invalid Locale: "+p_locale);
	ERR_FAIL_COND(!is_valid_locale(p_locale));
	locale=p_locale;
}
示例#5
0
void SurfaceTool::index() {

#if 0
	printf("indexing..\n");
	ERR_FAIL_COND( format & Surface::ARRAY_FORMAT_INDEX ); // already indexed

	index_array.clear();
	DVector< Vertex > indexed_vertex_array;

	int vertex_array_len = vertex_array.size();
	vertex_array.read_lock();
	const Vertex*vertex_array_ptr = vertex_array.read();

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

		int index_pos=-1;

		int indexed_vertex_array_len=indexed_vertex_array.size();

		if (indexed_vertex_array_len) {

			indexed_vertex_array.read_lock();
			const Vertex* indexed_vertex_array_ptr=indexed_vertex_array.read();

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

				if (vertex_array_ptr[i].same_as(indexed_vertex_array_ptr[j])) {

					index_pos=j;
					break;
				}
			}

			indexed_vertex_array.read_unlock();
		}

		if (index_pos==-1) {

			index_pos=indexed_vertex_array.size();
			indexed_vertex_array.push_back(vertex_array_ptr[i]);
		} else {

			indexed_vertex_array.write_lock();
			indexed_vertex_array.write()[index_pos].normal+=vertex_array_ptr[i].normal;
			indexed_vertex_array.write()[index_pos].binormal+=vertex_array_ptr[i].binormal;
			indexed_vertex_array.write()[index_pos].tangent+=vertex_array_ptr[i].tangent;
			indexed_vertex_array.write_unlock();
		}

		index_array.push_back(index_pos);
	}

	int idxvertsize=indexed_vertex_array.size();
	indexed_vertex_array.write_lock();
	Vertex* idxvert=indexed_vertex_array.write();
	for (int i=0;i<idxvertsize;i++) {

		idxvert[i].normal.normalize();
		idxvert[i].tangent.normalize();
		idxvert[i].binormal.normalize();
	}
	indexed_vertex_array.write_unlock();

	vertex_array.read_unlock();

	format|=Surface::ARRAY_FORMAT_INDEX;
	vertex_array=indexed_vertex_array;

	printf("indexing.. end\n");
#endif
}
示例#6
0
void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) {

	ERR_FAIL_COND(interface == NULL);

	interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect);
}
示例#7
0
void RWLockPosix::write_lock() {

	int err = pthread_rwlock_wrlock(&rwlock);
	ERR_FAIL_COND(err != 0);
}
示例#8
0
void Physics2DServerSW::area_set_transform(RID p_area, const Transform2D &p_transform) {

	Area2DSW *area = area_owner.get(p_area);
	ERR_FAIL_COND(!area);
	area->set_transform(p_transform);
};
示例#9
0
void Physics2DServerSW::area_set_pickable(RID p_area, bool p_pickable) {

	Area2DSW *area = area_owner.get(p_area);
	ERR_FAIL_COND(!area);
	area->set_pickable(p_pickable);
}
示例#10
0
static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_indent) {

	for (int i = 0; i < p_block->statements.size(); i++) {

		const GDScriptParser::Node *statement = p_block->statements[i];

		switch (statement->type) {

			case GDScriptParser::Node::TYPE_CONTROL_FLOW: {

				const GDScriptParser::ControlFlowNode *cf_node = static_cast<const GDScriptParser::ControlFlowNode *>(statement);
				switch (cf_node->cf_type) {

					case GDScriptParser::ControlFlowNode::CF_IF: {

						ERR_FAIL_COND(cf_node->arguments.size() != 1);
						String txt;
						txt += "if ";
						txt += _parser_expr(cf_node->arguments[0]);
						txt += ":";
						_print_indent(p_indent, txt);
						ERR_FAIL_COND(!cf_node->body);
						_parser_show_block(cf_node->body, p_indent + 1);
						if (cf_node->body_else) {
							_print_indent(p_indent, "else:");
							_parser_show_block(cf_node->body_else, p_indent + 1);
						}

					} break;
					case GDScriptParser::ControlFlowNode::CF_FOR: {
						ERR_FAIL_COND(cf_node->arguments.size() != 2);
						String txt;
						txt += "for ";
						txt += _parser_expr(cf_node->arguments[0]);
						txt += " in ";
						txt += _parser_expr(cf_node->arguments[1]);
						txt += ":";
						_print_indent(p_indent, txt);
						ERR_FAIL_COND(!cf_node->body);
						_parser_show_block(cf_node->body, p_indent + 1);

					} break;
					case GDScriptParser::ControlFlowNode::CF_WHILE: {

						ERR_FAIL_COND(cf_node->arguments.size() != 1);
						String txt;
						txt += "while ";
						txt += _parser_expr(cf_node->arguments[0]);
						txt += ":";
						_print_indent(p_indent, txt);
						ERR_FAIL_COND(!cf_node->body);
						_parser_show_block(cf_node->body, p_indent + 1);

					} break;
					case GDScriptParser::ControlFlowNode::CF_MATCH: {
						// FIXME: Implement
					} break;
					case GDScriptParser::ControlFlowNode::CF_CONTINUE: {

						_print_indent(p_indent, "continue");
					} break;
					case GDScriptParser::ControlFlowNode::CF_BREAK: {

						_print_indent(p_indent, "break");
					} break;
					case GDScriptParser::ControlFlowNode::CF_RETURN: {

						if (cf_node->arguments.size())
							_print_indent(p_indent, "return " + _parser_expr(cf_node->arguments[0]));
						else
							_print_indent(p_indent, "return ");
					} break;
				}

			} break;
			case GDScriptParser::Node::TYPE_LOCAL_VAR: {

				const GDScriptParser::LocalVarNode *lv_node = static_cast<const GDScriptParser::LocalVarNode *>(statement);
				_print_indent(p_indent, "var " + String(lv_node->name));
			} break;
			default: {
				//expression i guess
				_print_indent(p_indent, _parser_expr(statement));
			}
		}
	}
}
示例#11
0
void Physics2DServerSW::space_set_debug_contacts(RID p_space, int p_max_contacts) {

	Space2DSW *space = space_owner.get(p_space);
	ERR_FAIL_COND(!space);
	space->set_debug_contacts(p_max_contacts);
}
示例#12
0
SpatialSoundServer::SpatialSoundServer() {

	ERR_FAIL_COND(singleton!=NULL);
	singleton=this;
}
示例#13
0
void EditorAtlas::fit(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size) {

	ERR_FAIL_COND(p_rects.size() == 0);

	Vector<_EditorAtlasWorkRect> wrects;
	wrects.resize(p_rects.size());
	long total_area = 0;
	for (int i = 0; i < p_rects.size(); i++) {
		wrects[i].s = p_rects[i];
		wrects[i].idx = i;
		total_area += p_rects[i].width * p_rects[i].height;
	}
	wrects.sort();
	int widest = wrects[0].s.width;

	Vector<_EditorAtlasWorkRectResult> results;

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

		int w = 1 << i;
		int max_h = 0;
		int max_w = 0;
		if (w < widest)
			continue;

		Vector<int> wmax;
		wmax.resize(total_area / w);
		for (int j = 0; j < wmax.size(); j++)
			wmax[j] = 0;

		for (int j = 0; j < wrects.size(); j++) {

			int new_x = 0;
			int new_y = 0;

			int piece_w = wrects[j].s.width;
			int piece_h = wrects[j].s.height;

			bool found_place;

			do {
				found_place = true;
				new_x = 0;
				if (wmax.size() <= new_y + piece_h) {
					int prevS = wmax.size();
					wmax.resize(new_y + piece_h + 128);
					for (int k = prevS; k < wmax.size(); k++)
						wmax[k] = 0;
				}
				for (int k = 0; k < piece_h; k++) {
					if (new_x < wmax[new_y + k]) new_x = wmax[new_y + k];
					if (new_x + piece_w > w) {
						new_y += k + 1;
						found_place = false;
						break;
					}
				}
				if (found_place) {
					// one more check is calculating lost space of atlas
					long lost_area = 0;
					for (int k = 0; k < piece_h; k++) {
						lost_area += new_x - wmax[new_y + k];
					}
					if (lost_area >= piece_w * piece_h / 2) {
						found_place = false;
						new_y++;
					}
				}
			} while (!found_place);

			wrects[j].p.x = new_x;
			wrects[j].p.y = new_y;

			int end_h = new_y + piece_h;
			int end_w = new_x + piece_w;

			for (int k = 0; k < piece_h; k++) {
				wmax[new_y + k] = end_w;
			}

			if (end_h > max_h)
				max_h = end_h;

			if (end_w > max_w)
				max_w = end_w;
		}

		_EditorAtlasWorkRectResult result;
		result.result = wrects;
		result.max_h = max_h;
		result.max_w = max_w;
		results.push_back(result);
		float efficiency = float(max_w * max_h) / float(next_power_of_2(max_w) * next_power_of_2(max_h));
		print_line("Processing atlas: width " + itos(w) + " ,height " + itos(max_h) + " ,efficiency " + rtos(efficiency));
	}

	//find the result with the most efficiency

	int best = -1;
	float max_eff = 0;

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

		float h = results[i].max_h;
		float w = results[i].max_w;
		float efficiency = float(w * h) / float(next_power_of_2(w) * next_power_of_2(h));
		if (efficiency > max_eff) {
			best = i;
			max_eff = efficiency;
		}
	}

	r_result.resize(p_rects.size());

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

		r_result[results[best].result[i].idx] = results[best].result[i].p;
	}

	r_size = Size2(results[best].max_w, results[best].max_h);
}
示例#14
0
void ItemList::set_max_columns(int p_amount) {

	ERR_FAIL_COND(p_amount < 0);
	max_columns = p_amount;
	update();
}
示例#15
0
文件: sprite.cpp 项目: 93i/godot
void ViewportSprite::_notification(int p_what) {

    switch(p_what) {

    case NOTIFICATION_ENTER_TREE: {

        if (!viewport_path.is_empty()) {

            Node *n = get_node(viewport_path);
            ERR_FAIL_COND(!n);
            Viewport *vp=n->cast_to<Viewport>();
            ERR_FAIL_COND(!vp);

            Ref<RenderTargetTexture> rtt = vp->get_render_target_texture();
            texture=rtt;
            texture->connect("changed",this,"update");
            item_rect_changed();
        }
    }
    break;
    case NOTIFICATION_EXIT_TREE: {

        if (texture.is_valid()) {

            texture->disconnect("changed",this,"update");
            texture=Ref<Texture>();
        }
    }
    break;
    case NOTIFICATION_DRAW: {

        if (texture.is_null())
            return;

        RID ci = get_canvas_item();

        /*
        texture->draw(ci,Point2());
        break;
        */

        Size2i s;
        Rect2i src_rect;

        s = texture->get_size();

        src_rect.size=s;

        Point2 ofs=offset;
        if (centered)
            ofs-=s/2;

        if (OS::get_singleton()->get_use_pixel_snap()) {
            ofs=ofs.floor();
        }
        Rect2 dst_rect(ofs,s);
        texture->draw_rect_region(ci,dst_rect,src_rect,modulate);

    }
    break;
    }
}
示例#16
0
void Physics2DServerSW::body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_shape_metadata(p_shape_idx, p_metadata);
}
示例#17
0
void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) {

	ERR_FAIL_COND(interface == NULL);

	interface->set_anchor_detection_is_enabled(data, p_enable);
}
示例#18
0
void Physics2DServerSW::body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_continuous_collision_detection_mode(p_mode);
}
示例#19
0
void ARVRInterfaceGDNative::process() {
	ERR_FAIL_COND(interface == NULL);

	interface->process(data);
}
示例#20
0
void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_collision_mask(p_mask);
};
示例#21
0
文件: curve.cpp 项目: Alex-doc/godot
void Curve2D::advance(real_t p_distance,int &r_index, real_t &r_pos) const {

	int pc = points.size();
	ERR_FAIL_COND(pc<2);
	if (r_index<0 || r_index>=(pc-1))
		return;

	Vector2 pos = interpolate(r_index,r_pos);

	float sign=p_distance<0 ? -1 : 1;
	p_distance=Math::abs(p_distance);

	real_t base = r_index+r_pos;
	real_t top = 0.1; //a tenth is in theory representative
	int iterations=32;



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


		real_t o=base+top*sign;
		if (sign>0 && o >=pc) {
			top=pc-base;
			break;
		} else if (sign<0 && o <0) {
			top=-base;
			break;
		}

		Vector2 new_d = interpolatef(o);

		if (new_d.distance_to(pos) > p_distance)
			break;
		top*=2.0;
	}


	real_t bottom = 0.0;
	iterations=8;
	real_t final_offset;


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

		real_t middle = (bottom+top)*0.5;
		real_t o=base+middle*sign;
		Vector2 new_d = interpolatef(o);

		if (new_d.distance_to(pos) > p_distance) {
			bottom=middle;
		} else {
			top=middle;
		}
		final_offset=o;
	}

	r_index=(int)final_offset;
	r_pos=Math::fmod(final_offset,1.0);

}
示例#22
0
void Physics2DServerSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
};
示例#23
0
void FixedMaterial::set_point_size(float p_size) {

	ERR_FAIL_COND(p_size<0);
	point_size=p_size;
	VisualServer::get_singleton()->fixed_material_set_point_size(material,p_size);
}
示例#24
0
void Physics2DServerSW::body_set_max_contacts_reported(RID p_body, int p_contacts) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_max_contacts_reported(p_contacts);
}
示例#25
0
void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List<Vertex> *r_vertex, List<int> *r_index, int& lformat) {

	Array arr = p_existing->surface_get_arrays(p_surface);
	ERR_FAIL_COND( arr.size() !=VS::ARRAY_MAX );

	DVector<Vector3> varr = arr[VS::ARRAY_VERTEX];
	DVector<Vector3> narr = arr[VS::ARRAY_NORMAL];
	DVector<float> tarr = arr[VS::ARRAY_TANGENT];
	DVector<Color> carr = arr[VS::ARRAY_COLOR];
	DVector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV];
	DVector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2];
	DVector<int> barr = arr[VS::ARRAY_BONES];
	DVector<float> warr = arr[VS::ARRAY_WEIGHTS];

	int vc = varr.size();

	if (vc==0)
		return;
	lformat=0;

	DVector<Vector3>::Read rv;
	if (varr.size()) {
		lformat|=VS::ARRAY_FORMAT_VERTEX;
		rv=varr.read();
	}
	DVector<Vector3>::Read rn;
	if (narr.size()) {
		lformat|=VS::ARRAY_FORMAT_NORMAL;
		rn=narr.read();
	}
	DVector<float>::Read rt;
	if (tarr.size()) {
		lformat|=VS::ARRAY_FORMAT_TANGENT;
		rt=tarr.read();
	}
	DVector<Color>::Read rc;
	if (carr.size()) {
		lformat|=VS::ARRAY_FORMAT_COLOR;
		rc=carr.read();
	}

	DVector<Vector2>::Read ruv;
	if (uvarr.size()) {
		lformat|=VS::ARRAY_FORMAT_TEX_UV;
		ruv=uvarr.read();
	}

	DVector<Vector2>::Read ruv2;
	if (uv2arr.size()) {
		lformat|=VS::ARRAY_FORMAT_TEX_UV2;
		ruv2=uv2arr.read();
	}

	DVector<int>::Read rb;
	if (barr.size()) {
		lformat|=VS::ARRAY_FORMAT_BONES;
		rb=barr.read();
	}

	DVector<float>::Read rw;
	if (warr.size()) {
		lformat|=VS::ARRAY_FORMAT_WEIGHTS;
		rw=warr.read();
	}

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

		Vertex v;
		if (lformat&VS::ARRAY_FORMAT_VERTEX)
			v.vertex=varr[i];
		if (lformat&VS::ARRAY_FORMAT_NORMAL)
			v.normal=narr[i];
		if (lformat&VS::ARRAY_FORMAT_TANGENT) {
			Plane p( tarr[i*4+0],  tarr[i*4+1],  tarr[i*4+2],  tarr[i*4+3] );
			v.tangent=p.normal;
			v.binormal=p.normal.cross(last_normal).normalized() * p.d;
		}
		if (lformat&VS::ARRAY_FORMAT_COLOR)
			v.color=carr[i];
		if (lformat&VS::ARRAY_FORMAT_TEX_UV)
			v.uv=uvarr[i];
		if (lformat&VS::ARRAY_FORMAT_TEX_UV2)
			v.uv2=uv2arr[i];
		if (lformat&VS::ARRAY_FORMAT_BONES) {
			Vector<int> b;
			b.resize(4);
			b[0]=barr[i*4+0];
			b[1]=barr[i*4+1];
			b[2]=barr[i*4+2];
			b[3]=barr[i*4+3];
			v.bones=b;
		}
		if (lformat&VS::ARRAY_FORMAT_WEIGHTS) {
			Vector<float> w;
			w.resize(4);
			w[0]=warr[i*4+0];
			w[1]=warr[i*4+1];
			w[2]=warr[i*4+2];
			w[3]=warr[i*4+3];
			v.weights=w;
		}

		r_vertex->push_back(v);
	}

	//indices

	DVector<int> idx= arr[VS::ARRAY_INDEX];
	int is = idx.size();
	if (is) {

		lformat|=VS::ARRAY_FORMAT_INDEX;
		DVector<int>::Read iarr=idx.read();
		for(int i=0;i<is;i++) {
			r_index->push_back(iarr[i]);
		}

	}


}
示例#26
0
void Physics2DServerSW::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata);
}
示例#27
0
void PhysicsServerSW::shape_set_data(RID p_shape, const Variant &p_data) {

	ShapeSW *shape = shape_owner.get(p_shape);
	ERR_FAIL_COND(!shape);
	shape->set_data(p_data);
};
示例#28
0
void Physics2DServerSW::body_set_pickable(RID p_body, bool p_pickable) {

	Body2DSW *body = body_owner.get(p_body);
	ERR_FAIL_COND(!body);
	body->set_pickable(p_pickable);
}
示例#29
0
void PhysicsServerSW::joint_set_solver_priority(RID p_joint, int p_priority) {

	JointSW *joint = joint_owner.get(p_joint);
	ERR_FAIL_COND(!joint);
	joint->set_priority(p_priority);
}
示例#30
0
文件: font.cpp 项目: brakhane/godot
void BitmapFont::add_texture(const Ref<Texture> &p_texture) {

	ERR_FAIL_COND(p_texture.is_null());
	textures.push_back(p_texture);
}