您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ D3DXMatrixScaling函数代码示例

51自学网 2021-06-01 20:17:17
  C++
这篇教程C++ D3DXMatrixScaling函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中D3DXMatrixScaling函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DXMatrixScaling函数的具体用法?C++ D3DXMatrixScaling怎么用?C++ D3DXMatrixScaling使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了D3DXMatrixScaling函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: D3DXMatrixScaling

	void Node::SetScale(float x, float y, float z)	{		D3DXMatrixScaling( &this->matScale, x, y, z);        // Pitch	}
开发者ID:Siduron,项目名称:Siduron-Engine,代码行数:4,


示例2: starTwinkle

void star::starDraw(void)//this draws a Star to the Background will eventually include arguments to set stars X Y coords, size and color of star{		D3DXMATRIX matTranslateStar;    // a matrix to store the translation information	D3DXMATRIX matSpikeRotation;	//matrix used to rotate drawn spikes	D3DXMATRIX matScaleStar;			//matrix used to scale stars down	D3DXMATRIX matTwinkle;	starTwinkle();		D3DXMatrixTranslation(&matTranslateStar, xStar, yStar, -5.0f);//set star transformation here	D3DXMatrixScaling(&matScaleStar,scale,scale,scale);	D3DXMatrixRotationZ(&matTwinkle,D3DXToRadian(twinkle));	starBase();	// set the world transform	    dev->d3ddev->SetTransform(D3DTS_WORLD, &(matScaleStar*matTwinkle*matTranslateStar));    // set the world transform		// select the vertex buffer to display    dev->d3ddev->SetStreamSource(0, dev->v_buffer, 0, sizeof(CUSTOMVERTEX));    dev->d3ddev->SetIndices(dev->i_buffer);	// draw    dev->d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 18, 0, 32);	dev->cleanBuffers();	starAngle();	for(float i=0;i<=3;i+=1)//draws 4 spikes at equal areas	{	// set the world transform	D3DXMatrixRotationZ(&matSpikeRotation, D3DXToRadian(90*i));    dev->d3ddev->SetTransform(D3DTS_WORLD, &(matSpikeRotation*matScaleStar*matTwinkle*matTranslateStar));    // set the world transform	 	// select the vertex buffer to display    dev->d3ddev->SetStreamSource(0, dev->v_buffer, 0, sizeof(CUSTOMVERTEX));    dev->d3ddev->SetIndices(dev->i_buffer);	// draw    dev->d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 5, 0, 4);	}	dev->cleanBuffers();	starHV();	for(float i=0;i<=3;i+=1)//draws 4 spikes at equal areas	{	// set the world transform	D3DXMatrixRotationZ(&matSpikeRotation, D3DXToRadian(90*i));    dev->d3ddev->SetTransform(D3DTS_WORLD, &(matSpikeRotation*matScaleStar*matTwinkle*matTranslateStar));    // set the world transform		// select the vertex buffer to display    dev->d3ddev->SetStreamSource(0, dev->v_buffer, 0, sizeof(CUSTOMVERTEX));    dev->d3ddev->SetIndices(dev->i_buffer);	// draw    dev->d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 5, 0, 4);	}	dev->cleanBuffers();	return;}
开发者ID:ascriven,项目名称:Galaxian3D,代码行数:62,


示例3: getFloatProperty

void MegaExtrudeOperator::process(int tick){    if (mesh != 0)        delete mesh;    float distance = getFloatProperty(0);    unsigned char count = getByteProperty(1);    D3DXVECTOR3 scaleVector = getVectorProperty(2);    D3DXVECTOR3 rotationVector = getVectorProperty(3);    D3DXMATRIX scaleMatrix;    D3DXMatrixScaling(&scaleMatrix,                      scaleVector.x,                      scaleVector.y,                      scaleVector.z);    D3DXMATRIX rotationXMatrix;    D3DXMatrixRotationX(&rotationXMatrix, rotationVector.x);    D3DXMATRIX rotationYMatrix;    D3DXMatrixRotationY(&rotationYMatrix, rotationVector.y);    D3DXMATRIX rotationZMatrix;    D3DXMatrixRotationZ(&rotationZMatrix, rotationVector.z);    D3DXMATRIX translationMatrix;    D3DXMatrixTranslation(&translationMatrix,                          0.0f,                          distance / (float)count,                          0.0f);    D3DXMATRIX extrudeMatrix = scaleMatrix * rotationXMatrix * rotationYMatrix * rotationZMatrix * translationMatrix;    Mesh *srcMesh = getInput(0)->mesh;    int numberOfVertices = srcMesh->getNumVertices();    int numberOfQuads = srcMesh->getNumQuads();    // Calculate the new number of quads and vertices.    // The number of triangles will be unchanged.    for (int i = 0; i < srcMesh->getNumFaces(); i++)    {        int n;        int *face = srcMesh->face(i, n);        if (srcMesh->faceSelected(i))        {            numberOfQuads += n * count;            numberOfVertices += n * count;        }    }    mesh = new Mesh(numberOfVertices, srcMesh->getNumTriangles(), numberOfQuads, 1);    int triangleIndex = 0;    int quadIndex = 0;    // Copy the src mesh vertices.    for (int i = 0; i < srcMesh->getNumVertices(); i++)    {        mesh->pos(i) = srcMesh->pos(i);    }    int vertexIndex = srcMesh->getNumVertices();    // Extrude each selected face and add triangles and quads.    Vec3* lastPositions = new Vec3[4];    int* lastIndices = new int[4];    int* currentIndices = new int[4];    for (int i = 0; i < srcMesh->getNumFaces(); i++)    {        int n;        int *face = srcMesh->face(i, n);        for (int f = 0; f < n; f++)        {            lastPositions[f] = srcMesh->pos(face[f]);            lastIndices[f] = face[f];        }        if (srcMesh->faceSelected(i))        {            // Get our base vectors.            Vec3 pos1 = srcMesh->pos(face[1]);            Vec3 pos0 = srcMesh->pos(face[0]);            Vec3 faceBase1 = normalize(pos1 - pos0);            Vec3 faceBase2 = normalize(srcMesh->getFaceNormal(i));            Vec3 faceBase3 = normalize(cross(faceBase2, faceBase1));            D3DXMATRIX fromFaceBaseMatrix = D3DXMATRIX(faceBase1.x, faceBase1.y, faceBase1.z, 0.0f,                                            faceBase2.x, faceBase2.y, faceBase2.z, 0.0f,                                            faceBase3.x, faceBase3.y, faceBase3.z, 0.0f,                                            0.0f,               0.0f,        0.0f, 1.0f);            D3DXMATRIX toFaceBaseMatrix = D3DXMATRIX(faceBase1.x, faceBase2.x, faceBase3.x, 0.0f,                                          faceBase1.y, faceBase2.y, faceBase3.y, 0.0f,                                          faceBase1.z, faceBase2.z, faceBase3.z, 0.0f,                                          0.0f,               0.0f,        0.0f, 1.0f);            D3DXMATRIX toFaceBaseAndOrigoMatrix = toFaceBaseMatrix;            D3DXMATRIX fromFaceBaseAndToFaceMatrix = extrudeMatrix * fromFaceBaseMatrix;            for (int c = 0; c < count; c++)            {                for (int f = 0; f < n; f++)                {//.........这里部分代码省略.........
开发者ID:olofn,项目名称:db_public,代码行数:101,


示例4: D3DXMatrixScaling

void CRenderManager::Render(CTexture const * _pTexture,							CRect const * _rImgRect,							D3DXVECTOR2 const & _vPosition,							D3DXVECTOR2 const & _vScale,							D3DCOLOR const _ImgColor,							D3DXVECTOR2 const & _vCenter,							float const _fLocalRotAmount,							float const _fGlobalRotAmount,							D3DXVECTOR2 const & _vRotationVector) const{	RECT _rRect;	if(_rImgRect)	{		_rRect.top		= _rImgRect->m_nY;		_rRect.bottom	= _rImgRect->m_nY + _rImgRect->m_nHeight;		_rRect.left		= _rImgRect->m_nX;		_rRect.right	= _rImgRect->m_nX + _rImgRect->m_nWidth;	}	/* NOTE */	// Expensive call, transforming even when values are 0.	/* NOTE */	// Don't need to call identity on any of the matrices. Once the DirectX function gets call (Scale, Rotate, Translate),	// the matrix becomes identity with the applied values from the function.	D3DXMATRIX mTransform;	// Order (SRT -> Scale, Rotate, Translate)	// Scale	D3DXMATRIX mScale; 	D3DXMatrixScaling(&mScale, _vScale.x, _vScale.y, 0.0f);	// Local Rotation	D3DXMATRIX mLocalRotation;	D3DXMATRIX mRotationTranslate;	D3DXMatrixTranslation(&mRotationTranslate, -_vCenter.x, -_vCenter.y, 0.0f); 	D3DXMatrixRotationAxis(&mLocalRotation, &D3DXVECTOR3(0.0f, 0.0f, 1.0f), _fLocalRotAmount);	mLocalRotation = mRotationTranslate * mLocalRotation;	// Translate	D3DXMATRIX mTranslation;	D3DXMatrixTranslation(&mTranslation, (_vPosition.x + _vCenter.x), (_vPosition.y + _vCenter.y), 0.0f);	// Global Rotation	D3DXMATRIX mGlobalRotation;	D3DXMatrixTranslation(&mRotationTranslate, _vRotationVector.x, _vRotationVector.y, 0.0f);	D3DXMatrixRotationAxis(&mGlobalRotation, &D3DXVECTOR3(0.0f, 0.0f, 1.0f), _fGlobalRotAmount);	mGlobalRotation = mRotationTranslate * mGlobalRotation;	// Multiply all the matrices together	mTransform = mScale * mLocalRotation * mGlobalRotation * mTranslation;	// Set the transform to move the position, draw, then reset back to origin	m_pSpriteManager->SetTransform(&mTransform);	m_pSpriteManager->Draw(_pTexture->GetTexture(), _rImgRect ? (&_rRect) : NULL, 0, 0, _ImgColor);	// Now reset the picture back to top left of window	D3DXMatrixIdentity(&mTransform);	m_pSpriteManager->SetTransform(&mTransform);}
开发者ID:107-Studios,项目名称:GasNGo,代码行数:61,


示例5: D3DXMatrixPerspectiveFovLH

void DXApp::RenderFrame(){    _p_device->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 1.0f, 0);    _p_device->BeginScene();    _p_device->SetRenderState(D3DRS_AMBIENT,RGB(255,255,255));    _p_device->SetRenderState(D3DRS_LIGHTING,false);    _p_device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);    _p_device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);    _p_device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);    D3DXMatrixPerspectiveFovLH(&matProjection,0.30f,(float)width/height,200.0f,2000.0f);    //D3DXMatrixRotationX(&trans1, CameraAngleX);    D3DXMatrixRotationYawPitchRoll(&trans1, 0.0f, CameraAngleX, CameraAngleY);    D3DXMatrixIdentity(&matView);    D3DXMatrixLookAtLH( &matView, (D3DXVECTOR3*)&Cam.location,                        (D3DXVECTOR3*)&(Cam.location + Cam.ViewDir),                        &D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );    //D3DXMatrixMultiply(&matView, &trans1, &matView);    D3DXMATRIX matLocal;    D3DXMatrixIdentity(&matLocal);    _p_device->GetRenderTarget(0, & _back_buffer);    ///////////////////////////////////////////////////    //Render Shadow Buffer    IDirect3DSurface9* _shadow_buffer;    ShadowBuffer->GetSurfaceLevel(0, &_shadow_buffer);    _p_device->SetRenderTarget(0, _shadow_buffer);    _p_device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xFFFFFFFF, 1.0f, 0);    D3DXMATRIX matSBView;    D3DXMATRIX matSBProjection;    D3DXMATRIX matSBFull;    D3DXMatrixLookAtLH( &matSBView, (D3DXVECTOR3*)&DrawLight.location, &D3DXVECTOR3( 0.0f, 0.0f, 0.0f ), &D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );    D3DXMatrixPerspectiveFovLH( &matSBProjection, D3DXToRadian(30.0f), 1,200.0f,2000.0f);    D3DXMatrixMultiply( &matSBFull, &matSBView, &matSBProjection );    _p_SB_vertex_constant_able->SetMatrix(_p_device, hSBMatProjection, &matSBFull);    _p_device->SetFVF(particle_fvf);    _p_device->SetPixelShader(_p_SB_shader);    _p_device->SetVertexShader(_p_SB_vshader);    //now render the scene    for(int i=0; i < _max_particle_count; i++)    {        if(_particle_list[i].Particle != NULL)        {            NxMat34 Pose = _particle_list[i].Particle->getGlobalPose();            float MatTransform[16];            Pose.getColumnMajor44((NxF32*)&MatTransform);            D3DXMATRIX Transfom(MatTransform);            D3DXMatrixScaling(&matLocal, CubeMeshDrawScale, CubeMeshDrawScale, CubeMeshDrawScale);            D3DXMatrixMultiply(&Transfom, &matLocal, &Transfom);            _p_SB_vertex_constant_able->SetMatrix(_p_device, hSBMatWorld, &Transfom);            _particle_Mesh->DrawSubset(0);        }    }    _shadow_buffer->Release();    /////////////////////////////////////////////////    //Render Scene    //_p_device->SetTexture(0, _point_texture);    IDirect3DSurface9* screen_surface;    _screen_buffer->GetSurfaceLevel(0, &screen_surface);    _p_device->SetRenderTarget(0, screen_surface);    _p_device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xFF000000, 1.0f, 0);    _p_device->SetRenderTarget(0, _back_buffer);    _p_device->SetTexture(0, ShadowBuffer);    IDirect3DSurface9* blur_surface;    if(bMotionBlur)    {        _blur_buffer->GetSurfaceLevel(0, &blur_surface);        _p_device->SetRenderTarget(1, blur_surface);        _p_device->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 1.0f, 0);    }    _p_device->SetRenderTarget(0, screen_surface);    //Setup the Transform Matricies for the VertexShader;    _p_vertex_constant_able->SetMatrix(_p_device, hMatProjection, &matProjection);    _p_vertex_constant_able->SetMatrix(_p_device, hMatView, &matView);    _p_vertex_constant_able->SetFloatArray(_p_device, hLightPosition, (float*)&DrawLight.location, 3);    float fTexOffs = 0.5f + (0.5f / (float)ShadowMapSize);    D3DXMATRIX matTexAdj( 0.5f,     0.0f,     0.0f, 0.0f,                          0.0f,     -0.5f,    0.0f, 0.0f,                          0.0f,     0.0f,     1.0f, 0.0f,                          fTexOffs, fTexOffs, 0.0f, 1.0f );    D3DXMATRIX matTexture;// = matView;//.........这里部分代码省略.........
开发者ID:Arelius,项目名称:TestMotionBlur,代码行数:101,


示例6: D3DCOLOR_ARGB

void CWndChangeSex::OnDraw( C2DRender* p2DRender ) { 	if( g_pPlayer == NULL  )		return;	LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;	pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );	pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );	pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );	pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );	pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );	pd3dDevice->SetSamplerState ( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );	pd3dDevice->SetSamplerState ( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );	pd3dDevice->SetRenderState( D3DRS_AMBIENT,  D3DCOLOR_ARGB( 255, 255,255,255) );		CRect rect = GetClientRect();	// 
C++ D3DXMatrixTranslation函数代码示例
C++ D3DXMatrixRotationZ函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。