a few more changes to ubode

This commit is contained in:
UbitUmarov
2022-07-15 22:03:02 +01:00
parent ee76731cec
commit 164eca8ac2
4 changed files with 16 additions and 7 deletions
@@ -23,7 +23,7 @@
struct VertexPointers
{
const Point* Vertex[3];
/*
bool BackfaceCulling(const Point& source)
{
const Point& p0 = *Vertex[0];
@@ -36,6 +36,7 @@
// Backface culling
return (Normal | (source - p0)) >= 0.0f;
}
*/
};
struct VertexPointersEx
@@ -89,20 +89,25 @@ public:
return Result;
}
bool GetVertexUSEDFlag(unsigned VertexIndex) const { return (m_VertexUseBits[VertexIndex / 8] & (1 << (VertexIndex % 8))) != 0; }
void SetVertexUSEDFlag(unsigned VertexIndex) { m_VertexUseBits[VertexIndex / 8] |= (1 << (VertexIndex % 8)); }
bool GetVertexUSEDFlag(unsigned VertexIndex) const
{
return (m_VertexUseBits[VertexIndex >> 3] & (1 << (VertexIndex & 0x07))) != 0;
}
void SetVertexUSEDFlag(unsigned VertexIndex)
{
m_VertexUseBits[VertexIndex >> 3] |= (1 << (VertexIndex & 0x07));
}
private:
bool ReallocVertexUSEDFlags(size_t VertexNewElements)
{
bool Result = false;
uint8 *VertexNewBits = (uint8 *)dRealloc(m_VertexUseBits, m_VertexUseElements * sizeof(m_VertexUseBits[0]), VertexNewElements * sizeof(m_VertexUseBits[0]));
if (VertexNewBits) {
m_VertexUseBits = VertexNewBits;
m_VertexUseElements = VertexNewElements;
Result = true;
return true;
}
return Result;
return false;
}
void FreeVertexUSEDFlags()
@@ -100,12 +100,15 @@ int dCollideTrimeshPlane( dxGeom *o1, dxGeom *o2, int flags, dContactGeom* conta
//
// OPCODE data is in single precision format.
/*
int_vertex[ 0 ] = VP.Vertex[ v ]->x;
int_vertex[ 1 ] = VP.Vertex[ v ]->y;
int_vertex[ 2 ] = VP.Vertex[ v ]->z;
dMultiply0_331(vertex, trimesh_R, int_vertex );
*/
dMultiply0_331(vertex, trimesh_R, (dReal *)(VP.Vertex[v]));
dAddVector3r4(vertex, trimesh_pos);
//
@@ -929,7 +929,7 @@ int dxOSTerrain::dCollideOSTerrainZone( const int minX, const int maxX, const in
//set plane Geom
dCopyVector4((sliding_plane)->p, itPlane);
dGeomMoved(sliding_plane);
//dGeomMoved(sliding_plane);
numPlaneContacts = geomNPlaneCollider (o2, sliding_plane, planeTestFlags, PlaneContact, sizeof(dContactGeom));
if(numPlaneContacts > 0)