Guest User

Untitled

a guest
Apr 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.87 KB | None | 0 0
  1. /***
  2. *
  3. *   Copyright (c) 1998, Valve LLC. All rights reserved.
  4. *  
  5. *   This product contains software technology licensed from Id
  6. *   Software, Inc. ("Id Technology").  Id Technology (c) 1996 Id Software, Inc.
  7. *   All Rights Reserved.
  8. *
  9. ****/
  10.  
  11. typedef unsigned char       byte;
  12.  
  13. class StudioModel
  14. {
  15. public:
  16.     void                    Init( char *modelname );
  17.     void                    DrawModel( void );
  18.     void                    AdvanceFrame( float dt );
  19.  
  20.     void                    ExtractBbox( float *mins, float *maxs );
  21.  
  22.     int                     SetSequence( int iSequence );
  23.     int                     GetSequence( void );
  24.     float                   GetPrev( );
  25.     int                     SetPrev( float tick );
  26.     void                    GetSequenceInfo( float *pflFrameRate, float *pflGroundSpeed );
  27.  
  28.     float                   SetController( int iController, float flValue );
  29.     float                   SetMouth( float flValue );
  30.     float                   SetBlending( int iBlender, float flValue );
  31.     int                     SetBodygroup( int iGroup, int iValue );
  32.     int                     SetSkin( int iValue );
  33.  
  34. private:
  35.     // entity settings
  36.     vec3_t                  m_origin;
  37.     vec3_t                  m_angles;  
  38.     int                     m_sequence;         // sequence index
  39.     float                   m_frame;            // frame
  40.     int                     m_bodynum;          // bodypart selection  
  41.     int                     m_skinnum;          // skin group selection
  42.     byte                    m_controller[4];    // bone controllers
  43.     byte                    m_blending[2];      // animation blending
  44.     byte                    m_mouth;            // mouth position
  45.     float                   prev;               // previous Tick (animation)
  46.  
  47.     // internal data
  48.     studiohdr_t             *m_pstudiohdr;
  49.     mstudiomodel_t          *m_pmodel;
  50.  
  51.     studiohdr_t             *m_ptexturehdr;
  52.     studioseqhdr_t          *m_panimhdr[32];
  53.  
  54.     vec4_t                  m_adj;              // FIX: non persistant, make static
  55.  
  56.     studiohdr_t             *LoadModel( char *modelname );
  57.     studioseqhdr_t          *LoadDemandSequences( char *modelname );
  58.  
  59.     void                    CalcBoneAdj( void );
  60.     void                    CalcBoneQuaternion( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *q );
  61.     void                    CalcBonePosition( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *pos );
  62.     void                    CalcRotations ( vec3_t *pos, vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f );
  63.     mstudioanim_t           *GetAnim( mstudioseqdesc_t *pseqdesc );
  64.     void                    SlerpBones( vec4_t q1[], vec3_t pos1[], vec4_t q2[], vec3_t pos2[], float s );
  65.     void                    SetUpBones ( void );
  66.  
  67.     void                    DrawPoints( void );
  68.  
  69.     void                    Lighting (float *lv, int bone, int flags, vec3_t normal);
  70.     void                    Chrome (int *chrome, int bone, vec3_t normal);
  71.  
  72.     void                    SetupLighting( void );
  73.  
  74.     void                    SetupModel ( int bodypart );
  75.  
  76.     void                    UploadTexture( mstudiotexture_t *ptexture, byte *data, byte *pal );
  77. };
  78.  
  79. extern vec3_t g_vright;     // needs to be set to viewer's right in order for chrome to work
  80. extern float g_lambert;     // modifier for pseudo-hemispherical lighting
  81.  
  82. void mdlviewer_init( char *modelname, StudioModel &tempmodel );
  83. void mdlviewer_nextsequence( StudioModel &tempmodel );
  84. void mdlviewer_prevsequence( StudioModel &tempmodel );
  85. void mdlviewer_display( StudioModel &tempmodel );
Add Comment
Please, Sign In to add comment