@EditMaterial.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class EditMaterial
  4. {
  5. bool flip_normal_y, cull, high_quality_ios;
  6. byte downsize_tex_mobile;
  7. MATERIAL_TECHNIQUE tech;
  8. Vec4 color;
  9. Vec ambient;
  10. flt specular, sss, glow, rough, bump,
  11. tex_scale, det_scale, det_power, reflection;
  12. UID base_0_tex, base_1_tex, detail_tex, macro_tex, reflection_tex, light_tex;
  13. Str color_map, alpha_map, bump_map, normal_map, specular_map, glow_map,
  14. detail_color, detail_bump, detail_normal,
  15. macro_map,
  16. reflection_map,
  17. light_map;
  18. TimeStamp flip_normal_y_time, high_quality_ios_time,
  19. color_map_time, alpha_map_time, bump_map_time, normal_map_time, specular_map_time, glow_map_time,
  20. detail_map_time, macro_map_time, reflection_map_time, light_map_time,
  21. cull_time, tech_time, downsize_tex_mobile_time,
  22. color_time, ambient_time, spec_time, sss_time, rough_bump_time, glow_time, tex_scale_time, detail_time, reflection_time;
  23. // get
  24. bool hasBumpMap ()C;
  25. bool hasNormalMap ()C;
  26. bool hasDetailMap ()C;
  27. bool hasBase1Tex ()C;
  28. uint baseTex ()C;
  29. bool usesTexAlpha ()C;
  30. bool usesTexBump ()C; // always keep bump map because it can be used for multi-material per-pixel blending
  31. bool usesTexNormal()C;
  32. bool usesTexGlow ()C;
  33. bool usesTexDetail()C;
  34. bool wantTanBin ()C;
  35. bool equal(C EditMaterial &src)C;
  36. bool newer(C EditMaterial &src)C;
  37. // operations
  38. void reset();
  39. void resetAlpha();
  40. void separateNormalMap(C TimeStamp &time=TimeStamp().getUTC());
  41. void separateBaseTexs(C Project &proj, C TimeStamp &time=TimeStamp().getUTC());
  42. void cleanupMaps();
  43. void newData();
  44. void create(C Material &src, C TimeStamp &time=TimeStamp().getUTC());
  45. void copyTo(Material &dest, C Project &proj)C;
  46. void copyTo(Edit::Material &dest)C;
  47. enum
  48. {
  49. CHANGED_PARAM=1<<0,
  50. CHANGED_FNY =1<<1,
  51. CHANGED_BASE =1<<2,
  52. CHANGED_REFL =1<<3,
  53. CHANGED_DET =1<<4,
  54. CHANGED_MACRO=1<<5,
  55. CHANGED_LIGHT=1<<6,
  56. };
  57. uint sync(C Edit::Material &src);
  58. uint sync(C EditMaterial &src);
  59. uint undo(C EditMaterial &src);
  60. // io
  61. bool save(File &f)C;
  62. bool load(File &f);
  63. bool load(C Str &name);
  64. public:
  65. EditMaterial();
  66. };
  67. /******************************************************************************/
  68. /******************************************************************************/
  69. /******************************************************************************/