//-----------------------------------------------------------------------------
//
//  $Logfile:: /Source/sinmdl.h                                               $
// $Revision:: 2                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 1/3/01 4:12 PM                                                 $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// DESCRIPTION:
// sin model loading and caching
//

#ifndef __SINMDL_H__
#define __SINMDL_H__

#ifdef _H2INC
# ifndef VERSION
#  include "../qcommon/qcommon.h"
# endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*
==============================================================================

SIN BASE MODELS and ANIMATIONS

==============================================================================
*/
/*
=================
SINMDL_GetAnim
=================
*/
dsinanim_t * SINMDL_GetAnim ( int index );

/*
=================
SINMDL_GetBaseModel
=================
*/
dsinbasemdl_t * SINMDL_GetBaseModel ( int index );

/*
=================
SINMDL_GetDef
=================
*/
dsinmdl_t * SINMDL_GetDef ( int index );

/*
=================
SINMDL_DefHandleValid
=================
*/
qboolean SINMDL_DefHandleValid ( int index, const char * name );

/*
=================
SINMDL_RegisterAnim
=================
*/
int SINMDL_RegisterAnim ( const char * path );

/*
=================
SINMDL_RegisterBaseModel
=================
*/
int SINMDL_RegisterBaseModel ( const char * path );

/*
=================
SINMDL_RegisterDef
=================
*/
int SINMDL_RegisterDef ( const char * path );

/*
=================
SINMDL_FreeDef
=================
*/
void SINMDL_FreeDef ( int handle );

/*
=================
SINMDL_FreeAll
=================
*/
void SINMDL_FreeAll ( void );

/*
==============================================================================

SIN MODEL UTILITY FUNCTIONS

==============================================================================
*/

//
// DEF SPECIFIC STUFF
//

/*
=================
SINMDL_SetAliasPrefix
=================
*/
qboolean SINMDL_SetAliasPrefix( int defhandle, const char * aliasprefix );

/*
=================
SINMDL_GetAliasPrefix
=================
*/
const char * SINMDL_GetAliasPrefix( int defhandle );

/*
=================
SINMDL_NumAnims
=================
*/
int SINMDL_NumAnims( int defhandle );

/*
===============
SINMDL_Checksum
===============
*/
unsigned SINMDL_Checksum( int defhandle );

/*
=================
SINMDL_NumSkins
=================
*/
int SINMDL_NumSkins( int defhandle );

/*
=================
SINMDL_NumGroups
=================
*/
int SINMDL_NumGroups( int defhandle );

/*
=================
SINMDL_InitCommands_Server
=================
*/
sinmdl_cmd_t *SINMDL_InitCommands_Server( int defhandle );

/*
=================
SINMDL_InitCommands_Client
=================
*/
sinmdl_cmd_t *SINMDL_InitCommands_Client( int defhandle );

/*
=================
SINMDL_CalculateBounds
=================
*/
void SINMDL_CalculateBounds( int defhandle, float scale, vec3_t mins, vec3_t maxs );
//
// ANIM SPECIFIC STUFF
//

/*
=================
SINMDL_Anim_NameForNum
=================
*/
const char * SINMDL_Anim_NameForNum( int defhandle, int animnum );

/*
=================
SINMDL_Anim_NumForName
=================
*/
int SINMDL_Anim_NumForName( int defhandle, const char * name );

/*
=================
SINMDL_Anim_Random
=================
*/
int SINMDL_Anim_Random( int defhandle, const char * name );

/*
=================
SINMDL_Anim_NumFrames
=================
*/
int SINMDL_Anim_NumFrames( int defhandle, int animnum );

/*
=================
SINMDL_Anim_Time
=================
*/
float SINMDL_Anim_Time( int defhandle, int animnum );

/*
=================
SINMDL_Anim_Delta
=================
*/
void SINMDL_Anim_Delta( int defhandle, int animnum, vec3_t delta );

/*
=================
SINMDL_Anim_CalculateBounds
=================
*/
void SINMDL_Anim_CalculateBounds( int defhandle, int animnum, float scale, vec3_t mins, vec3_t maxs );

//
// FRAME SPECIFIC STUFF
//

/*
=================
SINMDL_Frame_Commands_Server
=================
*/
sinmdl_cmd_t *SINMDL_Frame_Commands_Server( int defhandle, int animnum, int framenum );

/*
=================
SINMDL_Frame_Commands_Client
=================
*/
sinmdl_cmd_t *SINMDL_Frame_Commands_Client( int defhandle, int animnum, int framenum );

/*
=================
SINMDL_Frame_Delta
=================
*/
void SINMDL_Frame_Delta( int defhandle, int animnum, int framenum, vec3_t delta );

/*
=================
SINMDL_Frame_Time
=================
*/
float SINMDL_Frame_Time( int defhandle, int animnum, int framenum );

//
// SKIN SPECIFIC STUFF
//
/*
=================
SINMDL_Skin_NameForNum
=================
*/
const char * SINMDL_Skin_NameForNum( int defhandle, int skinnum );

/*
=================
SINMDL_Skin_FullNameForNum
=================
*/
const char * SINMDL_Skin_FullNameForNum( int defhandle, int skinnum );
/*
=================
SINMDL_Skin_NumForName
=================
*/
int SINMDL_Skin_NumForName( int defhandle, const char * name );

/*
==============================================================================

SIN GROUP UTILITY FUNCTIONS

==============================================================================
*/

/*
=================
SINMDL_Group_NameToNum
=================
*/
int SINMDL_Group_NameToNum( int defhandle, const char * name );

/*
=================
SINMDL_Group_NumToName
=================
*/
const char * SINMDL_Group_NumToName( int defhandle, int num );

/*
=================
SINMDL_Group_DamageMultiplier
=================
*/
float SINMDL_Group_DamageMultiplier( int defhandle, int num );

/*
=================
SINMDL_Group_Flags
=================
*/
int SINMDL_Group_Flags( int defhandle, int num );

/*
==============================================================================

SIN BONE UTILITY FUNCTIONS

==============================================================================
*/
/*
=================
SINMDL_GetBoneInfo
=================
*/
qboolean SINMDL_GetBoneInfo
   (
   int defhandle,
   const char * bonename,
   int * groupindex,
   int * tri_num,
   vec3_t orientation
   );

/*
=================
SINMDL_GetBoneGroupName
=================
*/
const char * SINMDL_GetBoneGroupName
   (
   int defhandle,
   const char * bonename
   );

/*
=================
SINMDL_GetBoneTransform
=================
*/
qboolean SINMDL_GetBoneTransform
   (
   int defhandle,
   int groupindex,
   int tri_num,
   vec3_t orientation,
   int anim,
   int frame,
   float scale,
   vec3_t trans[3],
   vec3_t pos
   );

/*
=================
SINMDL_GetNamedBoneTransform
=================
*/
qboolean SINMDL_GetNamedBoneTransform(int defhandle,
	const char * bonename,
	int anim,
	int frame,
	float scale,
	vec3_t trans[3],
	vec3_t pos);


#ifndef SINED
/*
=================
SINMDL_RayIntersect
=================
*/
sinmdl_intersection_t * SINMDL_RayIntersect(int defhandle,
	int anim,
	int frame,
	float scale,
	vec3_t origin,
	float mat[3][3],
	const vec3_t start,
	const vec3_t end,
	float radius);
#endif

/*
=================
SINMDL_ModelList
=================
*/
void SINMDL_ModelList( void );
void SINMDL_ModelInfo( int defhandle );

#ifndef SINED
const char *   SINMDL_Alias_Find( int defhandle, const char * alias );
qboolean SINMDL_Alias_Add( int defhandle, const char * alias, const char * name, float weight );
void SINMDL_Alias_Dump( int defhandle );
void SINMDL_Alias_Clear( int defhandle );
const char *   SINMDL_Alias_FindRandom( int defhandle, const char * alias );
#endif

#ifdef __cplusplus
}
#endif

#endif //__SINMDL_H__







