summaryrefslogtreecommitdiff
path: root/scene/resources/surface_tool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/surface_tool.cpp')
-rw-r--r--scene/resources/surface_tool.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index fa177d03fb..fee6bd1b54 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -519,7 +519,7 @@ void SurfaceTool::deindex() {
void SurfaceTool::_create_list(const Ref<Mesh> &p_existing, int p_surface, List<Vertex> *r_vertex, List<int> *r_index, int &lformat) {
Array arr = p_existing->surface_get_arrays(p_surface);
- ERR_FAIL_COND(arr.size() != VS::ARRAY_MAX);
+ ERR_FAIL_COND(arr.size() != RS::ARRAY_MAX);
_create_list_from_arrays(arr, r_vertex, r_index, lformat);
}
@@ -527,14 +527,14 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
Vector<SurfaceTool::Vertex> ret;
- Vector<Vector3> varr = p_arrays[VS::ARRAY_VERTEX];
- Vector<Vector3> narr = p_arrays[VS::ARRAY_NORMAL];
- Vector<float> tarr = p_arrays[VS::ARRAY_TANGENT];
- Vector<Color> carr = p_arrays[VS::ARRAY_COLOR];
- Vector<Vector2> uvarr = p_arrays[VS::ARRAY_TEX_UV];
- Vector<Vector2> uv2arr = p_arrays[VS::ARRAY_TEX_UV2];
- Vector<int> barr = p_arrays[VS::ARRAY_BONES];
- Vector<float> warr = p_arrays[VS::ARRAY_WEIGHTS];
+ Vector<Vector3> varr = p_arrays[RS::ARRAY_VERTEX];
+ Vector<Vector3> narr = p_arrays[RS::ARRAY_NORMAL];
+ Vector<float> tarr = p_arrays[RS::ARRAY_TANGENT];
+ Vector<Color> carr = p_arrays[RS::ARRAY_COLOR];
+ Vector<Vector2> uvarr = p_arrays[RS::ARRAY_TEX_UV];
+ Vector<Vector2> uv2arr = p_arrays[RS::ARRAY_TEX_UV2];
+ Vector<int> barr = p_arrays[RS::ARRAY_BONES];
+ Vector<float> warr = p_arrays[RS::ARRAY_WEIGHTS];
int vc = varr.size();
if (vc == 0)
@@ -542,48 +542,48 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
int lformat = 0;
if (varr.size()) {
- lformat |= VS::ARRAY_FORMAT_VERTEX;
+ lformat |= RS::ARRAY_FORMAT_VERTEX;
}
if (narr.size()) {
- lformat |= VS::ARRAY_FORMAT_NORMAL;
+ lformat |= RS::ARRAY_FORMAT_NORMAL;
}
if (tarr.size()) {
- lformat |= VS::ARRAY_FORMAT_TANGENT;
+ lformat |= RS::ARRAY_FORMAT_TANGENT;
}
if (carr.size()) {
- lformat |= VS::ARRAY_FORMAT_COLOR;
+ lformat |= RS::ARRAY_FORMAT_COLOR;
}
if (uvarr.size()) {
- lformat |= VS::ARRAY_FORMAT_TEX_UV;
+ lformat |= RS::ARRAY_FORMAT_TEX_UV;
}
if (uv2arr.size()) {
- lformat |= VS::ARRAY_FORMAT_TEX_UV2;
+ lformat |= RS::ARRAY_FORMAT_TEX_UV2;
}
if (barr.size()) {
- lformat |= VS::ARRAY_FORMAT_BONES;
+ lformat |= RS::ARRAY_FORMAT_BONES;
}
if (warr.size()) {
- lformat |= VS::ARRAY_FORMAT_WEIGHTS;
+ lformat |= RS::ARRAY_FORMAT_WEIGHTS;
}
for (int i = 0; i < vc; i++) {
Vertex v;
- if (lformat & VS::ARRAY_FORMAT_VERTEX)
+ if (lformat & RS::ARRAY_FORMAT_VERTEX)
v.vertex = varr[i];
- if (lformat & VS::ARRAY_FORMAT_NORMAL)
+ if (lformat & RS::ARRAY_FORMAT_NORMAL)
v.normal = narr[i];
- if (lformat & VS::ARRAY_FORMAT_TANGENT) {
+ if (lformat & RS::ARRAY_FORMAT_TANGENT) {
Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]);
v.tangent = p.normal;
v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
}
- if (lformat & VS::ARRAY_FORMAT_COLOR)
+ if (lformat & RS::ARRAY_FORMAT_COLOR)
v.color = carr[i];
- if (lformat & VS::ARRAY_FORMAT_TEX_UV)
+ if (lformat & RS::ARRAY_FORMAT_TEX_UV)
v.uv = uvarr[i];
- if (lformat & VS::ARRAY_FORMAT_TEX_UV2)
+ if (lformat & RS::ARRAY_FORMAT_TEX_UV2)
v.uv2 = uv2arr[i];
- if (lformat & VS::ARRAY_FORMAT_BONES) {
+ if (lformat & RS::ARRAY_FORMAT_BONES) {
Vector<int> b;
b.resize(4);
b.write[0] = barr[i * 4 + 0];
@@ -592,7 +592,7 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
b.write[3] = barr[i * 4 + 3];
v.bones = b;
}
- if (lformat & VS::ARRAY_FORMAT_WEIGHTS) {
+ if (lformat & RS::ARRAY_FORMAT_WEIGHTS) {
Vector<float> w;
w.resize(4);
w.write[0] = warr[i * 4 + 0];
@@ -610,14 +610,14 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, List<int> *r_index, int &lformat) {
- Vector<Vector3> varr = arr[VS::ARRAY_VERTEX];
- Vector<Vector3> narr = arr[VS::ARRAY_NORMAL];
- Vector<float> tarr = arr[VS::ARRAY_TANGENT];
- Vector<Color> carr = arr[VS::ARRAY_COLOR];
- Vector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV];
- Vector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2];
- Vector<int> barr = arr[VS::ARRAY_BONES];
- Vector<float> warr = arr[VS::ARRAY_WEIGHTS];
+ Vector<Vector3> varr = arr[RS::ARRAY_VERTEX];
+ Vector<Vector3> narr = arr[RS::ARRAY_NORMAL];
+ Vector<float> tarr = arr[RS::ARRAY_TANGENT];
+ Vector<Color> carr = arr[RS::ARRAY_COLOR];
+ Vector<Vector2> uvarr = arr[RS::ARRAY_TEX_UV];
+ Vector<Vector2> uv2arr = arr[RS::ARRAY_TEX_UV2];
+ Vector<int> barr = arr[RS::ARRAY_BONES];
+ Vector<float> warr = arr[RS::ARRAY_WEIGHTS];
int vc = varr.size();
if (vc == 0)
@@ -625,48 +625,48 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li
lformat = 0;
if (varr.size()) {
- lformat |= VS::ARRAY_FORMAT_VERTEX;
+ lformat |= RS::ARRAY_FORMAT_VERTEX;
}
if (narr.size()) {
- lformat |= VS::ARRAY_FORMAT_NORMAL;
+ lformat |= RS::ARRAY_FORMAT_NORMAL;
}
if (tarr.size()) {
- lformat |= VS::ARRAY_FORMAT_TANGENT;
+ lformat |= RS::ARRAY_FORMAT_TANGENT;
}
if (carr.size()) {
- lformat |= VS::ARRAY_FORMAT_COLOR;
+ lformat |= RS::ARRAY_FORMAT_COLOR;
}
if (uvarr.size()) {
- lformat |= VS::ARRAY_FORMAT_TEX_UV;
+ lformat |= RS::ARRAY_FORMAT_TEX_UV;
}
if (uv2arr.size()) {
- lformat |= VS::ARRAY_FORMAT_TEX_UV2;
+ lformat |= RS::ARRAY_FORMAT_TEX_UV2;
}
if (barr.size()) {
- lformat |= VS::ARRAY_FORMAT_BONES;
+ lformat |= RS::ARRAY_FORMAT_BONES;
}
if (warr.size()) {
- lformat |= VS::ARRAY_FORMAT_WEIGHTS;
+ lformat |= RS::ARRAY_FORMAT_WEIGHTS;
}
for (int i = 0; i < vc; i++) {
Vertex v;
- if (lformat & VS::ARRAY_FORMAT_VERTEX)
+ if (lformat & RS::ARRAY_FORMAT_VERTEX)
v.vertex = varr[i];
- if (lformat & VS::ARRAY_FORMAT_NORMAL)
+ if (lformat & RS::ARRAY_FORMAT_NORMAL)
v.normal = narr[i];
- if (lformat & VS::ARRAY_FORMAT_TANGENT) {
+ if (lformat & RS::ARRAY_FORMAT_TANGENT) {
Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]);
v.tangent = p.normal;
v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
}
- if (lformat & VS::ARRAY_FORMAT_COLOR)
+ if (lformat & RS::ARRAY_FORMAT_COLOR)
v.color = carr[i];
- if (lformat & VS::ARRAY_FORMAT_TEX_UV)
+ if (lformat & RS::ARRAY_FORMAT_TEX_UV)
v.uv = uvarr[i];
- if (lformat & VS::ARRAY_FORMAT_TEX_UV2)
+ if (lformat & RS::ARRAY_FORMAT_TEX_UV2)
v.uv2 = uv2arr[i];
- if (lformat & VS::ARRAY_FORMAT_BONES) {
+ if (lformat & RS::ARRAY_FORMAT_BONES) {
Vector<int> b;
b.resize(4);
b.write[0] = barr[i * 4 + 0];
@@ -675,7 +675,7 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li
b.write[3] = barr[i * 4 + 3];
v.bones = b;
}
- if (lformat & VS::ARRAY_FORMAT_WEIGHTS) {
+ if (lformat & RS::ARRAY_FORMAT_WEIGHTS) {
Vector<float> w;
w.resize(4);
w.write[0] = warr[i * 4 + 0];
@@ -690,11 +690,11 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li
//indices
- Vector<int> idx = arr[VS::ARRAY_INDEX];
+ Vector<int> idx = arr[RS::ARRAY_INDEX];
int is = idx.size();
if (is) {
- lformat |= VS::ARRAY_FORMAT_INDEX;
+ lformat |= RS::ARRAY_FORMAT_INDEX;
const int *iarr = idx.ptr();
for (int i = 0; i < is; i++) {
r_index->push_back(iarr[i]);
@@ -733,7 +733,7 @@ void SurfaceTool::create_from_blend_shape(const Ref<Mesh> &p_existing, int p_sur
ERR_FAIL_COND(shape_idx == -1);
ERR_FAIL_COND(shape_idx >= arr.size());
Array mesh = arr[shape_idx];
- ERR_FAIL_COND(mesh.size() != VS::ARRAY_MAX);
+ ERR_FAIL_COND(mesh.size() != RS::ARRAY_MAX);
_create_list_from_arrays(arr[shape_idx], &vertex_array, &index_array, format);
}
@@ -755,10 +755,10 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const
Vertex v = E->get();
v.vertex = p_xform.xform(v.vertex);
- if (nformat & VS::ARRAY_FORMAT_NORMAL) {
+ if (nformat & RS::ARRAY_FORMAT_NORMAL) {
v.normal = p_xform.basis.xform(v.normal);
}
- if (nformat & VS::ARRAY_FORMAT_TANGENT) {
+ if (nformat & RS::ARRAY_FORMAT_TANGENT) {
v.tangent = p_xform.basis.xform(v.tangent);
v.binormal = p_xform.basis.xform(v.binormal);
}