mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-12-21 16:56:50 +01:00
Removed the immediate mode api.
This commit is contained in:
parent
3a034b011c
commit
38ed779965
@ -405,22 +405,6 @@ public:
|
||||
MMInterpolator *_multimesh_get_interpolator(RID p_multimesh) const { return nullptr; }
|
||||
void multimesh_attach_canvas_item(RID p_multimesh, RID p_canvas_item, bool p_attach) {}
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
RID immediate_create() { return RID(); }
|
||||
void immediate_begin(RID p_immediate, RS::PrimitiveType p_rimitive, RID p_texture = RID()) {}
|
||||
void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {}
|
||||
void immediate_normal(RID p_immediate, const Vector3 &p_normal) {}
|
||||
void immediate_tangent(RID p_immediate, const Plane &p_tangent) {}
|
||||
void immediate_color(RID p_immediate, const Color &p_color) {}
|
||||
void immediate_uv(RID p_immediate, const Vector2 &tex_uv) {}
|
||||
void immediate_uv2(RID p_immediate, const Vector2 &tex_uv) {}
|
||||
void immediate_end(RID p_immediate) {}
|
||||
void immediate_clear(RID p_immediate) {}
|
||||
void immediate_set_material(RID p_immediate, RID p_material) {}
|
||||
RID immediate_get_material(RID p_immediate) const { return RID(); }
|
||||
AABB immediate_get_aabb(RID p_immediate) const { return AABB(); }
|
||||
|
||||
/* Light API */
|
||||
|
||||
RID light_create(RS::LightType p_type) { return RID(); }
|
||||
|
@ -1107,14 +1107,6 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
|
||||
}
|
||||
} break;
|
||||
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
RasterizerStorageGLES2::Immediate *im = storage->immediate_owner.getptr(instance->base);
|
||||
ERR_CONTINUE(!im);
|
||||
|
||||
_add_geometry(im, instance, nullptr, -1, p_depth_pass, p_shadow_pass);
|
||||
|
||||
} break;
|
||||
|
||||
default: {
|
||||
}
|
||||
}
|
||||
@ -1351,9 +1343,6 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element) {
|
||||
|
||||
} break;
|
||||
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
} break;
|
||||
|
||||
default: {
|
||||
}
|
||||
}
|
||||
@ -1450,116 +1439,6 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
||||
}
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
const RasterizerStorageGLES2::Immediate *im = static_cast<const RasterizerStorageGLES2::Immediate *>(p_element->geometry);
|
||||
|
||||
if (im->building) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool restore_tex = false;
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer);
|
||||
|
||||
for (const List<RasterizerStorageGLES2::Immediate::Chunk>::Element *E = im->chunks.front(); E; E = E->next()) {
|
||||
const RasterizerStorageGLES2::Immediate::Chunk &c = E->get();
|
||||
|
||||
if (c.vertices.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int vertices = c.vertices.size();
|
||||
|
||||
uint32_t buf_ofs = 0;
|
||||
|
||||
storage->info.render.vertices_count += vertices;
|
||||
|
||||
if (c.texture.is_valid() && storage->texture_owner.owns(c.texture)) {
|
||||
RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(c.texture);
|
||||
|
||||
if (t->redraw_if_visible) {
|
||||
RenderingServerRaster::redraw_request(false);
|
||||
}
|
||||
t = t->get_ptr();
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (t->detect_3d) {
|
||||
t->detect_3d(t->detect_3d_ud);
|
||||
}
|
||||
#endif
|
||||
if (t->render_target) {
|
||||
t->render_target->used_in_frame = true;
|
||||
}
|
||||
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
glBindTexture(t->target, t->tex_id);
|
||||
restore_tex = true;
|
||||
} else if (restore_tex) {
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, state.current_main_tex);
|
||||
restore_tex = false;
|
||||
}
|
||||
|
||||
if (!c.normals.empty()) {
|
||||
glEnableVertexAttribArray(RS::ARRAY_NORMAL);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.normals.ptr());
|
||||
glVertexAttribPointer(RS::ARRAY_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Vector3) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(RS::ARRAY_NORMAL);
|
||||
}
|
||||
|
||||
if (!c.tangents.empty()) {
|
||||
glEnableVertexAttribArray(RS::ARRAY_TANGENT);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Plane) * vertices, c.tangents.ptr());
|
||||
glVertexAttribPointer(RS::ARRAY_TANGENT, 4, GL_FLOAT, GL_FALSE, sizeof(Plane), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Plane) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(RS::ARRAY_TANGENT);
|
||||
}
|
||||
|
||||
if (!c.colors.empty()) {
|
||||
glEnableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Color) * vertices, c.colors.ptr());
|
||||
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Color) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
}
|
||||
|
||||
if (!c.uvs.empty()) {
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uvs.ptr());
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Vector2) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
if (!c.uv2s.empty()) {
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV2);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uv2s.ptr());
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV2, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Vector2) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV2);
|
||||
}
|
||||
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.vertices.ptr());
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
|
||||
glDrawArrays(gl_primitive[c.primitive], 0, c.vertices.size());
|
||||
}
|
||||
|
||||
if (restore_tex) {
|
||||
WRAPPED_GL_ACTIVE_TEXTURE(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, state.current_main_tex);
|
||||
restore_tex = false;
|
||||
}
|
||||
|
||||
} break;
|
||||
default: {
|
||||
}
|
||||
@ -2124,8 +2003,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_PHYSICAL_LIGHT_ATTENUATION, storage->config.use_physical_light_attenuation);
|
||||
|
||||
bool octahedral_compression = e->instance->base_type != RS::INSTANCE_IMMEDIATE &&
|
||||
((RasterizerStorageGLES2::Surface *)e->geometry)->format & RenderingServer::ArrayFormat::ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION &&
|
||||
bool octahedral_compression = ((RasterizerStorageGLES2::Surface *)e->geometry)->format & RenderingServer::ArrayFormat::ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION &&
|
||||
(((RasterizerStorageGLES2::Surface *)e->geometry)->blend_shape_data.empty() || ((RasterizerStorageGLES2::Surface *)e->geometry)->blend_shape_buffer_size == 0);
|
||||
if (octahedral_compression != prev_octahedral_compression) {
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::ENABLE_OCTAHEDRAL_COMPRESSION, octahedral_compression);
|
||||
|
@ -3240,142 +3240,6 @@ void RasterizerStorageGLES2::update_dirty_multimeshes() {
|
||||
}
|
||||
}
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
RID RasterizerStorageGLES2::immediate_create() {
|
||||
Immediate *im = memnew(Immediate);
|
||||
return immediate_owner.make_rid(im);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_begin(RID p_immediate, RS::PrimitiveType p_primitive, RID p_texture) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(im->building);
|
||||
|
||||
Immediate::Chunk ic;
|
||||
ic.texture = p_texture;
|
||||
ic.primitive = p_primitive;
|
||||
im->chunks.push_back(ic);
|
||||
im->mask = 0;
|
||||
im->building = true;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
Immediate::Chunk *c = &im->chunks.back()->get();
|
||||
|
||||
if (c->vertices.empty() && im->chunks.size() == 1) {
|
||||
im->aabb.position = p_vertex;
|
||||
im->aabb.size = Vector3();
|
||||
} else {
|
||||
im->aabb.expand_to(p_vertex);
|
||||
}
|
||||
|
||||
if (im->mask & RS::ARRAY_FORMAT_NORMAL) {
|
||||
c->normals.push_back(chunk_normal);
|
||||
}
|
||||
if (im->mask & RS::ARRAY_FORMAT_TANGENT) {
|
||||
c->tangents.push_back(chunk_tangent);
|
||||
}
|
||||
if (im->mask & RS::ARRAY_FORMAT_COLOR) {
|
||||
c->colors.push_back(chunk_color);
|
||||
}
|
||||
if (im->mask & RS::ARRAY_FORMAT_TEX_UV) {
|
||||
c->uvs.push_back(chunk_uv);
|
||||
}
|
||||
if (im->mask & RS::ARRAY_FORMAT_TEX_UV2) {
|
||||
c->uv2s.push_back(chunk_uv2);
|
||||
}
|
||||
im->mask |= RS::ARRAY_FORMAT_VERTEX;
|
||||
c->vertices.push_back(p_vertex);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_normal(RID p_immediate, const Vector3 &p_normal) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
im->mask |= RS::ARRAY_FORMAT_NORMAL;
|
||||
chunk_normal = p_normal;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_tangent(RID p_immediate, const Plane &p_tangent) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
im->mask |= RS::ARRAY_FORMAT_TANGENT;
|
||||
chunk_tangent = p_tangent;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_color(RID p_immediate, const Color &p_color) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
im->mask |= RS::ARRAY_FORMAT_COLOR;
|
||||
chunk_color = p_color;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_uv(RID p_immediate, const Vector2 &tex_uv) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
im->mask |= RS::ARRAY_FORMAT_TEX_UV;
|
||||
chunk_uv = tex_uv;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_uv2(RID p_immediate, const Vector2 &tex_uv) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
im->mask |= RS::ARRAY_FORMAT_TEX_UV2;
|
||||
chunk_uv2 = tex_uv;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_end(RID p_immediate) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(!im->building);
|
||||
|
||||
im->building = false;
|
||||
im->instance_change_notify(true, false);
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_clear(RID p_immediate) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
ERR_FAIL_COND(im->building);
|
||||
|
||||
im->chunks.clear();
|
||||
im->instance_change_notify(true, false);
|
||||
}
|
||||
|
||||
AABB RasterizerStorageGLES2::immediate_get_aabb(RID p_immediate) const {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND_V(!im, AABB());
|
||||
return im->aabb;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::immediate_set_material(RID p_immediate, RID p_material) {
|
||||
Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND(!im);
|
||||
|
||||
im->material = p_material;
|
||||
im->instance_change_notify(false, true);
|
||||
}
|
||||
|
||||
RID RasterizerStorageGLES2::immediate_get_material(RID p_immediate) const {
|
||||
const Immediate *im = immediate_owner.get(p_immediate);
|
||||
ERR_FAIL_COND_V(!im, RID());
|
||||
return im->material;
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES2::update_dirty_blend_shapes() {
|
||||
while (blend_shapes_update_list.first()) {
|
||||
Mesh *mesh = blend_shapes_update_list.first()->self();
|
||||
@ -4123,10 +3987,6 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
|
||||
inst = multimesh_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
inst = immediate_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
case RS::INSTANCE_REFLECTION_PROBE: {
|
||||
inst = reflection_probe_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
@ -4155,10 +4015,6 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
|
||||
inst = multimesh_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
inst = immediate_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
} break;
|
||||
case RS::INSTANCE_REFLECTION_PROBE: {
|
||||
inst = reflection_probe_owner.getornull(p_base);
|
||||
ERR_FAIL_COND(!inst);
|
||||
@ -5069,8 +4925,6 @@ RS::InstanceType RasterizerStorageGLES2::get_base_type(RID p_rid) const {
|
||||
return RS::INSTANCE_LIGHT;
|
||||
} else if (multimesh_owner.owns(p_rid)) {
|
||||
return RS::INSTANCE_MULTIMESH;
|
||||
} else if (immediate_owner.owns(p_rid)) {
|
||||
return RS::INSTANCE_IMMEDIATE;
|
||||
} else if (reflection_probe_owner.owns(p_rid)) {
|
||||
return RS::INSTANCE_REFLECTION_PROBE;
|
||||
} else {
|
||||
@ -5209,14 +5063,6 @@ bool RasterizerStorageGLES2::free(RID p_rid) {
|
||||
multimesh_owner.free(p_rid);
|
||||
memdelete(multimesh);
|
||||
|
||||
return true;
|
||||
} else if (immediate_owner.owns(p_rid)) {
|
||||
Immediate *im = immediate_owner.get(p_rid);
|
||||
im->instance_remove_deps();
|
||||
|
||||
immediate_owner.free(p_rid);
|
||||
memdelete(im);
|
||||
|
||||
return true;
|
||||
} else if (light_owner.owns(p_rid)) {
|
||||
Light *light = light_owner.get(p_rid);
|
||||
|
@ -818,53 +818,6 @@ public:
|
||||
|
||||
void update_dirty_multimeshes();
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
struct Immediate : public Geometry {
|
||||
struct Chunk {
|
||||
RID texture;
|
||||
RS::PrimitiveType primitive;
|
||||
Vector<Vector3> vertices;
|
||||
Vector<Vector3> normals;
|
||||
Vector<Plane> tangents;
|
||||
Vector<Color> colors;
|
||||
Vector<Vector2> uvs;
|
||||
Vector<Vector2> uv2s;
|
||||
};
|
||||
|
||||
List<Chunk> chunks;
|
||||
bool building;
|
||||
int mask;
|
||||
AABB aabb;
|
||||
|
||||
Immediate() {
|
||||
type = GEOMETRY_IMMEDIATE;
|
||||
building = false;
|
||||
}
|
||||
};
|
||||
|
||||
Vector3 chunk_normal;
|
||||
Plane chunk_tangent;
|
||||
Color chunk_color;
|
||||
Vector2 chunk_uv;
|
||||
Vector2 chunk_uv2;
|
||||
|
||||
mutable RID_Owner<Immediate> immediate_owner;
|
||||
|
||||
virtual RID immediate_create();
|
||||
virtual void immediate_begin(RID p_immediate, RS::PrimitiveType p_primitive, RID p_texture = RID());
|
||||
virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex);
|
||||
virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal);
|
||||
virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent);
|
||||
virtual void immediate_color(RID p_immediate, const Color &p_color);
|
||||
virtual void immediate_uv(RID p_immediate, const Vector2 &tex_uv);
|
||||
virtual void immediate_uv2(RID p_immediate, const Vector2 &tex_uv);
|
||||
virtual void immediate_end(RID p_immediate);
|
||||
virtual void immediate_clear(RID p_immediate);
|
||||
virtual void immediate_set_material(RID p_immediate, RID p_material);
|
||||
virtual RID immediate_get_material(RID p_immediate) const;
|
||||
virtual AABB immediate_get_aabb(RID p_immediate) const;
|
||||
|
||||
/* Light API */
|
||||
|
||||
struct Light : Instantiable {
|
||||
|
@ -365,22 +365,6 @@ private:
|
||||
void _multimesh_add_to_interpolation_lists(RID p_multimesh, MMInterpolator &r_mmi);
|
||||
|
||||
public:
|
||||
/* IMMEDIATE API */
|
||||
|
||||
virtual RID immediate_create() = 0;
|
||||
virtual void immediate_begin(RID p_immediate, RS::PrimitiveType p_rimitive, RID p_texture = RID()) = 0;
|
||||
virtual void immediate_vertex(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;
|
||||
virtual void immediate_uv(RID p_immediate, const Vector2 &tex_uv) = 0;
|
||||
virtual void immediate_uv2(RID p_immediate, const Vector2 &tex_uv) = 0;
|
||||
virtual void immediate_end(RID p_immediate) = 0;
|
||||
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;
|
||||
|
||||
/* Light API */
|
||||
|
||||
virtual RID light_create(RS::LightType p_type) = 0;
|
||||
|
@ -283,21 +283,6 @@ public:
|
||||
BIND2(multimesh_set_visible_instances, RID, int)
|
||||
BIND1RC(int, multimesh_get_visible_instances, RID)
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
BIND0R(RID, immediate_create)
|
||||
BIND3(immediate_begin, RID, PrimitiveType, RID)
|
||||
BIND2(immediate_vertex, RID, const Vector3 &)
|
||||
BIND2(immediate_normal, RID, const Vector3 &)
|
||||
BIND2(immediate_tangent, RID, const Plane &)
|
||||
BIND2(immediate_color, RID, const Color &)
|
||||
BIND2(immediate_uv, RID, const Vector2 &)
|
||||
BIND2(immediate_uv2, RID, const Vector2 &)
|
||||
BIND1(immediate_end, RID)
|
||||
BIND1(immediate_clear, RID)
|
||||
BIND2(immediate_set_material, RID, RID)
|
||||
BIND1RC(RID, immediate_get_material, RID)
|
||||
|
||||
/* Light API */
|
||||
|
||||
BIND0R(RID, directional_light_create)
|
||||
|
@ -539,8 +539,7 @@ void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) {
|
||||
instance->base_data = light;
|
||||
} break;
|
||||
case RS::INSTANCE_MESH:
|
||||
case RS::INSTANCE_MULTIMESH:
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
case RS::INSTANCE_MULTIMESH: {
|
||||
InstanceGeometryData *geom = memnew(InstanceGeometryData);
|
||||
instance->base_data = geom;
|
||||
if (instance->base_type == RS::INSTANCE_MESH) {
|
||||
@ -1039,7 +1038,7 @@ void RenderingServerScene::instance_set_visible(RID p_instance, bool p_visible)
|
||||
}
|
||||
}
|
||||
inline bool is_geometry_instance(RenderingServer::InstanceType p_type) {
|
||||
return p_type == RS::INSTANCE_MESH || p_type == RS::INSTANCE_MULTIMESH || p_type == RS::INSTANCE_IMMEDIATE;
|
||||
return p_type == RS::INSTANCE_MESH || p_type == RS::INSTANCE_MULTIMESH;
|
||||
}
|
||||
|
||||
void RenderingServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb) {
|
||||
@ -1332,14 +1331,6 @@ void RenderingServerScene::_update_instance_aabb(Instance *p_instance) {
|
||||
new_aabb = RSG::storage->multimesh_get_aabb(p_instance->base);
|
||||
}
|
||||
|
||||
} break;
|
||||
case RenderingServer::INSTANCE_IMMEDIATE: {
|
||||
if (p_instance->custom_aabb) {
|
||||
new_aabb = *p_instance->custom_aabb;
|
||||
} else {
|
||||
new_aabb = RSG::storage->immediate_get_aabb(p_instance->base);
|
||||
}
|
||||
|
||||
} break;
|
||||
case RenderingServer::INSTANCE_LIGHT: {
|
||||
new_aabb = RSG::storage->light_get_aabb(p_instance->base);
|
||||
@ -1452,14 +1443,6 @@ void RenderingServerScene::_update_dirty_instance(Instance *p_instance) {
|
||||
can_cast_shadows = false;
|
||||
}
|
||||
}
|
||||
} else if (p_instance->base_type == RS::INSTANCE_IMMEDIATE) {
|
||||
RID mat = RSG::storage->immediate_get_material(p_instance->base);
|
||||
|
||||
can_cast_shadows = !mat.is_valid() || RSG::storage->material_casts_shadows(mat);
|
||||
|
||||
if (mat.is_valid() && RSG::storage->material_is_animated(mat)) {
|
||||
is_animated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,6 @@ void RenderingServerWrapMT::finish() {
|
||||
material_free_cached_ids();
|
||||
mesh_free_cached_ids();
|
||||
multimesh_free_cached_ids();
|
||||
immediate_free_cached_ids();
|
||||
directional_light_free_cached_ids();
|
||||
omni_light_free_cached_ids();
|
||||
spot_light_free_cached_ids();
|
||||
|
@ -209,21 +209,6 @@ public:
|
||||
FUNC2(multimesh_set_visible_instances, RID, int)
|
||||
FUNC1RC(int, multimesh_get_visible_instances, RID)
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
FUNCRID(immediate)
|
||||
FUNC3(immediate_begin, RID, PrimitiveType, RID)
|
||||
FUNC2(immediate_vertex, RID, const Vector3 &)
|
||||
FUNC2(immediate_normal, RID, const Vector3 &)
|
||||
FUNC2(immediate_tangent, RID, const Plane &)
|
||||
FUNC2(immediate_color, RID, const Color &)
|
||||
FUNC2(immediate_uv, RID, const Vector2 &)
|
||||
FUNC2(immediate_uv2, RID, const Vector2 &)
|
||||
FUNC1(immediate_end, RID)
|
||||
FUNC1(immediate_clear, RID)
|
||||
FUNC2(immediate_set_material, RID, RID)
|
||||
FUNC1RC(RID, immediate_get_material, RID)
|
||||
|
||||
/* Light API */
|
||||
|
||||
FUNCRID(directional_light)
|
||||
|
@ -1919,21 +1919,6 @@ void RenderingServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("multimesh_set_physics_interpolated", "multimesh", "interpolated"), &RenderingServer::multimesh_set_physics_interpolated);
|
||||
ClassDB::bind_method(D_METHOD("multimesh_set_physics_interpolation_quality", "multimesh", "quality"), &RenderingServer::multimesh_set_physics_interpolation_quality);
|
||||
ClassDB::bind_method(D_METHOD("multimesh_instance_reset_physics_interpolation", "multimesh", "index"), &RenderingServer::multimesh_instance_reset_physics_interpolation);
|
||||
#ifndef _3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("immediate_create"), &RenderingServer::immediate_create);
|
||||
ClassDB::bind_method(D_METHOD("immediate_begin", "immediate", "primitive", "texture"), &RenderingServer::immediate_begin, DEFVAL(RID()));
|
||||
ClassDB::bind_method(D_METHOD("immediate_vertex", "immediate", "vertex"), &RenderingServer::immediate_vertex);
|
||||
ClassDB::bind_method(D_METHOD("immediate_vertex_2d", "immediate", "vertex"), &RenderingServer::immediate_vertex_2d);
|
||||
ClassDB::bind_method(D_METHOD("immediate_normal", "immediate", "normal"), &RenderingServer::immediate_normal);
|
||||
ClassDB::bind_method(D_METHOD("immediate_tangent", "immediate", "tangent"), &RenderingServer::immediate_tangent);
|
||||
ClassDB::bind_method(D_METHOD("immediate_color", "immediate", "color"), &RenderingServer::immediate_color);
|
||||
ClassDB::bind_method(D_METHOD("immediate_uv", "immediate", "tex_uv"), &RenderingServer::immediate_uv);
|
||||
ClassDB::bind_method(D_METHOD("immediate_uv2", "immediate", "tex_uv"), &RenderingServer::immediate_uv2);
|
||||
ClassDB::bind_method(D_METHOD("immediate_end", "immediate"), &RenderingServer::immediate_end);
|
||||
ClassDB::bind_method(D_METHOD("immediate_clear", "immediate"), &RenderingServer::immediate_clear);
|
||||
ClassDB::bind_method(D_METHOD("immediate_set_material", "immediate", "material"), &RenderingServer::immediate_set_material);
|
||||
ClassDB::bind_method(D_METHOD("immediate_get_material", "immediate"), &RenderingServer::immediate_get_material);
|
||||
#endif
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("directional_light_create"), &RenderingServer::directional_light_create);
|
||||
@ -2327,7 +2312,6 @@ void RenderingServer::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(INSTANCE_NONE);
|
||||
BIND_ENUM_CONSTANT(INSTANCE_MESH);
|
||||
BIND_ENUM_CONSTANT(INSTANCE_MULTIMESH);
|
||||
BIND_ENUM_CONSTANT(INSTANCE_IMMEDIATE);
|
||||
BIND_ENUM_CONSTANT(INSTANCE_LIGHT);
|
||||
BIND_ENUM_CONSTANT(INSTANCE_REFLECTION_PROBE);
|
||||
BIND_ENUM_CONSTANT(INSTANCE_MAX);
|
||||
@ -2439,10 +2423,6 @@ void RenderingServer::mesh_add_surface_from_planes(RID p_mesh, const PoolVector<
|
||||
mesh_add_surface_from_mesh_data(p_mesh, mdata);
|
||||
}
|
||||
|
||||
void RenderingServer::immediate_vertex_2d(RID p_immediate, const Vector2 &p_vertex) {
|
||||
immediate_vertex(p_immediate, Vector3(p_vertex.x, p_vertex.y, 0));
|
||||
}
|
||||
|
||||
RID RenderingServer::instance_create2(RID p_base, RID p_scenario) {
|
||||
RID instance = instance_create();
|
||||
instance_set_base(instance, p_base);
|
||||
|
@ -387,22 +387,6 @@ public:
|
||||
virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0;
|
||||
virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0;
|
||||
|
||||
/* IMMEDIATE API */
|
||||
|
||||
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 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;
|
||||
virtual void immediate_uv(RID p_immediate, const Vector2 &tex_uv) = 0;
|
||||
virtual void immediate_uv2(RID p_immediate, const Vector2 &tex_uv) = 0;
|
||||
virtual void immediate_end(RID p_immediate) = 0;
|
||||
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;
|
||||
|
||||
/* Light API */
|
||||
|
||||
enum LightType {
|
||||
@ -655,12 +639,11 @@ public:
|
||||
INSTANCE_NONE,
|
||||
INSTANCE_MESH,
|
||||
INSTANCE_MULTIMESH,
|
||||
INSTANCE_IMMEDIATE,
|
||||
INSTANCE_LIGHT,
|
||||
INSTANCE_REFLECTION_PROBE,
|
||||
INSTANCE_MAX,
|
||||
|
||||
INSTANCE_GEOMETRY_MASK = (1 << INSTANCE_MESH) | (1 << INSTANCE_MULTIMESH) | (1 << INSTANCE_IMMEDIATE)
|
||||
INSTANCE_GEOMETRY_MASK = (1 << INSTANCE_MESH) | (1 << INSTANCE_MULTIMESH)
|
||||
};
|
||||
|
||||
virtual RID instance_create2(RID p_base, RID p_scenario);
|
||||
|
Loading…
Reference in New Issue
Block a user