OpenBarnyard
 
Loading...
Searching...
No Matches
ABoneAttachCameraHelper.h
Go to the documentation of this file.
1#pragma once
2#include "ACameraHelper.h"
3#include "Animation/AModel.h"
4
5#include <Render/TAnimation.h>
6
7class ARenderer;
8
9//-----------------------------------------------------------------------------
10// Purpose: Helper class to attach a camera to a specific bone of a model.
11// This class allows a camera to follow a bone in a model, updating its position and orientation
12// according to the bone's transform.
13//-----------------------------------------------------------------------------
15 : public ACameraHelper
16{
17public:
19
20public:
21 // Constructs a new ABoneAttachCameraHelper object.
23
24 // Destroys the ABoneAttachCameraHelper object and detaches from the model/bone.
26
27 //-----------------------------------------------------------------------------
28 // ACameraHelper
29 //-----------------------------------------------------------------------------
30 // Updates the camera's position and orientation based on the attached bone.
31 virtual TBOOL OnUpdate( TFLOAT a_fDeltaTime ) OVERRIDE;
32
33 // Unknown override method (purpose not documented).
34 virtual TBOOL Unk2( void* ) OVERRIDE;
35
36 // Unknown override method (purpose not documented).
37 virtual TBOOL Unk3( void*, void* ) OVERRIDE;
38
39 // Called when the helper is created.
40 virtual void OnCreate() OVERRIDE;
41
42 // Called when the helper is destroyed.
43 virtual void OnDestroy() OVERRIDE;
44
45 // Called when the helper is attached to a camera.
46 virtual void OnAttach() OVERRIDE;
47
48 // Called when the helper is detached from a camera.
49 virtual void OnDetach() OVERRIDE;
50
51 //-----------------------------------------------------------------------------
52 // Own Methods
53 //-----------------------------------------------------------------------------
54 // Unknown method (purpose not documented).
55 virtual void BoneHelper_Unknown();
56
57 // Sets the model and bone to which the camera will be attached.
58 void SetModel( const Toshi::TPString8& a_strModelName, const TCHAR* a_szBoneName );
59
60 // Sets the animation sequence for the attached model.
61 void SetAnimation( const TCHAR* a_szSeqName );
62
63private:
64 // Handles animation start events for the attached model.
65 static TBOOL __stdcall AnimationStartEventHandler( ABoneAttachCameraHelper* a_pCaller, ARenderer* a_pOwner, TBOOL** a_pData );
66
67private:
68 Toshi::TAnimation* m_pAnimation;
69 AModelInstance* m_pAModelInstance;
70 Toshi::TSceneObject* m_pSceneObject;
71 Toshi::TSkeletonInstance* m_pSkeletonInstance;
72 TINT m_iBoneId;
73 Toshi::TMatrix44 m_oTransform;
74 Toshi::TListener<ARenderer, TBOOL*, ABoneAttachCameraHelper> m_oAnimStartListener;
75 AAnimatableObject* m_pAnimatableObject;
76};
#define OVERRIDE
Definition Defines.h:12
char TCHAR
Definition Typedefs.h:20
float TFLOAT
Definition Typedefs.h:4
int TINT
Definition Typedefs.h:7
bool TBOOL
Definition Typedefs.h:6
virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime) OVERRIDE
virtual void OnCreate() OVERRIDE
virtual void OnDestroy() OVERRIDE
virtual void OnDetach() OVERRIDE
virtual void OnAttach() OVERRIDE
void SetAnimation(const TCHAR *a_szSeqName)
TDECLARE_CLASS(ABoneAttachCameraHelper, ACameraHelper)
void SetModel(const Toshi::TPString8 &a_strModelName, const TCHAR *a_szBoneName)