mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-17 22:17:19 +01:00
Removed the remnants of RasterizerScene.
This commit is contained in:
parent
dfeeb606e8
commit
88e8d53c52
@ -36,19 +36,6 @@
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class RasterizerSceneDummy : public RasterizerScene {
|
||||
public:
|
||||
void render_scene(const Transform &p_cam_transform, const Projection &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count) {}
|
||||
|
||||
void set_scene_pass(uint64_t p_pass) {}
|
||||
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) {}
|
||||
|
||||
bool free(RID p_rid) { return true; }
|
||||
|
||||
RasterizerSceneDummy() {}
|
||||
~RasterizerSceneDummy() {}
|
||||
};
|
||||
|
||||
class RasterizerStorageDummy : public RasterizerStorage {
|
||||
public:
|
||||
/* TEXTURE API */
|
||||
@ -214,9 +201,6 @@ public:
|
||||
bool material_is_animated(RID p_material) { return false; }
|
||||
bool material_casts_shadows(RID p_material) { return false; }
|
||||
|
||||
void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {}
|
||||
void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {}
|
||||
|
||||
/* MESH API */
|
||||
|
||||
RID mesh_create() {
|
||||
@ -460,7 +444,6 @@ class RasterizerDummy : public Rasterizer {
|
||||
protected:
|
||||
RasterizerCanvasDummy canvas;
|
||||
RasterizerStorageDummy storage;
|
||||
RasterizerSceneDummy scene;
|
||||
|
||||
public:
|
||||
RasterizerStorage *get_storage() { return &storage; }
|
||||
|
@ -1670,32 +1670,6 @@ bool RasterizerStorageGLES2::material_uses_ensure_correct_normals(RID p_material
|
||||
return material->shader->spatial.uses_ensure_correct_normals;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {
|
||||
Material *material = material_owner.getornull(p_material);
|
||||
ERR_FAIL_COND(!material);
|
||||
|
||||
RBMap<RasterizerScene::InstanceBase *, int>::Element *E = material->instance_owners.find(p_instance);
|
||||
if (E) {
|
||||
E->get()++;
|
||||
} else {
|
||||
material->instance_owners[p_instance] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {
|
||||
Material *material = material_owner.getornull(p_material);
|
||||
ERR_FAIL_COND(!material);
|
||||
|
||||
RBMap<RasterizerScene::InstanceBase *, int>::Element *E = material->instance_owners.find(p_instance);
|
||||
ERR_FAIL_COND(!E);
|
||||
|
||||
E->get()--;
|
||||
|
||||
if (E->get() == 0) {
|
||||
material->instance_owners.erase(E);
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::material_set_render_priority(RID p_material, int priority) {
|
||||
ERR_FAIL_COND(priority < RS::MATERIAL_RENDER_PRIORITY_MIN);
|
||||
ERR_FAIL_COND(priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
|
||||
@ -3233,53 +3207,6 @@ void RasterizerStorageGLES2::update_dirty_blend_shapes() {
|
||||
}
|
||||
}
|
||||
|
||||
////////
|
||||
|
||||
void RasterizerStorageGLES2::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
|
||||
Instantiable *inst = nullptr;
|
||||
switch (p_instance->base_type) {
|
||||
case RS::INSTANCE_MESH: {
|
||||
inst = mesh_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
case RS::INSTANCE_MULTIMESH: {
|
||||
inst = multimesh_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
default: {
|
||||
ERR_FAIL();
|
||||
}
|
||||
}
|
||||
|
||||
inst->instance_list.add(&p_instance->dependency_item);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
|
||||
Instantiable *inst = nullptr;
|
||||
|
||||
switch (p_instance->base_type) {
|
||||
case RS::INSTANCE_MESH: {
|
||||
inst = mesh_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
case RS::INSTANCE_MULTIMESH: {
|
||||
inst = multimesh_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
default: {
|
||||
ERR_FAIL();
|
||||
}
|
||||
}
|
||||
|
||||
inst->instance_list.remove(&p_instance->dependency_item);
|
||||
}
|
||||
|
||||
/* RENDER TARGET */
|
||||
|
||||
void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
|
||||
@ -4084,24 +4011,6 @@ bool RasterizerStorageGLES2::free(RID p_rid) {
|
||||
g->material = RID();
|
||||
}
|
||||
|
||||
for (RBMap<RasterizerScene::InstanceBase *, int>::Element *E = m->instance_owners.front(); E; E = E->next()) {
|
||||
RasterizerScene::InstanceBase *ins = E->key();
|
||||
|
||||
if (ins->material_override == p_rid) {
|
||||
ins->material_override = RID();
|
||||
}
|
||||
|
||||
if (ins->material_overlay == p_rid) {
|
||||
ins->material_overlay = RID();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ins->materials.size(); i++) {
|
||||
if (ins->materials[i] == p_rid) {
|
||||
ins->materials.write[i] = RID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
material_owner.free(p_rid);
|
||||
memdelete(m);
|
||||
|
||||
|
@ -172,23 +172,10 @@ public:
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Instantiable : public RID_Data {
|
||||
SelfList<RasterizerScene::InstanceBase>::List instance_list;
|
||||
|
||||
_FORCE_INLINE_ void instance_change_notify(bool p_aabb, bool p_materials) {
|
||||
SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first();
|
||||
while (instances) {
|
||||
instances->self()->base_changed(p_aabb, p_materials);
|
||||
instances = instances->next();
|
||||
}
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void instance_remove_deps() {
|
||||
SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first();
|
||||
|
||||
while (instances) {
|
||||
instances->self()->base_removed();
|
||||
instances = instances->next();
|
||||
}
|
||||
}
|
||||
|
||||
Instantiable() {}
|
||||
@ -542,7 +529,6 @@ public:
|
||||
uint64_t last_pass;
|
||||
|
||||
RBMap<Geometry *, int> geometry_owners;
|
||||
RBMap<RasterizerScene::InstanceBase *, int> instance_owners;
|
||||
|
||||
bool can_cast_shadow_cache;
|
||||
bool is_animated_cache;
|
||||
@ -586,9 +572,6 @@ public:
|
||||
virtual bool material_uses_tangents(RID p_material);
|
||||
virtual bool material_uses_ensure_correct_normals(RID p_material);
|
||||
|
||||
virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance);
|
||||
virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance);
|
||||
|
||||
virtual void material_set_render_priority(RID p_material, int priority);
|
||||
|
||||
void update_dirty_materials();
|
||||
@ -810,14 +793,6 @@ public:
|
||||
|
||||
void update_dirty_multimeshes();
|
||||
|
||||
/* INSTANCE */
|
||||
|
||||
virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance);
|
||||
virtual void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance);
|
||||
|
||||
virtual void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance);
|
||||
virtual void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance);
|
||||
|
||||
/* RENDER TARGET */
|
||||
|
||||
struct RenderTarget : public RID_Data {
|
||||
|
@ -36,85 +36,6 @@
|
||||
|
||||
#include "core/containers/self_list.h"
|
||||
|
||||
class RasterizerScene {
|
||||
public:
|
||||
struct InstanceBase : RID_Data {
|
||||
RS::InstanceType base_type;
|
||||
RID base;
|
||||
|
||||
RID skeleton;
|
||||
RID material_override;
|
||||
RID material_overlay;
|
||||
|
||||
// This is the main transform to be drawn with ..
|
||||
// This will either be the interpolated transform (when using fixed timestep interpolation)
|
||||
// or the ONLY transform (when not using FTI).
|
||||
Transform transform;
|
||||
|
||||
// for interpolation we store the current transform (this physics tick)
|
||||
// and the transform in the previous tick
|
||||
Transform transform_curr;
|
||||
Transform transform_prev;
|
||||
|
||||
int depth_layer;
|
||||
uint32_t layer_mask;
|
||||
|
||||
//RID sampled_light;
|
||||
|
||||
Vector<RID> materials;
|
||||
Vector<RID> light_instances;
|
||||
|
||||
PoolVector<float> blend_values;
|
||||
|
||||
//fit in 32 bits
|
||||
bool mirror : 1;
|
||||
bool receive_shadows : 1;
|
||||
bool visible : 1;
|
||||
bool redraw_if_visible : 1;
|
||||
|
||||
bool on_interpolate_list : 1;
|
||||
bool on_interpolate_transform_list : 1;
|
||||
bool interpolated : 1;
|
||||
TransformInterpolator::Method interpolation_method : 3;
|
||||
|
||||
// For fixed timestep interpolation.
|
||||
// Note 32 bits is plenty for checksum, no need for real_t
|
||||
float transform_checksum_curr;
|
||||
float transform_checksum_prev;
|
||||
|
||||
float depth; //used for sorting
|
||||
|
||||
SelfList<InstanceBase> dependency_item;
|
||||
|
||||
virtual void base_removed() = 0;
|
||||
virtual void base_changed(bool p_aabb, bool p_materials) = 0;
|
||||
InstanceBase() :
|
||||
dependency_item(this) {
|
||||
base_type = RS::INSTANCE_NONE;
|
||||
receive_shadows = true;
|
||||
visible = true;
|
||||
depth_layer = 0;
|
||||
layer_mask = 1;
|
||||
redraw_if_visible = false;
|
||||
on_interpolate_list = false;
|
||||
on_interpolate_transform_list = false;
|
||||
interpolated = true;
|
||||
interpolation_method = TransformInterpolator::INTERP_LERP;
|
||||
transform_checksum_curr = 0.0;
|
||||
transform_checksum_prev = 0.0;
|
||||
}
|
||||
};
|
||||
|
||||
virtual void render_scene(const Transform &p_cam_transform, const Projection &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count) = 0;
|
||||
|
||||
virtual void set_scene_pass(uint64_t p_pass) = 0;
|
||||
virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0;
|
||||
|
||||
virtual bool free(RID p_rid) = 0;
|
||||
|
||||
virtual ~RasterizerScene() {}
|
||||
};
|
||||
|
||||
class RasterizerStorage {
|
||||
public:
|
||||
/* TEXTURE API */
|
||||
@ -208,9 +129,6 @@ public:
|
||||
virtual bool material_uses_tangents(RID p_material);
|
||||
virtual bool material_uses_ensure_correct_normals(RID p_material);
|
||||
|
||||
virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) = 0;
|
||||
virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) = 0;
|
||||
|
||||
/* MESH API */
|
||||
|
||||
virtual RID mesh_create() = 0;
|
||||
@ -332,12 +250,6 @@ private:
|
||||
void _multimesh_add_to_interpolation_lists(RID p_multimesh, MMInterpolator &r_mmi);
|
||||
|
||||
public:
|
||||
virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) = 0;
|
||||
virtual void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) = 0;
|
||||
|
||||
virtual void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) = 0;
|
||||
virtual void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) = 0;
|
||||
|
||||
/* RENDER TARGET */
|
||||
|
||||
enum RenderTargetFlags {
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
RasterizerStorage *RenderingServerGlobals::storage = nullptr;
|
||||
RasterizerCanvas *RenderingServerGlobals::canvas_render = nullptr;
|
||||
RasterizerScene *RenderingServerGlobals::scene_render = nullptr;
|
||||
Rasterizer *RenderingServerGlobals::rasterizer = nullptr;
|
||||
|
||||
RenderingServerCanvas *RenderingServerGlobals::canvas = nullptr;
|
||||
|
@ -39,7 +39,6 @@ class RenderingServerGlobals {
|
||||
public:
|
||||
static RasterizerStorage *storage;
|
||||
static RasterizerCanvas *canvas_render;
|
||||
static RasterizerScene *scene_render;
|
||||
static Rasterizer *rasterizer;
|
||||
|
||||
static RenderingServerCanvas *canvas;
|
||||
|
@ -78,9 +78,6 @@ void RenderingServerRaster::free(RID p_rid) {
|
||||
if (RSG::viewport->free(p_rid)) {
|
||||
return;
|
||||
}
|
||||
if (RSG::scene_render->free(p_rid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_MSG("Invalid RID.");
|
||||
}
|
||||
|
@ -128,7 +128,6 @@ void RenderingServerViewport::draw_viewports() {
|
||||
RSG::storage->render_target_set_external_texture(vp->render_target, 0, 0);
|
||||
RSG::rasterizer->set_current_render_target(vp->render_target);
|
||||
|
||||
RSG::scene_render->set_debug_draw_mode(vp->debug_draw);
|
||||
RSG::storage->render_info_begin_capture();
|
||||
|
||||
// render standard mono camera
|
||||
@ -153,7 +152,6 @@ void RenderingServerViewport::draw_viewports() {
|
||||
if (vp->update_mode == RS::VIEWPORT_UPDATE_ONCE) {
|
||||
vp->update_mode = RS::VIEWPORT_UPDATE_DISABLED;
|
||||
}
|
||||
RSG::scene_render->set_debug_draw_mode(RS::VIEWPORT_DEBUG_DRAW_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user