本文整理汇总了C++中Matrix::GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::GetColumn方法的具体用法?C++ Matrix::GetColumn怎么用?C++ Matrix::GetColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix
的用法示例。
在下文中一共展示了Matrix::GetColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Bullet_Update
void Bullet_Update(Object *pObject)
{
Projectile *pProjectile=(Projectile *)pObject;
Matrix mat;
Matrix *pLast;
Object_GetMatrix(pObject,&mat);
mat.SetColumn(3, mat.GetColumn(3) + pProjectile->vecVel);
Object_GetMatrixPtrLast(pObject,&pLast);
if(Level_TestLineCollide( pLast->GetColumn(3), mat.GetColumn(3) ))
{
ColData Data;
// Get the collision data
Collision_GetColData(&Data);
// Create particle effect at collision position
Particles_Create( 1, Data.vecPoint );
pProjectile->fLife = -1.f;
}
Object_SetMatrix(pObject, &mat);
}
示例2: Rocket_GetRenderTrans
void Rocket_GetRenderTrans(void *pData, Vec3 *pVec)
{
Object *pObj = (Object*)pData;
Matrix *pMat;
Object_GetInterpMatrix(pObj, &pMat);
*pVec = pMat->GetColumn(3);
}
示例3: Projectile_Create
Projectile* Projectile_Create( PROJECTILE_TYPES type, Object *pCreator, Vec4 *pvecOffset )
{
Projectile *pProjectile;
ObjectCreate Create;
memset(&Create,0,sizeof(Create));
Create.exitfunc=Projectile_Exit;
Create.renderfunc=Projectile_Render;
Create.updatefunc=Projectile_Update;
Create.iType=OBJECT_Projectile;
Create.pName="Projectile";
pProjectile = (Projectile*)Object_Create(&Create, sizeof(Projectile));
pProjectile->type = type;
pProjectile->pCreator = pCreator;
Matrix *pMat;
Matrix Mat;
Object_GetMatrixPtr((Object *)pCreator, &pMat);
Mat = *pMat;
Mat.SetColumn(3, *pMat * (*pvecOffset));
Object_SetAllMatrix((Object *)pProjectile, &Mat);
Vec3 vecDir;
switch(type)
{
case PROJECTILE_BULLET:
pProjectile->fLife = 1.f;
pProjectile->vecVel = Mat.GetColumn(2) * 7.f;
break;
case PROJECTILE_ROCKET:
pProjectile->fLife = 3.f;
pProjectile->vecVel = Mat.GetColumn(2) * 5.f;
pProjectile->pTrails[0] = Trail_Create( 0.08f, false, SWITCHCOL(0x1faaaaaa), "data/textures/stream.tga" );
pProjectile->pTrails[1] = Trail_Create( 0.08f, false, SWITCHCOL(0x1faaaaaa), "data/textures/stream.tga" );
vecDir = (Mat.GetColumn(0)*0.25f);
Trail_AddPoint((Object*)pProjectile->pTrails[0], Mat.GetColumn(3), vecDir);
vecDir = (Mat.GetColumn(1)*0.25f);
Trail_AddPoint((Object*)pProjectile->pTrails[1], Mat.GetColumn(3), vecDir);
pProjectile->pTrails[0]->leadingPointCallback = Rocket_GetRenderTrans;
pProjectile->pTrails[0]->pSendData = pProjectile;
pProjectile->pTrails[1]->leadingPointCallback = Rocket_GetRenderTrans;
pProjectile->pTrails[1]->pSendData = pProjectile;
break;
}
return pProjectile;
}
示例4: Rocket_Update
void Rocket_Update(Object *pObject)
{
Projectile *pProjectile=(Projectile *)pObject;
Matrix mat;
Matrix *pLast;
Object_GetMatrix(pObject,&mat);
mat.SetColumn(3, mat.GetColumn(3) + pProjectile->vecVel);
Object_GetMatrixPtrLast(pObject,&pLast);
Vec3 vecDir(mat.GetColumn(0)*0.25f);
Trail_AddPoint((Object*)pProjectile->pTrails[0], pLast->GetColumn(3), vecDir);
vecDir = (mat.GetColumn(1)*0.25f);
Trail_AddPoint((Object*)pProjectile->pTrails[1], pLast->GetColumn(3), vecDir);
if(Level_TestLineCollide( pLast->GetColumn(3), mat.GetColumn(3) ))
{
pProjectile->fLife = -1.f;
ColData Data;
// Get the collision data
Collision_GetColData(&Data);
vecDir = (mat.GetColumn(0)*0.25f);
Trail_AddPoint((Object*)pProjectile->pTrails[0], Data.vecPoint, vecDir);
vecDir = (mat.GetColumn(1)*0.25f);
Trail_AddPoint((Object*)pProjectile->pTrails[1], Data.vecPoint, vecDir);
// NIK: Create particle effect at collision position
Particles_Create( 0, Data.vecPoint );
}
Object_SetMatrix(pObject, &mat);
}
示例5: Mesh_Light
void Mesh_Light(Model *pModel, Matrix &mat)
{
i32 i;
i32 j;
float *pNormal=pModel->p_fNormals;
u8 *pCol=(u8*)pModel->p_uColours;
float xNormal;
float yNormal;
float zNormal;
float xLightDot;
u8 uCol;
for(j=0;j<pModel->iMeshes;j++)
{
for(i=0;i<pModel->pMesh[j]->iNumVerts;i++)
{
// get rotated normal
xNormal=mat.GetColumn(0).GetX()*pNormal[0] +
mat.GetColumn(0).GetY()*pNormal[1] +
mat.GetColumn(0).GetZ()*pNormal[2];
yNormal=mat.GetColumn(1).GetX()*pNormal[0] +
mat.GetColumn(1).GetY()*pNormal[1] +
mat.GetColumn(1).GetZ()*pNormal[2];
zNormal=mat.GetColumn(2).GetX()*pNormal[0] +
mat.GetColumn(2).GetY()*pNormal[1] +
mat.GetColumn(2).GetZ()*pNormal[2];
// get dot product of normal and light
xLightDot=xNormal*LightDir[0] + yNormal*LightDir[1] + zNormal*LightDir[2];
if(xLightDot<0.f)
{
uCol=-(u8)(xLightDot*255);
pCol[0]=uCol;
pCol[1]=uCol;
pCol[2]=uCol;
}
else
{
pCol[0]=0;
pCol[1]=0;
pCol[2]=0;
}
pNormal+=3;
pCol+=4;
}
}
}