summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/renderer_storage_rd.h
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-01-25 12:20:11 -0300
committerreduz <reduzio@gmail.com>2021-01-25 15:03:15 -0300
commit51d8e32c937f9e0fd75ce86b0d48848255723bd4 (patch)
treec65ed356cc9b4fd634a15827a12cecb7e0e05b05 /servers/rendering/renderer_rd/renderer_storage_rd.h
parentc5c9517e1e03175e9cdc483d3dce27fc531af2be (diff)
Implement shadow meshes
-When importing, a vertex-only version of the mesh is created. -This version is used when rendering shadows, and improves performance by reducing bandwidth -It's automatic, but can optionally be used by users, in case they want to make special versions of geometry for shadow casting.
Diffstat (limited to 'servers/rendering/renderer_rd/renderer_storage_rd.h')
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h
index 2fb66ac573..aa7195232a 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.h
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.h
@@ -478,6 +478,9 @@ private:
List<MeshInstance *> instances;
+ RID shadow_mesh;
+ Set<Mesh *> shadow_owners;
+
Dependency dependency;
};
@@ -1423,6 +1426,7 @@ public:
virtual AABB mesh_get_custom_aabb(RID p_mesh) const;
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton = RID());
+ virtual void mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh);
virtual void mesh_clear(RID p_mesh);
@@ -1461,6 +1465,13 @@ public:
return mesh->surfaces[p_surface_index];
}
+ _FORCE_INLINE_ RID mesh_get_shadow_mesh(RID p_mesh) {
+ Mesh *mesh = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!mesh, RID());
+
+ return mesh->shadow_mesh;
+ }
+
_FORCE_INLINE_ RS::PrimitiveType mesh_surface_get_primitive(void *p_surface) {
Mesh::Surface *surface = reinterpret_cast<Mesh::Surface *>(p_surface);
return surface->primitive;