Reverted changes to bsp code so that the code will compile

under gcc 3.x. A better solution should be found as this
breaks booleans.

Chris
This commit is contained in:
Chris Want
2002-12-28 17:55:24 +00:00
parent 7c96971152
commit 9e3c814e72
4 changed files with 17 additions and 16 deletions

View File

@@ -412,7 +412,7 @@ DuplicateMesh(
// duplicate the face data for this face. // duplicate the face data for this face.
o_f_data.Duplicate(i_f_data[*f_faces_it]); o_f_data.Duplicate(i_f_data[*f_faces_it]);
output.AddSubTriangle(dup_face,triangle_indices.begin() + i); output.AddSubTriangle(dup_face,&triangle_indices[i]);
} }
} }

View File

@@ -30,6 +30,7 @@
*/ */
#ifndef BSP_CSGMesh_CFIterator_h #ifndef BSP_CSGMesh_CFIterator_h
#define BSP_CSGMesh_CFIterator_h #define BSP_CSGMesh_CFIterator_h
#include "BSP_CSGMesh.h" #include "BSP_CSGMesh.h"
@@ -69,7 +70,7 @@ BSP_CSGMesh_VertexIt_Done(
// assume CSG_IteratorPtr is of the correct type. // assume CSG_IteratorPtr is of the correct type.
BSP_CSGMesh_VertexIt * vertex_it = (BSP_CSGMesh_VertexIt *)it; 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; return 1;
}; };
@@ -103,7 +104,7 @@ BSP_CSGMesh_VertexIt_Reset(
) { ) {
// assume CSG_IteratorPtr is of the correct type. // assume CSG_IteratorPtr is of the correct type.
BSP_CSGMesh_VertexIt * vertex_it = (BSP_CSGMesh_VertexIt *)it; BSP_CSGMesh_VertexIt * vertex_it = (BSP_CSGMesh_VertexIt *)it;
vertex_it->pos = vertex_it->mesh->VertexSet().begin(); vertex_it->pos = &vertex_it->mesh->VertexSet()[0];
}; };
static static
@@ -122,7 +123,7 @@ BSP_CSGMeshVertexIt_Construct(
BSP_CSGMesh_VertexIt * v_it = new BSP_CSGMesh_VertexIt; BSP_CSGMesh_VertexIt * v_it = new BSP_CSGMesh_VertexIt;
v_it->mesh = mesh; v_it->mesh = mesh;
v_it->pos = mesh->VertexSet().begin(); v_it->pos = &mesh->VertexSet()[0];
output->it = v_it; output->it = v_it;
}; };
@@ -161,7 +162,7 @@ BSP_CSGMesh_FaceIt_Done(
// assume CSG_IteratorPtr is of the correct type. // assume CSG_IteratorPtr is of the correct type.
BSP_CSGMesh_FaceIt * face_it = (BSP_CSGMesh_FaceIt *)it; 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()) { if (face_it->face_triangle + 3 <= face_it->pos->m_verts.size()) {
return 0; return 0;
} }
@@ -190,7 +191,7 @@ BSP_CSGMesh_FaceIt_Fill(
// time to change the iterator type to an integer... // time to change the iterator type to an integer...
face_it->mesh->FaceData().Copy( face_it->mesh->FaceData().Copy(
face->user_face_data, face->user_face_data,
int(face_it->pos - face_it->mesh->FaceSet().begin()) int(face_it->pos - &face_it->mesh->FaceSet()[0])
); );
// Copy face vertex data across... // Copy face vertex data across...
@@ -222,7 +223,8 @@ BSP_CSGMesh_FaceIt_Step(
BSP_CSGMesh_FaceIt * face_it = (BSP_CSGMesh_FaceIt *)it; BSP_CSGMesh_FaceIt * face_it = (BSP_CSGMesh_FaceIt *)it;
// safety guard // 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()) { if (face_it->face_triangle + 3 < face_it->pos->m_verts.size()) {
(face_it->face_triangle)++; (face_it->face_triangle)++;
} else { } else {
@@ -239,7 +241,7 @@ BSP_CSGMesh_FaceIt_Reset(
) { ) {
// assume CSG_IteratorPtr is of the correct type. // assume CSG_IteratorPtr is of the correct type.
BSP_CSGMesh_FaceIt * f_it = (BSP_CSGMesh_FaceIt *)it; BSP_CSGMesh_FaceIt * f_it = (BSP_CSGMesh_FaceIt *)it;
f_it->pos = f_it->mesh->FaceSet().begin(); f_it->pos = &f_it->mesh->FaceSet()[0];
f_it->face_triangle = 0; f_it->face_triangle = 0;
}; };
@@ -259,7 +261,7 @@ BSP_CSGMesh_FaceIt_Construct(
BSP_CSGMesh_FaceIt * f_it = new BSP_CSGMesh_FaceIt; BSP_CSGMesh_FaceIt * f_it = new BSP_CSGMesh_FaceIt;
f_it->mesh = mesh; f_it->mesh = mesh;
f_it->pos = mesh->FaceSet().begin(); f_it->pos = &mesh->FaceSet()[0];
f_it->face_triangle = 0; f_it->face_triangle = 0;
output->it = f_it; output->it = f_it;

View File

@@ -66,7 +66,7 @@ Duplicate(
int output = Size(); int output = Size();
IncSize(); IncSize();
memcpy(m_data.end() - m_width,record,m_width); memcpy(&m_data[ m_data.size() - 1 - m_width ], record, m_width);
return output; return output;
} }
@@ -80,9 +80,8 @@ Duplicate(
){ ){
if (m_width) { if (m_width) {
IncSize(); IncSize();
memcpy(&m_data[ m_data.size() - 1 - m_width ],
memcpy(m_data.end() - m_width,m_data.begin() + &m_data[ record_index * m_width], m_width);
record_index * m_width,m_width);
} }
} }
@@ -94,7 +93,7 @@ Copy(
int pos int pos
){ ){
if (m_width) { if (m_width) {
memcpy(output,m_data.begin() + m_width*pos,m_width); memcpy(output, &m_data[m_width*pos],m_width);
} }
} }
void void
@@ -133,6 +132,6 @@ BSP_CSGUserData::
operator [] ( operator [] (
const int pos const int pos
){ ){
return m_data.begin() + m_width*pos; return &m_data[ m_width*pos ];
} }

View File

@@ -219,7 +219,7 @@ Process(
/* Try and snip this triangle off from the /* Try and snip this triangle off from the
current polygon.*/ current polygon.*/
if ( Snip(verts,contour,u,v,w,nv,m_V.begin()) ) if ( Snip(verts,contour,u,v,w,nv, &m_V[0]) )
{ {
int a,b,c,s,t; int a,b,c,s,t;