summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scene/2d/polygon_2d.cpp23
-rw-r--r--scene/2d/polygon_2d.h3
-rw-r--r--scene/3d/camera.cpp8
-rw-r--r--scene/3d/camera.h1
4 files changed, 11 insertions, 24 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 217a98aaea..fc6986327f 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -192,14 +192,14 @@ void Polygon2D::set_texture(const Ref<Texture>& p_texture){
texture=p_texture;
- if (texture.is_valid()) {
+ /*if (texture.is_valid()) {
uint32_t flags=texture->get_flags();
flags&=~Texture::FLAG_REPEAT;
if (tex_tile)
flags|=Texture::FLAG_REPEAT;
texture->set_flags(flags);
- }
+ }*/
update();
}
Ref<Texture> Polygon2D::get_texture() const{
@@ -228,22 +228,6 @@ float Polygon2D::get_texture_rotation() const{
return tex_rot;
}
-void Polygon2D::set_texture_repeat(bool p_enable){
-
- tex_tile=p_enable;
- if (texture.is_valid()) {
- uint32_t flags=texture->get_flags();
- flags&=~Texture::FLAG_REPEAT;
- if (p_enable)
- flags|=Texture::FLAG_REPEAT;
- texture->set_flags(flags);
- }
- update();
-}
-bool Polygon2D::get_texture_repeat() const{
-
- return tex_tile;
-}
void Polygon2D::_set_texture_rotationd(float p_rot){
@@ -324,8 +308,6 @@ void Polygon2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_texture_scale","texture_scale"),&Polygon2D::set_texture_scale);
ObjectTypeDB::bind_method(_MD("get_texture_scale"),&Polygon2D::get_texture_scale);
- ObjectTypeDB::bind_method(_MD("set_texture_repeat","enable"),&Polygon2D::set_texture_repeat);
- ObjectTypeDB::bind_method(_MD("get_texture_repeat"),&Polygon2D::get_texture_repeat);
ObjectTypeDB::bind_method(_MD("set_invert","invert"),&Polygon2D::set_invert);
ObjectTypeDB::bind_method(_MD("get_invert"),&Polygon2D::get_invert);
@@ -346,7 +328,6 @@ void Polygon2D::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"texture/offset"),_SCS("set_texture_offset"),_SCS("get_texture_offset"));
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"texture/scale"),_SCS("set_texture_scale"),_SCS("get_texture_scale"));
ADD_PROPERTY( PropertyInfo(Variant::REAL,"texture/rotation",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_texture_rotationd"),_SCS("_get_texture_rotationd"));
- ADD_PROPERTY( PropertyInfo(Variant::BOOL,"texture/repeat"),_SCS("set_texture_repeat"),_SCS("get_texture_repeat"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"invert/enable"),_SCS("set_invert"),_SCS("get_invert"));
ADD_PROPERTY( PropertyInfo(Variant::REAL,"invert/border",PROPERTY_HINT_RANGE,"0.1,16384,0.1"),_SCS("set_invert_border"),_SCS("get_invert_border"));
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index 38fa57b9b4..517b623ccd 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -52,9 +52,6 @@ public:
void set_texture_scale(const Vector2& p_scale);
Vector2 get_texture_scale() const;
- void set_texture_repeat(bool p_rot);
- bool get_texture_repeat() const;
-
void set_invert(bool p_rot);
bool get_invert() const;
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index d8512172c8..dce5060a44 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -552,6 +552,13 @@ Vector3 Camera::project_ray_origin(const Point2& p_pos) const {
};
};
+bool Camera::is_position_behind(const Vector3& p_pos) const {
+
+ Transform t = get_global_transform();
+ Vector3 eyedir = -get_global_transform().basis.get_axis(2).normalized();
+ return eyedir.dot(p_pos) < (eyedir.dot(t.origin)+near);
+}
+
Point2 Camera::unproject_position(const Vector3& p_pos) const {
if (!is_inside_tree()) {
@@ -666,6 +673,7 @@ void Camera::_bind_methods() {
ObjectTypeDB::bind_method( _MD("project_local_ray_normal","screen_point"), &Camera::project_local_ray_normal);
ObjectTypeDB::bind_method( _MD("project_ray_origin","screen_point"), &Camera::project_ray_origin);
ObjectTypeDB::bind_method( _MD("unproject_position","world_point"), &Camera::unproject_position);
+ ObjectTypeDB::bind_method( _MD("is_position_behind","world_point"), &Camera::is_position_behind);
ObjectTypeDB::bind_method( _MD("project_position","screen_point"), &Camera::project_position);
ObjectTypeDB::bind_method( _MD("set_perspective","fov","z_near","z_far"),&Camera::set_perspective );
ObjectTypeDB::bind_method( _MD("set_orthogonal","size","z_near","z_far"),&Camera::set_orthogonal );
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index a3f59231da..e21f4865ec 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -126,6 +126,7 @@ public:
Vector3 project_ray_origin(const Point2& p_point) const;
Vector3 project_local_ray_normal(const Point2& p_point) const;
Point2 unproject_position(const Vector3& p_pos) const;
+ bool is_position_behind(const Vector3& p_pos) const;
Vector3 project_position(const Point2& p_point) const;
void set_visible_layers(uint32_t p_layers);