⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sprite.cpp

📁 游戏音频程序设计-Beginning.Game.Audio.Programming
💻 CPP
字号:
#include "Sprite.h"

CSprite::CSprite()
{
  m_pAnim = NULL;
  m_fSize = 1.0f;
	m_fRotationYaw = m_fRotationPitch = m_fRotationRoll = 0.0f;
}

CSprite::CSprite(CAnimSequence *anim)
{
  m_pAnim = anim;
  m_fSize = 1.0f;
}

CSprite::~CSprite()
{
}

void CSprite::Render(D3DXMATRIX view)
{
  if (!m_pAnim) return;

  // Set up a rotation matrix to orient the explo sprite towards the camera.
  D3DXMATRIX matScale, matTranslate, matTranspose, matBillboardRot, matWorld;
	D3DXMATRIX matRot; // user-specified rotation
  D3DXMatrixTranspose(&matTranspose, &view);
  D3DXMatrixIdentity(&matBillboardRot);
  
  matBillboardRot._11 = matTranspose._11;
  matBillboardRot._12 = matTranspose._12;
  matBillboardRot._13 = matTranspose._13;
  matBillboardRot._21 = matTranspose._21;
  matBillboardRot._22 = matTranspose._22;
  matBillboardRot._23 = matTranspose._23;
  matBillboardRot._31 = matTranspose._31;
  matBillboardRot._32 = matTranspose._32;
  matBillboardRot._33 = matTranspose._33;
      
  D3DXMatrixTranslation(&matWorld, m_vPos.x, m_vPos.y, m_vPos.z);
	D3DXMatrixRotationYawPitchRoll(&matRot, m_fRotationYaw, m_fRotationPitch, m_fRotationRoll);

  D3DXMatrixScaling(&matScale, m_fSize, m_fSize, 1);
  m_pAnim->Render(m_Timer, matScale * matRot * matBillboardRot * matWorld);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -