first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __NSHAPE__
#define __NSHAPE__
#include "math/vector.h"
namespace GS {
/*!
@short Shape base class.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
struct Shape
{
/// Get shape center.
virtual Vector4 &GetCenter() const = 0;
/// Get distance to support point on a given direction.
virtual float GetSupportDistance(const Vector4 &) const = 0;
};
} // GS
#endif // __NSHAPE__

View File

@ -0,0 +1,47 @@
/*
nEngine
Emmanuel Julien 2000-2010
All Rights Reserved
http://www.gamestart3d.com
Please refer to the included license.txt for license informations.
*/
#ifndef __NSHAPEBOX__
#define __NSHAPEBOX__
#include "shape/shape.h"
/*!
@short Box shape class.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
struct nBoxShape : public nShape
{
Vector4 center;
Vector4 half_d;
virtual Vector4 &GetCenter() const
{ return center; }
virtual float GetSupportDistance(const Vector4 &d) const
{ return d.Abs().Dot(half_d); }
nSphereShape(const Vector4 &c, const Vector4 &d)
{
center = c;
half_d = d;
}
nSphereShape()
{
center.Set(0, 0, 0);
half_d.Set(0, 0, 0);
}
};
#endif // __NSHAPEBOX__

View File

@ -0,0 +1,59 @@
/*
nEngine
Emmanuel Julien 2000-2010
All Rights Reserved
http://www.gamestart3d.com
Please refer to the included license.txt for license informations.
*/
#ifndef __NSHAPECONVEX__
#define __NSHAPECONVEX__
#include "shape/shape.h"
#include "container/narray.h"
/*!
@short Convex shape class.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
struct nConvexShape : public nShape
{
Vector4 center;
nArray <Vector4> vtx;
virtual Vector4 &GetCenter() const
{ return center; }
virtual float GetSupportDistance(const Vector4 &d) const
{
if (!vtx.GetCount())
return 0;
float d = vtx[0].Dot(d);
for (uint n = 1; n < vtx.GetCount(); ++n)
{
float _d = vtx[n].Dot(d);
if (_d > d)
d = _d;
}
return d;
}
nConvexShape(const Vector4 &c, const nArray <Vector4> &v)
{
center = c;
vtx.Clone(v);
}
nConvexShape()
{
center.Set(0, 0, 0);
}
};
#endif // __NSHAPECONVEX__

View File

@ -0,0 +1,47 @@
/*
nEngine
Emmanuel Julien 2000-2010
All Rights Reserved
http://www.gamestart3d.com
Please refer to the included license.txt for license informations.
*/
#ifndef __NSHAPESPHERE__
#define __NSHAPESPHERE__
#include "shape/shape.h"
/*!
@short Sphere shape class.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
struct nSphereShape : public nShape
{
Vector4 center;
float radius;
virtual Vector4 &GetCenter() const
{ return center; }
virtual float GetSupportDistance(const Vector4 &) const
{ return radius; }
nSphereShape(const Vector4 &c, float r)
{
center = c;
radius = r;
}
nSphereShape()
{
center.Set(0, 0, 0);
radius = 0;
}
};
#endif // __NSHAPESPHERE__