summaryrefslogtreecommitdiff
path: root/servers/physics
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-07 18:25:37 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-07 18:26:38 -0300
commit2ab83e1abbf5ee6d00e16056a9e9394114026f28 (patch)
tree7efbb375cc4d00d8e8589fcf1b6a1303bec5df2d /servers/physics
parent2a38a5eaa844043b846e03d6655f84caf8a31e74 (diff)
Memory pool vectors (DVector) have been enormously simplified in code, and renamed to PoolVector
Diffstat (limited to 'servers/physics')
-rw-r--r--servers/physics/shape_sw.cpp62
-rw-r--r--servers/physics/shape_sw.h16
2 files changed, 39 insertions, 39 deletions
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index 304bcf8f7b..c853dcff35 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -971,10 +971,10 @@ FaceShapeSW::FaceShapeSW() {
-DVector<Vector3> ConcavePolygonShapeSW::get_faces() const {
+PoolVector<Vector3> ConcavePolygonShapeSW::get_faces() const {
- DVector<Vector3> rfaces;
+ PoolVector<Vector3> rfaces;
rfaces.resize(faces.size()*3);
for(int i=0;i<faces.size();i++) {
@@ -998,7 +998,7 @@ void ConcavePolygonShapeSW::project_range(const Vector3& p_normal, const Transfo
r_max=0;
return;
}
- DVector<Vector3>::Read r=vertices.read();
+ PoolVector<Vector3>::Read r=vertices.read();
const Vector3 *vptr=r.ptr();
for (int i=0;i<count;i++) {
@@ -1020,7 +1020,7 @@ Vector3 ConcavePolygonShapeSW::get_support(const Vector3& p_normal) const {
if (count==0)
return Vector3();
- DVector<Vector3>::Read r=vertices.read();
+ PoolVector<Vector3>::Read r=vertices.read();
const Vector3 *vptr=r.ptr();
Vector3 n=p_normal;
@@ -1111,9 +1111,9 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3& p_begin,const Vecto
return false;
// unlock data
- DVector<Face>::Read fr=faces.read();
- DVector<Vector3>::Read vr=vertices.read();
- DVector<BVH>::Read br=bvh.read();
+ PoolVector<Face>::Read fr=faces.read();
+ PoolVector<Vector3>::Read vr=vertices.read();
+ PoolVector<BVH>::Read br=bvh.read();
_SegmentCullParams params;
@@ -1184,9 +1184,9 @@ void ConcavePolygonShapeSW::cull(const AABB& p_local_aabb,Callback p_callback,vo
AABB local_aabb=p_local_aabb;
// unlock data
- DVector<Face>::Read fr=faces.read();
- DVector<Vector3>::Read vr=vertices.read();
- DVector<BVH>::Read br=bvh.read();
+ PoolVector<Face>::Read fr=faces.read();
+ PoolVector<Vector3>::Read vr=vertices.read();
+ PoolVector<BVH>::Read br=bvh.read();
FaceShapeSW face; // use this to send in the callback
@@ -1347,7 +1347,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array
}
-void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
+void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
int src_face_count=p_faces.size();
if (src_face_count==0) {
@@ -1357,7 +1357,7 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
ERR_FAIL_COND(src_face_count%3);
src_face_count/=3;
- DVector<Vector3>::Read r = p_faces.read();
+ PoolVector<Vector3>::Read r = p_faces.read();
const Vector3 * facesr= r.ptr();
#if 0
@@ -1399,7 +1399,7 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
vertices.resize( point_map.size() );
- DVector<Vector3>::Write vw = vertices.write();
+ PoolVector<Vector3>::Write vw = vertices.write();
Vector3 *verticesw=vw.ptr();
AABB _aabb;
@@ -1418,7 +1418,7 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
point_map.clear(); // not needed anymore
faces.resize(face_list.size());
- DVector<Face>::Write w = faces.write();
+ PoolVector<Face>::Write w = faces.write();
Face *facesw=w.ptr();
int fc=0;
@@ -1431,10 +1431,10 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
face_list.clear();
- DVector<_VolumeSW_BVH_Element> bvh_array;
+ PoolVector<_VolumeSW_BVH_Element> bvh_array;
bvh_array.resize( fc );
- DVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write();
+ PoolVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write();
_VolumeSW_BVH_Element *bvh_arrayw=bvhw.ptr();
@@ -1451,8 +1451,8 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
}
- w=DVector<Face>::Write();
- vw=DVector<Vector3>::Write();
+ w=PoolVector<Face>::Write();
+ vw=PoolVector<Vector3>::Write();
int count=0;
@@ -1460,11 +1460,11 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
ERR_FAIL_COND(count==0);
- bvhw=DVector<_VolumeSW_BVH_Element>::Write();
+ bvhw=PoolVector<_VolumeSW_BVH_Element>::Write();
bvh.resize( count+1 );
- DVector<BVH>::Write bvhw2 = bvh.write();
+ PoolVector<BVH>::Write bvhw2 = bvh.write();
BVH*bvh_arrayw2=bvhw2.ptr();
int idx=0;
@@ -1473,19 +1473,19 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
set_aabb(_aabb);
#else
- DVector<_VolumeSW_BVH_Element> bvh_array;
+ PoolVector<_VolumeSW_BVH_Element> bvh_array;
bvh_array.resize( src_face_count );
- DVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write();
+ PoolVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write();
_VolumeSW_BVH_Element *bvh_arrayw=bvhw.ptr();
faces.resize(src_face_count);
- DVector<Face>::Write w = faces.write();
+ PoolVector<Face>::Write w = faces.write();
Face *facesw=w.ptr();
vertices.resize( src_face_count*3 );
- DVector<Vector3>::Write vw = vertices.write();
+ PoolVector<Vector3>::Write vw = vertices.write();
Vector3 *verticesw=vw.ptr();
AABB _aabb;
@@ -1512,15 +1512,15 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) {
}
- w=DVector<Face>::Write();
- vw=DVector<Vector3>::Write();
+ w=PoolVector<Face>::Write();
+ vw=PoolVector<Vector3>::Write();
int count=0;
_VolumeSW_BVH *bvh_tree=_volume_sw_build_bvh(bvh_arrayw,src_face_count,count);
bvh.resize( count+1 );
- DVector<BVH>::Write bvhw2 = bvh.write();
+ PoolVector<BVH>::Write bvhw2 = bvh.write();
BVH*bvh_arrayw2=bvhw2.ptr();
int idx=0;
@@ -1553,7 +1553,7 @@ ConcavePolygonShapeSW::ConcavePolygonShapeSW() {
/* HEIGHT MAP SHAPE */
-DVector<float> HeightMapShapeSW::get_heights() const {
+PoolVector<float> HeightMapShapeSW::get_heights() const {
return heights;
}
@@ -1614,14 +1614,14 @@ Vector3 HeightMapShapeSW::get_moment_of_inertia(float p_mass) const {
}
-void HeightMapShapeSW::_setup(DVector<real_t> p_heights,int p_width,int p_depth,real_t p_cell_size) {
+void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights,int p_width,int p_depth,real_t p_cell_size) {
heights=p_heights;
width=p_width;
depth=p_depth;;
cell_size=p_cell_size;
- DVector<real_t>::Read r = heights. read();
+ PoolVector<real_t>::Read r = heights. read();
AABB aabb;
@@ -1656,7 +1656,7 @@ void HeightMapShapeSW::set_data(const Variant& p_data) {
int width=d["width"];
int depth=d["depth"];
float cell_size=d["cell_size"];
- DVector<float> heights=d["heights"];
+ PoolVector<float> heights=d["heights"];
ERR_FAIL_COND( width<= 0);
ERR_FAIL_COND( depth<= 0);
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index d031a9fb9b..5916fd9881 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -279,8 +279,8 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
int indices[3];
};
- DVector<Face> faces;
- DVector<Vector3> vertices;
+ PoolVector<Face> faces;
+ PoolVector<Vector3> vertices;
struct BVH {
@@ -291,7 +291,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
int face_index;
};
- DVector<BVH> bvh;
+ PoolVector<BVH> bvh;
struct _CullParams {
@@ -326,10 +326,10 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
void _fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array,int& p_idx);
- void _setup(DVector<Vector3> p_faces);
+ void _setup(PoolVector<Vector3> p_faces);
public:
- DVector<Vector3> get_faces() const;
+ PoolVector<Vector3> get_faces() const;
virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; }
@@ -352,7 +352,7 @@ public:
struct HeightMapShapeSW : public ConcaveShapeSW {
- DVector<real_t> heights;
+ PoolVector<real_t> heights;
int width;
int depth;
float cell_size;
@@ -360,10 +360,10 @@ struct HeightMapShapeSW : public ConcaveShapeSW {
// void _cull_segment(int p_idx,_SegmentCullParams *p_params) const;
// void _cull(int p_idx,_CullParams *p_params) const;
- void _setup(DVector<float> p_heights,int p_width,int p_depth,float p_cell_size);
+ void _setup(PoolVector<float> p_heights,int p_width,int p_depth,float p_cell_size);
public:
- DVector<real_t> get_heights() const;
+ PoolVector<real_t> get_heights() const;
int get_width() const;
int get_depth() const;
float get_cell_size() const;