Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. void ModelClass::UpdateObjectTransformations(const std::string ID, XMFLOAT3 pos, XMFLOAT3 rotation, XMFLOAT3 scale)
  2. {
  3. for (int i = 0; i < ObjectDatas.size(); i++)
  4. {
  5.  
  6. if (ObjectDatas[i].ID == ID)
  7. {
  8. if (ObjectDatas[i].pos.x != pos.x || ObjectDatas[i].pos.y != pos.y || ObjectDatas[i].pos.z != pos.z)
  9. {
  10. ObjectDatas[i].pos = pos;
  11. }
  12.  
  13. if (ObjectDatas[i].rotation.x != rotation.x || ObjectDatas[i].rotation.y != rotation.y || ObjectDatas[i].rotation.z != rotation.z)
  14. {
  15. ObjectDatas[i].rotation = rotation;
  16. }
  17. if (ObjectDatas[i].scale.x != scale.x || ObjectDatas[i].scale.y != scale.y || ObjectDatas[i].scale.z != scale.z)
  18. {
  19. ObjectDatas[i].scale = scale;
  20. }
  21. }
  22. }
  23. }
  24. void ModelClass::UpdateObjectResources(const std::string ID, char* ObjectDataLocation, LPCWSTR texturelocation)
  25. {
  26. ID3D11ShaderResourceView *m_texture;
  27. for (int i = 0; i < ObjectDatas.size(); i++)
  28. {
  29.  
  30. if (ObjectDatas[i].ID == ID)
  31. {
  32.  
  33. if (ObjectDatas[i].ObjectDataLocation != ObjectDataLocation)
  34. {
  35. ObjectDatas[i].ObjectDataLocation = ObjectDataLocation;
  36. }
  37. if (ObjectDatas[i].texturelocation != texturelocation)
  38. {
  39. D3DX11CreateShaderResourceViewFromFile(m_graphicsClass->m_D3D->GetDevice(), texturelocation, NULL, NULL, &m_texture, NULL);
  40. ObjectDatas[ArrayCount].texture = m_texture;
  41.  
  42. m_texture = NULL;
  43. }
  44.  
  45. }
  46. }
  47. }
  48. void ModelClass::UpdateObjectSettings(const std::string ID, bool Render, int PixelShaderNumber, int VertexShaderNumber, bool InsideTexturing)
  49. {
  50. for (int i = 0; i < ObjectDatas.size(); i++)
  51. {
  52.  
  53. if (ObjectDatas[i].ID == ID)
  54. {
  55. if (ObjectDatas[i].Render != Render)
  56. {
  57. ObjectDatas[i].Render = Render;
  58. }
  59. if (ObjectDatas[i].InsideTexturing != InsideTexturing)
  60. {
  61. ObjectDatas[i].InsideTexturing = InsideTexturing;
  62. }
  63. if (ObjectDatas[i].PixelShaderNumber != PixelShaderNumber)
  64. {
  65. ObjectDatas[i].PixelShaderNumber = PixelShaderNumber;
  66. }
  67. if (ObjectDatas[i].VertexShaderNumber != VertexShaderNumber)
  68. {
  69. ObjectDatas[i].VertexShaderNumber = VertexShaderNumber;
  70. }
  71. }
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement