MaterialPreviewView.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #pragma once
  21. #include "MaterialView.h"
  22. #include "../radiant/GLWidget.h"
  23. class idGLDrawableView : public idGLDrawable {
  24. public:
  25. idGLDrawableView();
  26. ~idGLDrawableView();
  27. virtual void setMedia(const char *name);
  28. virtual void draw(int x, int y, int w, int h);
  29. virtual void buttonUp(int button){}
  30. virtual void buttonDown(int _button, float x, float y);
  31. virtual void mouseMove(float x, float y);
  32. virtual void Update() {};
  33. void UpdateCamera( renderView_t *refdef );
  34. void UpdateModel( void );
  35. void UpdateLights( void );
  36. void addLight( void );
  37. void deleteLight( const int lightId );
  38. void drawLights( renderView_t *refdef );
  39. void InitWorld();
  40. void ResetView( void );
  41. void setLightShader( const int lightId, const idStr shaderName );
  42. void setLightColor( const int lightId, const idVec3 &value );
  43. void setLightRadius( const int lightId, const float radius );
  44. void setLightAllowMove( const int lightId, const bool move );
  45. void setObject( int Id );
  46. void setCustomModel( const idStr modelName );
  47. void setShowLights( bool _showLights );
  48. void setLocalParm( int parmNum, float value );
  49. void setGlobalParm( int parmNum, float value );
  50. protected:
  51. idRenderWorld *world;
  52. idRenderModel *worldModel;
  53. const idMaterial *material;
  54. bool showLights;
  55. idVec3 viewOrigin;
  56. idAngles viewRotation;
  57. float viewDistance;
  58. renderEntity_t worldEntity;
  59. qhandle_t modelDefHandle;
  60. int objectId;
  61. idStr customModelName;
  62. float globalParms[MAX_GLOBAL_SHADER_PARMS];
  63. typedef struct {
  64. renderLight_t renderLight;
  65. qhandle_t lightDefHandle;
  66. idVec3 origin;
  67. const idMaterial *shader;
  68. float radius;
  69. idVec3 color;
  70. bool allowMove;
  71. } lightInfo_t;
  72. idList<lightInfo_t> viewLights;
  73. };
  74. // ==================================================================
  75. // ==================================================================
  76. class MaterialPreviewView : public CView, public MaterialView
  77. {
  78. DECLARE_DYNCREATE(MaterialPreviewView)
  79. protected:
  80. MaterialPreviewView();
  81. virtual ~MaterialPreviewView();
  82. public:
  83. virtual void OnDraw(CDC* pDC); // overridden to draw this view
  84. void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial);
  85. void OnModelChange( int modelId );
  86. void OnCustomModelChange( idStr modelName );
  87. void OnShowLightsChange( bool showLights );
  88. void OnLocalParmChange( int parmNum, float value );
  89. void OnGlobalParmChange( int parmNum, float value );
  90. void OnLightShaderChange( int lightId, idStr shaderName );
  91. void OnLightRadiusChange( int lightId, float radius );
  92. void OnLightColorChange( int lightId, idVec3 &color );
  93. void OnLightAllowMoveChange( int lightId, bool move );
  94. void OnAddLight( void );
  95. void OnDeleteLight( int lightId );
  96. #ifdef _DEBUG
  97. virtual void AssertValid() const;
  98. virtual void Dump(CDumpContext& dc) const;
  99. #endif
  100. protected:
  101. idGLWidget renderWindow;
  102. idGLDrawableView renderedView;
  103. idStr currentMaterial;
  104. DECLARE_MESSAGE_MAP()
  105. public:
  106. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  107. afx_msg void OnSize(UINT nType, int cx, int cy);
  108. };