本文整理汇总了C++中MatrixMultiply函数的典型用法代码示例。如果您正苦于以下问题:C++ MatrixMultiply函数的具体用法?C++ MatrixMultiply怎么用?C++ MatrixMultiply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MatrixMultiply函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: center
void CTextureTransformProxy::OnBind( void *pC_BaseEntity )
{
Vector2D center( 0.5, 0.5 );
Vector2D translation( 0, 0 );
VMatrix mat, temp;
if (m_pCenterVar)
{
m_pCenterVar->GetVecValue( center.Base(), 2 );
}
MatrixBuildTranslation( mat, -center.x, -center.y, 0.0f );
if (m_pScaleVar)
{
Vector2D scale;
m_pScaleVar->GetVecValue( scale.Base(), 2 );
MatrixBuildScale( temp, scale.x, scale.y, 1.0f );
MatrixMultiply( temp, mat, mat );
}
if (m_pRotateVar)
{
float angle = m_pRotateVar->GetFloatValue( );
MatrixBuildRotateZ( temp, angle );
MatrixMultiply( temp, mat, mat );
}
MatrixBuildTranslation( temp, center.x, center.y, 0.0f );
MatrixMultiply( temp, mat, mat );
if (m_pTranslateVar)
{
m_pTranslateVar->GetVecValue( translation.Base(), 2 );
MatrixBuildTranslation( temp, translation.x, translation.y, 0.0f );
MatrixMultiply( temp, mat, mat );
}
m_pResult->SetMatrixValue( mat );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
开发者ID:GOGIBERRY,项目名称:source-sdk-2013,代码行数:44,代码来源:matrixproxy.cpp
示例2: UI_PositionRotatedEntityOnTag
/*
======================
UI_PositionRotatedEntityOnTag
======================
*/
static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
clipHandle_t parentModel, char *tagName ) {
int i;
orientation_t lerped;
vec3_t tempAxis[3];
// lerp the tag
trap_CM_LerpTag( &lerped, parent, tagName, 0 );
// FIXME: allow origin offsets along tag?
VectorCopy( parent->origin, entity->origin );
for ( i = 0 ; i < 3 ; i++ ) {
VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
}
// cast away const because of compiler problems
MatrixMultiply( entity->axis, ( (refEntity_t *)parent )->axis, tempAxis );
MatrixMultiply( lerped.axis, tempAxis, entity->axis );
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:24,代码来源:ui_players.c
示例3: MatrixGetOffset
//-----------------------------------------------------------------------------------
void Matrix4x4::MatrixInvertOrthogonal(Matrix4x4* matrix)
{
Vector3 translation = MatrixGetOffset(matrix);
MatrixTranspose(matrix);
MatrixSetColumn(matrix, 3, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Matrix4x4 translationMatrix;
MatrixMakeTranslation(&translationMatrix, translation);
MatrixInvert(&translationMatrix);
MatrixMultiply(matrix, &translationMatrix, matrix);
}
开发者ID:picoriley,项目名称:Laundry-Squadron,代码行数:11,代码来源:Matrix4x4.cpp
示例4: main
main( )
{
Matrix A = { { 1, 2 }, { 3, 4 } };
Matrix C;
MatrixMultiply( A, A, C, 2 );
printf( "%6.2f %6.2f\n%6.2f %6.2f\n", C[ 0 ][ 0 ], C[ 0 ][ 1 ],
C[ 1 ][ 0 ], C[ 1 ][ 1 ] );
return 0;
}
开发者ID:EdisonChendi,项目名称:data_structure,代码行数:10,代码来源:fig10_38.c
示例5: MatrixMultiply
//heading으로부터 side각도로 회전 행렬 생성
void ZeroMat::Rotate(const ZeroVec & _fwd, const ZeroVec & _side) {
ZeroMat::Matrix mat;
mat._11 = _fwd.x; mat._12 = _fwd.y; mat._13 = 0;
mat._21 = _side.x; mat._22 = _side.y; mat._23 = 0;
mat._31 = 0; mat._32 = 0; mat._33 = 1;
//행렬을 곱한다.
MatrixMultiply(mat);
}
开发者ID:bamtoll09,项目名称:GROWN,代码行数:11,代码来源:ZeroMat.cpp
示例6: while
void Bone::calculatedMatrix()
{
//iterate through all sibling and set the matrices
Bone *curBone = this;
while(curBone && curBone->sibling)
{
MatrixMultiply(&curBone->sibling->combinedTranformation, &curBone->combinedTranformation, &curBone->sibling->localTransform);
curBone = curBone->sibling;
}
//iterate through all children and set the matrices
curBone = this;
while(curBone && curBone->child)
{
MatrixMultiply(&curBone->child->combinedTranformation, &curBone->combinedTranformation, &curBone->sibling->localTransform);
curBone = curBone->child;
}
}
开发者ID:n3on,项目名称:clearsky,代码行数:19,代码来源:skeletonanim.cpp
示例7: MatrixTranspose
//-----------------------------------------------------------------------------
// Loads the model * view matrix into pixel shader constants
//-----------------------------------------------------------------------------
void CBaseVSShader::LoadModelViewMatrixIntoVertexShaderConstant( int vertexReg )
{
VMatrix view, model, modelView, transpose;
s_pShaderAPI->GetMatrix( MATERIAL_MODEL, model.m[0] );
MatrixTranspose( model, model );
s_pShaderAPI->GetMatrix( MATERIAL_VIEW, view.m[0] );
MatrixTranspose( view, view );
MatrixMultiply( view, model, modelView );
s_pShaderAPI->SetVertexShaderConstant( vertexReg, modelView.m[0], 3 );
}
开发者ID:RubberWar,项目名称:Portal-2,代码行数:14,代码来源:BaseVSShader.cpp
示例8: MatrixRotationY
// 描画後処理
void CPlayer::PostDraw(void)
{
if (!m_pMesh) {
return;
}
// 後ろ向きモデルのため、Y軸180度回転
MATRIX world;
MatrixRotationY(&world, RAD * 180);
MatrixMultiply(&world, &m_world, &world);
DrawMeshAlpha(&world, m_pMesh);
}
开发者ID:deedum,项目名称:GLGame,代码行数:12,代码来源:Player.cpp
示例9: QuaternionToMatrix
//====================
// ボーンの行列を更新
//====================
void cPMDBone::updateMatrix( void )
{
// クォータニオンと移動値からボーンのローカルマトリックスを作成
QuaternionToMatrix( m_matLocal, &m_vec4Rotation );
m_matLocal[3][0] = m_vec3Position.x + m_vec3Offset.x;
m_matLocal[3][1] = m_vec3Position.y + m_vec3Offset.y;
m_matLocal[3][2] = m_vec3Position.z + m_vec3Offset.z;
// 親があるなら親の回転を受け継ぐ
if( m_pParentBone ) MatrixMultiply( m_matLocal, m_matLocal, m_pParentBone->m_matLocal );
}
开发者ID:r1cebank,项目名称:MMDRender,代码行数:14,代码来源:PMDBone.cpp
示例10: assert
void SpinAdapted::MatrixRotate (const Matrix& a, const Matrix& b, const Matrix& c, Matrix& d)
{
try
{
assert (d.Nrows () == a.Ncols () && d.Ncols () == c.Ncols ());
#ifdef BLAS
Matrix work (b.Nrows (), c.Ncols ());
Clear (work);
MatrixMultiply (b, 'n', c, 'n', work, 1.);
MatrixMultiply (a, 't', work, 'n', d, 1.);
#else
d = a.t () * b * c;
#endif
}
catch (Exception)
{
pout << Exception::what () << endl;
abort ();
}
}
开发者ID:i-maruyama,项目名称:Block,代码行数:20,代码来源:MatrixBLAS.C
示例11: MatrixRotationZ
void ParticleData::MatrixMap(float x, float y, float z, float theta, float size, bool init, float speed){
MATRIX mov;
MATRIX rot;
//シェーダーのコンスタントバッファーに各種データを渡す
D3D11_MAPPED_SUBRESOURCE pData;
CONSTANT_BUFFER_P cb;
dx->pDeviceContext->Map(pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &pData);
MatrixRotationZ(&rot, theta);
MatrixTranslation(&mov, x, y, z);
MatrixMultiply(&dx->World, &rot, &mov);
MatrixMultiply(&cb.WV, &dx->World, &dx->View);
cb.Proj = dx->Proj;
MatrixTranspose(&cb.WV);
MatrixTranspose(&cb.Proj);
cb.size.x = size;
if (init)cb.size.y = 1.0f; else cb.size.y = 0.0f;
cb.size.z = speed;
memcpy_s(pData.pData, pData.RowPitch, (void*)(&cb), sizeof(cb));
dx->pDeviceContext->Unmap(pConstantBuffer, 0);
}
开发者ID:sugawara5110,项目名称:3DRPG,代码行数:21,代码来源:Dx_ParticleData_CreateParticle.cpp
示例12: sinf
void MyMatrix::RotateZ(float angle)
{
float sinAngle, cosAngle;
sinAngle = sinf ( angle * PI / 180.0f );
cosAngle = cosf ( angle * PI / 180.0f );
MyMatrix temp;
temp.LoadIndentity();
temp.m[0][0] = temp.m[1][1] = cosAngle;
temp.m[0][1] = sinAngle;
temp.m[1][0] = -sinAngle;
MatrixMultiply(&temp,this);
}
开发者ID:50802353,项目名称:wot-version2,代码行数:12,代码来源:MyMatrix.cpp
示例13: MatrixIdentity
//==========================
// ボーンを指定座標へ向ける
//==========================
void cPMDBone::lookAt( const Vector3 *pvecTargetPos, float fLimitXD, float fLimitXU, float fLimitY )
{
// どうもおかしいので要調整
Matrix matTemp;
MatrixIdentity( matTemp );
matTemp[3][0] = m_vec3Position.x + m_vec3Offset.x;
matTemp[3][1] = m_vec3Position.y + m_vec3Offset.y;
matTemp[3][2] = m_vec3Position.z + m_vec3Offset.z;
if( m_pParentBone )
{
Matrix matInvTemp;
MatrixInverse( matInvTemp, m_pParentBone->m_matLocal );
matInvTemp[3][0] = m_pParentBone->m_matLocal[3][0];
matInvTemp[3][1] = m_pParentBone->m_matLocal[3][1];
matInvTemp[3][2] = -m_pParentBone->m_matLocal[3][2];
MatrixMultiply( matTemp, matTemp, matInvTemp );
}
MatrixInverse( matTemp, matTemp );
Vector3 vec3LocalTgtPosZY;
Vector3 vec3LocalTgtPosXZ;
Vector3Transform( &vec3LocalTgtPosZY, pvecTargetPos, matTemp );
vec3LocalTgtPosXZ = vec3LocalTgtPosZY;
vec3LocalTgtPosXZ.y = 0.0f;
Vector3Normalize( &vec3LocalTgtPosXZ, &vec3LocalTgtPosXZ );
vec3LocalTgtPosZY.x = 0.0f;
Vector3Normalize( &vec3LocalTgtPosZY, &vec3LocalTgtPosZY );
Vector3 vec3Angle = { 0.0f, 0.0f, 0.0f };
vec3Angle.x = asinf( vec3LocalTgtPosZY.y );
if( vec3LocalTgtPosXZ.x < 0.0f ) vec3Angle.y = acosf( vec3LocalTgtPosXZ.z );
else vec3Angle.y = -acosf( vec3LocalTgtPosXZ.z );
if( vec3Angle.x < RAD(fLimitXD) ) vec3Angle.x = RAD(fLimitXD);
if( RAD(fLimitXU) < vec3Angle.x ) vec3Angle.x = RAD(fLimitXU);
if( vec3Angle.y < RAD(-fLimitY) ) vec3Angle.y = RAD(-fLimitY);
if( RAD(fLimitY) < vec3Angle.y ) vec3Angle.y = RAD( fLimitY);
Vector4 vec4RotTemp;
QuaternionCreateEuler( &vec4RotTemp, &vec3Angle );
QuaternionSlerp( &m_vec4LookRotation, &m_vec4LookRotation, &vec4RotTemp, 0.5f ); // 0.3f ); // 視線の動きを高速化
m_vec4Rotation = m_vec4LookRotation;
}
开发者ID:r1cebank,项目名称:MMDRender,代码行数:56,代码来源:PMDBone.cpp
示例14: R_SetupMatrix
/*
=============
R_SetupMatrix
=============
*/
void R_SetupMatrix (void)
{
GL_Viewport(glx + r_refdef.vrect.x,
gly + glheight - r_refdef.vrect.y - r_refdef.vrect.height,
r_refdef.vrect.width,
r_refdef.vrect.height);
// Projection matrix
GL_FrustumMatrix(vulkan_globals.projection_matrix, DEG2RAD(r_fovx), DEG2RAD(r_fovy));
// View matrix
float rotation_matrix[16];
RotationMatrix(vulkan_globals.view_matrix, -M_PI / 2.0f, 1.0f, 0.0f, 0.0f);
RotationMatrix(rotation_matrix, M_PI / 2.0f, 0.0f, 0.0f, 1.0f);
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
RotationMatrix(rotation_matrix, DEG2RAD(-r_refdef.viewangles[2]), 1.0f, 0.0f, 0.0f);
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
RotationMatrix(rotation_matrix, DEG2RAD(-r_refdef.viewangles[0]), 0.0f, 1.0f, 0.0f);
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
RotationMatrix(rotation_matrix, DEG2RAD(-r_refdef.viewangles[1]), 0.0f, 0.0f, 1.0f);
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
float translation_matrix[16];
TranslationMatrix(translation_matrix, -r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);
MatrixMultiply(vulkan_globals.view_matrix, translation_matrix);
// View projection matrix
memcpy(vulkan_globals.view_projection_matrix, vulkan_globals.projection_matrix, 16 * sizeof(float));
MatrixMultiply(vulkan_globals.view_projection_matrix, vulkan_globals.view_matrix);
vkCmdPushConstants(vulkan_globals.command_buffer, vulkan_globals.basic_pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, 0, 16 * sizeof(float), vulkan_globals.view_projection_matrix);
}
开发者ID:chronokun,项目名称:vkQuake,代码行数:37,代码来源:gl_rmain.c
示例15: CreateMatrixMaterialVarFromKeyValue
//-----------------------------------------------------------------------------
// Creates a vector material var
//-----------------------------------------------------------------------------
static IMaterialVar* CreateMatrixMaterialVarFromKeyValue( IMaterial* pMaterial, KeyValues* pKeyValue )
{
char const* pScan = pKeyValue->GetString();
// Matrices can be specified one of two ways:
// [ # # # # # # # # # # # # # # # # ]
// or
// center # # scale # # rotate # translate # #
VMatrix mat;
int count = sscanf( pScan, " [ %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f ]",
&mat.m[0][0], &mat.m[0][1], &mat.m[0][2], &mat.m[0][3],
&mat.m[1][0], &mat.m[1][1], &mat.m[1][2], &mat.m[1][3],
&mat.m[2][0], &mat.m[2][1], &mat.m[2][2], &mat.m[2][3],
&mat.m[3][0], &mat.m[3][1], &mat.m[3][2], &mat.m[3][3] );
if (count == 16)
{
return IMaterialVar::Create( pMaterial, pKeyValue->GetName(), mat );
}
Vector2D scale, center;
float angle;
Vector2D translation;
count = sscanf( pScan, " center %f %f scale %f %f rotate %f translate %f %f",
¢er.x, ¢er.y, &scale.x, &scale.y, &angle, &translation.x, &translation.y );
if (count != 7)
return NULL;
VMatrix temp;
MatrixBuildTranslation( mat, -center.x, -center.y, 0.0f );
MatrixBuildScale( temp, scale.x, scale.y, 1.0f );
MatrixMultiply( temp, mat, mat );
MatrixBuildRotateZ( temp, angle );
MatrixMultiply( temp, mat, mat );
MatrixBuildTranslation( temp, center.x + translation.x, center.y + translation.y, 0.0f );
MatrixMultiply( temp, mat, mat );
// Create the variable!
return IMaterialVar::Create( pMaterial, pKeyValue->GetName(), mat );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:43,代码来源:CMaterialSubRect.cpp
示例16: UI_PositionRotatedEntityOnTag
/*
* UI_PositionRotatedEntityOnTag
*/
static void
UI_PositionRotatedEntityOnTag(Refent *entity, const Refent *parent,
Cliphandle parentModel, char *tagName)
{
int i;
Orient lerped;
Vec3 tempAxis[3];
/* lerp the tag */
trap_CM_LerpTag(&lerped, parentModel, parent->oldframe, parent->frame,
1.0 - parent->backlerp, tagName);
/* FIXME: allow origin offsets along tag? */
copyv3(parent->origin, entity->origin);
for(i = 0; i < 3; i++)
saddv3(entity->origin, lerped.origin[i], parent->axis[i],
entity->origin);
/* cast away const because of compiler problems */
MatrixMultiply(entity->axis, ((Refent*)parent)->axis, tempAxis);
MatrixMultiply(lerped.axis, tempAxis, entity->axis);
}
开发者ID:icanhas,项目名称:yantar,代码行数:25,代码来源:players.c
示例17: ContrastVMF
/*------------------------------------------------------------
ContrastVMF() - computes the variance multiplication factor
------------------------------------------------------------*/
static double ContrastVMF(MATRIX *X, MATRIX *C) {
float vmf;
MATRIX *Xt, *XtX, *iXtX, *CiXtX, *Ct, *CiXtXCt;
Xt = MatrixTranspose(X,NULL);
XtX = MatrixMultiply(Xt,X,NULL);
iXtX = MatrixInverse(XtX,NULL);
CiXtX = MatrixMultiply(C,iXtX,NULL);
Ct = MatrixTranspose(C,NULL);
CiXtXCt = MatrixMultiply(CiXtX,Ct,NULL);
vmf = CiXtXCt->rptr[1][1];
MatrixFree(&Xt);
MatrixFree(&XtX);
MatrixFree(&iXtX);
MatrixFree(&CiXtX);
MatrixFree(&Ct);
MatrixFree(&CiXtXCt);
return(vmf);
}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:25,代码来源:mri_gdfglm.c
示例18: SetPanelName
//-----------------------------------------------------------------------------
// Read in worldcraft data...
//-----------------------------------------------------------------------------
bool CVGuiScreen::KeyValue( const char *szKeyName, const char *szValue )
{
//!! temp hack, until worldcraft is fixed
// strip the # tokens from (duplicate) key names
char *s = (char *)strchr( szKeyName, '#' );
if ( s )
{
*s = '\0';
}
if ( FStrEq( szKeyName, "panelname" ))
{
SetPanelName( szValue );
return true;
}
// NOTE: Have to do these separate because they set two values instead of one
if( FStrEq( szKeyName, "angles" ) )
{
Assert( GetMoveParent() == NULL );
QAngle angles;
UTIL_StringToVector( angles.Base(), szValue );
// Because the vgui screen basis is strange (z is front, y is up, x is right)
// we need to rotate the typical basis before applying it
VMatrix mat, rotation, tmp;
MatrixFromAngles( angles, mat );
MatrixBuildRotationAboutAxis( rotation, Vector( 0, 1, 0 ), 90 );
MatrixMultiply( mat, rotation, tmp );
MatrixBuildRotateZ( rotation, 90 );
MatrixMultiply( tmp, rotation, mat );
MatrixToAngles( mat, angles );
SetAbsAngles( angles );
return true;
}
return BaseClass::KeyValue( szKeyName, szValue );
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:42,代码来源:vguiscreen.cpp
示例19: sqrtf
void MyMatrix::Rotate(float angle, float x, float y, float z)
{
float sinAngle, cosAngle;
float mag = sqrtf(x * x + y * y + z * z);
sinAngle = sinf ( angle * PI / 180.0f );
cosAngle = cosf ( angle * PI / 180.0f );
if ( mag > 0.0f )
{
float xx, yy, zz, xy, yz, zx, xs, ys, zs;
float oneMinusCos;
MyMatrix rotMat;
x /= mag;
y /= mag;
z /= mag;
xx = x * x;
yy = y * y;
zz = z * z;
xy = x * y;
yz = y * z;
zx = z * x;
xs = x * sinAngle;
ys = y * sinAngle;
zs = z * sinAngle;
oneMinusCos = 1.0f - cosAngle;
rotMat.m[0][0] = (oneMinusCos * xx) + cosAngle;
rotMat.m[0][1] = (oneMinusCos * xy) - zs;
rotMat.m[0][2] = (oneMinusCos * zx) + ys;
rotMat.m[0][3] = 0.0F;
rotMat.m[1][0] = (oneMinusCos * xy) + zs;
rotMat.m[1][1] = (oneMinusCos * yy) + cosAngle;
rotMat.m[1][2] = (oneMinusCos * yz) - xs;
rotMat.m[1][3] = 0.0F;
rotMat.m[2][0] = (oneMinusCos * zx) - ys;
rotMat.m[2][1] = (oneMinusCos * yz) + xs;
rotMat.m[2][2] = (oneMinusCos * zz) + cosAngle;
rotMat.m[2][3] = 0.0F;
rotMat.m[3][0] = 0.0F;
rotMat.m[3][1] = 0.0F;
rotMat.m[3][2] = 0.0F;
rotMat.m[3][3] = 1.0F;
MatrixMultiply( &rotMat, this);
}
}
开发者ID:50802353,项目名称:wot-version2,代码行数:51,代码来源:MyMatrix.cpp
示例20: AngleMatrix
//-----------------------------------------------------------------------------
// Sets up the camera
//-----------------------------------------------------------------------------
void CRenderManager::SetupCameraRenderState( )
{
CCameraProperty *pCamera = g_pWorldManager->GetLocalPlayer()->m_pCameraProperty;
matrix3x4_t cameraToWorld;
AngleMatrix( pCamera->m_Angles, pCamera->m_Origin, cameraToWorld );
matrix3x4_t matRotate;
matrix3x4_t matRotateZ;
MatrixBuildRotationAboutAxis( Vector(0,0,1), -90, matRotateZ );
MatrixMultiply( cameraToWorld, matRotateZ, matRotate );
matrix3x4_t matRotateX;
MatrixBuildRotationAboutAxis( Vector(1,0,0), 90, matRotateX );
MatrixMultiply( matRotate, matRotateX, matRotate );
matrix3x4_t view;
MatrixInvert( matRotate, view );
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
pRenderContext->MatrixMode( MATERIAL_VIEW );
pRenderContext->LoadMatrix( view );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:26,代码来源:rendermanager.cpp
注:本文中的MatrixMultiply函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论