/usr/include/ois/OISEffect.h is in libois-dev 1.3.0+dfsg0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | /*
The zlib/libpng License
Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
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, subject to the following
restrictions:
1. The origin of this software must not be misrepresented; you must not claim that
you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef OIS_Effect_H
#define OIS_Effect_H
#include "OISPrereqs.h"
namespace OIS
{
//Predeclare some Effect Property structs
class ForceEffect;
class ConstantEffect;
class RampEffect;
class PeriodicEffect;
class ConditionalEffect;
/**
Force Feedback is a relatively complex set of properties to upload to a device.
The best place for information on the different properties, effects, etc is in
the DX Documentation and MSDN - there are even pretty graphs ther =)
As this class is modeled on the the DX interface you can apply that same
knowledge to creating effects via this class on any OS supported by OIS.
In anycase, this is the main class you will be using. There is *absolutely* no
need to instance any of the supporting ForceEffect classes yourself.
*/
class _OISExport Effect
{
/**
hidden so this class cannot be instanced with default constructor
*/
Effect();
public:
//! Type of force
enum EForce
{
UnknownForce = 0,
ConstantForce,
RampForce,
PeriodicForce,
ConditionalForce,
CustomForce,
_ForcesNumber // Always keep in last position.
};
static const char* getForceTypeName(EForce eValue);
//! Type of effect
enum EType
{
//Type ----- Pairs with force:
Unknown = 0, //UnknownForce
Constant, //ConstantForce
Ramp, //RampForce
Square, //PeriodicForce
Triangle, //PeriodicForce
Sine, //PeriodicForce
SawToothUp, //PeriodicForce
SawToothDown,//PeriodicForce
Friction, //ConditionalForce
Damper, //ConditionalForce
Inertia, //ConditionalForce
Spring, //ConditionalForce
Custom, //CustomForce
_TypesNumber // Always keep in last position.
};
static const char* getEffectTypeName(EType eValue);
//! Direction of the Force
enum EDirection
{
NorthWest,
North,
NorthEast,
East,
SouthEast,
South,
SouthWest,
West,
_DirectionsNumber // Always keep in last position.
};
static const char* getDirectionName(EDirection eValue);
/**
This constructor allows you to set the force type and effect.
*/
Effect(EForce ef, EType et);
virtual ~Effect();
const EForce force;
const EType type;
//Infinite Time
static const unsigned int OIS_INFINITE = 0xFFFFFFFF;
//-------------------------------------------------------------------//
//--- Set these variables before uploading or modifying an effect ---//
//Direction to apply to the force - affects two axes+ effects
EDirection direction;
//Number of button triggering an effect (-1 means no trigger)
short trigger_button;
//Time to wait before an effect can be re-triggered (microseconds)
unsigned int trigger_interval;
//Duration of an effect (microseconds)
unsigned int replay_length;
//Time to wait before to start playing an effect (microseconds)
unsigned int replay_delay;
//Get the specific Force Effect. This should be cast depending on the EForce
ForceEffect* getForceEffect() const;
/**
@remarks
Set the number of Axes to use before the initial creation of the effect.
Can only be done prior to creation! Use the FF interface to determine
how many axes can be used (are availiable)
*/
void setNumAxes(short nAxes);
/**
@remarks
Returns the number of axes used in this effect
*/
short getNumAxes() const;
//------------- Library Internal -------------------------------------//
/**
set internally.. do not change or you will not be able to upload/stop
this effect any more. It will become lost. It is mutable so even
with const reference it can/will be changed by this lib
*/
mutable int _handle;
protected:
ForceEffect* effect; //Properties depend on EForce
short axes; //Number of axes to use in effect
};
//-----------------------------------------------------------------------------//
/**
Base class of all effect property classes
*/
class _OISExport ForceEffect
{
public:
virtual ~ForceEffect() {}
};
//-----------------------------------------------------------------------------//
/**
An optional envelope to be applied to the start/end of an effect. If any of
these values are nonzero, then the envelope will be used in setting up the
effect.
*/
class _OISExport Envelope : public ForceEffect
{
public:
Envelope() : attackLength(0), attackLevel(0), fadeLength(0), fadeLevel(0) {}
#if defined(OIS_MSVC_COMPILER)
#pragma warning (push)
#pragma warning (disable : 4800)
#endif
bool isUsed() const { return attackLength | attackLevel | fadeLength | fadeLevel; }
#if defined(OIS_MSVC_COMPILER)
#pragma warning (pop)
#endif
// Duration of the attack (microseconds)
unsigned int attackLength;
// Absolute level at the beginning of the attack (0 to 10K)
// (automatically signed when necessary by FF core according to effect level sign)
unsigned short attackLevel;
// Duration of fade (microseconds)
unsigned int fadeLength;
// Absolute level at the end of fade (0 to 10K)
// (automatically signed when necessary by FF core according to effect level sign)
unsigned short fadeLevel;
};
//-----------------------------------------------------------------------------//
/**
Use this class when dealing with Force type of Constant
*/
class _OISExport ConstantEffect : public ForceEffect
{
public:
ConstantEffect() : level(5000) {}
class Envelope envelope; //Optional envolope
signed short level; //-10K to +10k
};
//-----------------------------------------------------------------------------//
/**
Use this class when dealing with Force type of Ramp
*/
class _OISExport RampEffect : public ForceEffect
{
public:
RampEffect() : startLevel(0), endLevel(0) {}
class Envelope envelope; //Optional envelope
signed short startLevel; //-10K to +10k
signed short endLevel; //-10K to +10k
};
//-----------------------------------------------------------------------------//
/**
Use this class when dealing with Force type of Periodic
*/
class _OISExport PeriodicEffect : public ForceEffect
{
public:
PeriodicEffect() : magnitude(0), offset(0), phase(0), period(0) {}
class Envelope envelope; //Optional Envelope
unsigned short magnitude; //0 to 10,0000
signed short offset;
unsigned short phase; //Position at which playback begins 0 to 35,999
unsigned int period; //Period of effect (microseconds)
};
//-----------------------------------------------------------------------------//
/**
Use this class when dealing with Force type of Condional
*/
class _OISExport ConditionalEffect : public ForceEffect
{
public:
ConditionalEffect() :
rightCoeff(0), leftCoeff(0), rightSaturation(0), leftSaturation(0),
deadband(0), center(0) {}
signed short rightCoeff; //-10k to +10k (Positive Coeff)
signed short leftCoeff; //-10k to +10k (Negative Coeff)
unsigned short rightSaturation; //0 to 10k (Pos Saturation)
unsigned short leftSaturation; //0 to 10k (Neg Saturation)
//Region around center in which the condition is not active, in the range
//from 0 through 10,000
unsigned short deadband;
//(Offset in DX) -10k and 10k
signed short center;
};
}
#endif //OIS_Effect_H
|