Beispiel #1
0
void MeshInstance::set_mesh(const Ref<Mesh> &p_mesh) {

	if (mesh == p_mesh)
		return;

	if (mesh.is_valid()) {
		mesh->disconnect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_mesh_changed);
		materials.clear();
	}

	mesh = p_mesh;

	blend_shape_tracks.clear();
	if (mesh.is_valid()) {

		for (int i = 0; i < mesh->get_blend_shape_count(); i++) {

			BlendShapeTrack mt;
			mt.idx = i;
			mt.value = 0;
			blend_shape_tracks["blend_shapes/" + String(mesh->get_blend_shape_name(i))] = mt;
		}

		mesh->connect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_mesh_changed);
		materials.resize(mesh->get_surface_count());

		set_base(mesh->get_rid());
	} else {

		set_base(RID());
	}

	_change_notify();
}
Beispiel #2
0
static void tetris_redraw_preview(void)
{
    unsigned int w, h;

    drawSquare(CP_X_OFFSET, CP_Y_OFFSET, CP_X_WIDTH,CP_X_WIDTH, WSTL_GAME_BG_01);// for next preview
    /* make Preview Block be center in Preview Window */
    get_block_geosize(NewShape[0], 0, &w, &h);
    set_base(CP_X_OFFSET + 18 + BOX_WIDTH * (BLOCK_GEO_SPACE - w) / 2, \
          CP_Y_OFFSET + 18 + BOX_WIDTH * (BLOCK_GEO_SPACE - h) / 2);
    show(2, 0, NewShape[0], 0, BLOCK_ACTIVE);
    set_base(BK_X_OFFSET, BK_Y_OFFSET);
}
Beispiel #3
0
Light::Light(VisualServer::LightType p_type) {

	type=p_type;
	light=VisualServer::get_singleton()->light_create(p_type);

	set_parameter(PARAM_SPOT_ATTENUATION,1.0);
	set_parameter(PARAM_SPOT_ANGLE,30.0);
	set_parameter(PARAM_RADIUS,2.0);
	set_parameter(PARAM_ENERGY,1.0);
	set_parameter(PARAM_ATTENUATION,1.0);
	set_parameter(PARAM_SHADOW_DARKENING,0.0);
	set_parameter(PARAM_SHADOW_Z_OFFSET,0.05);
	set_parameter(PARAM_SHADOW_Z_SLOPE_SCALE,0);
	set_parameter(PARAM_SHADOW_ESM_MULTIPLIER,60);
	set_parameter(PARAM_SHADOW_BLUR_PASSES,1);


	set_color( COLOR_DIFFUSE, Color(1,1,1));
	set_color( COLOR_SPECULAR, Color(1,1,1));

	op=OPERATOR_ADD;
	set_project_shadows( false );
	set_base(light);
	enabled=true;
	editor_only=false;
	bake_mode=BAKE_MODE_DISABLED;

}
Beispiel #4
0
static void tetris_redraw_main(void)
{
    UINT8   i, j;

    drawSquare(BK_X_OFFSET, BK_Y_OFFSET, MAXX*BOX_WIDTH, MAXY*BOX_WIDTH, WSTL_GAME_BG_01);    
    for (i = 0; i < MAXY; i++)
    {
        for (j = 2; j < MAXX + 2; j++)
        {
            if (back[i][j] == 1)
            {
                drawBitmap(BK_X_OFFSET + (j - 2) * BOX_WIDTH, \
                      BK_Y_OFFSET + i * BOX_WIDTH, BOX_WIDTH, \
                      BOX_WIDTH, IM_GAME_TETRIS_BLOCK_08);
            }
            else
            {
                drawSquare(BK_X_OFFSET + (j - 2) * BOX_WIDTH, \
                      BK_Y_OFFSET + i * BOX_WIDTH, BOX_WIDTH, \
                      BOX_WIDTH, WSTL_GAME_BG_01);
            }
        }   
    }
    set_base(BK_X_OFFSET, BK_Y_OFFSET);
    show(x, y, CurrentShape, Status, BLOCK_ACTIVE);
}
Beispiel #5
0
int set_cursor(INT loc)
{
  if (loc < 0 && base % lineLength)
    loc = 0;

  if (!tryloc(loc))
    return FALSE;

  if (loc < base) {
    if (loc - base % lineLength < 0)
      set_base(0);
    else if (!move_base(myfloor(loc - base % lineLength, lineLength) + base % lineLength - base))
      return FALSE;
    cursor = loc - base;
  } else if (loc >= base + page) {
    if (!move_base(myfloor(loc - base % lineLength, lineLength) + base % lineLength - page + lineLength - base))
      return FALSE;
    cursor = loc - base;
  } else if (loc > base + nbBytes) {
    return FALSE;
  } else
    cursor = loc - base;

  if (mark_set)
    updateMarked();

  return TRUE;
}
Beispiel #6
0
ImmediateGeometry::ImmediateGeometry() {

	im = VisualServer::get_singleton()->immediate_create();
	set_base(im);
	empty=true;

}
Beispiel #7
0
void BakedLightmap::set_light_data(const Ref<BakedLightmapData> &p_data) {

	if (light_data.is_valid()) {
		if (is_inside_tree()) {
			_clear_lightmaps();
		}
		set_base(RID());
	}
	light_data = p_data;

	if (light_data.is_valid()) {
		set_base(light_data->get_rid());
		if (is_inside_tree()) {
			_assign_lightmaps();
		}
	}
}
Beispiel #8
0
 LLC::LLC(const shared_ptr<float>& base, const uint32_t dim,
          const uint32_t num_base)
     : kdforest_model_(NULL),
       has_setup_(false)
 {
   init_with_default_parameter();
   set_base(base, dim, num_base);
 }
Beispiel #9
0
int move_base(INT delta)
{
  if (mode == bySector) {
    if (delta > 0 && delta < page)
      delta = page;
    else if (delta < 0 && delta > -page)
      delta = -page;
  }
  return set_base(base + delta);
}
Beispiel #10
0
struct da *
da_create(void)
{
  struct da *da;
  da = malloc(sizeof(struct da));
  da->size = 0;
  da->arr = NULL;
  set_base(da, 1, 1);
  set_check(da, 1, 1);
  return da;
}
Beispiel #11
0
Quad::Quad() {

	pending_update = true;
	centered = true;
	//offset=0;
	size = Vector2(1, 1);
	axis = Vector3::AXIS_Z;
	mesh = VisualServer::get_singleton()->mesh_create();
	set_base(mesh);
	configured = false;
}
Beispiel #12
0
Particles::Particles() {

	particles = VisualServer::get_singleton()->particles_create();
	timer = memnew(Timer);
	add_child(timer);
	emit_timeout = 0;

	set_amount(64);
	set_emitting(true);
	set_visibility_aabb(AABB( Vector3(-4,-4,-4), Vector3(8,8,8) ) );
	
	for (int i=0;i<VAR_MAX;i++) {
		set_randomness((Variable)i,0.0);
	}
	
	set_variable( VAR_LIFETIME, 5.0);
	set_variable( VAR_SPREAD, 0.2);
	set_variable( VAR_GRAVITY, 9.8);
	set_variable( VAR_LINEAR_VELOCITY, 0.2);
	set_variable( VAR_ANGULAR_VELOCITY, 0.0);
	set_variable( VAR_LINEAR_ACCELERATION, 0.0);
	set_variable( VAR_DRAG, 0.0);
	set_variable( VAR_TANGENTIAL_ACCELERATION, 0.0);
	set_variable( VAR_DAMPING, 0.0);
	set_variable( VAR_INITIAL_SIZE, 1.0);
	set_variable( VAR_FINAL_SIZE, 1.0);
	set_variable( VAR_INITIAL_ANGLE, 0.0);			
	set_variable( VAR_HEIGHT, 1.0);
	set_variable( VAR_HEIGHT_SPEED_SCALE, 0.0);

	color_phase_count=0;

	set_color_phase_pos(0,0.0);
	set_color_phase_pos(1,1.0);
	set_color_phase_pos(2,1.0);
	set_color_phase_pos(3,1.0);

	set_color_phase_color(0,Color(1,1,1));
	set_color_phase_color(1,Color(0,0,0));
	set_color_phase_color(2,Color(0,0,0));
	set_color_phase_color(3,Color(0,0,0));

	set_gravity_normal(Vector3(0,-1.0,0));
	set_emission_half_extents(Vector3(0.1,0.1,0.1));

	height_from_velocity=false;

	Vector<Variant> pars;
	pars.push_back(false);
	timer->connect("timeout", this, "set_emitting", pars);
	set_base(particles);
	local_coordinates=false;
}
Beispiel #13
0
void pnpbios_calls_init(union pnp_bios_install_struct *header)
{
	int i;

	spin_lock_init(&pnp_bios_lock);
	pnp_bios_callpoint.offset = header->fields.pm16offset;
	pnp_bios_callpoint.segment = PNP_CS16;

	set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
	_set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
	for (i = 0; i < NR_CPUS; i++) {
		struct desc_struct *gdt = get_cpu_gdt_table(i);
		if (!gdt)
			continue;
		set_base(gdt[GDT_ENTRY_PNPBIOS_CS32], &pnp_bios_callfunc);
		set_base(gdt[GDT_ENTRY_PNPBIOS_CS16],
			 __va(header->fields.pm16cseg));
		set_base(gdt[GDT_ENTRY_PNPBIOS_DS],
			 __va(header->fields.pm16dseg));
	}
}
Beispiel #14
0
static void
move_children(struct da *da, struct resolve_stat *rs,
	      int parent, int left)
{
  int i;
  int orig_base = get_base(da, parent);
  int move;
  move = parent + orig_base - left;
  /*printf("parent=%d, nr=%d, left=%d, orig_base=%d\n",
    parent, rs->nr, left, orig_base);*/
  set_base(da, parent, left - parent);
  /* put moved children */
  for (i = 0; i < rs->nr; i++) {
    int idx = left + rs->elm[i].c;
    set_check(da, idx, parent);
    set_base(da, idx, rs->elm[i].base + move);
  }
  /* trim grand children */
  for (i = 0; i < rs->nr; i++) {
    int orig_left, old_child;
    int j;
    /**/
    orig_left = parent + orig_base + rs->elm[i].base + rs->elm[i].c;
    old_child = parent + orig_base + rs->elm[i].c;
    /*printf("parent=%d, old_child=%d, %d\n", parent, old_child, move);*/
    for (j = 0; j < 256; j++) {
      int orig_check = get_check(da, orig_left + j);
      if (get_check(da, orig_left + j) == old_child &&
	  get_check(da, orig_check) == 0) {
	int new_check;
	new_check = get_check(da, orig_left +j) - move;
	/*printf("rewrite check[%d] %d to %d (%d)\n",
	       orig_left + j,
	       get_check(da, orig_left + j), new_check,
	       get_check(da, orig_check));*/
	set_check(da, orig_left + j, new_check);
      }
    }
  }
}
BakedLightSampler::BakedLightSampler() {

	base = VS::get_singleton()->baked_light_sampler_create();
	set_base(base);

	params[PARAM_RADIUS]=1.0;
	params[PARAM_STRENGTH]=1.0;
	params[PARAM_ATTENUATION]=1.0;
	params[PARAM_DETAIL_RATIO]=0.1;
	resolution=16;


}
Beispiel #16
0
// 设置新任务的代码和数据段基址、限长并复制页表。
// nr 为新任务号;p 是新任务数据结构的指针。
int copy_mem (int nr, struct task_struct *p)
{
	unsigned long old_data_base, new_data_base, data_limit;
	unsigned long old_code_base, new_code_base, code_limit;

	code_limit = get_limit (0x0f);	// 取局部描述符表中代码段描述符项中段限长。
	data_limit = get_limit (0x17);	// 取局部描述符表中数据段描述符项中段限长。
	old_code_base = get_base (current->ldt[1]);	// 取原代码段基址。
	old_data_base = get_base (current->ldt[2]);	// 取原数据段基址。
	if (old_data_base != old_code_base)	// 0.11 版不支持代码和数据段分立的情况。
		panic ("We don't support separate I&D");
	if (data_limit < code_limit)	// 如果数据段长度 < 代码段长度也不对。
		panic ("Bad data_limit");
	new_data_base = new_code_base = nr * 0x4000000;	// 新基址=任务号*64Mb(任务大小)。
	p->start_code = new_code_base;
	set_base (p->ldt[1], new_code_base);	// 设置代码段描述符中基址域。
	set_base (p->ldt[2], new_data_base);	// 设置数据段描述符中基址域。
	if (copy_page_tables (old_data_base, new_data_base, data_limit))
    {				// 复制代码和数据段。
		free_page_tables (new_data_base, data_limit);	// 如果出错则释放申请的内存。
		return -ENOMEM;
    }
	return 0;
}
Beispiel #17
0
Portal::Portal() {

	portal = VisualServer::get_singleton()->portal_create();
	Vector<Point2> points;
	points.push_back(Point2(-1, 1));
	points.push_back(Point2(1, 1));
	points.push_back(Point2(1, -1));
	points.push_back(Point2(-1, -1));
	set_shape(points); // default shape

	set_connect_range(0.8);
	set_disable_distance(50);
	set_enabled(true);

	set_base(portal);
}
Beispiel #18
0
static int
do_add(struct da *da, int idx, unsigned char c)
{
  int base = get_base(da, idx);
  int next = idx + base + c;
  int cur_check = get_check(da, next);
  int new_base;
  if (cur_check > 0) {
    printf("conflict(%d,%c)\n", idx, c);
    return resolve_conflict(da, idx, c);
  }
  set_check(da, next, idx);
  /**/
  new_base = 1;
  if (idx == 1) {
    new_base = 256 - next;
  }
  set_base(da, next, new_base);
  return next;
}
Beispiel #19
0
SpriteBase3D::SpriteBase3D() {

	color_dirty=true;
	centered=true;
	hflip=false;
	vflip=false;
	parent_sprite=NULL;
	pI=NULL;

	for(int i=0;i<FLAG_MAX;i++)
		flags[i]=i==FLAG_TRANSPARENT;

	axis=Vector3::AXIS_Z;
	pixel_size=0.01;
	modulate=Color(1,1,1,1);
	pending_update=false;
	opacity=1.0;
	immediate = VisualServer::get_singleton()->immediate_create();
	set_base(immediate);
}
void BakedLightInstance::set_baked_light(const Ref<BakedLight>& p_baked_light) {

	baked_light=p_baked_light;	

	RID base_rid;

	if (baked_light.is_valid())
		base_rid=baked_light->get_rid();
	else
		base_rid=RID();

	set_base(base_rid);

	if (is_inside_world()) {

		emit_signal(SceneStringNames::get_singleton()->baked_light_changed);

//		for (List<Node*>::Element *E=baked_geometry.front();E;E=E->next()) {
//			VS::get_singleton()->instance_geometry_set_baked_light(E->get()->get_instance(),baked_light.is_valid()?get_instance():RID());
//		}
	}
}
Beispiel #21
0
static void
collect_child(struct da *da, struct resolve_stat *rs,
	      int parent, unsigned char c)
{
  int i;
  int base = get_base(da, parent);
  rs->nr = 0;
  ensure_array(da, base + 256);
  for (i = 0; i < 256; i++) {
    int idx = parent + base + i;
    if (i == c) {
      push_child(rs, c, 1);
    } else if (get_check(da, idx) == parent) {
      /* escape */
      /*printf("idx=%d,base=%d, parent=%d,i=%d\n",
	idx, base, parent, i);*/
      push_child(rs, i, get_base(da, idx));
      /* clear */
      set_base(da, idx, 0);
      set_check(da, idx, 0);
    }
  }
}
Beispiel #22
0
Arm::Arm(vector<Segment*>segs, Point3f pos) {
    base = Point3f(0,0,0);
    set_segments(segs);
    set_base(pos);
}
Beispiel #23
0
void *g_html_special(struct g_part *p, int c, ...)
{
	va_list l;
	unsigned char *t;
	struct form_control *fc;
	struct frameset_param *fsp;
	struct frame_param *fp;
	struct image_description *im;
	struct g_object_tag *tag;
	struct refresh_param *rp;
	struct hr_param *hr;
	va_start(l, c);
	switch (c) {
		case SP_TAG:
			t = va_arg(l, unsigned char *);
			va_end(l);
			/*html_tag(p->data, t, X(p->cx), Y(p->cy));*/
			tag = mem_calloc(sizeof(struct g_object_tag) + strlen(t) + 1);
			tag->mouse_event = g_dummy_mouse;
			tag->draw = g_dummy_draw;
			tag->destruct = g_tag_destruct;
			strcpy(tag->name, t);
			flush_pending_text_to_line(p);
			add_object_to_line(p, &p->line, (struct g_object *)tag);
			break;
		case SP_CONTROL:
			fc = va_arg(l, struct form_control *);
			va_end(l);
			g_html_form_control(p, fc);
			break;
		case SP_TABLE:
			va_end(l);
			return convert_table;
		case SP_USED:
			va_end(l);
			return (void *)(my_intptr_t)!!p->data;
		case SP_FRAMESET:
			fsp = va_arg(l, struct frameset_param *);
			va_end(l);
			return create_frameset(p->data, fsp);
		case SP_FRAME:
			fp = va_arg(l, struct frame_param *);
			va_end(l);
			create_frame(fp);
			break;
		case SP_SCRIPT:
			t = va_arg(l, unsigned char *);
			va_end(l);
			if (p->data) process_script(p->data, t);
			break;
		case SP_IMAGE:
			im = va_arg(l, struct image_description *);
			va_end(l);
			do_image(p, im);
			break;
		case SP_NOWRAP:
			va_end(l);
			break;
		case SP_REFRESH:
			rp = va_arg(l, struct refresh_param *);
			va_end(l);
			html_process_refresh(p->data, rp->url, rp->time);
			break;
		case SP_SET_BASE:
			t = va_arg(l, unsigned char *);
			va_end(l);
			if (p->data) set_base(p->data, t);
			break;
		case SP_HR:
			hr = va_arg(l, struct hr_param *);
			va_end(l);
			g_hr(p, hr);
			break;
		default:
			va_end(l);
			internal("html_special: unknown code %d", c);
	}
	return NULL;
}
Beispiel #24
0
/*
* Fixed_Base_Power_Mod Constructor
*/
Fixed_Base_Power_Mod::Fixed_Base_Power_Mod(const BigInt& b, const BigInt& n,
                                           Usage_Hints hints) :
   Power_Mod(n, Usage_Hints(hints | BASE_IS_FIXED | choose_base_hints(b, n)))
   {
   set_base(b);
   }
Beispiel #25
0
CodeBlock* GlobalEntry::codeGen(){
	CodeBlock* main_block = new CodeBlock();

	//--------------Init stack and base pointers--------------
	ICode set_stack(ICode::ICodeType::MOVI,new Value(0,Type::TypeTag::UINT),&MemoryMgr::stackPointerRegister());
	ICode set_base(ICode::ICodeType::MOVI,new Value(0,Type::TypeTag::UINT),&MemoryMgr::basePointerRegister());

	main_block->append(set_stack);
	main_block->append(set_base);

	//----------------------Declarations----------------------
	//Loops over all declarations
	SymTab* st = this->symTab();

	//Separates FunctionEntries from the other types
	vector<CodeBlock*> function_blocks;
	vector<CodeBlock*> other_blocks;
	for(SymTab::iterator i = st->begin(); i != st->end(); ++i){
		CodeBlock* cb = (*i)->codeGen();
		if((*i)->kind() == SymTabEntry::Kind::FUNCTION_KIND){
			function_blocks.push_back(cb);
		} else {
			other_blocks.push_back(cb);
		}
	}
	for(unsigned int x = 0; x < other_blocks.size();++x){
		main_block->append(other_blocks[x]);
	}
	ICode jmp_start(ICode::ICodeType::JMP,parse_label_);
	main_block->append(jmp_start);
	for(unsigned int x = 0; x < function_blocks.size();++x){
		main_block->append(function_blocks[x]);
	}

	//---------------------Event Matching---------------------

	// Reads in character
	CodeBlock* input_block = new CodeBlock();
	ICode read_in(ICode::ICodeType::IN,&in_reg_);
	
	//If negative, then reached end of file
	ICode* check_neg = new ICode(ICode::ICodeType::GT,new Value(0,Type::TypeTag::INT),&in_reg_);
	ICode end_jmp(ICode::ICodeType::JMPC,check_neg,end_label_);

	input_block->append(read_in);
	input_block->append(end_jmp);

	input_block->setStartLabel(parse_label_);

	CodeBlock* rule_block;
	// Named rules
	for(unsigned int i = 0; i < rule_names_.size(); ++i){
		rule_block = new CodeBlock();
		// Moves the string constant to the register
		ICode mov_string(ICode::ICodeType::MOVI,new Value((int)(rule_names_[i].at(0)),Type::TypeTag::INT),&comp_reg_);
		// Comparison
		ICode* compare = new ICode(ICode::ICodeType::EQ,&comp_reg_,&in_reg_);
		//Conditionally jumps
		ICode jmpc(ICode::ICodeType::JMPC,compare,rule_labels_[i]);

		rule_block->append(mov_string);
		rule_block->append(jmpc);
		rule_block->setEndLabel(rule_return_labels_[i]);

		input_block->append(rule_block);
	}

	// "Any" rules
	for(unsigned int i = 0; i < any_labels_.size(); ++i){
		rule_block = new CodeBlock();

		//Jumps to any rule body
		ICode jmp(ICode::ICodeType::JMP,any_labels_[i]);

		rule_block->append(jmp);
		rule_block->setEndLabel(any_return_labels_[i]);

		input_block->append(rule_block);
	}

	input_block->append(jmp_start);

	main_block->append(input_block);

	//------------------------Rules------------------------

	//Loops over all Rules
	for(unsigned int x = 0; x < rules_.size();++x){
		main_block->append(rules_[x]->codeGen());
	}

	//---------------------End program---------------------

	//Do the end jump here
	CodeBlock* end_block = new CodeBlock();
	ICode print_end(ICode::ICodeType::PRTS,new Value("PROGRAM END\\n"));
	end_block->setStartLabel(end_label_);
	end_block->append(print_end);

	main_block->append(end_block);

	return main_block;
}