mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Tidy up indentation in openvr changes
This commit is contained in:
parent
e6159a590a
commit
212ac36cc1
25 changed files with 2171 additions and 2172 deletions
|
|
@ -102,10 +102,10 @@ bool OpenVROverlay::onAdd()
|
|||
mOverlayTypeDirty = true;
|
||||
mOverlayDirty = true;
|
||||
|
||||
if (OPENVR)
|
||||
{
|
||||
OPENVR->registerOverlay(this);
|
||||
}
|
||||
if (OPENVR)
|
||||
{
|
||||
OPENVR->registerOverlay(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -127,10 +127,10 @@ void OpenVROverlay::onRemove()
|
|||
mThumbOverlayHandle = NULL;
|
||||
}
|
||||
|
||||
if (ManagedSingleton<OpenVRProvider>::instanceOrNull())
|
||||
{
|
||||
OPENVR->unregisterOverlay(this);
|
||||
}
|
||||
if (ManagedSingleton<OpenVRProvider>::instanceOrNull())
|
||||
{
|
||||
OPENVR->unregisterOverlay(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenVROverlay::resetOverlay()
|
||||
|
|
@ -233,14 +233,14 @@ void OpenVROverlay::showOverlay()
|
|||
if (mOverlayHandle == NULL)
|
||||
return;
|
||||
|
||||
if (mOverlayType != OVERLAYTYPE_DASHBOARD)
|
||||
{
|
||||
vr::EVROverlayError err = vr::VROverlay()->ShowOverlay(mOverlayHandle);
|
||||
if (err != vr::VROverlayError_None)
|
||||
{
|
||||
Con::errorf("VR Overlay error!");
|
||||
}
|
||||
}
|
||||
if (mOverlayType != OVERLAYTYPE_DASHBOARD)
|
||||
{
|
||||
vr::EVROverlayError err = vr::VROverlay()->ShowOverlay(mOverlayHandle);
|
||||
if (err != vr::VROverlayError_None)
|
||||
{
|
||||
Con::errorf("VR Overlay error!");
|
||||
}
|
||||
}
|
||||
|
||||
if (!mStagingTexture)
|
||||
{
|
||||
|
|
@ -253,10 +253,10 @@ void OpenVROverlay::hideOverlay()
|
|||
if (mOverlayHandle == NULL)
|
||||
return;
|
||||
|
||||
if (mOverlayType != OVERLAYTYPE_DASHBOARD)
|
||||
{
|
||||
vr::VROverlay()->HideOverlay(mOverlayHandle);
|
||||
}
|
||||
if (mOverlayType != OVERLAYTYPE_DASHBOARD)
|
||||
{
|
||||
vr::VROverlay()->HideOverlay(mOverlayHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -317,8 +317,8 @@ bool OpenVROverlay::castRay(const Point3F &origin, const Point3F &direction, Ray
|
|||
vr::VROverlayIntersectionParams_t params;
|
||||
vr::VROverlayIntersectionResults_t result;
|
||||
|
||||
Point3F ovrOrigin = OpenVRUtil::convertPointToOVR(origin);
|
||||
Point3F ovrDirection = OpenVRUtil::convertPointToOVR(direction);
|
||||
Point3F ovrOrigin = OpenVRUtil::convertPointToOVR(origin);
|
||||
Point3F ovrDirection = OpenVRUtil::convertPointToOVR(direction);
|
||||
|
||||
params.eOrigin = mTrackingOrigin;
|
||||
params.vSource.v[0] = ovrOrigin.x;
|
||||
|
|
@ -350,17 +350,17 @@ void OpenVROverlay::moveGamepadFocusToNeighbour()
|
|||
|
||||
void OpenVROverlay::handleOpenVREvents()
|
||||
{
|
||||
if (mManualMouseHandling)
|
||||
{
|
||||
// tell OpenVR to make some events for us
|
||||
for (vr::TrackedDeviceIndex_t unDeviceId = 1; unDeviceId < vr::k_unControllerStateAxisCount; unDeviceId++)
|
||||
{
|
||||
if (vr::VROverlay()->HandleControllerOverlayInteractionAsMouse(mOverlayHandle, unDeviceId))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mManualMouseHandling)
|
||||
{
|
||||
// tell OpenVR to make some events for us
|
||||
for (vr::TrackedDeviceIndex_t unDeviceId = 1; unDeviceId < vr::k_unControllerStateAxisCount; unDeviceId++)
|
||||
{
|
||||
if (vr::VROverlay()->HandleControllerOverlayInteractionAsMouse(mOverlayHandle, unDeviceId))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vr::VREvent_t vrEvent;
|
||||
|
|
@ -373,13 +373,13 @@ void OpenVROverlay::handleOpenVREvents()
|
|||
eventInfo.modifier = (InputModifiers)0;
|
||||
eventInfo.ascii = 0;
|
||||
|
||||
//Con::printf("Overlay event %i", vrEvent.eventType);
|
||||
//Con::printf("Overlay event %i", vrEvent.eventType);
|
||||
|
||||
switch (vrEvent.eventType)
|
||||
{
|
||||
case vr::VREvent_MouseMove:
|
||||
{
|
||||
//Con::printf("mousemove %f,%f", vrEvent.data.mouse.x, vrEvent.data.mouse.y);
|
||||
//Con::printf("mousemove %f,%f", vrEvent.data.mouse.x, vrEvent.data.mouse.y);
|
||||
eventInfo.objType = SI_AXIS;
|
||||
eventInfo.objInst = SI_XAXIS;
|
||||
eventInfo.action = SI_MAKE;
|
||||
|
|
@ -424,11 +424,11 @@ void OpenVROverlay::handleOpenVREvents()
|
|||
AssertFatal(false, "WTF is going on here");
|
||||
break;
|
||||
|
||||
case vr::VREvent_KeyboardCharInput:
|
||||
case vr::VREvent_KeyboardDone:
|
||||
updateTextControl((GuiControl*)vrEvent.data.keyboard.uUserValue);
|
||||
break;
|
||||
}
|
||||
case vr::VREvent_KeyboardCharInput:
|
||||
case vr::VREvent_KeyboardDone:
|
||||
updateTextControl((GuiControl*)vrEvent.data.keyboard.uUserValue);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -450,16 +450,16 @@ void OpenVROverlay::handleOpenVREvents()
|
|||
|
||||
void OpenVROverlay::updateTextControl(GuiControl* ctrl)
|
||||
{
|
||||
if (!ctrl)
|
||||
return;
|
||||
if (!ctrl)
|
||||
return;
|
||||
|
||||
GuiTextCtrl* textCtrl = dynamic_cast<GuiTextCtrl*>(ctrl);
|
||||
if (textCtrl)
|
||||
{
|
||||
char text[GuiTextCtrl::MAX_STRING_LENGTH];
|
||||
vr::VROverlay()->GetKeyboardText(text, GuiTextCtrl::MAX_STRING_LENGTH);
|
||||
textCtrl->setText(text);
|
||||
}
|
||||
GuiTextCtrl* textCtrl = dynamic_cast<GuiTextCtrl*>(ctrl);
|
||||
if (textCtrl)
|
||||
{
|
||||
char text[GuiTextCtrl::MAX_STRING_LENGTH];
|
||||
vr::VROverlay()->GetKeyboardText(text, GuiTextCtrl::MAX_STRING_LENGTH);
|
||||
textCtrl->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenVROverlay::onFrameRendered()
|
||||
|
|
@ -508,27 +508,27 @@ void OpenVROverlay::onFrameRendered()
|
|||
|
||||
void OpenVROverlay::enableKeyboardTranslation()
|
||||
{
|
||||
vr::IVROverlay *overlay = vr::VROverlay();
|
||||
if (!overlay || !mOverlayHandle)
|
||||
return;
|
||||
vr::IVROverlay *overlay = vr::VROverlay();
|
||||
if (!overlay || !mOverlayHandle)
|
||||
return;
|
||||
|
||||
GuiTextEditCtrl* ctrl = dynamic_cast<GuiTextEditCtrl*>(getFirstResponder());
|
||||
if (ctrl)
|
||||
{
|
||||
vr::EGamepadTextInputMode inputMode = ctrl->isPasswordText() ? vr::k_EGamepadTextInputModePassword : vr::k_EGamepadTextInputModeNormal;
|
||||
char text[GuiTextCtrl::MAX_STRING_LENGTH + 1];
|
||||
ctrl->getText(text);
|
||||
overlay->ShowKeyboardForOverlay(mOverlayHandle, inputMode, vr::k_EGamepadTextInputLineModeSingleLine, ctrl->getTooltip().c_str(), GuiTextCtrl::MAX_STRING_LENGTH, text, false, (uint64_t)ctrl);
|
||||
}
|
||||
GuiTextEditCtrl* ctrl = dynamic_cast<GuiTextEditCtrl*>(getFirstResponder());
|
||||
if (ctrl)
|
||||
{
|
||||
vr::EGamepadTextInputMode inputMode = ctrl->isPasswordText() ? vr::k_EGamepadTextInputModePassword : vr::k_EGamepadTextInputModeNormal;
|
||||
char text[GuiTextCtrl::MAX_STRING_LENGTH + 1];
|
||||
ctrl->getText(text);
|
||||
overlay->ShowKeyboardForOverlay(mOverlayHandle, inputMode, vr::k_EGamepadTextInputLineModeSingleLine, ctrl->getTooltip().c_str(), GuiTextCtrl::MAX_STRING_LENGTH, text, false, (uint64_t)ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenVROverlay::disableKeyboardTranslation()
|
||||
{
|
||||
vr::IVROverlay *overlay = vr::VROverlay();
|
||||
if (!overlay || !mOverlayHandle)
|
||||
return;
|
||||
vr::IVROverlay *overlay = vr::VROverlay();
|
||||
if (!overlay || !mOverlayHandle)
|
||||
return;
|
||||
|
||||
overlay->HideKeyboard();
|
||||
overlay->HideKeyboard();
|
||||
}
|
||||
|
||||
void OpenVROverlay::setNativeAcceleratorsEnabled(bool enabled)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
bool mOverlayTypeDirty; ///< Overlay type is dirty
|
||||
bool mOverlayDirty; ///< Overlay properties are dirty
|
||||
bool mManualMouseHandling;
|
||||
bool mManualMouseHandling;
|
||||
OverlayType mOverlayType;
|
||||
|
||||
//
|
||||
|
|
@ -90,12 +90,12 @@ public:
|
|||
void moveGamepadFocusToNeighbour();
|
||||
|
||||
void handleOpenVREvents();
|
||||
void updateTextControl(GuiControl* ctrl);
|
||||
void updateTextControl(GuiControl* ctrl);
|
||||
void onFrameRendered();
|
||||
|
||||
virtual void enableKeyboardTranslation();
|
||||
virtual void disableKeyboardTranslation();
|
||||
virtual void setNativeAcceleratorsEnabled(bool enabled);
|
||||
virtual void enableKeyboardTranslation();
|
||||
virtual void disableKeyboardTranslation();
|
||||
virtual void setNativeAcceleratorsEnabled(bool enabled);
|
||||
};
|
||||
|
||||
typedef OpenVROverlay::OverlayType OpenVROverlayType;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -62,91 +62,91 @@ namespace OpenVRUtil
|
|||
|
||||
U32 convertOpenVRButtonToTorqueButton(uint32_t vrButton);
|
||||
|
||||
/// Converts a point to OVR coords
|
||||
inline Point3F convertPointToOVR(const Point3F &point)
|
||||
{
|
||||
return Point3F(-point.x, -point.z, point.y);
|
||||
}
|
||||
/// Converts a point to OVR coords
|
||||
inline Point3F convertPointToOVR(const Point3F &point)
|
||||
{
|
||||
return Point3F(-point.x, -point.z, point.y);
|
||||
}
|
||||
|
||||
/// Converts a point from OVR coords
|
||||
inline Point3F convertPointFromOVR(const Point3F &point)
|
||||
{
|
||||
return Point3F(-point.x, point.z, -point.y);
|
||||
}
|
||||
/// Converts a point from OVR coords
|
||||
inline Point3F convertPointFromOVR(const Point3F &point)
|
||||
{
|
||||
return Point3F(-point.x, point.z, -point.y);
|
||||
}
|
||||
|
||||
// Converts a point from OVR coords, from an input float array
|
||||
inline Point3F convertPointFromOVR(const vr::HmdVector3_t& v)
|
||||
{
|
||||
return Point3F(-v.v[0], v.v[2], -v.v[1]);
|
||||
}
|
||||
// Converts a point from OVR coords, from an input float array
|
||||
inline Point3F convertPointFromOVR(const vr::HmdVector3_t& v)
|
||||
{
|
||||
return Point3F(-v.v[0], v.v[2], -v.v[1]);
|
||||
}
|
||||
};
|
||||
|
||||
template<int TEXSIZE> class VRTextureSet
|
||||
{
|
||||
public:
|
||||
static const int TextureCount = TEXSIZE;
|
||||
GFXTexHandle mTextures[TEXSIZE];
|
||||
U32 mIndex;
|
||||
static const int TextureCount = TEXSIZE;
|
||||
GFXTexHandle mTextures[TEXSIZE];
|
||||
U32 mIndex;
|
||||
|
||||
VRTextureSet() : mIndex(0)
|
||||
{
|
||||
}
|
||||
VRTextureSet() : mIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
void init(U32 width, U32 height, GFXFormat fmt, GFXTextureProfile *profile, const String &desc)
|
||||
{
|
||||
for (U32 i = 0; i < TextureCount; i++)
|
||||
{
|
||||
mTextures[i].set(width, height, fmt, profile, desc);
|
||||
}
|
||||
}
|
||||
void init(U32 width, U32 height, GFXFormat fmt, GFXTextureProfile *profile, const String &desc)
|
||||
{
|
||||
for (U32 i = 0; i < TextureCount; i++)
|
||||
{
|
||||
mTextures[i].set(width, height, fmt, profile, desc);
|
||||
}
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
for (U32 i = 0; i < TextureCount; i++)
|
||||
{
|
||||
mTextures[i] = NULL;
|
||||
}
|
||||
}
|
||||
void clear()
|
||||
{
|
||||
for (U32 i = 0; i < TextureCount; i++)
|
||||
{
|
||||
mTextures[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void advance()
|
||||
{
|
||||
mIndex = (mIndex + 1) % TextureCount;
|
||||
}
|
||||
void advance()
|
||||
{
|
||||
mIndex = (mIndex + 1) % TextureCount;
|
||||
}
|
||||
|
||||
GFXTexHandle& getTextureHandle()
|
||||
{
|
||||
return mTextures[mIndex];
|
||||
}
|
||||
GFXTexHandle& getTextureHandle()
|
||||
{
|
||||
return mTextures[mIndex];
|
||||
}
|
||||
};
|
||||
|
||||
/// Simple class to handle rendering native OpenVR model data
|
||||
class OpenVRRenderModel
|
||||
{
|
||||
public:
|
||||
typedef GFXVertexPNT VertexType;
|
||||
GFXVertexBufferHandle<VertexType> mVertexBuffer;
|
||||
GFXPrimitiveBufferHandle mPrimitiveBuffer;
|
||||
BaseMatInstance* mMaterialInstance; ///< Material to use for rendering. NOTE:
|
||||
Box3F mLocalBox;
|
||||
typedef GFXVertexPNT VertexType;
|
||||
GFXVertexBufferHandle<VertexType> mVertexBuffer;
|
||||
GFXPrimitiveBufferHandle mPrimitiveBuffer;
|
||||
BaseMatInstance* mMaterialInstance; ///< Material to use for rendering. NOTE:
|
||||
Box3F mLocalBox;
|
||||
|
||||
OpenVRRenderModel() : mMaterialInstance(NULL)
|
||||
{
|
||||
}
|
||||
OpenVRRenderModel() : mMaterialInstance(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
~OpenVRRenderModel()
|
||||
{
|
||||
SAFE_DELETE(mMaterialInstance);
|
||||
}
|
||||
~OpenVRRenderModel()
|
||||
{
|
||||
SAFE_DELETE(mMaterialInstance);
|
||||
}
|
||||
|
||||
Box3F getWorldBox(MatrixF &mat)
|
||||
{
|
||||
Box3F ret = mLocalBox;
|
||||
mat.mul(ret);
|
||||
return ret;
|
||||
}
|
||||
Box3F getWorldBox(MatrixF &mat)
|
||||
{
|
||||
Box3F ret = mLocalBox;
|
||||
mat.mul(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool init(const vr::RenderModel_t & vrModel, StringTableEntry materialName);
|
||||
void draw(SceneRenderState *state, MeshRenderInst* renderInstance);
|
||||
bool init(const vr::RenderModel_t & vrModel, StringTableEntry materialName);
|
||||
void draw(SceneRenderState *state, MeshRenderInst* renderInstance);
|
||||
};
|
||||
|
||||
struct OpenVRRenderState
|
||||
|
|
@ -196,21 +196,21 @@ public:
|
|||
|
||||
struct LoadedRenderModel
|
||||
{
|
||||
StringTableEntry name;
|
||||
vr::RenderModel_t *vrModel;
|
||||
OpenVRRenderModel *model;
|
||||
vr::EVRRenderModelError modelError;
|
||||
S32 textureId;
|
||||
bool loadedTexture;
|
||||
StringTableEntry name;
|
||||
vr::RenderModel_t *vrModel;
|
||||
OpenVRRenderModel *model;
|
||||
vr::EVRRenderModelError modelError;
|
||||
S32 textureId;
|
||||
bool loadedTexture;
|
||||
};
|
||||
|
||||
struct LoadedRenderTexture
|
||||
{
|
||||
U32 vrTextureId;
|
||||
vr::RenderModel_TextureMap_t *vrTexture;
|
||||
GFXTextureObject *texture;
|
||||
NamedTexTarget *targetTexture;
|
||||
vr::EVRRenderModelError textureError;
|
||||
U32 vrTextureId;
|
||||
vr::RenderModel_TextureMap_t *vrTexture;
|
||||
GFXTextureObject *texture;
|
||||
NamedTexTarget *targetTexture;
|
||||
vr::EVRRenderModelError textureError;
|
||||
};
|
||||
|
||||
OpenVRProvider();
|
||||
|
|
@ -283,21 +283,21 @@ public:
|
|||
IDevicePose getTrackedDevicePose(U32 idx);
|
||||
/// }
|
||||
|
||||
/// @name Overlay registration
|
||||
/// {
|
||||
void registerOverlay(OpenVROverlay* overlay);
|
||||
void unregisterOverlay(OpenVROverlay* overlay);
|
||||
/// }
|
||||
/// @name Overlay registration
|
||||
/// {
|
||||
void registerOverlay(OpenVROverlay* overlay);
|
||||
void unregisterOverlay(OpenVROverlay* overlay);
|
||||
/// }
|
||||
|
||||
/// @name Model loading
|
||||
/// {
|
||||
const S32 preloadRenderModel(StringTableEntry name);
|
||||
const S32 preloadRenderModelTexture(U32 index);
|
||||
bool getRenderModel(S32 idx, OpenVRRenderModel **ret, bool &failed);
|
||||
bool getRenderModelTexture(S32 idx, GFXTextureObject **outTex, bool &failed);
|
||||
bool getRenderModelTextureName(S32 idx, String &outName);
|
||||
void resetRenderModels();
|
||||
/// }
|
||||
/// @name Model loading
|
||||
/// {
|
||||
const S32 preloadRenderModel(StringTableEntry name);
|
||||
const S32 preloadRenderModelTexture(U32 index);
|
||||
bool getRenderModel(S32 idx, OpenVRRenderModel **ret, bool &failed);
|
||||
bool getRenderModelTexture(S32 idx, GFXTextureObject **outTex, bool &failed);
|
||||
bool getRenderModelTextureName(S32 idx, String &outName);
|
||||
void resetRenderModels();
|
||||
/// }
|
||||
|
||||
|
||||
/// @name Console API
|
||||
|
|
@ -338,17 +338,17 @@ public:
|
|||
|
||||
vr::ETrackingUniverseOrigin mTrackingSpace;
|
||||
|
||||
Vector<OpenVROverlay*> mOverlays;
|
||||
Vector<OpenVROverlay*> mOverlays;
|
||||
|
||||
VREventSignal mVREventSignal;
|
||||
Namespace *mOpenVRNS;
|
||||
VREventSignal mVREventSignal;
|
||||
Namespace *mOpenVRNS;
|
||||
|
||||
Vector<LoadedRenderModel> mLoadedModels;
|
||||
Vector<LoadedRenderTexture> mLoadedTextures;
|
||||
Map<StringTableEntry, S32> mLoadedModelLookup;
|
||||
Map<U32, S32> mLoadedTextureLookup;
|
||||
Vector<LoadedRenderModel> mLoadedModels;
|
||||
Vector<LoadedRenderTexture> mLoadedTextures;
|
||||
Map<StringTableEntry, S32> mLoadedModelLookup;
|
||||
Map<U32, S32> mLoadedTextureLookup;
|
||||
|
||||
Map<U32, S32> mDeviceEventMap;
|
||||
Map<U32, S32> mDeviceEventMap;
|
||||
/// }
|
||||
|
||||
GuiCanvas* mDrawCanvas;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -23,132 +23,132 @@ class PhysicsBody;
|
|||
|
||||
class OpenVRTrackedObjectData : public GameBaseData {
|
||||
public:
|
||||
typedef GameBaseData Parent;
|
||||
typedef GameBaseData Parent;
|
||||
|
||||
StringTableEntry mShapeFile;
|
||||
Resource<TSShape> mShape; ///< Torque model
|
||||
StringTableEntry mShapeFile;
|
||||
Resource<TSShape> mShape; ///< Torque model
|
||||
|
||||
Point3F mCollisionBoxMin;
|
||||
Point3F mCollisionBoxMax;
|
||||
Point3F mCollisionBoxMin;
|
||||
Point3F mCollisionBoxMax;
|
||||
|
||||
public:
|
||||
|
||||
OpenVRTrackedObjectData();
|
||||
~OpenVRTrackedObjectData();
|
||||
OpenVRTrackedObjectData();
|
||||
~OpenVRTrackedObjectData();
|
||||
|
||||
DECLARE_CONOBJECT(OpenVRTrackedObjectData);
|
||||
DECLARE_CONOBJECT(OpenVRTrackedObjectData);
|
||||
|
||||
bool onAdd();
|
||||
bool preload(bool server, String &errorStr);
|
||||
bool onAdd();
|
||||
bool preload(bool server, String &errorStr);
|
||||
|
||||
static void initPersistFields();
|
||||
static void initPersistFields();
|
||||
|
||||
virtual void packData(BitStream* stream);
|
||||
virtual void unpackData(BitStream* stream);
|
||||
virtual void packData(BitStream* stream);
|
||||
virtual void unpackData(BitStream* stream);
|
||||
};
|
||||
|
||||
/// Implements a GameObject which tracks an OpenVR controller
|
||||
class OpenVRTrackedObject : public GameBase
|
||||
{
|
||||
typedef GameBase Parent;
|
||||
typedef GameBase Parent;
|
||||
|
||||
enum MaskBits
|
||||
{
|
||||
UpdateMask = Parent::NextFreeMask << 0,
|
||||
NextFreeMask = Parent::NextFreeMask << 1
|
||||
};
|
||||
enum MaskBits
|
||||
{
|
||||
UpdateMask = Parent::NextFreeMask << 0,
|
||||
NextFreeMask = Parent::NextFreeMask << 1
|
||||
};
|
||||
|
||||
struct RenderModelSlot
|
||||
{
|
||||
StringTableEntry componentName; ///< Component name
|
||||
S16 mappedNodeIdx; ///< Mapped node idx in mShape
|
||||
OpenVRRenderModel *nativeModel; ///< Native model
|
||||
};
|
||||
struct RenderModelSlot
|
||||
{
|
||||
StringTableEntry componentName; ///< Component name
|
||||
S16 mappedNodeIdx; ///< Mapped node idx in mShape
|
||||
OpenVRRenderModel *nativeModel; ///< Native model
|
||||
};
|
||||
|
||||
OpenVRTrackedObjectData *mDataBlock;
|
||||
OpenVRTrackedObjectData *mDataBlock;
|
||||
|
||||
/// @name Rendering
|
||||
/// {
|
||||
TSShapeInstance *mShapeInstance; ///< Shape used to render controller (uses native model otherwise)
|
||||
StringTableEntry mModelName;
|
||||
OpenVRRenderModel *mBasicModel; ///< Basic model
|
||||
Vector<RenderModelSlot> mRenderComponents;
|
||||
/// }
|
||||
/// @name Rendering
|
||||
/// {
|
||||
TSShapeInstance *mShapeInstance; ///< Shape used to render controller (uses native model otherwise)
|
||||
StringTableEntry mModelName;
|
||||
OpenVRRenderModel *mBasicModel; ///< Basic model
|
||||
Vector<RenderModelSlot> mRenderComponents;
|
||||
/// }
|
||||
|
||||
S32 mDeviceIndex; ///< Controller idx in openvr (for direct updating)
|
||||
S32 mMappedMoveIndex; ///< Movemanager move index for rotation
|
||||
S32 mDeviceIndex; ///< Controller idx in openvr (for direct updating)
|
||||
S32 mMappedMoveIndex; ///< Movemanager move index for rotation
|
||||
|
||||
vr::VRControllerState_t mCurrentControllerState;
|
||||
vr::VRControllerState_t mPreviousControllerState;
|
||||
vr::VRControllerState_t mCurrentControllerState;
|
||||
vr::VRControllerState_t mPreviousControllerState;
|
||||
|
||||
IDevicePose mPose; ///< Current openvr pose data, or reconstructed data from the client
|
||||
IDevicePose mPose; ///< Current openvr pose data, or reconstructed data from the client
|
||||
|
||||
Convex* mConvexList;
|
||||
EarlyOutPolyList mClippedList;
|
||||
PhysicsBody *mPhysicsRep;
|
||||
Convex* mConvexList;
|
||||
EarlyOutPolyList mClippedList;
|
||||
PhysicsBody *mPhysicsRep;
|
||||
|
||||
SimObjectPtr<SceneObject> mCollisionObject; ///< Object we're currently colliding with
|
||||
SimObjectPtr<SceneObject> mInteractObject; ///< Object we've designated as important to interact with
|
||||
SimObjectPtr<SceneObject> mCollisionObject; ///< Object we're currently colliding with
|
||||
SimObjectPtr<SceneObject> mInteractObject; ///< Object we've designated as important to interact with
|
||||
|
||||
bool mHoldInteractedObject; ///< Performs pickup logic with mInteractObject
|
||||
bool mIgnoreParentRotation; ///< Ignores the rotation of the parent object
|
||||
bool mHoldInteractedObject; ///< Performs pickup logic with mInteractObject
|
||||
bool mIgnoreParentRotation; ///< Ignores the rotation of the parent object
|
||||
|
||||
static bool smDebugControllerPosition; ///< Shows latest controller position in DebugDrawer
|
||||
static bool smDebugControllerMovePosition; ///< Shows move position in DebugDrawer
|
||||
static U32 sServerCollisionMask;
|
||||
static U32 sClientCollisionMask;
|
||||
static bool smDebugControllerPosition; ///< Shows latest controller position in DebugDrawer
|
||||
static bool smDebugControllerMovePosition; ///< Shows move position in DebugDrawer
|
||||
static U32 sServerCollisionMask;
|
||||
static U32 sClientCollisionMask;
|
||||
|
||||
public:
|
||||
OpenVRTrackedObject();
|
||||
virtual ~OpenVRTrackedObject();
|
||||
OpenVRTrackedObject();
|
||||
virtual ~OpenVRTrackedObject();
|
||||
|
||||
void updateRenderData();
|
||||
void setupRenderDataFromModel(bool loadComponentModels);
|
||||
void updateRenderData();
|
||||
void setupRenderDataFromModel(bool loadComponentModels);
|
||||
|
||||
void clearRenderData();
|
||||
void clearRenderData();
|
||||
|
||||
DECLARE_CONOBJECT(OpenVRTrackedObject);
|
||||
DECLARE_CONOBJECT(OpenVRTrackedObject);
|
||||
|
||||
static void initPersistFields();
|
||||
static void initPersistFields();
|
||||
|
||||
virtual void inspectPostApply();
|
||||
virtual void inspectPostApply();
|
||||
|
||||
bool onAdd();
|
||||
void onRemove();
|
||||
bool onAdd();
|
||||
void onRemove();
|
||||
|
||||
|
||||
void _updatePhysics();
|
||||
bool onNewDataBlock(GameBaseData *dptr, bool reload);
|
||||
void _updatePhysics();
|
||||
bool onNewDataBlock(GameBaseData *dptr, bool reload);
|
||||
|
||||
void setInteractObject(SceneObject* object, bool holding);
|
||||
void setInteractObject(SceneObject* object, bool holding);
|
||||
|
||||
void setTransform(const MatrixF &mat);
|
||||
void setModelName(String &modelName);
|
||||
void setTransform(const MatrixF &mat);
|
||||
void setModelName(String &modelName);
|
||||
|
||||
U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
|
||||
void unpackUpdate(NetConnection *conn, BitStream *stream);
|
||||
void writePacketData(GameConnection *conn, BitStream *stream);
|
||||
void readPacketData(GameConnection *conn, BitStream *stream);
|
||||
U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
|
||||
void unpackUpdate(NetConnection *conn, BitStream *stream);
|
||||
void writePacketData(GameConnection *conn, BitStream *stream);
|
||||
void readPacketData(GameConnection *conn, BitStream *stream);
|
||||
|
||||
void prepRenderImage(SceneRenderState *state);
|
||||
void prepRenderImage(SceneRenderState *state);
|
||||
|
||||
MatrixF getTrackedTransform();
|
||||
MatrixF getLastTrackedTransform();
|
||||
MatrixF getBaseTrackingTransform();
|
||||
MatrixF getTrackedTransform();
|
||||
MatrixF getLastTrackedTransform();
|
||||
MatrixF getBaseTrackingTransform();
|
||||
|
||||
U32 getCollisionMask();
|
||||
void updateWorkingCollisionSet();
|
||||
U32 getCollisionMask();
|
||||
void updateWorkingCollisionSet();
|
||||
|
||||
// Time management
|
||||
void updateMove(const Move *move);
|
||||
void processTick(const Move *move);
|
||||
void interpolateTick(F32 delta);
|
||||
void advanceTime(F32 dt);
|
||||
// Time management
|
||||
void updateMove(const Move *move);
|
||||
void processTick(const Move *move);
|
||||
void interpolateTick(F32 delta);
|
||||
void advanceTime(F32 dt);
|
||||
|
||||
// Collision
|
||||
bool castRay(const Point3F &start, const Point3F &end, RayInfo* info);
|
||||
void buildConvex(const Box3F& box, Convex* convex);
|
||||
bool testObject(SceneObject* enter);
|
||||
// Collision
|
||||
bool castRay(const Point3F &start, const Point3F &end, RayInfo* info);
|
||||
void buildConvex(const Box3F& box, Convex* convex);
|
||||
bool testObject(SceneObject* enter);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue