forked from hitmen047/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdlpanel.h
157 lines (119 loc) · 4.6 KB
/
mdlpanel.h
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#ifndef MDLPANEL_H
#define MDLPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/Panel.h"
#include "datacache/imdlcache.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "matsys_controls/potterywheelpanel.h"
#include "tier3/mdlutils.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class IScheme;
}
//
struct MDLAnimEventState_t
{
int m_nEventSequence;
float m_flPrevEventCycle;
};
//-----------------------------------------------------------------------------
// MDL Viewer Panel
//-----------------------------------------------------------------------------
class CMDLPanel : public CPotteryWheelPanel
{
DECLARE_CLASS_SIMPLE( CMDLPanel, CPotteryWheelPanel );
public:
// constructor, destructor
CMDLPanel( vgui::Panel *pParent, const char *pName );
virtual ~CMDLPanel();
// Overriden methods of vgui::Panel
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnTick();
virtual void Paint();
// Sets the current mdl
virtual void SetMDL( MDLHandle_t handle, void *pProxyData = NULL );
virtual void SetMDL( const char *pMDLName, void *pProxyData = NULL );
// Sets the camera to look at the model
void LookAtMDL( );
// Sets the current LOD
void SetLOD( int nLOD );
// Sets the current sequence
void SetSequence( int nSequence, bool bResetSequence = false );
// Set the pose parameters
void SetPoseParameters( const float *pPoseParameters, int nCount );
bool SetPoseParameterByName( const char *pszName, float fValue );
// Set the overlay sequence layers
void SetSequenceLayers( const MDLSquenceLayer_t *pSequenceLayers, int nCount );
void SetCollsionModel( bool bVisible );
void SetGroundGrid( bool bVisible );
void SetWireFrame( bool bVisible );
void SetLockView( bool bLocked );
void SetSkin( int nSkin );
void SetLookAtCamera( bool bLookAtCamera );
void SetIgnoreDoubleClick( bool bState );
void SetThumbnailSafeZone( bool bVisible );
// Bounds.
bool GetBoundingBox( Vector &vecBoundsMin, Vector &vecBoundsMax );
bool GetBoundingSphere( Vector &vecCenter, float &flRadius );
virtual void SetModelAnglesAndPosition( const QAngle &angRot, const Vector &vecPos );
// Attached models.
void SetMergeMDL( MDLHandle_t handle, void *pProxyData = NULL, int nSkin = -1 );
MDLHandle_t SetMergeMDL( const char *pMDLName, void *pProxyData = NULL, int nSkin = -1 );
int GetMergeMDLIndex( void *pProxyData );
int GetMergeMDLIndex( MDLHandle_t handle );
CMDL *GetMergeMDL(MDLHandle_t handle );
void ClearMergeMDLs( void );
virtual void SetupFlexWeights( void ) { return; }
// Events
void DoAnimationEvents();
void DoAnimationEvents( CStudioHdr *pStudioHdr, int nSeqNum, float flTime, bool bNoLoop, MDLAnimEventState_t *pEventState );
virtual void FireEvent( const char *pszEventName, const char *pszEventOptions ) { }
void ResetAnimationEventState( MDLAnimEventState_t *pEventState );
protected:
virtual void SetupRenderState( int nDisplayWidth, int nDisplayHeight ) OVERRIDE;
struct MDLData_t
{
CMDL m_MDL;
matrix3x4_t m_MDLToWorld;
bool m_bDisabled;
float m_flCycleStartTime;
};
MDLData_t m_RootMDL;
CUtlVector<MDLData_t> m_aMergeMDLs;
static const int MAX_SEQUENCE_LAYERS = 8;
int m_nNumSequenceLayers;
MDLSquenceLayer_t m_SequenceLayers[ MAX_SEQUENCE_LAYERS ];
MDLAnimEventState_t m_EventState;
MDLAnimEventState_t m_SequenceLayerEventState[ MAX_SEQUENCE_LAYERS ];
private:
// paint it!
virtual void OnPaint3D();
virtual void PrePaint3D( IMatRenderContext *pRenderContext ) { };
virtual void PostPaint3D( IMatRenderContext *pRenderContext ) { };
virtual void RenderingRootModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { };
virtual void RenderingMergedModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { };
void OnMouseDoublePressed( vgui::MouseCode code );
void DrawCollisionModel();
void UpdateStudioRenderConfig( void );
CTextureReference m_DefaultEnvCubemap;
CTextureReference m_DefaultHDREnvCubemap;
bool m_bDrawCollisionModel : 1;
bool m_bGroundGrid : 1;
bool m_bLockView : 1;
bool m_bWireFrame : 1;
bool m_bLookAtCamera : 1;
bool m_bIgnoreDoubleClick : 1;
bool m_bThumbnailSafeZone : 1;
float m_PoseParameters[ MAXSTUDIOPOSEPARAM ];
};
#endif // MDLPANEL_H