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

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

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

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

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

示例1: D3DXMatrixTranspose

		bool ShadowMappingShader::SetShaderParameters(D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,			D3DXMATRIX projectionMatrix, D3DXMATRIX lightViewMatrix, D3DXMATRIX lightProjectionMatrix,			ID3D11ShaderResourceView* texture, ID3D11ShaderResourceView* depthMapTexture, D3DXVECTOR3 lightPosition,			D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor)		{			HRESULT result;			D3D11_MAPPED_SUBRESOURCE mappedResource;			unsigned int bufferNumber;			MatrixBufferType* dataPtr;			LightBufferType* dataPtr2;			LightBufferType2* dataPtr3;			// Transpose the matrices to prepare them for the shader.			D3DXMatrixTranspose(&worldMatrix, &worldMatrix);			D3DXMatrixTranspose(&viewMatrix, &viewMatrix);			D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);			D3DXMatrixTranspose(&lightViewMatrix, &lightViewMatrix);			D3DXMatrixTranspose(&lightProjectionMatrix, &lightProjectionMatrix);			ID3D11DeviceContext* deviceContext = GraphicsDX::GetDeviceContext();			// Lock the constant buffer so it can be written to.			result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);			if (FAILED(result))			{				return false;			}			// Get a pointer to the data in the constant buffer.			dataPtr = (MatrixBufferType*)mappedResource.pData;			// Copy the matrices into the constant buffer.			dataPtr->world = worldMatrix;			dataPtr->view = viewMatrix;			dataPtr->projection = projectionMatrix;			dataPtr->lightView = lightViewMatrix;			dataPtr->lightProjection = lightProjectionMatrix;			// Unlock the constant buffer.			deviceContext->Unmap(m_matrixBuffer, 0);			// Set the position of the constant buffer in the vertex shader.			bufferNumber = 0;			// Now set the constant buffer in the vertex shader with the updated values.			deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);			// Set shader texture resource in the pixel shader.			deviceContext->PSSetShaderResources(0, 1, &texture);			deviceContext->PSSetShaderResources(1, 1, &depthMapTexture);			// Lock the light constant buffer so it can be written to.			result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);			if (FAILED(result))			{				return false;			}			// Get a pointer to the data in the constant buffer.			dataPtr2 = (LightBufferType*)mappedResource.pData;			// Copy the lighting variables into the constant buffer.			dataPtr2->ambientColor = ambientColor;			dataPtr2->diffuseColor = diffuseColor;			// Unlock the constant buffer.			deviceContext->Unmap(m_lightBuffer, 0);			// Set the position of the light constant buffer in the pixel shader.			bufferNumber = 0;			// Finally set the light constant buffer in the pixel shader with the updated values.			deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);			// Lock the second light constant buffer so it can be written to.			result = deviceContext->Map(m_lightBuffer2, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);			if (FAILED(result))			{				return false;			}			// Get a pointer to the data in the constant buffer.			dataPtr3 = (LightBufferType2*)mappedResource.pData;			// Copy the lighting variables into the constant buffer.			dataPtr3->lightPosition = lightPosition;			dataPtr3->padding = 0.0f;			// Unlock the constant buffer.			deviceContext->Unmap(m_lightBuffer2, 0);			// Set the position of the light constant buffer in the vertex shader.			bufferNumber = 1;			// Finally set the light constant buffer in the pixel shader with the updated values.			deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer2);//.........这里部分代码省略.........
开发者ID:singingsingh,项目名称:Indra,代码行数:101,


示例2: vecLightDirUnnormalized

void CLcXSkinIns::Render(){	HRESULT hr=-1;	LPDIRECT3DDEVICE9 pDev = (LPDIRECT3DDEVICE9)LcDev_GetD3Device();	CLcXSkinSrc*	pOrg = (CLcXSkinSrc*)m_pOrg;	ID3DXEffect*	pEft	= pOrg->GetEffect();	// Setup the projection matrix	D3DXMATRIX matProj;	pDev->GetTransform(D3DTS_PROJECTION, &matProj);	D3DLIGHT9 light;	D3DXVECTOR3 vecLightDirUnnormalized(0.0f, -1.0f, 1.0f);	ZeroMemory( &light, sizeof(D3DLIGHT9) );	light.Type        = D3DLIGHT_DIRECTIONAL;	light.Diffuse.r   = 1.0f;	light.Diffuse.g   = 1.0f;	light.Diffuse.b   = 1.0f;	D3DXVec3Normalize( (D3DXVECTOR3*)&light.Direction, &vecLightDirUnnormalized );	light.Position.x   = 0.0f;	light.Position.y   = -1.0f;	light.Position.z   = 1.0f;	light.Range        = 1000.0f;	pDev->SetLight(0, &light );	pDev->LightEnable(0, TRUE );			// Set Light for vertex shader	D3DXVECTOR4 vLightDir( 0.0f, 1.0f, -1.0f, 0.0f );	D3DXVec4Normalize( &vLightDir, &vLightDir );			// for HLSL	{		pEft->SetMatrix( "mViewProj", &matProj);		pEft->SetVector( "lhtDir", &vLightDir);	}				// for shader	{		// set the projection matrix for the vertex shader based skinning method		D3DXMatrixTranspose(&matProj, &matProj);		pDev->SetVertexShaderConstantF(2, (float*)&matProj, 4);		pDev->SetVertexShaderConstantF(1, (float*)&vLightDir, 1);	}	if(m_pAC)		m_pAC->AdvanceTime(m_fElapse, NULL);	pOrg->UpdateFrameMatrices(m_pFrameOrg, &m_mtWld);		pOrg->DrawFrame(m_pFrameOrg);	static	D3DXMATRIX	mtI(1,0,0,0,  0,1,0,0,  0,0,1,0,  0,0,0,1);	pDev->SetTransform(D3DTS_WORLD, &mtI);}
开发者ID:GALICSOFT,项目名称:glc220_src,代码行数:65,


示例3: D3DXMatrixTranspose

bool TerrainShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, 											 D3DXMATRIX projectionMatrix, D3DXVECTOR4 ambientColor, D3DXVECTOR4 diffuseColor, D3DXVECTOR3 lightDirection){	HRESULT result;    D3D11_MAPPED_SUBRESOURCE mappedResource;	unsigned int bufferNumber;	MatrixBufferType* dataPtr;	LightBufferType* dataPtr2;	// Transpose the matrices to prepare them for the shader.	D3DXMatrixTranspose(&worldMatrix, &worldMatrix);	D3DXMatrixTranspose(&viewMatrix, &viewMatrix);	D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);	// Lock the constant buffer so it can be written to.	result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr = (MatrixBufferType*)mappedResource.pData;	// Copy the matrices into the constant buffer.	dataPtr->world = worldMatrix;	dataPtr->view = viewMatrix;	dataPtr->projection = projectionMatrix;	// Unlock the constant buffer.    deviceContext->Unmap(m_matrixBuffer, 0);	// Set the position of the constant buffer in the vertex shader.	bufferNumber = 0;	// Now set the constant buffer in the vertex shader with the updated values.    deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);	// Lock the light constant buffer so it can be written to.	result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr2 = (LightBufferType*)mappedResource.pData;	// Copy the lighting variables into the constant buffer.	dataPtr2->ambientColor = ambientColor;	dataPtr2->diffuseColor = diffuseColor;	dataPtr2->lightDirection = lightDirection;	dataPtr2->padding = 0.0f;	// Unlock the constant buffer.	deviceContext->Unmap(m_lightBuffer, 0);	// Set the position of the light constant buffer in the pixel shader.	bufferNumber = 0;	// Finally set the light constant buffer in the pixel shader with the updated values.	deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);	return true;}
开发者ID:richa-sachdeva,项目名称:CGTPortfolio,代码行数:66,


示例4: transpose

Matrix Matrix::transpose(const Matrix& matrix){	return *D3DXMatrixTranspose(&tmp, &matrix);}
开发者ID:steinbergerbernd,项目名称:Lucky-Leprechauns,代码行数:4,


示例5: D3DXMatrixTranspose

/** Draws the visual for the given vob */void GSkeletalMeshVisual::DrawVisual(const RenderInfo& info){	GVisual::DrawVisual(info);	// Draw the mesh using immediate states	int n=0;	for(auto it = VisualInfo.SkeletalMeshes.begin();it != VisualInfo.SkeletalMeshes.end(); it++)	{		D3DXMATRIX world; D3DXMatrixTranspose(&world, info.WorldMatrix);		std::vector<SkeletalMeshInfo*>& meshes = (*it).second;		for(int i=0;i<meshes.size();i++)		{			if(ImmediatePipelineStates[n]->BaseState.TextureIDs[0] == 0xFFFF)			{				// Only draw if the texture is loaded				if((*it).first->GetTexture() && (*it).first->GetTexture()->CacheIn(0.6f) != zRES_CACHED_IN)				{					n++;					continue;				}				// Get texture ID if everything is allright				if((*it).first &&					(*it).first->GetTexture() &&					(*it).first->GetTexture()->GetSurface() &&					(*it).first->GetTexture()->GetSurface()->GetEngineTexture())				{					ImmediatePipelineStates[n]->BaseState.TextureIDs[0] = (*it).first->GetTexture()->GetSurface()->GetEngineTexture()->GetID();					// Get Alphatest					if((*it).first->GetAlphaFunc() > 1 || (*it).first->GetTexture()->HasAlphaChannel())						ImmediatePipelineStates[n]->BaseState.TranspacenyMode = PipelineState::ETransparencyMode::TM_MASKED;					Engine::GraphicsEngine->SetupPipelineForStage(STAGE_DRAW_SKELETAL, ImmediatePipelineStates[n]);				}			}			// Clone the state for this mesh			PipelineState* transientState = Engine::GraphicsEngine->CreatePipelineState(ImmediatePipelineStates[n]);			transientState->TransientState = true;			// Input instanceCB and our bones			transientState->BaseState.ConstantBuffersVS[1] = info.InstanceCB;			transientState->BaseState.ConstantBuffersVS[2] = BoneConstantBuffer;			Engine::GraphicsEngine->FillPipelineStateObject(transientState);			// Push to renderlist			Engine::GraphicsEngine->PushPipelineState(transientState);			n++;		}	}	return;#ifndef DEBUG_DRAW_VISUALS	return;#endif	std::vector<D3DXMATRIX> trans = *BoneTransforms;	for(int i=0;i<trans.size();i++)		D3DXMatrixTranspose(&trans[i], &trans[i]);	// Debug draw the mesh as line-wireframe	for(auto it = VisualInfo.SkeletalMeshes.begin();it != VisualInfo.SkeletalMeshes.end(); it++)	{		D3DXMATRIX world; D3DXMatrixTranspose(&world, info.WorldMatrix);		std::vector<SkeletalMeshInfo*>& meshes = (*it).second;		for(int i=0;i<meshes.size();i++)		{			std::vector<VERTEX_INDEX>& indices = meshes[i]->Indices;			std::vector<ExSkelVertexStruct>& vertices = meshes[i]->Vertices;			for(int i=0;i<indices.size();i+=3)			{				D3DXVECTOR3 vx[3];				for(int v=0;v<3;v++)				{					D3DXVECTOR3 position = D3DXVECTOR3(0,0,0);					ExSkelVertexStruct& input = vertices[indices[i + v]];					for(int i=0;i<4;i++)					{						D3DXVECTOR3 bp; D3DXVec3TransformCoord(&bp, input.Position[i].toD3DXVECTOR3(), &trans[input.boneIndices[i]]);						position += input.weights[i] * bp;					}					D3DXVec3TransformCoord(&position, &position, &world);					vx[v] = position;								}				// Don't draw too far				if(D3DXVec3Length(&(vx[0] - Engine::GAPI->GetCameraPosition())) > 2400)					continue;				Engine::GraphicsEngine->GetLineRenderer()->AddTriangle(vx[0], vx[1], vx[2], D3DXVECTOR4(1,0,0,1));//.........这里部分代码省略.........
开发者ID:parav,项目名称:GD3D11,代码行数:101,


示例6: HR

void RobotArmDemo::drawScene(){	// Clear the backbuffer and depth buffer.	HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));	HR(gd3dDevice->BeginScene());	HR(mFX->SetValue(mhLight, &mLight, sizeof(DirLight)));		HR(mFX->SetTechnique(mhTech));	UINT numPasses = 0;	HR(mFX->Begin(&numPasses, 0));	HR(mFX->BeginPass(0));	// Build the world transforms for each bone, then render them.	buildBoneWorldTransforms();	D3DXMATRIX T;	D3DXMatrixTranslation(&T, -NUM_BONES, 0.0f, 0.0f);	for(int i = 0; i < NUM_BONES; ++i)	{		// Append the transformation with a slight translation to better		// center the skeleton at the center of the scene.		mWorld = mBones[i].toWorldXForm * T;		HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj)));		D3DXMATRIX worldInvTrans;		D3DXMatrixInverse(&worldInvTrans, 0, &mWorld);		D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans);		HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans));		HR(mFX->SetMatrix(mhWorld, &mWorld));		for(int j = 0; j < mMtrl.size(); ++j)		{			HR(mFX->SetValue(mhMtrl, &mMtrl[j], sizeof(Mtrl)));					// If there is a texture, then use.			if(mTex[j] != 0)			{				HR(mFX->SetTexture(mhTex, mTex[j]));			}			// But if not, then set a pure white texture.  When the texture color			// is multiplied by the color from lighting, it is like multiplying by			// 1 and won't change the color from lighting.			else			{				HR(mFX->SetTexture(mhTex, mWhiteTex));			}					HR(mFX->CommitChanges());			HR(mBoneMesh->DrawSubset(j));		}	}	HR(mFX->EndPass());	HR(mFX->End());		mGfxStats->display();	HR(gd3dDevice->EndScene());	// Present the backbuffer.	HR(gd3dDevice->Present(0, 0, 0, 0));}
开发者ID:nguyenkim495,项目名称:KidBuu,代码行数:62,


示例7: D3DXMatrixTranspose

bool SpecularMapShader::SetShaderParameters(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix, 					     D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, 					     ID3D11ShaderResourceView** textureArray, D3DXVECTOR3 lightDirection, 					     D3DXVECTOR4 diffuseColor, D3DXVECTOR3 cameraPosition, D3DXVECTOR4 specularColor,					     float specularPower){	HRESULT result;	D3D11_MAPPED_SUBRESOURCE mappedResource;	MatrixBufferType* dataPtr;	unsigned int bufferNumber;	LightBufferType* dataPtr2;	CameraBufferType* dataPtr3;	// Transpose the matrices to prepare them for the shader.	D3DXMatrixTranspose(&worldMatrix, &worldMatrix);	D3DXMatrixTranspose(&viewMatrix, &viewMatrix);	D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);	// Lock the matrix constant buffer so it can be written to.	result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr = (MatrixBufferType*)mappedResource.pData;	// Copy the matrices into the constant buffer.	dataPtr->world = worldMatrix;	dataPtr->view = viewMatrix;	dataPtr->projection = projectionMatrix;	// Unlock the matrix constant buffer.	deviceContext->Unmap(m_matrixBuffer, 0);	// Set the position of the matrix constant buffer in the vertex shader.	bufferNumber = 0;	// Now set the matrix constant buffer in the vertex shader with the updated values.	deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);	// Set shader texture array resource in the pixel shader.	deviceContext->PSSetShaderResources(0, 3, textureArray);	// Lock the light constant buffer so it can be written to.	result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr2 = (LightBufferType*)mappedResource.pData;	// Copy the lighting variables into the constant buffer.	dataPtr2->diffuseColor = diffuseColor;	dataPtr2->lightDirection = lightDirection;	dataPtr2->specularColor = specularColor;	dataPtr2->specularPower = specularPower;	// Unlock the constant buffer.	deviceContext->Unmap(m_lightBuffer, 0);	// Set the position of the light constant buffer in the pixel shader.	bufferNumber = 0;	// Finally set the light constant buffer in the pixel shader with the updated values.	deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);	// Lock the camera constant buffer so it can be written to.	result = deviceContext->Map(m_cameraBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr3 = (CameraBufferType*)mappedResource.pData;	// Copy the camera position into the constant buffer.	dataPtr3->cameraPosition = cameraPosition;	// Unlock the matrix constant buffer.	deviceContext->Unmap(m_cameraBuffer, 0);	// Set the position of the camera constant buffer in the vertex shader as the second buffer.	bufferNumber = 1;	// Now set the matrix constant buffer in the vertex shader with the updated values.	deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_cameraBuffer);	return true;}
开发者ID:AidanTemple,项目名称:Direct3D_11_Sample,代码行数:94,


示例8: HR

void EngineMain::drawScene(){	// Clear the backbuffer and depth buffer.	HR(g_d3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));		HR(g_d3dDevice->BeginScene());	D3DXMATRIX wVPM = camera.GetView()*camera.GetProjection();	// Setup the rendering FX	Shaders::BasicFX->SetDirectionalLight(&m_DirLight);	Shaders::BasicFX->m_FX->SetTechnique(Shaders::BasicFX->m_hTech);	// Begin passes.	UINT numPasses = 0;	Shaders::BasicFX->m_FX->Begin(&numPasses, 0);	Shaders::BasicFX->m_FX->BeginPass(0);	skull->DrawModel(wVPM);	dwarf->DrawModel(wVPM);	tiny->DrawModel(wVPM);	Shaders::BasicFX->m_FX->EndPass();	Shaders::BasicFX->m_FX->End();	// Animation Passes //	Shaders::VBlendFX->SetDirectionalLight(&m_DirLight);	//HR(Shaders::VBlendFX->m_FX->SetValue(Shaders::VBlendFX->m_hLight, &m_DirLight, sizeof(DirectionalLight))); 	Shaders::VBlendFX->m_FX->SetTechnique(Shaders::VBlendFX->m_hTech);	numPasses = 0;	Shaders::VBlendFX->m_FX->Begin(&numPasses, 0);	Shaders::VBlendFX->m_FX->BeginPass(0);	//tiny->draw(wVPM);	Shaders::VBlendFX->m_FX->EndPass();	Shaders::VBlendFX->m_FX->End();	// End //	#pragma region Draw Grid	HR(mFX->SetTechnique(mhTech));	HR(mFX->SetMatrix(mhWVP, &wVPM));	D3DXMATRIX worldInvTrans;	D3DXMatrixInverse(&worldInvTrans, 0, &m_World);	D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans);	HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans));	HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3)));	HR(mFX->SetValue(mhDiffuseMtrl, &mDiffuseMtrl, sizeof(D3DXCOLOR)));	HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR)));	HR(mFX->SetValue(mhAmbientMtrl, &mAmbientMtrl, sizeof(D3DXCOLOR)));	HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR)));	HR(mFX->SetValue(mhSpecularLight, &mSpecularLight, sizeof(D3DXCOLOR)));	HR(mFX->SetValue(mhSpecularMtrl, &mSpecularMtrl, sizeof(D3DXCOLOR)));	HR(mFX->SetFloat(mhSpecularPower, mSpecularPower));	HR(mFX->SetMatrix(mhWorld, &m_World));	HR(mFX->SetTexture(mhTex, mGroundTex));	HR(g_d3dDevice->SetVertexDeclaration(VertexPNT::Decl));	HR(g_d3dDevice->SetStreamSource(0, mGridVB, 0, sizeof(VertexPNT)));	HR(g_d3dDevice->SetIndices(mGridIB));	// Begin passes.	numPasses = 0;	HR(mFX->Begin(&numPasses, 0));	for(UINT i = 0; i < numPasses; ++i)	{		HR(mFX->BeginPass(i));		HR(g_d3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, mNumGridVertices, 0, mNumGridTriangles));		HR(mFX->EndPass());	}	HR(mFX->End());#pragma endregion	m_GfxStats->display();	HR(g_d3dDevice->EndScene());	// Present the backbuffer.	HR(g_d3dDevice->Present(0, 0, 0, 0));}
开发者ID:aSaul2006,项目名称:GameEngineProject,代码行数:85,


示例9: D3DXMatrixTranspose

void Matrix::setTranspose( const Matrix& mat ){	D3DXMATRIX a;	D3DXMatrixTranspose( &a, &D3DXMATRIX((float*)&mat.m ) );	m.set( a );}
开发者ID:KirisameMarisa,项目名称:Yoserusu,代码行数:5,


示例10: D3DXMatrixTranspose

bool ReflectionShader::SetShaderParameters(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, 						D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* colorTexture, 						ID3D11ShaderResourceView* normalTexture, D3DXVECTOR4 lightDiffuseColor, D3DXVECTOR3 lightDirection, 						float colorTextureBrightness, D3DXVECTOR4 clipPlane){	HRESULT result;	D3D11_MAPPED_SUBRESOURCE mappedResource;	unsigned int bufferNumber;	MatrixBufferType* dataPtr;	ClipPlaneBufferType* dataPtr1;	LightBufferType* dataPtr2;	// Transpose the matrices to prepare them for the shader.	D3DXMatrixTranspose(&worldMatrix, &worldMatrix);	D3DXMatrixTranspose(&viewMatrix, &viewMatrix);	D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);	// Lock the constant buffer so it can be written to.	result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr = (MatrixBufferType*)mappedResource.pData;	// Copy the matrices into the constant buffer.	dataPtr->world = worldMatrix;	dataPtr->view = viewMatrix;	dataPtr->projection = projectionMatrix;	// Unlock the constant buffer.	deviceContext->Unmap(m_matrixBuffer, 0);	// Set the position of the constant buffer in the vertex shader.	bufferNumber = 0;	// Now set the constant buffer in the vertex shader with the updated values.	deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);		// Lock the clip plane constant buffer so it can be written to.	result = deviceContext->Map(m_clipPlaneBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the clip plane constant buffer.	dataPtr1 = (ClipPlaneBufferType*)mappedResource.pData;	// Copy the clip plane into the clip plane constant buffer.	dataPtr1->clipPlane = clipPlane;	// Unlock the buffer.	deviceContext->Unmap(m_clipPlaneBuffer, 0);	// Set the position of the clip plane constant buffer in the vertex shader.	bufferNumber = 1;	// Now set the clip plane constant buffer in the vertex shader with the updated values.	deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_clipPlaneBuffer);		// Lock the light constant buffer so it can be written to.	result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);	if(FAILED(result))	{		return false;	}	// Get a pointer to the data in the constant buffer.	dataPtr2 = (LightBufferType*)mappedResource.pData;	// Copy the lighting variables into the constant buffer.	dataPtr2->lightDiffuseColor = lightDiffuseColor;	dataPtr2->lightDirection = lightDirection;	dataPtr2->colorTextureBrightness = colorTextureBrightness;	// Unlock the constant buffer.	deviceContext->Unmap(m_lightBuffer, 0);	// Set the position of the light constant buffer in the pixel shader.	bufferNumber = 0;	// Finally set the light constant buffer in the pixel shader with the updated values.	deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);	// Set the texture resources in the pixel shader.	deviceContext->PSSetShaderResources(0, 1, &colorTexture);	deviceContext->PSSetShaderResources(1, 1, &normalTexture);	return true;}
开发者ID:makehimanoffer,项目名称:3rdYearProjectStorage,代码行数:94,


示例11: GetDevice

	void Ground::Render() {		GetDevice()->SetFVF(D3DFVF_GROUNDCUSTOMVERTEX);		// TODO: 
C++ D3DXVECTOR2函数代码示例
C++ D3DXMatrixTranslation函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。