Some changes made to the bsp code in early November
(to stop gcc compiler warnings) caused segfaults when performing intersections (and possibly while doing other boolean operations). I felt it was best to revert these changes (I also got rid of the DOS line terminators in the files). Some more info about the matter can be found in the first 10 or so posts for Novembor on the old mailing list: http://www.soze.com/mailman/private/bf-committers/2002-November/date.html Chris (Merry Christmas!)
This commit is contained in:
parent
b479689cf8
commit
f8b3f65d85
@ -412,7 +412,7 @@ DuplicateMesh(
|
||||
// duplicate the face data for this face.
|
||||
o_f_data.Duplicate(i_f_data[*f_faces_it]);
|
||||
|
||||
output.AddSubTriangle(dup_face,&triangle_indices[i]);
|
||||
output.AddSubTriangle(dup_face,triangle_indices.begin() + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ BSP_CSGMesh_VertexIt_Done(
|
||||
// assume CSG_IteratorPtr is of the correct type.
|
||||
BSP_CSGMesh_VertexIt * vertex_it = (BSP_CSGMesh_VertexIt *)it;
|
||||
|
||||
if (vertex_it->pos < &(*vertex_it->mesh->VertexSet().end())) return 0;
|
||||
if (vertex_it->pos < vertex_it->mesh->VertexSet().end()) return 0;
|
||||
return 1;
|
||||
};
|
||||
|
||||
@ -109,7 +109,7 @@ BSP_CSGMesh_VertexIt_Reset(
|
||||
) {
|
||||
// assume CSG_IteratorPtr is of the correct type.
|
||||
BSP_CSGMesh_VertexIt * vertex_it = (BSP_CSGMesh_VertexIt *)it;
|
||||
vertex_it->pos = &vertex_it->mesh->VertexSet()[0];
|
||||
vertex_it->pos = vertex_it->mesh->VertexSet().begin();
|
||||
};
|
||||
|
||||
static
|
||||
@ -128,7 +128,7 @@ BSP_CSGMeshVertexIt_Construct(
|
||||
|
||||
BSP_CSGMesh_VertexIt * v_it = new BSP_CSGMesh_VertexIt;
|
||||
v_it->mesh = mesh;
|
||||
v_it->pos = &mesh->VertexSet()[0];
|
||||
v_it->pos = mesh->VertexSet().begin();
|
||||
output->it = v_it;
|
||||
};
|
||||
|
||||
@ -167,7 +167,7 @@ BSP_CSGMesh_FaceIt_Done(
|
||||
// assume CSG_IteratorPtr is of the correct type.
|
||||
BSP_CSGMesh_FaceIt * face_it = (BSP_CSGMesh_FaceIt *)it;
|
||||
|
||||
if (face_it->pos < &(*face_it->mesh->FaceSet().end())) {
|
||||
if (face_it->pos < face_it->mesh->FaceSet().end()) {
|
||||
if (face_it->face_triangle + 3 <= face_it->pos->m_verts.size()) {
|
||||
return 0;
|
||||
}
|
||||
@ -196,7 +196,7 @@ BSP_CSGMesh_FaceIt_Fill(
|
||||
// time to change the iterator type to an integer...
|
||||
face_it->mesh->FaceData().Copy(
|
||||
face->user_face_data,
|
||||
int(face_it->pos - &face_it->mesh->FaceSet()[0])
|
||||
int(face_it->pos - face_it->mesh->FaceSet().begin())
|
||||
);
|
||||
|
||||
// Copy face vertex data across...
|
||||
@ -228,8 +228,7 @@ BSP_CSGMesh_FaceIt_Step(
|
||||
BSP_CSGMesh_FaceIt * face_it = (BSP_CSGMesh_FaceIt *)it;
|
||||
|
||||
// safety guard
|
||||
if (face_it->pos < &(*face_it->mesh->FaceSet().end())) {
|
||||
|
||||
if (face_it->pos < face_it->mesh->FaceSet().end()) {
|
||||
if (face_it->face_triangle + 3 < face_it->pos->m_verts.size()) {
|
||||
(face_it->face_triangle)++;
|
||||
} else {
|
||||
@ -246,7 +245,7 @@ BSP_CSGMesh_FaceIt_Reset(
|
||||
) {
|
||||
// assume CSG_IteratorPtr is of the correct type.
|
||||
BSP_CSGMesh_FaceIt * f_it = (BSP_CSGMesh_FaceIt *)it;
|
||||
f_it->pos = &f_it->mesh->FaceSet()[0];
|
||||
f_it->pos = f_it->mesh->FaceSet().begin();
|
||||
f_it->face_triangle = 0;
|
||||
};
|
||||
|
||||
@ -266,7 +265,7 @@ BSP_CSGMesh_FaceIt_Construct(
|
||||
|
||||
BSP_CSGMesh_FaceIt * f_it = new BSP_CSGMesh_FaceIt;
|
||||
f_it->mesh = mesh;
|
||||
f_it->pos = &mesh->FaceSet()[0];
|
||||
f_it->pos = mesh->FaceSet().begin();
|
||||
f_it->face_triangle = 0;
|
||||
|
||||
output->it = f_it;
|
||||
|
@ -66,7 +66,7 @@ Duplicate(
|
||||
int output = Size();
|
||||
IncSize();
|
||||
|
||||
memcpy(&m_data[ m_data.size() - 1 - m_width ], record, m_width);
|
||||
memcpy(m_data.end() - m_width,record,m_width);
|
||||
|
||||
return output;
|
||||
}
|
||||
@ -80,8 +80,9 @@ Duplicate(
|
||||
){
|
||||
if (m_width) {
|
||||
IncSize();
|
||||
memcpy(&m_data[ m_data.size() - 1 - m_width ],
|
||||
&m_data[ record_index * m_width], m_width);
|
||||
|
||||
memcpy(m_data.end() - m_width,m_data.begin() +
|
||||
record_index * m_width,m_width);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +94,7 @@ Copy(
|
||||
int pos
|
||||
){
|
||||
if (m_width) {
|
||||
memcpy(output, &m_data[m_width*pos],m_width);
|
||||
memcpy(output,m_data.begin() + m_width*pos,m_width);
|
||||
}
|
||||
}
|
||||
void
|
||||
@ -132,6 +133,6 @@ BSP_CSGUserData::
|
||||
operator [] (
|
||||
const int pos
|
||||
){
|
||||
return &m_data[ m_width*pos ];
|
||||
return m_data.begin() + m_width*pos;
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ Process(
|
||||
/* Try and snip this triangle off from the
|
||||
current polygon.*/
|
||||
|
||||
if ( Snip(verts,contour,u,v,w,nv, &m_V[0]) )
|
||||
if ( Snip(verts,contour,u,v,w,nv,m_V.begin()) )
|
||||
{
|
||||
int a,b,c,s,t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user