You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Renaming of servers for coherency.
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
This commit is contained in:
@@ -169,20 +169,20 @@ Vector<Face3> Mesh::get_faces() const {
|
||||
/*
|
||||
for (int i=0;i<surfaces.size();i++) {
|
||||
|
||||
if (VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != VisualServer::PRIMITIVE_TRIANGLES )
|
||||
if (RenderingServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != RenderingServer::PRIMITIVE_TRIANGLES )
|
||||
continue;
|
||||
|
||||
Vector<int> indices;
|
||||
Vector<Vector3> vertices;
|
||||
|
||||
vertices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_VERTEX);
|
||||
vertices=RenderingServer::get_singleton()->mesh_surface_get_array(mesh, i,RenderingServer::ARRAY_VERTEX);
|
||||
|
||||
int len=VisualServer::get_singleton()->mesh_surface_get_array_index_len(mesh, i);
|
||||
int len=RenderingServer::get_singleton()->mesh_surface_get_array_index_len(mesh, i);
|
||||
bool has_indices;
|
||||
|
||||
if (len>0) {
|
||||
|
||||
indices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_INDEX);
|
||||
indices=RenderingServer::get_singleton()->mesh_surface_get_array(mesh, i,RenderingServer::ARRAY_INDEX);
|
||||
has_indices=true;
|
||||
|
||||
} else {
|
||||
@@ -846,7 +846,7 @@ Array ArrayMesh::_get_surfaces() const {
|
||||
|
||||
Array ret;
|
||||
for (int i = 0; i < surfaces.size(); i++) {
|
||||
VisualServer::SurfaceData surface = VS::get_singleton()->mesh_get_surface(mesh, i);
|
||||
RenderingServer::SurfaceData surface = RS::get_singleton()->mesh_get_surface(mesh, i);
|
||||
Dictionary data;
|
||||
data["format"] = surface.format;
|
||||
data["primitive"] = surface.primitive;
|
||||
@@ -902,20 +902,20 @@ Array ArrayMesh::_get_surfaces() const {
|
||||
|
||||
void ArrayMesh::_create_if_empty() const {
|
||||
if (!mesh.is_valid()) {
|
||||
mesh = VS::get_singleton()->mesh_create();
|
||||
VS::get_singleton()->mesh_set_blend_shape_mode(mesh, (VS::BlendShapeMode)blend_shape_mode);
|
||||
mesh = RS::get_singleton()->mesh_create();
|
||||
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
|
||||
}
|
||||
}
|
||||
|
||||
void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
|
||||
|
||||
Vector<VS::SurfaceData> surface_data;
|
||||
Vector<RS::SurfaceData> surface_data;
|
||||
Vector<Ref<Material>> surface_materials;
|
||||
Vector<String> surface_names;
|
||||
Vector<bool> surface_2d;
|
||||
|
||||
for (int i = 0; i < p_surfaces.size(); i++) {
|
||||
VS::SurfaceData surface;
|
||||
RS::SurfaceData surface;
|
||||
Dictionary d = p_surfaces[i];
|
||||
ERR_FAIL_COND(!d.has("format"));
|
||||
ERR_FAIL_COND(!d.has("primitive"));
|
||||
@@ -923,7 +923,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
|
||||
ERR_FAIL_COND(!d.has("vertex_count"));
|
||||
ERR_FAIL_COND(!d.has("aabb"));
|
||||
surface.format = d["format"];
|
||||
surface.primitive = VS::PrimitiveType(int(d["primitive"]));
|
||||
surface.primitive = RS::PrimitiveType(int(d["primitive"]));
|
||||
surface.vertex_data = d["vertex_data"];
|
||||
surface.vertex_count = d["vertex_count"];
|
||||
surface.aabb = d["aabb"];
|
||||
@@ -938,7 +938,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
|
||||
Array lods = d["lods"];
|
||||
ERR_FAIL_COND(lods.size() & 1); //must be even
|
||||
for (int j = 0; j < lods.size(); j += 2) {
|
||||
VS::SurfaceData::LOD lod;
|
||||
RS::SurfaceData::LOD lod;
|
||||
lod.edge_length = lods[j + 0];
|
||||
lod.index_data = lods[j + 1];
|
||||
surface.lods.push_back(lod);
|
||||
@@ -993,15 +993,15 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
|
||||
|
||||
if (mesh.is_valid()) {
|
||||
//if mesh exists, it needs to be updated
|
||||
VS::get_singleton()->mesh_clear(mesh);
|
||||
RS::get_singleton()->mesh_clear(mesh);
|
||||
for (int i = 0; i < surface_data.size(); i++) {
|
||||
VS::get_singleton()->mesh_add_surface(mesh, surface_data[i]);
|
||||
RS::get_singleton()->mesh_add_surface(mesh, surface_data[i]);
|
||||
}
|
||||
} else {
|
||||
// if mesh does not exist (first time this is loaded, most likely),
|
||||
// we can create it with a single call, which is a lot more efficient and thread friendly
|
||||
mesh = VS::get_singleton()->mesh_create_from_surfaces(surface_data);
|
||||
VS::get_singleton()->mesh_set_blend_shape_mode(mesh, (VS::BlendShapeMode)blend_shape_mode);
|
||||
mesh = RS::get_singleton()->mesh_create_from_surfaces(surface_data);
|
||||
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode);
|
||||
}
|
||||
|
||||
surfaces.clear();
|
||||
@@ -1102,7 +1102,7 @@ void ArrayMesh::_recompute_aabb() {
|
||||
#ifndef _MSC_VER
|
||||
#warning need to add binding to add_surface using future MeshSurfaceData object
|
||||
#endif
|
||||
void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<VS::SurfaceData::LOD> &p_lods) {
|
||||
void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<RS::SurfaceData::LOD> &p_lods) {
|
||||
|
||||
_create_if_empty();
|
||||
|
||||
@@ -1117,9 +1117,9 @@ void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const
|
||||
surfaces.push_back(s);
|
||||
_recompute_aabb();
|
||||
|
||||
VS::SurfaceData sd;
|
||||
RS::SurfaceData sd;
|
||||
sd.format = p_format;
|
||||
sd.primitive = VS::PrimitiveType(p_primitive);
|
||||
sd.primitive = RS::PrimitiveType(p_primitive);
|
||||
sd.aabb = p_aabb;
|
||||
sd.vertex_count = p_vertex_count;
|
||||
sd.vertex_data = p_array;
|
||||
@@ -1129,7 +1129,7 @@ void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const
|
||||
sd.bone_aabbs = p_bone_aabb;
|
||||
sd.lods = p_lods;
|
||||
|
||||
VisualServer::get_singleton()->mesh_add_surface(mesh, sd);
|
||||
RenderingServer::get_singleton()->mesh_add_surface(mesh, sd);
|
||||
|
||||
clear_cache();
|
||||
_change_notify();
|
||||
@@ -1140,9 +1140,9 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &
|
||||
|
||||
ERR_FAIL_COND(p_arrays.size() != ARRAY_MAX);
|
||||
|
||||
VS::SurfaceData surface;
|
||||
RS::SurfaceData surface;
|
||||
|
||||
Error err = VS::get_singleton()->mesh_create_surface_data_from_arrays(&surface, (VisualServer::PrimitiveType)p_primitive, p_arrays, p_blend_shapes, p_lods, p_flags);
|
||||
Error err = RS::get_singleton()->mesh_create_surface_data_from_arrays(&surface, (RenderingServer::PrimitiveType)p_primitive, p_arrays, p_blend_shapes, p_lods, p_flags);
|
||||
ERR_FAIL_COND(err != OK);
|
||||
|
||||
/* print_line("format: " + itos(surface.format));
|
||||
@@ -1159,16 +1159,16 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array &
|
||||
Array ArrayMesh::surface_get_arrays(int p_surface) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Array());
|
||||
return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh, p_surface);
|
||||
return RenderingServer::get_singleton()->mesh_surface_get_arrays(mesh, p_surface);
|
||||
}
|
||||
Array ArrayMesh::surface_get_blend_shape_arrays(int p_surface) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Array());
|
||||
return VisualServer::get_singleton()->mesh_surface_get_blend_shape_arrays(mesh, p_surface);
|
||||
return RenderingServer::get_singleton()->mesh_surface_get_blend_shape_arrays(mesh, p_surface);
|
||||
}
|
||||
Dictionary ArrayMesh::surface_get_lods(int p_surface) const {
|
||||
ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Dictionary());
|
||||
return VisualServer::get_singleton()->mesh_surface_get_lods(mesh, p_surface);
|
||||
return RenderingServer::get_singleton()->mesh_surface_get_lods(mesh, p_surface);
|
||||
}
|
||||
|
||||
int ArrayMesh::get_surface_count() const {
|
||||
@@ -1193,7 +1193,7 @@ void ArrayMesh::add_blend_shape(const StringName &p_name) {
|
||||
}
|
||||
|
||||
blend_shapes.push_back(name);
|
||||
//VS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size());
|
||||
//RS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size());
|
||||
}
|
||||
|
||||
int ArrayMesh::get_blend_shape_count() const {
|
||||
@@ -1215,7 +1215,7 @@ void ArrayMesh::set_blend_shape_mode(BlendShapeMode p_mode) {
|
||||
|
||||
blend_shape_mode = p_mode;
|
||||
if (mesh.is_valid()) {
|
||||
VS::get_singleton()->mesh_set_blend_shape_mode(mesh, (VS::BlendShapeMode)p_mode);
|
||||
RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)p_mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1254,7 +1254,7 @@ void ArrayMesh::surface_set_material(int p_idx, const Ref<Material> &p_material)
|
||||
if (surfaces[p_idx].material == p_material)
|
||||
return;
|
||||
surfaces.write[p_idx].material = p_material;
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(mesh, p_idx, p_material.is_null() ? RID() : p_material->get_rid());
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(mesh, p_idx, p_material.is_null() ? RID() : p_material->get_rid());
|
||||
|
||||
_change_notify("material");
|
||||
emit_changed();
|
||||
@@ -1286,7 +1286,7 @@ String ArrayMesh::surface_get_name(int p_idx) const {
|
||||
void ArrayMesh::surface_update_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
|
||||
|
||||
ERR_FAIL_INDEX(p_surface, surfaces.size());
|
||||
VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data);
|
||||
RS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data);
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
@@ -1318,7 +1318,7 @@ void ArrayMesh::clear_surfaces() {
|
||||
if (!mesh.is_valid()) {
|
||||
return;
|
||||
}
|
||||
VS::get_singleton()->mesh_clear(mesh);
|
||||
RS::get_singleton()->mesh_clear(mesh);
|
||||
surfaces.clear();
|
||||
aabb = AABB();
|
||||
}
|
||||
@@ -1327,7 +1327,7 @@ void ArrayMesh::set_custom_aabb(const AABB &p_custom) {
|
||||
|
||||
_create_if_empty();
|
||||
custom_aabb = p_custom;
|
||||
VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb);
|
||||
RS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb);
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
@@ -1609,7 +1609,7 @@ void ArrayMesh::_bind_methods() {
|
||||
}
|
||||
|
||||
void ArrayMesh::reload_from_file() {
|
||||
VisualServer::get_singleton()->mesh_clear(mesh);
|
||||
RenderingServer::get_singleton()->mesh_clear(mesh);
|
||||
surfaces.clear();
|
||||
clear_blend_shapes();
|
||||
clear_cache();
|
||||
@@ -1622,13 +1622,13 @@ void ArrayMesh::reload_from_file() {
|
||||
ArrayMesh::ArrayMesh() {
|
||||
|
||||
//mesh is now created on demand
|
||||
//mesh = VisualServer::get_singleton()->mesh_create();
|
||||
//mesh = RenderingServer::get_singleton()->mesh_create();
|
||||
blend_shape_mode = BLEND_SHAPE_MODE_RELATIVE;
|
||||
}
|
||||
|
||||
ArrayMesh::~ArrayMesh() {
|
||||
|
||||
if (mesh.is_valid()) {
|
||||
VisualServer::get_singleton()->free(mesh);
|
||||
RenderingServer::get_singleton()->free(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user