summaryrefslogtreecommitdiff
path: root/scene/resources/primitive_meshes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/primitive_meshes.cpp')
-rw-r--r--scene/resources/primitive_meshes.cpp104
1 files changed, 52 insertions, 52 deletions
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 959ee214a2..46e8575018 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "primitive_meshes.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
/**
PrimitiveMesh
@@ -37,10 +37,10 @@
void PrimitiveMesh::_update() const {
Array arr;
- arr.resize(VS::ARRAY_MAX);
+ arr.resize(RS::ARRAY_MAX);
_create_mesh_array(arr);
- Vector<Vector3> points = arr[VS::ARRAY_VERTEX];
+ Vector<Vector3> points = arr[RS::ARRAY_VERTEX];
aabb = AABB();
@@ -57,10 +57,10 @@ void PrimitiveMesh::_update() const {
}
}
- Vector<int> indices = arr[VS::ARRAY_INDEX];
+ Vector<int> indices = arr[RS::ARRAY_INDEX];
if (flip_faces) {
- Vector<Vector3> normals = arr[VS::ARRAY_NORMAL];
+ Vector<Vector3> normals = arr[RS::ARRAY_NORMAL];
if (normals.size() && indices.size()) {
@@ -79,17 +79,17 @@ void PrimitiveMesh::_update() const {
SWAP(w[i + 0], w[i + 1]);
}
}
- arr[VS::ARRAY_NORMAL] = normals;
- arr[VS::ARRAY_INDEX] = indices;
+ arr[RS::ARRAY_NORMAL] = normals;
+ arr[RS::ARRAY_INDEX] = indices;
}
}
array_len = pc;
index_array_len = indices.size();
// in with the new
- VisualServer::get_singleton()->mesh_clear(mesh);
- VisualServer::get_singleton()->mesh_add_surface_from_arrays(mesh, (VisualServer::PrimitiveType)primitive_type, arr);
- VisualServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid());
+ RenderingServer::get_singleton()->mesh_clear(mesh);
+ RenderingServer::get_singleton()->mesh_add_surface_from_arrays(mesh, (RenderingServer::PrimitiveType)primitive_type, arr);
+ RenderingServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid());
pending_request = false;
@@ -136,7 +136,7 @@ Array PrimitiveMesh::surface_get_arrays(int p_surface) const {
_update();
}
- return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh, 0);
+ return RenderingServer::get_singleton()->mesh_surface_get_arrays(mesh, 0);
}
Dictionary PrimitiveMesh::surface_get_lods(int p_surface) const {
@@ -150,7 +150,7 @@ Array PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) const {
uint32_t PrimitiveMesh::surface_get_format(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, 1, 0);
- return VS::ARRAY_FORMAT_VERTEX | VS::ARRAY_FORMAT_NORMAL | VS::ARRAY_FORMAT_TANGENT | VS::ARRAY_FORMAT_TEX_UV | VS::ARRAY_FORMAT_INDEX | VS::ARRAY_COMPRESS_DEFAULT;
+ return RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_TANGENT | RS::ARRAY_FORMAT_TEX_UV | RS::ARRAY_FORMAT_INDEX | RS::ARRAY_COMPRESS_DEFAULT;
}
Mesh::PrimitiveType PrimitiveMesh::surface_get_primitive_type(int p_idx) const {
@@ -164,7 +164,7 @@ void PrimitiveMesh::surface_set_material(int p_idx, const Ref<Material> &p_mater
}
Ref<Material> PrimitiveMesh::surface_get_material(int p_idx) const {
- ERR_FAIL_INDEX_V(p_idx, 1, NULL);
+ ERR_FAIL_INDEX_V(p_idx, 1, nullptr);
return material;
}
@@ -215,7 +215,7 @@ void PrimitiveMesh::set_material(const Ref<Material> &p_material) {
material = p_material;
if (!pending_request) {
// just apply it, else it'll happen when _update is called.
- VisualServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid());
+ RenderingServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid());
_change_notify();
emit_changed();
};
@@ -232,7 +232,7 @@ Array PrimitiveMesh::get_mesh_arrays() const {
void PrimitiveMesh::set_custom_aabb(const AABB &p_custom) {
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();
}
@@ -254,7 +254,7 @@ PrimitiveMesh::PrimitiveMesh() {
flip_faces = false;
// defaults
- mesh = VisualServer::get_singleton()->mesh_create();
+ mesh = RenderingServer::get_singleton()->mesh_create();
// assume primitive triangles as the type, correct for all but one and it will change this :)
primitive_type = Mesh::PRIMITIVE_TRIANGLES;
@@ -267,7 +267,7 @@ PrimitiveMesh::PrimitiveMesh() {
}
PrimitiveMesh::~PrimitiveMesh() {
- VisualServer::get_singleton()->free(mesh);
+ RenderingServer::get_singleton()->free(mesh);
}
/**
@@ -413,11 +413,11 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
};
- p_arr[VS::ARRAY_VERTEX] = points;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
- p_arr[VS::ARRAY_INDEX] = indices;
+ p_arr[RS::ARRAY_VERTEX] = points;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_INDEX] = indices;
}
void CapsuleMesh::_bind_methods() {
@@ -670,11 +670,11 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
};
- p_arr[VS::ARRAY_VERTEX] = points;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
- p_arr[VS::ARRAY_INDEX] = indices;
+ p_arr[RS::ARRAY_VERTEX] = points;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_INDEX] = indices;
}
void CubeMesh::_bind_methods() {
@@ -871,11 +871,11 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
};
};
- p_arr[VS::ARRAY_VERTEX] = points;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
- p_arr[VS::ARRAY_INDEX] = indices;
+ p_arr[RS::ARRAY_VERTEX] = points;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_INDEX] = indices;
}
void CylinderMesh::_bind_methods() {
@@ -1010,11 +1010,11 @@ void PlaneMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
};
- p_arr[VS::ARRAY_VERTEX] = points;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
- p_arr[VS::ARRAY_INDEX] = indices;
+ p_arr[RS::ARRAY_VERTEX] = points;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_INDEX] = indices;
}
void PlaneMesh::_bind_methods() {
@@ -1270,11 +1270,11 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
};
- p_arr[VS::ARRAY_VERTEX] = points;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
- p_arr[VS::ARRAY_INDEX] = indices;
+ p_arr[RS::ARRAY_VERTEX] = points;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_INDEX] = indices;
}
void PrismMesh::_bind_methods() {
@@ -1401,10 +1401,10 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
uvs.set(i, quad_uv[j]);
}
- p_arr[VS::ARRAY_VERTEX] = faces;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_VERTEX] = faces;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
}
void QuadMesh::_bind_methods() {
@@ -1494,11 +1494,11 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const {
thisrow = point;
};
- p_arr[VS::ARRAY_VERTEX] = points;
- p_arr[VS::ARRAY_NORMAL] = normals;
- p_arr[VS::ARRAY_TANGENT] = tangents;
- p_arr[VS::ARRAY_TEX_UV] = uvs;
- p_arr[VS::ARRAY_INDEX] = indices;
+ p_arr[RS::ARRAY_VERTEX] = points;
+ p_arr[RS::ARRAY_NORMAL] = normals;
+ p_arr[RS::ARRAY_TANGENT] = tangents;
+ p_arr[RS::ARRAY_TEX_UV] = uvs;
+ p_arr[RS::ARRAY_INDEX] = indices;
}
void SphereMesh::_bind_methods() {
@@ -1585,7 +1585,7 @@ void PointMesh::_create_mesh_array(Array &p_arr) const {
faces.resize(1);
faces.set(0, Vector3(0.0, 0.0, 0.0));
- p_arr[VS::ARRAY_VERTEX] = faces;
+ p_arr[RS::ARRAY_VERTEX] = faces;
}
PointMesh::PointMesh() {