summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-11-23 07:04:55 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-11-23 07:04:55 -0300
commit7cf8d75cf8c49d02a72eac1d5342808526fa54ef (patch)
tree01fd616a0d376dccb227388365eba46674e151b5 /servers
parentb72ca046051018628a31bc458dd730384ebddbe8 (diff)
WIP immediates and proper buffers swapping
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer.h3
-rw-r--r--servers/visual/visual_server_raster.h1
-rw-r--r--servers/visual/visual_server_scene.cpp25
-rw-r--r--servers/visual_server.cpp4
-rw-r--r--servers/visual_server.h2
5 files changed, 24 insertions, 11 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 08d1995725..5f536b8fd4 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -285,7 +285,6 @@ public:
virtual RID immediate_create()=0;
virtual void immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture=RID())=0;
virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex)=0;
- virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex)=0;
virtual void immediate_normal(RID p_immediate,const Vector3& p_normal)=0;
virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent)=0;
virtual void immediate_color(RID p_immediate,const Color& p_color)=0;
@@ -295,6 +294,8 @@ public:
virtual void immediate_clear(RID p_immediate)=0;
virtual void immediate_set_material(RID p_immediate,RID p_material)=0;
virtual RID immediate_get_material(RID p_immediate) const=0;
+ virtual AABB immediate_get_aabb(RID p_immediate) const=0;
+
/* SKELETON API */
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 675e2d4aef..c3afadb393 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -731,7 +731,6 @@ public:
BIND0R(RID,immediate_create)
BIND3(immediate_begin,RID,PrimitiveType,RID)
BIND2(immediate_vertex,RID,const Vector3&)
- BIND2(immediate_vertex_2d,RID,const Vector3&)
BIND2(immediate_normal,RID,const Vector3&)
BIND2(immediate_tangent,RID,const Plane&)
BIND2(immediate_color,RID,const Color&)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index f25e5bc943..2439eacd75 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -557,12 +557,9 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){
instance->base_data=light;
} break;
- case VS::INSTANCE_MESH: {
-
- InstanceGeometryData *geom = memnew( InstanceGeometryData );
- instance->base_data=geom;
- } break;
- case VS::INSTANCE_MULTIMESH: {
+ case VS::INSTANCE_MESH:
+ case VS::INSTANCE_MULTIMESH:
+ case VS::INSTANCE_IMMEDIATE: {
InstanceGeometryData *geom = memnew( InstanceGeometryData );
instance->base_data=geom;
@@ -1147,13 +1144,14 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) {
new_aabb = VSG::storage->multimesh_get_aabb(p_instance->base);
} break;
-#if 0
case VisualServer::INSTANCE_IMMEDIATE: {
- new_aabb = rasterizer->immediate_get_aabb(p_instance->base);
+ new_aabb = VSG::storage->immediate_get_aabb(p_instance->base);
} break;
+#if 0
+
case VisualServer::INSTANCE_PARTICLES: {
new_aabb = rasterizer->particles_get_aabb(p_instance->base);
@@ -2309,6 +2307,17 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
can_cast_shadows=false;
}
}
+ } else if (p_instance->base_type==VS::INSTANCE_IMMEDIATE) {
+
+ RID mat = VSG::storage->immediate_get_material(p_instance->base);
+
+ if (!mat.is_valid() || VSG::storage->material_casts_shadows(mat)) {
+ can_cast_shadows=true;
+ } else {
+ can_cast_shadows=false;
+ }
+
+
}
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 30d6b76b8e..27b08c4c50 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1648,6 +1648,10 @@ void VisualServer::mesh_add_surface_from_planes( RID p_mesh, const DVector<Plane
}
+void VisualServer::immediate_vertex_2d(RID p_immediate,const Vector2& p_vertex) {
+ immediate_vertex(p_immediate,Vector3(p_vertex.x,p_vertex.y,0));
+}
+
RID VisualServer::instance_create2(RID p_base, RID p_scenario) {
RID instance = instance_create();
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 7d561bee38..0fd0733727 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -319,7 +319,7 @@ public:
virtual RID immediate_create()=0;
virtual void immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture=RID())=0;
virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex)=0;
- virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex)=0;
+ virtual void immediate_vertex_2d(RID p_immediate,const Vector2& p_vertex);
virtual void immediate_normal(RID p_immediate,const Vector3& p_normal)=0;
virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent)=0;
virtual void immediate_color(RID p_immediate,const Color& p_color)=0;