本文整理汇总了C++中R_GetModelByHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ R_GetModelByHandle函数的具体用法?C++ R_GetModelByHandle怎么用?C++ R_GetModelByHandle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_GetModelByHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: G2_Get_Bone_Index
int G2_Get_Bone_Index(CGhoul2Info *ghoul2, const char *boneName)
{
model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(ghoul2->mFileName));
model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex);
return (G2_Find_Bone(mod_a, ghoul2->mBlist, boneName));
}
示例2: G2_Pause_Bone_Anim
// given a model, bonelist and bonename, lets pause an anim if it's playing.
qboolean G2_Pause_Bone_Anim(const char *fileName, boneInfo_v &blist, const char *boneName, const int currentTime)
{
model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName));
model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex);
int index = G2_Find_Bone(mod_a, blist, boneName);
// did we find it?
if (index != -1)
{
// are we pausing or un pausing?
if (blist[index].pauseTime)
{
int startFrame, endFrame, flags;
float currentFrame, animSpeed;
// figure out what frame we are on now
G2_Get_Bone_Anim(fileName, blist, boneName, blist[index].pauseTime, ¤tFrame, &startFrame, &endFrame, &flags, &animSpeed, NULL, 0);
// reset start time so we are actually on this frame right now
G2_Set_Bone_Anim(fileName, blist, boneName, startFrame, endFrame, flags, animSpeed, currentTime, currentFrame, 0);
// no pausing anymore
blist[index].pauseTime = 0;
}
// ahh, just pausing, the easy bit
else
{
blist[index].pauseTime = currentTime;
}
return qtrue;
}
assert(0);
return qfalse;
}
示例3: G2_Remove_Bone
// Given a model handle, and a bone name, we want to remove this bone from the bone override list
qboolean G2_Remove_Bone (const char *fileName, boneInfo_v &blist, const char *boneName)
{
model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName));
model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex);
int index = G2_Find_Bone(mod_a, blist, boneName);
return G2_Remove_Bone_Index(blist, index);
}
示例4: G2_Set_Bone_Angles
// Given a model handle, and a bone name, we want to set angles specifically for overriding
qboolean G2_Set_Bone_Angles(const char *fileName, boneInfo_v &blist, const char *boneName, const float *angles,
const int flags, const Eorientations up, const Eorientations left, const Eorientations forward,
qhandle_t *modelList, const int modelIndex, const int blendTime, const int currentTime)
{
model_t *mod_m;
if (!fileName[0])
{
mod_m = R_GetModelByHandle(modelList[modelIndex]);
}
else
{
mod_m = R_GetModelByHandle(RE_RegisterModel(fileName));
}
model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex);
int index = G2_Find_Bone(mod_a, blist, boneName);
// did we find it?
if (index != -1)
{
// yes, so set the angles and flags correctly
blist[index].flags &= ~(BONE_ANGLES_TOTAL);
blist[index].flags |= flags;
blist[index].boneBlendStart = currentTime;
blist[index].boneBlendTime = blendTime;
#if DEBUG_PCJ
OutputDebugString(va("%2d %6d (%6.2f,%6.2f,%6.2f) %d %d %d %d\n",index,currentTime,angles[0],angles[1],angles[2],up,left,forward,flags));
#endif
G2_Generate_Matrix(mod_a, blist, index, angles, flags, up, left, forward);
return qtrue;
}
// no - lets try and add this bone in
index = G2_Add_Bone(mod_a, blist, boneName);
// did we find a free one?
if (index != -1)
{
// yes, so set the angles and flags correctly
blist[index].flags &= ~(BONE_ANGLES_TOTAL);
blist[index].flags |= flags;
blist[index].boneBlendStart = currentTime;
blist[index].boneBlendTime = blendTime;
#if DEBUG_PCJ
OutputDebugString(va("%2d %6d (%6.2f,%6.2f,%6.2f) %d %d %d %d\n",index,currentTime,angles[0],angles[1],angles[2],up,left,forward,flags));
#endif
G2_Generate_Matrix(mod_a, blist, index, angles, flags, up, left, forward);
return qtrue;
}
assert(0);
// no
return qfalse;
}
示例5: R_ModelBounds
/*
====================
R_ModelBounds
====================
*/
void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs )
{
model_t *model;
mdvModel_t *header;
mdvFrame_t *frame;
model = R_GetModelByHandle( handle );
if ( model->bsp )
{
VectorCopy( model->bsp->bounds[ 0 ], mins );
VectorCopy( model->bsp->bounds[ 1 ], maxs );
}
else if ( model->mdv[ 0 ] )
{
header = model->mdv[ 0 ];
frame = header->frames;
VectorCopy( frame->bounds[ 0 ], mins );
VectorCopy( frame->bounds[ 1 ], maxs );
}
else if ( model->md5 )
{
VectorCopy( model->md5->bounds[ 0 ], mins );
VectorCopy( model->md5->bounds[ 1 ], maxs );
}
else
{
VectorClear( mins );
VectorClear( maxs );
}
}
示例6: R_AddModelShadow
// adds a simple shadow projector to the scene
void R_AddModelShadow( const refEntity_t* ent ) {
// shadows?
if ( !r_drawentities->integer || r_shadows->integer != 1 || ent->renderfx & RF_NOSHADOW ) {
return;
}
// get model
idRenderModel* m = R_GetModelByHandle( ent->hModel );
if ( m == NULL || m->q3_shadowShader == 0 ) {
return;
}
// calculate projection
vec4_t projection;
VectorSet( projection, 0, 0, -1.0f );
projection[ 3 ] = m->q3_shadowParms[ 4 ];
// push origin
vec3_t pushedOrigin;
VectorMA( ent->origin, m->q3_shadowParms[ 5 ], projection, pushedOrigin );
// make shadow polygon
vec3_t points[ 4 ];
VectorMA( pushedOrigin, m->q3_shadowParms[ 0 ], ent->axis[ 1 ], points[ 0 ] );
VectorMA( points[ 0 ], m->q3_shadowParms[ 1 ], ent->axis[ 0 ], points[ 0 ] );
VectorMA( points[ 0 ], m->q3_shadowParms[ 2 ], ent->axis[ 1 ], points[ 1 ] );
VectorMA( points[ 1 ], m->q3_shadowParms[ 3 ], ent->axis[ 0 ], points[ 2 ] );
VectorMA( points[ 0 ], m->q3_shadowParms[ 3 ], ent->axis[ 0 ], points[ 3 ] );
// add the decal
vec4_t color = { 1, 1, 1, 1 };
R_ProjectDecal( m->q3_shadowShader, 4, points, projection, color, -1, -1 );
}
示例7: R_LerpTag
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, float frac, const char *tagName )
{
const model_t* model = R_GetModelByHandle( handle );
if ( !model->md3[0] ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
const md3Tag_t* start = R_GetTag( model->md3[0], startFrame, tagName );
const md3Tag_t* end = R_GetTag( model->md3[0], endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
float backLerp = 1.0f - frac;
for ( int i = 0; i < 3; ++i ) {
tag->origin[i] = start->origin[i] * backLerp + end->origin[i] * frac;
tag->axis[0][i] = start->axis[0][i] * backLerp + end->axis[0][i] * frac;
tag->axis[1][i] = start->axis[1][i] * backLerp + end->axis[1][i] * frac;
tag->axis[2][i] = start->axis[2][i] * backLerp + end->axis[2][i] * frac;
}
VectorNormalize( tag->axis[0] );
VectorNormalize( tag->axis[1] );
VectorNormalize( tag->axis[2] );
return qtrue;
}
示例8: R_LerpTag
bool R_LerpTag( orientation_t* tag, qhandle_t handle, int startFrame, int endFrame,
float frac, const char* tagName ) {
int i;
float frontLerp, backLerp;
idRenderModel* model = R_GetModelByHandle( handle );
if ( !model->q3_md3[ 0 ].header ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return false;
}
md3Tag_t* start = R_GetTag( model->q3_md3[ 0 ].header, startFrame, tagName );
md3Tag_t* end = R_GetTag( model->q3_md3[ 0 ].header, endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return false;
}
frontLerp = frac;
backLerp = 1.0f - frac;
for ( i = 0; i < 3; i++ ) {
tag->origin[ i ] = start->origin[ i ] * backLerp + end->origin[ i ] * frontLerp;
tag->axis[ 0 ][ i ] = start->axis[ 0 ][ i ] * backLerp + end->axis[ 0 ][ i ] * frontLerp;
tag->axis[ 1 ][ i ] = start->axis[ 1 ][ i ] * backLerp + end->axis[ 1 ][ i ] * frontLerp;
tag->axis[ 2 ][ i ] = start->axis[ 2 ][ i ] * backLerp + end->axis[ 2 ][ i ] * frontLerp;
}
VectorNormalize( tag->axis[ 0 ] );
VectorNormalize( tag->axis[ 1 ] );
VectorNormalize( tag->axis[ 2 ] );
return true;
}
示例9: R_LerpTag
int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame,
float frac, const char *tagName ) {
md3Tag_t *start, *end;
#ifdef RAVENMD4
md3Tag_t start_space, end_space;
#endif
int i;
float frontLerp, backLerp;
model_t *model;
model = R_GetModelByHandle( handle );
if ( !model->md3[0] )
{
#ifdef RAVENMD4
if(model->type == MOD_MDR)
{
start = &start_space;
end = &end_space;
R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, start);
R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, end);
}
else
#endif
if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
AxisClear( tag->axis );
VectorClear( &tag->origin );
return qfalse;
}
}
else
{
start = R_GetTag( model->md3[0], startFrame, tagName );
end = R_GetTag( model->md3[0], endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( &tag->origin );
return qfalse;
}
}
frontLerp = frac;
backLerp = 1.0f - frac;
for ( i = 0 ; i < 3 ; i++ ) {
tag->origin.data[i] = start->origin.data[i] * backLerp + end->origin.data[i] * frontLerp;
tag->axis[0].data[i] = start->axis[0].data[i] * backLerp + end->axis[0].data[i] * frontLerp;
tag->axis[1].data[i] = start->axis[1].data[i] * backLerp + end->axis[1].data[i] * frontLerp;
tag->axis[2].data[i] = start->axis[2].data[i] * backLerp + end->axis[2].data[i] * frontLerp;
}
VectorNormalize( &tag->axis[0] );
VectorNormalize( &tag->axis[1] );
VectorNormalize( &tag->axis[2] );
return qtrue;
}
示例10: G2_List_Model_Surfaces
// assorted Ghoul 2 functions.
// list all surfaces associated with a model
void G2_List_Model_Surfaces(const char *fileName)
{
int i, x;
model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(fileName));
mdxmSurfHierarchy_t *surf;
surf = (mdxmSurfHierarchy_t *) ( (byte *)mod_m->mdxm + mod_m->mdxm->ofsSurfHierarchy );
mdxmSurface_t *surface = (mdxmSurface_t *)((byte *)mod_m->mdxm + mod_m->mdxm->ofsLODs + sizeof(mdxmLOD_t));
for ( x = 0 ; x < mod_m->mdxm->numSurfaces ; x++)
{
Com_Printf("Surface %i Name %s\n", x, surf->name);
if (r_verbose->value)
{
Com_Printf("Num Descendants %i\n", surf->numChildren);
for (i=0; i<surf->numChildren; i++)
{
Com_Printf("Descendant %i\n", surf->childIndexes[i]);
}
}
// find the next surface
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
surface =(mdxmSurface_t *)( (byte *)surface + surface->ofsEnd );
}
}
示例11: R_ModelFlags
// Use only by Quake and Hexen 2, only .MDL files will have meaningfull flags.
int R_ModelFlags( qhandle_t Handle ) {
idRenderModel* Model = R_GetModelByHandle( Handle );
if ( Model->type == MOD_MESH1 ) {
return Model->q1_flags;
}
return 0;
}
示例12: R_AddModelShadow
void R_AddModelShadow( refEntity_t *ent ) {
model_t *m;
vec4_t projection, color = { 1, 1, 1, 1 };
vec3_t pushedOrigin, points[ 4 ];
/* shadows? */
if ( !r_drawentities->integer || r_shadows->integer != 1 || ent->renderfx & RF_NOSHADOW ) {
return;
}
/* get model */
m = R_GetModelByHandle( ent->hModel );
if ( m == NULL || m->shadowShader == 0 ) {
return;
}
/* calculate projection */
VectorSubtract( vec3_origin, ent->axis[ 2 ], projection );
VectorSet( projection, 0, 0, -1.0f );
projection[ 3 ] = m->shadowParms[ 4 ];
/* push origin */
VectorMA( ent->origin, m->shadowParms[ 5 ], projection, pushedOrigin );
/* make shadow polygon */
VectorMA( pushedOrigin, m->shadowParms[ 0 ], ent->axis[ 1 ], points[ 0 ] );
VectorMA( points[ 0 ], m->shadowParms[ 1 ], ent->axis[ 0 ], points[ 0 ] );
VectorMA( points[ 0 ], m->shadowParms[ 2 ], ent->axis[ 1 ], points[ 1 ] );
VectorMA( points[ 1 ], m->shadowParms[ 3 ], ent->axis[ 0 ], points[ 2 ] );
VectorMA( points[ 0 ], m->shadowParms[ 3 ], ent->axis[ 0 ], points[ 3 ] );
/* add the decal */
RE_ProjectDecal( m->shadowShader, 4, points, projection, color, -1, -1 );
}
示例13: RE_BoneIndex
/*
================
RE_BoneIndex
================
*/
int RE_BoneIndex( qhandle_t hModel, const char *boneName )
{
int i;
md5Bone_t *bone;
md5Model_t *md5;
model_t *model;
model = R_GetModelByHandle( hModel );
if ( !model->md5 )
{
return -1;
}
else
{
md5 = model->md5;
}
for ( i = 0, bone = md5->bones; i < md5->numBones; i++, bone++ )
{
if ( !Q_stricmp( bone->name, boneName ) )
{
return i;
}
}
return -1;
}
示例14: R_ModelBounds
/*
====================
R_ModelBounds
====================
*/
void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ) {
model_t *model;
md3Header_t *header;
md3Frame_t *frame;
model = R_GetModelByHandle( handle );
if ( model->bmodel ) {
VectorCopy( model->bmodel->bounds[0], mins );
VectorCopy( model->bmodel->bounds[1], maxs );
return;
}
if ( !model->md3[0] ) {
VectorClear( mins );
VectorClear( maxs );
return;
}
header = model->md3[0];
frame = (md3Frame_t *)( (byte *)header + header->ofsFrames );
VectorCopy( frame->bounds[0], mins );
VectorCopy( frame->bounds[1], maxs );
}
示例15: R_ModelBounds
/*
====================
R_ModelBounds
====================
*/
void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ) {
model_t *model;
model = R_GetModelByHandle( handle );
if(model->type == MOD_BRUSH) {
VectorCopy( model->bmodel->bounds[0], mins );
VectorCopy( model->bmodel->bounds[1], maxs );
return;
} else if (model->type == MOD_MESH) {
md3Header_t *header;
md3Frame_t *frame;
header = model->md3[0];
frame = (md3Frame_t *) ((byte *)header + header->ofsFrames);
VectorCopy( frame->bounds[0], mins );
VectorCopy( frame->bounds[1], maxs );
return;
} else if (model->type == MOD_MD4) {
md4Header_t *header;
md4Frame_t *frame;
header = (md4Header_t *)model->modelData;
frame = (md4Frame_t *) ((byte *)header + header->ofsFrames);
VectorCopy( frame->bounds[0], mins );
VectorCopy( frame->bounds[1], maxs );
return;
} else if (model->type == MOD_MDR) {
mdrHeader_t *header;
mdrFrame_t *frame;
header = (mdrHeader_t *)model->modelData;
frame = (mdrFrame_t *) ((byte *)header + header->ofsFrames);
VectorCopy( frame->bounds[0], mins );
VectorCopy( frame->bounds[1], maxs );
return;
} else if(model->type == MOD_IQM) {
iqmData_t *iqmData;
iqmData = model->modelData;
if(iqmData->bounds)
{
VectorCopy(iqmData->bounds, mins);
VectorCopy(iqmData->bounds + 3, maxs);
return;
}
}
VectorClear( mins );
VectorClear( maxs );
}