first commit
This commit is contained in:
89
include/engine/physic/physic_shape.h
Normal file
89
include/engine/physic/physic_shape.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NPHYSICSHAPE__
|
||||
#define __NPHYSICSHAPE__
|
||||
|
||||
|
||||
#include "physic/physic_wheel.h"
|
||||
#include "container/narray.h"
|
||||
#include "nstring/nstring.h"
|
||||
|
||||
|
||||
namespace GS {
|
||||
namespace NML { class Tag; }
|
||||
namespace S3D {
|
||||
|
||||
/*!
|
||||
@short Physic shape.
|
||||
@author Emmanuel Julien (ejulien@gsworks.fr)
|
||||
*/
|
||||
struct PhysicShape
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
TypeNone = 0,
|
||||
TypeBox,
|
||||
TypeSphere,
|
||||
TypeConvex,
|
||||
TypeCylinder,
|
||||
TypeCone,
|
||||
TypeCapsule,
|
||||
TypeMesh,
|
||||
TypeHeightmap
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Type type;
|
||||
|
||||
int width, height;
|
||||
Array <float> heightmap;
|
||||
|
||||
float resolution;
|
||||
|
||||
public:
|
||||
|
||||
void Free();
|
||||
|
||||
Matrix4 GetMatrix();
|
||||
void SetMatrix(const Matrix4 &);
|
||||
|
||||
String path;
|
||||
|
||||
Vector4 position, ///< Position.
|
||||
rotation, ///< Rotation.
|
||||
scale, ///< Scale.
|
||||
dimensions; ///< Dimensions.
|
||||
|
||||
float mass,
|
||||
restitution,
|
||||
dynamic_friction,
|
||||
static_friction;
|
||||
|
||||
float *GetHeightmap() const { return heightmap; }
|
||||
int GetWidth() const { return width; }
|
||||
int GetHeight() const { return height; }
|
||||
float GetResolution() const { return resolution; }
|
||||
|
||||
bool Set(float *heightmap, int width, int height, float resolution);
|
||||
bool Set(Type, const char *path);
|
||||
bool Set(Type = TypeNone, const Vector4 & = Vector4(1, 1, 1));
|
||||
|
||||
Type GetType() const { return type; }
|
||||
|
||||
bool FromMetaTag(NML::Tag &);
|
||||
NML::Tag *AsMetaTag() const;
|
||||
|
||||
PhysicShape();
|
||||
~PhysicShape();
|
||||
};
|
||||
|
||||
} // S3D
|
||||
} // GS
|
||||
|
||||
|
||||
#endif // __NPHYSICSHAPE__
|
||||
Reference in New Issue
Block a user