FactoryCraftModel.cpp 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "FactoryCraftModel.h"
  2. #include <Shader.h>
  3. #include "CustomDX12API.h"
  4. #include "Globals.h"
  5. #include "World.h"
  6. FactoryCraftModel::FactoryCraftModel()
  7. : Model3D()
  8. {
  9. memset(lightBufferData, -1, 6);
  10. lightBuffer = uiFactory.initParam.bildschirm->zGraphicsApi()
  11. ->createStructuredBuffer(1);
  12. lightBuffer->setLength(6);
  13. lightBuffer->setData(lightBufferData, 1);
  14. destroyedState = 0;
  15. }
  16. FactoryCraftModel::~FactoryCraftModel()
  17. {
  18. if (lightBuffer) lightBuffer->release();
  19. }
  20. struct TexturEffect
  21. {
  22. bool enabled;
  23. float percentage;
  24. };
  25. void FactoryCraftModel::setLightBuffer(unsigned char light[6])
  26. {
  27. memcpy(lightBufferData, light, 6);
  28. lightBuffer->setChanged();
  29. }
  30. Framework::DXBuffer* FactoryCraftModel::zLightBuffer() const
  31. {
  32. return lightBuffer;
  33. }
  34. void FactoryCraftModel::setDestroyedState(float percentage)
  35. {
  36. destroyedState = percentage;
  37. }
  38. float FactoryCraftModel::getEffectPercentage()
  39. {
  40. return destroyedState;
  41. }