Пример #1
0
void SpriteBase3D::set_alpha_cut_mode(AlphaCutMode p_mode){

	ERR_FAIL_INDEX(p_mode,3);
	alpha_cut=p_mode;
	_queue_update();

}
Пример #2
0
ProceduralSky::ProceduralSky() {

	sky = VS::get_singleton()->sky_create();
	texture = VS::get_singleton()->texture_create();

	update_queued = false;
	sky_top_color = Color::hex(0xa5d6f1ff);
	sky_horizon_color = Color::hex(0xd6eafaff);
	sky_curve = 0.09;
	sky_energy = 1;

	ground_bottom_color = Color::hex(0x282f36ff);
	ground_horizon_color = Color::hex(0x6c655fff);
	ground_curve = 0.02;
	ground_energy = 1;

	sun_color = Color(1, 1, 1);
	sun_latitude = 35;
	sun_longitude = 0;
	sun_angle_min = 1;
	sun_angle_max = 100;
	sun_curve = 0.05;
	sun_energy = 16;

	texture_size = TEXTURE_SIZE_1024;
	sky_thread = NULL;
	regen_queued = false;
	first_time = true;

	_queue_update();
}
Пример #3
0
void AnimatedSprite3D::_res_changed() {

	set_frame(frame);
	_change_notify("frame");
	_change_notify("animation");
	_queue_update();
}
Пример #4
0
void Sprite3D::set_hframes(int p_amount) {

	ERR_FAIL_COND(p_amount<1);
	hframes=p_amount;
	_queue_update();
	_change_notify("frame");
}
Пример #5
0
ProceduralSky::ProceduralSky() {

	sky = VS::get_singleton()->sky_create();
	texture = VS::get_singleton()->texture_create();

	update_queued = false;

	sky_top_color = Color::hex(0x4d67e8ff);
	sky_horizon_color = Color::hex(0x8ed2e8ff);
	sky_curve = 0.25;
	sky_energy = 1;

	ground_bottom_color = Color::hex(0x322719ff);
	ground_horizon_color = Color::hex(0x543610ff);
	ground_curve = 0.25;
	ground_energy = 1;

	sun_color = Color(1, 1, 1);
	sun_latitude = 35;
	sun_longitude = 0;
	sun_angle_min = 1;
	sun_angle_max = 100;
	sun_curve = 0.05;
	sun_energy = 16;

	texture_size = TEXTURE_SIZE_1024;

	_queue_update();
}
Пример #6
0
void Sprite3D::set_region_rect(const Rect2& p_region_rect) {

	bool changed=region_rect!=p_region_rect;
	region_rect=p_region_rect;
	if (region && changed) {
		_queue_update();
	}
}
Пример #7
0
void Sprite3D::set_region(bool p_region) {

	if (p_region==region)
		return;

	region=p_region;
	_queue_update();
}
Пример #8
0
void Sprite3D::set_frame(int p_frame) {

	ERR_FAIL_INDEX(p_frame,vframes*hframes);

	if (frame != p_frame)

	frame=p_frame;
	_queue_update();
}
Пример #9
0
void Sprite3D::set_frame(int p_frame) {

	ERR_FAIL_INDEX(p_frame, vframes * hframes);

	if (frame != p_frame)

		frame = p_frame;
	_queue_update();
	emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
Пример #10
0
void AnimatedSprite3D::set_animation(const StringName &p_animation) {

	if (animation == p_animation)
		return;

	animation = p_animation;
	_reset_timeout();
	set_frame(0);
	_change_notify();
	_queue_update();
}
Пример #11
0
void NoiseTexture::set_noise(Ref<SimplexNoise> p_noise) {
	if (p_noise == noise)
		return;
	if (noise.is_valid()) {
		noise->disconnect(CoreStringNames::get_singleton()->changed, this, "_update_texture");
	}
	noise = p_noise;
	if (noise.is_valid()) {
		noise->connect(CoreStringNames::get_singleton()->changed, this, "_update_texture");
	}
	_queue_update();
}
Пример #12
0
void SpriteBase3D::_propagate_color_changed() {

	if (color_dirty)
		return;

	color_dirty=true;
	_queue_update();

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

		E->get()->_propagate_color_changed();
	}
}
Пример #13
0
void AnimatedSprite3D::set_frame(int p_frame){

	if (frames.is_null())
		return;

	ERR_FAIL_INDEX(p_frame,frames->get_frame_count());

	if (frame==p_frame)
		return;

	frame=p_frame;
	_queue_update();

}
Пример #14
0
void Sprite3D::set_texture(const Ref<Texture> &p_texture) {

	if (p_texture == texture)
		return;
	if (texture.is_valid()) {
		texture->disconnect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_queue_update);
	}
	texture = p_texture;
	if (texture.is_valid()) {
		texture->set_flags(texture->get_flags()); //remove repeat from texture, it looks bad in sprites
		texture->connect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_queue_update);
	}
	_queue_update();
}
Пример #15
0
void AnimatedSprite3D::set_frame(int p_frame){

	if (frames.is_null())
		return;

	ERR_FAIL_INDEX(p_frame,frames->get_frame_count(animation));

	if (frame==p_frame)
		return;

	frame=p_frame;
	_queue_update();
	emit_signal(SceneStringNames::get_singleton()->frame_changed);

}
Пример #16
0
void AnimatedSprite3D::_notification(int p_what) {

	switch (p_what) {
		case NOTIFICATION_INTERNAL_PROCESS: {

			if (frames.is_null())
				return;
			if (!frames->has_animation(animation))
				return;
			if (frame < 0)
				return;

			float speed = frames->get_animation_speed(animation);
			if (speed == 0)
				return; //do nothing

			float remaining = get_process_delta_time();

			while (remaining) {

				if (timeout <= 0) {

					timeout = 1.0 / speed;

					int fc = frames->get_frame_count(animation);
					if (frame >= fc - 1) {
						if (frames->get_animation_loop(animation)) {
							frame = 0;
						} else {
							frame = fc - 1;
						}
					} else {
						frame++;
					}

					_queue_update();
					_change_notify("frame");
				}

				float to_process = MIN(timeout, remaining);
				remaining -= to_process;
				timeout -= to_process;
			}
		} break;
	}
}
Пример #17
0
NoiseTexture::NoiseTexture() {
	update_queued = false;
	noise_thread = NULL;
	regen_queued = false;
	first_time = true;

	size = Vector2i(512, 512);
	seamless = false;
	as_normalmap = false;
	flags = FLAGS_DEFAULT;

	noise = Ref<SimplexNoise>();

	texture = VS::get_singleton()->texture_create();

	_queue_update();
}
Пример #18
0
void AnimatedSprite3D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {

	if (frames.is_valid())
		frames->disconnect("changed", this, "_res_changed");
	frames = p_frames;
	if (frames.is_valid())
		frames->connect("changed", this, "_res_changed");

	if (!frames.is_valid()) {
		frame = 0;
	} else {
		set_frame(frame);
	}

	_change_notify();
	_reset_timeout();
	_queue_update();
	update_configuration_warning();
}
Пример #19
0
void AnimatedSprite3D::set_sprite_frames(const Ref<SpriteFrames>& p_sprite_frames) {


	if (frames==p_sprite_frames)
		return;

	if (frames.is_valid())
		frames->disconnect("changed",this,"_queue_update");
	frames=p_sprite_frames;
	if (frames.is_valid())
		frames->connect("changed",this,"_queue_update");

	if (!frames.is_valid() || frame >=frames->get_frame_count(animation)) {
		frame=0;

	}
	_queue_update();

}
Пример #20
0
void AnimatedSprite3D::set_frame(int p_frame) {

	if (!frames.is_valid()) {
		return;
	}

	if (frames->has_animation(animation)) {
		int limit = frames->get_frame_count(animation);
		if (p_frame >= limit)
			p_frame = limit - 1;
	}

	if (p_frame < 0)
		p_frame = 0;

	if (frame == p_frame)
		return;

	frame = p_frame;
	_reset_timeout();
	_queue_update();
	_change_notify("frame");
	emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
Пример #21
0
void ProceduralSky::set_texture_size(TextureSize p_size) {
	ERR_FAIL_INDEX(p_size, TEXTURE_SIZE_MAX);

	texture_size = p_size;
	_queue_update();
}
Пример #22
0
void ProceduralSky::set_sun_energy(float p_energy) {

	sun_energy = p_energy;
	_queue_update();
}
Пример #23
0
void ProceduralSky::set_sun_curve(float p_curve) {

	sun_curve = p_curve;
	_queue_update();
}
Пример #24
0
void ProceduralSky::set_sun_angle_max(float p_angle) {

	sun_angle_max = p_angle;
	_queue_update();
}
Пример #25
0
void ProceduralSky::set_sun_longitude(float p_angle) {

	sun_longitude = p_angle;
	_queue_update();
}
Пример #26
0
void ProceduralSky::set_sun_color(const Color &p_sun) {

	sun_color = p_sun;
	_queue_update();
}
Пример #27
0
void ProceduralSky::set_ground_energy(float p_energy) {

	ground_energy = p_energy;
	_queue_update();
}
Пример #28
0
void ProceduralSky::set_ground_curve(float p_curve) {

	ground_curve = p_curve;
	_queue_update();
}
Пример #29
0
void ProceduralSky::set_ground_horizon_color(const Color &p_ground_horizon) {

	ground_horizon_color = p_ground_horizon;
	_queue_update();
}
Пример #30
0
void ProceduralSky::set_ground_bottom_color(const Color &p_ground_bottom) {

	ground_bottom_color = p_ground_bottom;
	_queue_update();
}