summaryrefslogtreecommitdiff
path: root/public/movieobjects/dmemdl.h
blob: 1d79f86d5c4d86fb7c7eeb88aaa6a83adb9fdf66 (plain) (blame)
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// A class representing an MDL
//
//=============================================================================

#ifndef DMEMDL_H
#define DMEMDL_H

#ifdef _WIN32
#pragma once
#endif

#include "datamodel/dmelement.h"
#include "datamodel/dmattribute.h"
#include "datamodel/dmattributevar.h"
#include "movieobjects/dmeshape.h"
#include "datacache/imdlcache.h"
#include "tier3/mdlutils.h"

#include "mathlib/vector.h"
#include <string>
#include <vector>


//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CDmeTransform;
class IMorph;
class IMaterial;
struct SubdivMesh_t;
class IMesh;
class CDmeDrawSettings;
struct matrix3x4_t;
class CStudioHdr;


//-----------------------------------------------------------------------------
// A class representing an MDL
//-----------------------------------------------------------------------------
class CDmeMDL : public CDmeShape
{
	DEFINE_ELEMENT( CDmeMDL, CDmeShape );

public:
	virtual void Draw( const matrix3x4_t& shapeToWorld, CDmeDrawSettings *pDrawSettings = NULL );

	void DrawInEngine( bool bDrawInEngine );
	bool IsDrawingInEngine() const;

	void SetMDL( MDLHandle_t handle );
	MDLHandle_t GetMDL( ) const;
	float GetRadius() const; // NOTE: This radius is one that is centered at the origin
	void GetBoundingSphere( Vector &vecCenter, float &flRadius );
	void GetBoundingBox( Vector *pMins, Vector *pMaxs ) const;

	// Computes bone-to-world transforms
	void SetUpBones( const matrix3x4_t& shapeToWorld, int nMaxBoneCount, matrix3x4_t *pOutputMatrices );

public:
	CDmaColor m_Color;
	CDmaVar<int> m_nSkin;
	CDmaVar<int> m_nBody;
	CDmaVar<int> m_nSequence;
	CDmaVar<int> m_nLOD;
	CDmaVar<float> m_flPlaybackRate;
	CDmaVar<float> m_flTime;
	CDmaVar<Vector> m_vecViewTarget;
	CDmaVar<bool> m_bWorldSpaceViewTarget;

private:
	void UpdateMDL();

	CMDL m_MDL;
	bool m_bDrawInEngine;
};

#endif // DMEMDL_H