Improved interface

*MappedNoiseBase provides a gain and offset control on the noise value
*AbstractXDNoise provides a way to contain different noises in a std
container and access the main "GetValue" member function
*Applied minor optimisation to Perlin4D (previously forgotten)
This commit is contained in:
Remi Beges 2012-07-24 14:21:56 +02:00
parent 10a436b481
commit 354d7ed002
22 changed files with 303 additions and 1313 deletions

View File

@ -0,0 +1,24 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_ABSTRACT2DNOISE_HPP
#define NAZARA_ABSTRACT2DNOISE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/MappedNoiseBase.hpp>
template <typename T> class NAZARA_API NzAbstract2DNoise : public NzMappedNoiseBase<T>
{
public:
virtual T GetMappedValue(T x, T y);
virtual T GetValue(T x, T y, T resolution) = 0;
virtual T GetValue(T x, T y);
};
#include <Nazara/Noise/Abstract2DNoise.inl>
#endif // NAZARA_ABSTRACT2DNOISE_HPP

View File

@ -0,0 +1,23 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/StringStream.hpp>
#include <Nazara/Math/Basic.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
template <typename T>
T NzAbstract2DNoise<T>::GetMappedValue(T x, T y)
{
return GetValue(x,y,this->m_resolution) * this->m_gain + this->m_offset;
}
template <typename T>
T NzAbstract2DNoise<T>::GetValue(T x, T y)
{
return GetValue(x,y,this->m_resolution);
}
#include <Nazara/Core/DebugOff.hpp>

View File

@ -0,0 +1,23 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_ABSTRACT3DNOISE_HPP
#define NAZARA_ABSTRACT3DNOISE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/MappedNoiseBase.hpp>
template <typename T> class NAZARA_API NzAbstract3DNoise : public NzMappedNoiseBase
{
public:
virtual T GetMappedValue(T x, T y, T z);
virtual T GetValue(T x, T y, T z) = 0;
virtual T GetValue(T x, T y, T z, T resolution);
};
#include <Nazara/Noise/Abstract3DNoise.inl>
#endif // NAZARA_ABSTRACT3DNOISE_HPP

View File

@ -0,0 +1,23 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/StringStream.hpp>
#include <Nazara/Math/Basic.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
template <typename T>
T NzAbstract3DNoise<T>::GetMappedValue(T x, T y, T z)
{
return GetValue(x,y,z) * m_gain + m_offset;
}
template <typename T>
T NzAbstract3DNoise<T>::GetValue(T x, T y, T z, T resolution)
{
return GetValue(x,y,z,this->m_resolution);
}
#include <Nazara/Core/DebugOff.hpp>

View File

@ -0,0 +1,24 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_ABSTRACT4DNOISE_HPP
#define NAZARA_ABSTRACT4DNOISE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/MappedNoiseBase.hpp>
template <typename T> class NAZARA_API NzAbstract4DNoise : public NzMappedNoiseBase
{
public:
virtual T GetMappedValue(T x, T y, T z, T w);
virtual T GetValue(T x, T y, T z, T w) = 0;
virtual T GetValue(T x, T y, T z, T w, T resolution);
};
#include <Nazara/Noise/Abstract4DNoise.inl>
#endif // NAZARA_ABSTRACT4DNOISE_HPP

View File

@ -0,0 +1,23 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/StringStream.hpp>
#include <Nazara/Math/Basic.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
template <typename T>
T NzAbstract4DNoise<T>::GetMappedValue(T x, T y, T z, T w)
{
return GetValue(x,y,z,w) * m_gain + m_offset;
}
template <typename T>
T NzAbstract3DNoise<T>::GetValue(T x, T y, T z, T resolution)
{
return GetValue(x,y,z,w,this->m_resolution);
}
#include <Nazara/Core/DebugOff.hpp>

View File

@ -0,0 +1,32 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_MAPPEDNOISEBASE_HPP
#define NAZARA_MAPPEDNOISEBASE_HPP
#include <Nazara/Prerequesites.hpp>
template <typename T> class NzMappedNoiseBase
{
public:
NzMappedNoiseBase();
~NzMappedNoiseBase() = default;
T GetGain() const;
T GetOffset() const;
T GetResolution() const;
void SetGain(T gain);
void SetOffset(T offset);
void SetResolution(T resolution);
protected:
T m_gain;
T m_offset;
T m_resolution;
};
#include <Nazara/Noise/MappedNoiseBase.inl>
#endif // NAZARA_MAPPEDNOISEBASE_HPP

View File

@ -0,0 +1,62 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/StringStream.hpp>
#include <Nazara/Math/Basic.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <stdexcept>
#include <Nazara/Noise/Debug.hpp>
template <typename T>
NzMappedNoiseBase<T>::NzMappedNoiseBase() : m_gain(1), m_offset(0), m_resolution(30)
{
}
template <typename T>
T NzMappedNoiseBase<T>::GetGain() const
{
return m_gain;
}
template <typename T>
T NzMappedNoiseBase<T>::GetOffset() const
{
return m_offset;
}
template <typename T>
T NzMappedNoiseBase<T>::GetResolution() const
{
return m_resolution;
}
template <typename T>
void NzMappedNoiseBase<T>::SetGain(T gain)
{
m_gain = gain;
}
template <typename T>
void NzMappedNoiseBase<T>::SetOffset(T offset)
{
m_offset = offset;
}
template <typename T>
void NzMappedNoiseBase<T>::SetResolution(T resolution)
{
if (NzNumberEquals(resolution, static_cast<T>(0.0)))
{
NzStringStream ss;
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
throw std::domain_error(ss.ToString());
}
m_resolution = static_cast<T>(1.0)/resolution;
}
#include <Nazara/Core/DebugOff.hpp>

View File

@ -9,13 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <Nazara/Noise/Abstract2DNoise.hpp>
#include <Nazara/Math/Vector2.hpp>
template <typename T> class NAZARA_API NzPerlin2D : public NzNoiseBase
template <typename T> class NAZARA_API NzPerlin2D : public NzAbstract2DNoise<T>, public NzNoiseBase
{
public:
NzPerlin2D();
T GetValue(T x, T y, T res);
T GetValue(T x, T y, T resolution);
~NzPerlin2D() = default;
protected:
private:

View File

@ -18,10 +18,10 @@ NzPerlin2D<T>::NzPerlin2D()
}
template <typename T>
T NzPerlin2D<T>::GetValue(T x, T y, T res)
T NzPerlin2D<T>::GetValue(T x, T y, T resolution)
{
x /= res;
y /= res;
x *= resolution;
y *= resolution;
x0 = fastfloor(x);
y0 = fastfloor(y);

View File

@ -9,13 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <Nazara/Noise/Abstract3DNoise.hpp>
#include <Nazara/Math/Vector3.hpp>
template <typename T> class NAZARA_API NzPerlin3D : public NzNoiseBase
template <typename T> class NAZARA_API NzPerlin3D : public NzAbstract3DNoise<T>, public NzNoiseBase
{
public:
NzPerlin3D();
T GetValue(T x, T y, T z, T res);
T GetValue(T x, T y, T z, T resolution);
~NzPerlin3D() = default;
protected:
private:

View File

@ -22,11 +22,11 @@ NzPerlin3D<T>::NzPerlin3D()
}
template <typename T>
T NzPerlin3D<T>::GetValue(T x, T y, T z, T res)
T NzPerlin3D<T>::GetValue(T x, T y, T z, T resolution)
{
x /= res;
y /= res;
z /= res;
x *= resolution;
y *= resolution;
z *= resolution;
x0 = fastfloor(x);
y0 = fastfloor(y);

View File

@ -9,13 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <Nazara/Noise/Abstract4DNoise.hpp>
#include <Nazara/Math/Vector4.hpp>
template <typename T> class NAZARA_API NzPerlin4D : public NzNoiseBase
template <typename T> class NAZARA_API NzPerlin4D : public NzAbstract4DNoise<T>, public NzNoiseBase
{
public:
NzPerlin4D();
T GetValue(T x, T y, T z, T w, T res);
T GetValue(T x, T y, T z, T w, T resolution);
~NzPerlin4D() = default;
protected:
private:
@ -26,7 +27,6 @@ template <typename T> class NAZARA_API NzPerlin4D : public NzNoiseBase
T Li1,Li2,Li3,Li4,Li5,Li6,Li7,Li8,Li9,Li10,Li11,Li12,Li13,Li14;
T s[4],t[4],u[4],v[4];
T Cx,Cy,Cz,Cw;
T nx,ny,nz,nw;
T tmp;
NzVector4<T> temp;

View File

@ -27,17 +27,17 @@ NzPerlin4D<T>::NzPerlin4D()
}
template <typename T>
T NzPerlin4D<T>::GetValue(T x, T y, T z, T w, T res)
T NzPerlin4D<T>::GetValue(T x, T y, T z, T w, T resolution)
{
nx = x/res;
ny = y/res;
nz = z/res;
nw = w/res;
x *= resolution;
y *= resolution;
z *= resolution;
w *= resolution;
x0 = fastfloor(nx);
y0 = fastfloor(ny);
z0 = fastfloor(nz);
w0 = fastfloor(nw);
x0 = fastfloor(x);
y0 = fastfloor(y);
z0 = fastfloor(z);
w0 = fastfloor(w);
ii = x0 & 255;
jj = y0 & 255;
@ -64,10 +64,10 @@ T NzPerlin4D<T>::GetValue(T x, T y, T z, T w, T res)
gi14 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi15 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31;
temp.x = nx-x0;
temp.y = ny-y0;
temp.z = nz-z0;
temp.w = nw-w0;
temp.x = x-x0;
temp.y = y-y0;
temp.z = z-z0;
temp.w = w-w0;
Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10);
Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10);
@ -76,55 +76,55 @@ T NzPerlin4D<T>::GetValue(T x, T y, T z, T w, T res)
s[0] = gradient4[gi0][0]*temp.x + gradient4[gi0][1]*temp.y + gradient4[gi0][2]*temp.z + gradient4[gi0][3]*temp.w;
temp.x = nx-(x0+1);
temp.x = x-(x0+1);
t[0] = gradient4[gi1][0]*temp.x + gradient4[gi1][1]*temp.y + gradient4[gi1][2]*temp.z + gradient4[gi1][3]*temp.w;
temp.y = ny-(y0+1);
temp.y = y-(y0+1);
v[0] = gradient4[gi3][0]*temp.x + gradient4[gi3][1]*temp.y + gradient4[gi3][2]*temp.z + gradient4[gi3][3]*temp.w;
temp.x = nx-x0;
temp.x = x-x0;
u[0] = gradient4[gi2][0]*temp.x + gradient4[gi2][1]*temp.y + gradient4[gi2][2]*temp.z + gradient4[gi2][3]*temp.w;
temp.y = ny-y0;
temp.z = nz-(z0+1);
temp.y = y-y0;
temp.z = z-(z0+1);
s[1] = gradient4[gi4][0]*temp.x + gradient4[gi4][1]*temp.y + gradient4[gi4][2]*temp.z + gradient4[gi4][3]*temp.w;
temp.x = nx-(x0+1);
temp.x = x-(x0+1);
t[1] = gradient4[gi5][0]*temp.x + gradient4[gi5][1]*temp.y + gradient4[gi5][2]*temp.z + gradient4[gi5][3]*temp.w;
temp.y = ny-(y0+1);
temp.y = y-(y0+1);
v[1] = gradient4[gi7][0]*temp.x + gradient4[gi7][1]*temp.y + gradient4[gi7][2]*temp.z + gradient4[gi7][3]*temp.w;
temp.x = nx-x0;
temp.x = x-x0;
u[1] = gradient4[gi6][0]*temp.x + gradient4[gi6][1]*temp.y + gradient4[gi6][2]*temp.z + gradient4[gi6][3]*temp.w;
temp.y = ny-y0;
temp.z = nz-z0;
temp.w = nw-(w0+1);
temp.y = y-y0;
temp.z = z-z0;
temp.w = w-(w0+1);
s[2] = gradient4[gi8][0]*temp.x + gradient4[gi8][1]*temp.y + gradient4[gi8][2]*temp.z + gradient4[gi8][3]*temp.w;
temp.x = nx-(x0+1);
temp.x = x-(x0+1);
t[2] = gradient4[gi9][0]*temp.x + gradient4[gi9][1]*temp.y + gradient4[gi9][2]*temp.z + gradient4[gi9][3]*temp.w;
temp.y = ny-(y0+1);
temp.y = y-(y0+1);
v[2] = gradient4[gi11][0]*temp.x + gradient4[gi11][1]*temp.y + gradient4[gi11][2]*temp.z + gradient4[gi11][3]*temp.w;
temp.x = nx-x0;
temp.x = x-x0;
u[2] = gradient4[gi10][0]*temp.x + gradient4[gi10][1]*temp.y + gradient4[gi10][2]*temp.z + gradient4[gi10][3]*temp.w;
temp.y = ny-y0;
temp.z = nz-(z0+1);
temp.y = y-y0;
temp.z = z-(z0+1);
s[3] = gradient4[gi12][0]*temp.x + gradient4[gi12][1]*temp.y + gradient4[gi12][2]*temp.z + gradient4[gi12][3]*temp.w;
temp.x = nx-(x0+1);
temp.x = x-(x0+1);
t[3] = gradient4[gi13][0]*temp.x + gradient4[gi13][1]*temp.y + gradient4[gi13][2]*temp.z + gradient4[gi13][3]*temp.w;
temp.y = ny-(y0+1);
temp.y = y-(y0+1);
v[3] = gradient4[gi15][0]*temp.x + gradient4[gi15][1]*temp.y + gradient4[gi15][2]*temp.z + gradient4[gi15][3]*temp.w;
temp.x = nx-x0;
temp.x = x-x0;
u[3] = gradient4[gi14][0]*temp.x + gradient4[gi14][1]*temp.y + gradient4[gi14][2]*temp.z + gradient4[gi14][3]*temp.w;
Li1 = s[0] + Cx*(t[0]-s[0]);

View File

@ -9,13 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <Nazara/Noise/Abstract2DNoise.hpp>
#include <Nazara/Math/Vector2.hpp>
template <typename T> class NAZARA_API NzSimplex2D : public NzNoiseBase
template <typename T> class NAZARA_API NzSimplex2D : public NzAbstract2DNoise<T>, public NzNoiseBase
{
public:
NzSimplex2D();
T GetValue(T x, T y, T res);
T GetValue(T x, T y, T resolution);
~NzSimplex2D() = default;
protected:
private:

View File

@ -21,10 +21,10 @@ NzSimplex2D<T>::NzSimplex2D()
}
template <typename T>
T NzSimplex2D<T>::GetValue(T x, T y, T res)
T NzSimplex2D<T>::GetValue(T x, T y, T resolution)
{
x /= res;
y /= res;
x *= resolution;
y *= resolution;
sum = (x + y) * SkewCoeff2D;
skewedCubeOrigin.x = fastfloor(x + sum);

View File

@ -9,13 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <Nazara/Noise/Abstract3DNoise.hpp>
#include <Nazara/Math/Vector3.hpp>
template <typename T> class NAZARA_API NzSimplex3D : public NzNoiseBase
template <typename T> class NAZARA_API NzSimplex3D : public NzAbstract3DNoise<T>, public NzNoiseBase
{
public:
NzSimplex3D();
T GetValue(T x, T y, T z, T res);
T GetValue(T x, T y, T z, T resolution);
~NzSimplex3D() = default;
protected:
private:

View File

@ -22,11 +22,11 @@ NzSimplex3D<T>::NzSimplex3D()
}
template <typename T>
T NzSimplex3D<T>::GetValue(T x, T y, T z, T res)
T NzSimplex3D<T>::GetValue(T x, T y, T z, T resolution)
{
x /= res;
y /= res;
z /= res;
x *= resolution;
y *= resolution;
z *= resolution;
sum = (x + y + z) * SkewCoeff3D;
skewedCubeOrigin.x = fastfloor(x + sum);

View File

@ -9,13 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <Nazara/Noise/Abstract4DNoise.hpp>
#include <Nazara/Math/Vector4.hpp>
template <typename T> class NAZARA_API NzSimplex4D : public NzNoiseBase
template <typename T> class NAZARA_API NzSimplex4D : public NzAbstract4DNoise<T>, public NzNoiseBase
{
public:
NzSimplex4D();
T GetValue(T x, T y, T z, T w, T res);
T GetValue(T x, T y, T z, T w, T resolution);
~NzSimplex4D() = default;
protected:
private:

View File

@ -46,12 +46,12 @@ NzSimplex4D<T>::NzSimplex4D()
}
template <typename T>
T NzSimplex4D<T>::GetValue(T x, T y, T z, T w, T res)
T NzSimplex4D<T>::GetValue(T x, T y, T z, T w, T resolution)
{
x /= res;
y /= res;
z /= res;
w /= res;
x *= resolution;
y *= resolution;
z *= resolution;
w *= resolution;
sum = (x + y + z + w) * SkewCoeff4D;
skewedCubeOrigin.x = fastfloor(x + sum);

View File

@ -1,190 +0,0 @@
/* Copyright (c) <2009> <Newton Game Dynamics>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely
*/
#ifndef NEWTON_CUSTOM_JOINTS_H_INCLUDED_
#define NEWTON_CUSTOM_JOINTS_H_INCLUDED_
#include "Newton.h"
//#include "CustomJointLibraryStdAfx.h"
#ifdef _NEWTON_STATIC_LIB
#define JOINTLIBRARY_API
#else
#ifdef JOINTLIBRARY_LIB
#define JOINTLIBRARY_API
#else
#ifdef JOINTLIBRARY_EXPORTS
#define JOINTLIBRARY_API __declspec(dllexport)
#else
#define JOINTLIBRARY_API __declspec(dllimport)
#endif
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
// Generic joint call back and user data
typedef struct NewtonUserJoint{} NewtonUserJoint;
typedef void (*NewtonUserJointDestructorCallback) (const NewtonUserJoint* me);
typedef void (*NewtonUserJointSubmitConstraintCallback) (const NewtonUserJoint* me, dFloat timestep, int threadIndex);
// generic joint functions
JOINTLIBRARY_API void CustomDestroyJoint(const NewtonUserJoint *joint);
JOINTLIBRARY_API NewtonJoint* CustomGetNewtonJoint (const NewtonUserJoint *joint);
JOINTLIBRARY_API int CustomGetJointID (const NewtonUserJoint *joint);
JOINTLIBRARY_API void CustomSetJointID (const NewtonUserJoint *joint, int rttI);
JOINTLIBRARY_API const NewtonBody* CustomGetBody0 (const NewtonUserJoint *joint);
JOINTLIBRARY_API const NewtonBody* CustomGetBody1 (const NewtonUserJoint *joint);
JOINTLIBRARY_API int CustomGetBodiesCollisionState (const NewtonUserJoint *joint);
JOINTLIBRARY_API void CustomSetBodiesCollisionState (const NewtonUserJoint *joint, int state);
JOINTLIBRARY_API void* CustomGetUserData (const NewtonUserJoint *joint);
JOINTLIBRARY_API void CustomSetUserData (const NewtonUserJoint *joint, void* userData);
JOINTLIBRARY_API void CustomSetDestructorCallback (const NewtonUserJoint *joint, NewtonUserJointDestructorCallback callback);
JOINTLIBRARY_API void CustomSetSubmitContraintCallback (const NewtonUserJoint *joint, NewtonUserJointSubmitConstraintCallback callback);
// this is a plain blank joint that can be used by advanced users who want to make their own joints
// but that can only use languages that can only interface with C code.
// we recommend using the CPP library to make the joints and then add a C interface, but this join is here for completion
typedef void (*BlankJointGetInfo) (const NewtonUserJoint* me, NewtonJointRecord* info);
JOINTLIBRARY_API NewtonUserJoint* CustomCreateBlankJoint(int maxDof, const NewtonBody* body0, const NewtonBody* body1, BlankJointGetInfo info);
// Kinematic control joint
JOINTLIBRARY_API NewtonUserJoint *CreateCustomKinematicController (const NewtonBody* targetBody, dFloat* attachmentPointInGlobalSpace);
JOINTLIBRARY_API void CustomKinematicControllerSetPickMode (const NewtonUserJoint *pick, int mode);
JOINTLIBRARY_API void CustomKinematicControllerSetMaxLinearFriction(const NewtonUserJoint *pick, dFloat accel);
JOINTLIBRARY_API void CustomKinematicControllerSetMaxAngularFriction(const NewtonUserJoint *pick, dFloat alpha);
JOINTLIBRARY_API void CustomKinematicControllerSetTargetPosit (const NewtonUserJoint *pick, dFloat* posit);
JOINTLIBRARY_API void CustomKinematicControllerSetTargetRotation (const NewtonUserJoint *pick, dFloat* rotation);
JOINTLIBRARY_API void CustomKinematicControllerSetTargetMatrix (const NewtonUserJoint *pick, dFloat* matrix);
JOINTLIBRARY_API void CustomKinematicControllerGetTargetMatrix (const NewtonUserJoint *pick, dFloat* matrix);
// Generic 6 degree of Freedom Joint
JOINTLIBRARY_API NewtonUserJoint *CreateCustomJoint6DOF (const dFloat* pinsAndPivotChildFrame, const dFloat* pinsAndPivotParentFrame, const NewtonBody* child, const NewtonBody* parent);
JOINTLIBRARY_API void CustomJoint6DOF_SetLinearLimits (NewtonUserJoint* customJoint6DOF, const dFloat* minLinearLimits, const dFloat* maxLinearLimits);
JOINTLIBRARY_API void CustomJoint6DOF_SetAngularLimits (NewtonUserJoint* customJoint6DOF, const dFloat* minAngularLimits, const dFloat* maxAngularLimits);
JOINTLIBRARY_API void CustomJoint6DOF_GetLinearLimits (NewtonUserJoint* customJoint6DOF, dFloat* minLinearLimits, dFloat* maxLinearLimits);
JOINTLIBRARY_API void CustomJoint6DOF_GetAngularLimits (NewtonUserJoint* customJoint6DOF, dFloat* minAngularLimits, dFloat* maxAngularLimits);
JOINTLIBRARY_API void CustomJoint6DOF_SetReverseUniversal (NewtonUserJoint* customJoint6DOF, int order);
// Interface for a custom BallAndSocket joint with Limits
JOINTLIBRARY_API NewtonUserJoint *CreateCustomBallAndSocket (const dFloat* pinsAndPivotChildFrame, const NewtonBody* child, const NewtonBody* parent);
JOINTLIBRARY_API void BallAndSocketSetConeAngle (NewtonUserJoint* ballJoint, dFloat angle);
JOINTLIBRARY_API void BallAndSocketSetTwistAngle (NewtonUserJoint* ballJoint, dFloat minAngle, dFloat maxAngle);
// Interface for a custom Hinge joint with Limits
JOINTLIBRARY_API NewtonUserJoint *CreateCustomHinge (const dFloat* pinsAndPivotChildFrame, const NewtonBody* child, const NewtonBody* parent);
JOINTLIBRARY_API void HingeEnableLimits(NewtonUserJoint* hingeJoint, int state);
JOINTLIBRARY_API void HingeSetLimits (NewtonUserJoint* hingeJoint, dFloat minAngle, dFloat maxAngle);
JOINTLIBRARY_API dFloat HingeGetJointAngle (const NewtonUserJoint* hingeJoint);
JOINTLIBRARY_API void HingeGetPinAxis (const NewtonUserJoint* hingeJoint, dFloat* pin);
JOINTLIBRARY_API dFloat HingeCalculateJointOmega (const NewtonUserJoint* hingeJoint);
// Interface for a custom Slider joint with Limits
JOINTLIBRARY_API NewtonUserJoint *CreateCustomSlider (const dFloat* pinsAndPivotChildFrame, const NewtonBody* child, const NewtonBody* parent);
JOINTLIBRARY_API void SliderEnableLimits(NewtonUserJoint* sliderJoint, int state);
JOINTLIBRARY_API void SliderSetLimits (NewtonUserJoint* sliderJoint, dFloat mindist, dFloat maxdist);
// player controller functions
// typedef int (*PlayerCanPuchThisBodyCalback) (NewtonUserJoint *me, const NewtonBody* hitBody);
JOINTLIBRARY_API NewtonUserJoint *CreateCustomPlayerController (const dFloat* pins, const NewtonBody* player, dFloat maxStairStepFactor, dFloat cushion);
JOINTLIBRARY_API void CustomPlayerControllerSetVelocity (const NewtonUserJoint* playerController, dFloat forwardSpeed, dFloat sideSpeed, dFloat heading);
JOINTLIBRARY_API void CustomPlayerControllerGetVisualMaTrix (const NewtonUserJoint* playerController, dFloat* matrix);
JOINTLIBRARY_API dFloat CustomPlayerControllerGetMaxSlope (const NewtonUserJoint* playerController);
JOINTLIBRARY_API void CustomPlayerControllerSetMaxSlope (const NewtonUserJoint* playerController, dFloat maxSlopeAngleIndRadian);
JOINTLIBRARY_API const NewtonCollision* CustomPlayerControllerGetSensorShape (const NewtonUserJoint* playerController);
// JOINTLIBRARY_API void CustomPlayerControllerSetPushActorCallback (NewtonUserJoint* playerController, PlayerCanPuchThisBodyCalback callback);
// JOINTLIBRARY_API const NewtonCollision* CustomPlayerControllerGetVerticalSensorShape (NewtonUserJoint* playerController);
// JOINTLIBRARY_API const NewtonCollision* CustomPlayerControllerGetDynamicsSensorShape (NewtonUserJoint* playerController);
// Multi rigid BodyCar controller functions
// JOINTLIBRARY_API NewtonUserJoint *CreateCustomMultiBodyVehicle (const dFloat* frontDir, const dFloat* upDir, const NewtonBody* carBody);
// JOINTLIBRARY_API int CustomMultiBodyVehicleAddTire (NewtonUserJoint *car, const void* userData, const dFloat* localPosition,
// dFloat mass, dFloat radius, dFloat width,
// dFloat suspensionLength, dFloat springConst, dFloat springDamper);
// JOINTLIBRARY_API int CustomMultiBodyVehicleAddSlipDifferencial (NewtonUserJoint *car, int leftTireIndex, int rightToreIndex, dFloat maxFriction);
// JOINTLIBRARY_API int CustomMultiBodyVehicleGetTiresCount(NewtonUserJoint *car);
// JOINTLIBRARY_API const NewtonBody* CustomMultiBodyVehicleGetTireBody(NewtonUserJoint *car, int tireIndex);
// JOINTLIBRARY_API dFloat CustomMultiBodyVehicleGetSpeed(NewtonUserJoint *car);
// JOINTLIBRARY_API dFloat CustomMultiBodyVehicleGetTireSteerAngle (NewtonUserJoint *car, int index);
// JOINTLIBRARY_API void CustomMultiBodyVehicleApplyTorque (NewtonUserJoint *car, int tireIndex, dFloat torque);
// JOINTLIBRARY_API void CustomMultiBodyVehicleApplySteering (NewtonUserJoint *car, int tireIndex, dFloat angle);
// JOINTLIBRARY_API void CustomMultiBodyVehicleApplyBrake (NewtonUserJoint *car, int tireIndex, dFloat brakeTorque);
// JOINTLIBRARY_API void CustomMultiBodyVehicleApplyTireRollingDrag (NewtonUserJoint *car, int index, dFloat angularDampingCoef);
// BEGIN k00m (Dave Gravel simple ray cast world vehicle)
typedef void (*DGRaycastVehicleTireTransformCallback) (NewtonUserJoint *car);
JOINTLIBRARY_API NewtonUserJoint *DGRaycastVehicleCreate (int maxTireCount, const dFloat* cordenateSytemInLocalSpace, NewtonBody* carBody);
JOINTLIBRARY_API void DGRaycastVehicleAddTire (NewtonUserJoint *car, void *userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat friction, dFloat suspensionLength, dFloat springConst, dFloat springDamper, int castMode);
JOINTLIBRARY_API void DGRaycastVehicleSetTireTransformCallback (NewtonUserJoint *car, DGRaycastVehicleTireTransformCallback callback);
JOINTLIBRARY_API int DGRaycastVehicleGetTiresCount(NewtonUserJoint *car);
JOINTLIBRARY_API void* DGRaycastVehicleGetTiresUserData(NewtonUserJoint *car, int tireIndex);
JOINTLIBRARY_API void DGRaycastVehicleGetTireMatrix(NewtonUserJoint *car, int tireIndex, dFloat* tireMatrix);
JOINTLIBRARY_API void DGRaycastVehicleInitNormalizeTireLateralForce(NewtonUserJoint *car, int pointsCount, dFloat* const piceSizeStepAxis, dFloat* const normalizedForceValue);
JOINTLIBRARY_API void DGRaycastVehicleInitNormalizeTireLongitudinalForce(NewtonUserJoint *car, int pointsCount, dFloat* const piceSizeStepAxis, dFloat* const normalizedForceValue);
// JOINTLIBRARY_API void DGRayCarGetChassisMatrixLocal(NewtonUserJoint *car, dFloat* chassisMatrix);
// JOINTLIBRARY_API void DGRayCarTireMatrix(NewtonUserJoint *car, int tire, dFloat* tireMatrix);
// JOINTLIBRARY_API void DGRayCarSuspensionMatrix(NewtonUserJoint *car, int tire, dFloat param, dFloat* SuspensionMatrix);
// JOINTLIBRARY_API const NewtonCollision* DGRayCarTireShape(NewtonUserJoint *car, int tireIndex);
// JOINTLIBRARY_API dFloat DGRaycastVehicleGetSpeed(NewtonUserJoint *car);
// JOINTLIBRARY_API void DGRaycastVehicleSetCustomTireBrake (NewtonUserJoint *car, int index, dFloat torque);
// JOINTLIBRARY_API void DGRaycastVehicleSetCustomTireTorque (NewtonUserJoint *car, int index, dFloat torque);
// JOINTLIBRARY_API void DGRaycastVehicleSetCustomTireSteerAngleForce (NewtonUserJoint *car, int index, dFloat angle, dFloat turnforce);
// JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresBrake (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresTorque (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresSteerForce (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API dFloat DGRaycastVehicleGenerateTiresSteerAngle (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarTireMovePointForceFront (NewtonUserJoint *car, int index, dFloat distance);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarTireMovePointForceRight (NewtonUserJoint *car, int index, dFloat distance);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarTireMovePointForceUp (NewtonUserJoint *car, int index, dFloat distance);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarFixDeceleration (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarChassisRotationLimit (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerAngle (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerRate (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerForceRate (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerForce (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxSteerSpeedRestriction (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxBrakeForce (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxTorque (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarMaxTorqueRate (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarEngineSteerDiv (NewtonUserJoint *car, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarTireSuspenssionHardLimit (NewtonUserJoint *car, int index, dFloat value);
// JOINTLIBRARY_API void DGRaycastVehicleSetVarTireFriction (NewtonUserJoint *car, int index, dFloat value);
// JOINTLIBRARY_API int DGRaycastVehicleGetVehicleOnAir(NewtonUserJoint *car);
// JOINTLIBRARY_API int DGRaycastVehicleGetTireOnAir(NewtonUserJoint *car, int index);
// JOINTLIBRARY_API void DGRaycastVehicleDestroy (NewtonUserJoint *car);
// END
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff