BsBuiltinEditorResources.cpp 82 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845
  1. #include "BsBuiltinEditorResources.h"
  2. #include "BsGUIElementStyle.h"
  3. #include "BsGUILabel.h"
  4. #include "BsGUIButton.h"
  5. #include "BsGUIInputBox.h"
  6. #include "BsGUIToggle.h"
  7. #include "BsGUIColor.h"
  8. #include "BsTextSprite.h"
  9. #include "BsSpriteTexture.h"
  10. #include "BsGUITreeViewEditBox.h"
  11. #include "BsGUIIntField.h"
  12. #include "BsGUIFloatField.h"
  13. #include "BsGUIColorField.h"
  14. #include "BsGUITextField.h"
  15. #include "BsGUIToggleField.h"
  16. #include "BsGUIVector2Field.h"
  17. #include "BsGUIVector3Field.h"
  18. #include "BsGUIVector4Field.h"
  19. #include "BsGUIComponentFoldout.h"
  20. #include "BsGUIFoldout.h"
  21. #include "BsGUIProgressBar.h"
  22. #include "BsGUISlider.h"
  23. #include "BsGUIDropDownContent.h"
  24. #include "BsFont.h"
  25. #include "BsFontImportOptions.h"
  26. #include "BsImporter.h"
  27. #include "BsGpuProgram.h"
  28. #include "BsShader.h"
  29. #include "BsTechnique.h"
  30. #include "BsPass.h"
  31. #include "BsMaterial.h"
  32. #include "BsBlendState.h"
  33. #include "BsDepthStencilState.h"
  34. #include "BsRasterizerState.h"
  35. #include "BsGpuProgramImportOptions.h"
  36. #include "BsResources.h"
  37. #include "BsRTTIType.h"
  38. #include "BsFileSystem.h"
  39. namespace BansheeEngine
  40. {
  41. const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
  42. const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
  43. const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
  44. const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  45. const Path BuiltinEditorResources::DefaultSkinFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Skin\\";
  46. const Path BuiltinEditorResources::DefaultShaderFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Shaders\\";
  47. const Path BuiltinEditorResources::DefaultSkinFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
  48. const Path BuiltinEditorResources::DefaultShaderFolder = L"..\\..\\..\\..\\Data\\Editor\\Shaders\\";
  49. const WString BuiltinEditorResources::HLSL11ShaderSubFolder = L"HLSL11/";
  50. const WString BuiltinEditorResources::HLSL9ShaderSubFolder = L"HLSL9/";
  51. const WString BuiltinEditorResources::GLSLShaderSubFolder = L"GLSL/";
  52. const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
  53. const UINT32 BuiltinEditorResources::DefaultFontSize = 10;
  54. const WString BuiltinEditorResources::WindowBackgroundTexture = L"WindowBgTile.psd";
  55. const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.psd";
  56. const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.psd";
  57. const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.psd";
  58. const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.psd";
  59. const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.psd";
  60. const WString BuiltinEditorResources::ToggleActiveTex = L"ToggleActive.psd";
  61. const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  62. const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleOnHover.psd";
  63. const WString BuiltinEditorResources::ToggleActiveOnTex = L"ToggleOnActive.psd";
  64. const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
  65. const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectFieldDropOnNormal.psd";
  66. const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
  67. const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
  68. const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
  69. const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
  70. const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
  71. const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
  72. const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
  73. const WString BuiltinEditorResources::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
  74. const WString BuiltinEditorResources::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
  75. const WString BuiltinEditorResources::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
  76. const WString BuiltinEditorResources::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
  77. const WString BuiltinEditorResources::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
  78. const WString BuiltinEditorResources::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
  79. const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.psd";
  80. const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.psd";
  81. const WString BuiltinEditorResources::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  82. const WString BuiltinEditorResources::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  83. const WString BuiltinEditorResources::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  84. const WString BuiltinEditorResources::WindowMinButtonNormal = L"WindowMinBtnNormal.psd";
  85. const WString BuiltinEditorResources::WindowMinButtonHover = L"WindowMinBtnHover.psd";
  86. const WString BuiltinEditorResources::WindowMaxButtonNormal = L"WindowMaxBtnNormal.psd";
  87. const WString BuiltinEditorResources::WindowMaxButtonHover = L"WindowMaxBtnHover.psd";
  88. const WString BuiltinEditorResources::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  89. const WString BuiltinEditorResources::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  90. const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.psd";
  91. const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.psd";
  92. const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
  93. const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  94. const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  95. const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  96. const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  97. const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  98. const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  99. const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  100. const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  101. const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  102. const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  103. const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  104. const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  105. const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  106. const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  107. const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  108. const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  109. const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  110. const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  111. const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
  112. const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownHover.psd";
  113. const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  114. const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  115. const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  116. const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  117. const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  118. const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  119. const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  120. const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  121. const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  122. const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
  123. const WString BuiltinEditorResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  124. const WString BuiltinEditorResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  125. const WString BuiltinEditorResources::ScrollBarBgTex = L"ScrollBarBg.psd";
  126. const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBg.psd";
  127. const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  128. const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  129. const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  130. const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderBtn.psd";
  131. const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  132. const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  133. const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  134. const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  135. const WString BuiltinEditorResources::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  136. const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
  137. const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  138. const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  139. const WString BuiltinEditorResources::ColorPickerSliderHorzHandleTex = L"ColorPickerSliderHorzHandle.psd";
  140. const WString BuiltinEditorResources::ColorPickerSliderVertHandleTex = L"ColorPickerSliderVertHandle.psd";
  141. const WString BuiltinEditorResources::ColorPickerSlider2DHandleTex = L"ColorPicker2DHandle.psd";
  142. const WString BuiltinEditorResources::ProgressBarFillTex = L"ProgressBarFill.psd";
  143. const WString BuiltinEditorResources::ProgressBarBgTex = L"ProgressBarBg.psd";
  144. /************************************************************************/
  145. /* SHADERS */
  146. /************************************************************************/
  147. struct GpuProgramImportData
  148. {
  149. WString filename;
  150. String entryPoint;
  151. GpuProgramType type;
  152. GpuProgramProfile profile;
  153. String language;
  154. WString folder;
  155. };
  156. const WString BuiltinEditorResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
  157. const WString BuiltinEditorResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
  158. const WString BuiltinEditorResources::SceneGridVSFile = L"sceneGridVS.gpuprog";
  159. const WString BuiltinEditorResources::SceneGridPSFile = L"sceneGridPS.gpuprog";
  160. const WString BuiltinEditorResources::PickingVSFile = L"pickingVS.gpuprog";
  161. const WString BuiltinEditorResources::PickingPSFile = L"pickingPS.gpuprog";
  162. const WString BuiltinEditorResources::PickingAlphaVSFile = L"pickingAlphaVS.gpuprog";
  163. const WString BuiltinEditorResources::PickingAlphaPSFile = L"pickingAlphaPS.gpuprog";
  164. const WString BuiltinEditorResources::ShaderWireGizmoVSFile = L"wireGizmoVS.gpuprog";
  165. const WString BuiltinEditorResources::ShaderWireGizmoPSFile = L"wireGizmoPS.gpuprog";
  166. const WString BuiltinEditorResources::ShaderSolidGizmoVSFile = L"solidGizmoVS.gpuprog";
  167. const WString BuiltinEditorResources::ShaderSolidGizmoPSFile = L"solidGizmoPS.gpuprog";
  168. const WString BuiltinEditorResources::ShaderIconGizmo0VSFile = L"iconGizmo0VS.gpuprog";
  169. const WString BuiltinEditorResources::ShaderIconGizmo0PSFile = L"iconGizmo0PS.gpuprog";
  170. const WString BuiltinEditorResources::ShaderIconGizmo1VSFile = L"iconGizmo1VS.gpuprog";
  171. const WString BuiltinEditorResources::ShaderIconGizmo1PSFile = L"iconGizmo1PS.gpuprog";
  172. const WString BuiltinEditorResources::GizmoPickingVSFile = L"pickingGizmoVS.gpuprog";
  173. const WString BuiltinEditorResources::GizmoPickingPSFile = L"pickingGizmoPS.gpuprog";
  174. const WString BuiltinEditorResources::GizmoPickingAlphaVSFile = L"pickingGizmoAlphaVS.gpuprog";
  175. const WString BuiltinEditorResources::GizmoPickingAlphaPSFile = L"pickingGizmoAlphaPS.gpuprog";
  176. const WString BuiltinEditorResources::SelectionVSFile = L"selectionVS.gpuprog";
  177. const WString BuiltinEditorResources::SelectionPSFile = L"selectionPS.gpuprog";
  178. BuiltinEditorResources::BuiltinEditorResources(RenderSystemPlugin activeRSPlugin)
  179. :mRenderSystemPlugin(activeRSPlugin)
  180. {
  181. switch (activeRSPlugin)
  182. {
  183. case RenderSystemPlugin::DX11:
  184. mActiveShaderSubFolder = HLSL11ShaderSubFolder;
  185. mActiveRenderSystem = RenderAPIDX11;
  186. break;
  187. case RenderSystemPlugin::DX9:
  188. mActiveShaderSubFolder = HLSL9ShaderSubFolder;
  189. mActiveRenderSystem = RenderAPIDX9;
  190. break;
  191. case RenderSystemPlugin::OpenGL:
  192. mActiveShaderSubFolder = GLSLShaderSubFolder;
  193. mActiveRenderSystem = RenderAPIOpenGL;
  194. break;
  195. }
  196. preprocess();
  197. initDockDropOverlayShader();
  198. initSceneGridShader();
  199. initPickingShader(CULL_NONE);
  200. initPickingShader(CULL_CLOCKWISE);
  201. initPickingShader(CULL_COUNTERCLOCKWISE);
  202. initPickingAlphaShader(CULL_NONE);
  203. initPickingAlphaShader(CULL_CLOCKWISE);
  204. initPickingAlphaShader(CULL_COUNTERCLOCKWISE);
  205. initWireGizmoShader();
  206. initSolidGizmoShader();
  207. initIconGizmoShader();
  208. initGizmoPickingShader();
  209. initGizmoPickingAlphaShader();
  210. initWireHandleShader();
  211. initSolidHandleShader();
  212. initSelectionShader();
  213. Path fontPath = FileSystem::getWorkingDirectoryPath();
  214. fontPath.append(DefaultSkinFolder);
  215. fontPath.append(DefaultFontFilename + L".asset");
  216. HFont font = Resources::instance().load<Font>(fontPath);
  217. // Label
  218. GUIElementStyle labelStyle;
  219. labelStyle.font = font;
  220. labelStyle.fontSize = DefaultFontSize;
  221. labelStyle.fixedWidth = false;
  222. labelStyle.fixedHeight = true;
  223. labelStyle.height = 11;
  224. labelStyle.minWidth = 10;
  225. mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
  226. // Window frame
  227. GUIElementStyle windowFrameStyle;
  228. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  229. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  230. windowFrameStyle.border.left = 1;
  231. windowFrameStyle.border.right = 1;
  232. windowFrameStyle.border.top = 1;
  233. windowFrameStyle.border.bottom = 1;
  234. mSkin.setStyle("WindowFrame", windowFrameStyle);
  235. // Button
  236. GUIElementStyle buttonStyle;
  237. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  238. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  239. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  240. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  241. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  242. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  243. buttonStyle.border.left = 6;
  244. buttonStyle.border.right = 6;
  245. buttonStyle.border.top = 6;
  246. buttonStyle.border.bottom = 6;
  247. buttonStyle.contentOffset.left = 3;
  248. buttonStyle.contentOffset.right = 3;
  249. buttonStyle.fixedHeight = true;
  250. buttonStyle.height = 15;
  251. buttonStyle.minWidth = 50;
  252. buttonStyle.font = font;
  253. buttonStyle.fontSize = DefaultFontSize;
  254. buttonStyle.textHorzAlign = THA_Center;
  255. buttonStyle.textVertAlign = TVA_Center;
  256. mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
  257. // Toggle
  258. GUIElementStyle toggleStyle;
  259. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  260. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  261. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  262. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  263. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  264. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  265. toggleStyle.fixedHeight = true;
  266. toggleStyle.fixedWidth = true;
  267. toggleStyle.height = 15;
  268. toggleStyle.width = 15;
  269. mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  270. // Color
  271. GUIElementStyle colorStyle;
  272. colorStyle.margins.left = 2;
  273. colorStyle.margins.right = 2;
  274. colorStyle.margins.top = 2;
  275. colorStyle.margins.bottom = 2;
  276. colorStyle.fixedHeight = true;
  277. colorStyle.height = 10;
  278. colorStyle.minWidth = 10;
  279. mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
  280. // Window background texture
  281. GUIElementStyle windowBgStyle;
  282. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  283. mSkin.setStyle("WindowBackground", windowBgStyle);
  284. // Window title bar background
  285. GUIElementStyle titleBarBgStyle;
  286. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  287. titleBarBgStyle.fixedHeight = true;
  288. titleBarBgStyle.height = 13;
  289. mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
  290. // Tabbed title bar tab button
  291. GUIElementStyle tabbedBarButton;
  292. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  293. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  294. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  295. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  296. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  297. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  298. tabbedBarButton.fixedHeight = true;
  299. tabbedBarButton.height = 13;
  300. tabbedBarButton.minWidth = 10;
  301. tabbedBarButton.maxWidth = 110;
  302. tabbedBarButton.font = font;
  303. tabbedBarButton.fontSize = DefaultFontSize;
  304. tabbedBarButton.textHorzAlign = THA_Center;
  305. tabbedBarButton.textVertAlign = TVA_Center;
  306. mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
  307. // Tabbed title bar drag/drop button
  308. GUIElementStyle tabbedBarDropButton;
  309. tabbedBarDropButton.fixedHeight = true;
  310. tabbedBarDropButton.fixedWidth = true;
  311. tabbedBarDropButton.height = 13;
  312. tabbedBarDropButton.width = 6;
  313. mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
  314. // Window minimize button
  315. GUIElementStyle winMinButtonStyle;
  316. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  317. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  318. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  319. winMinButtonStyle.fixedHeight = true;
  320. winMinButtonStyle.fixedWidth = true;
  321. winMinButtonStyle.height = 7;
  322. winMinButtonStyle.width = 8;
  323. mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
  324. // Window maximize button
  325. GUIElementStyle winMaxButtonStyle;
  326. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  327. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  328. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  329. winMaxButtonStyle.fixedHeight = true;
  330. winMaxButtonStyle.fixedWidth = true;
  331. winMaxButtonStyle.height = 8;
  332. winMaxButtonStyle.width = 8;
  333. mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
  334. // Window close button
  335. GUIElementStyle winCloseButtonStyle;
  336. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  337. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  338. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  339. winCloseButtonStyle.fixedHeight = true;
  340. winCloseButtonStyle.fixedWidth = true;
  341. winCloseButtonStyle.height = 7;
  342. winCloseButtonStyle.width = 8;
  343. mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
  344. // Input box
  345. GUIElementStyle inputBoxStyle;
  346. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  347. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  348. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  349. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  350. inputBoxStyle.border.left = 1;
  351. inputBoxStyle.border.right = 1;
  352. inputBoxStyle.border.top = 1;
  353. inputBoxStyle.border.bottom = 1;
  354. inputBoxStyle.contentOffset.left = 3;
  355. inputBoxStyle.contentOffset.right = 3;
  356. inputBoxStyle.contentOffset.top = 2;
  357. inputBoxStyle.contentOffset.bottom = 2;
  358. inputBoxStyle.fixedHeight = true;
  359. inputBoxStyle.height = 15;
  360. inputBoxStyle.minWidth = 10;
  361. inputBoxStyle.font = font;
  362. inputBoxStyle.fontSize = DefaultFontSize;
  363. inputBoxStyle.textHorzAlign = THA_Left;
  364. inputBoxStyle.textVertAlign = TVA_Top;
  365. mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  366. /************************************************************************/
  367. /* SCROLL BAR */
  368. /************************************************************************/
  369. // Up button
  370. GUIElementStyle scrollUpBtnStyle;
  371. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  372. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  373. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  374. scrollUpBtnStyle.fixedHeight = true;
  375. scrollUpBtnStyle.fixedWidth = true;
  376. scrollUpBtnStyle.height = 4;
  377. scrollUpBtnStyle.width = 8;
  378. mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
  379. // Down button
  380. GUIElementStyle scrollDownBtnStyle;
  381. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  382. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  383. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  384. scrollDownBtnStyle.fixedHeight = true;
  385. scrollDownBtnStyle.fixedWidth = true;
  386. scrollDownBtnStyle.height = 4;
  387. scrollDownBtnStyle.width = 8;
  388. mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
  389. // Left button
  390. GUIElementStyle scrollLeftBtnStyle;
  391. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  392. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  393. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  394. scrollLeftBtnStyle.fixedHeight = true;
  395. scrollLeftBtnStyle.fixedWidth = true;
  396. scrollLeftBtnStyle.height = 8;
  397. scrollLeftBtnStyle.width = 4;
  398. mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  399. // Right button
  400. GUIElementStyle scrollRightBtnStyle;
  401. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  402. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  403. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  404. scrollRightBtnStyle.fixedHeight = true;
  405. scrollRightBtnStyle.fixedWidth = true;
  406. scrollRightBtnStyle.height = 8;
  407. scrollRightBtnStyle.width = 4;
  408. mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
  409. // Horizontal handle
  410. GUIElementStyle scrollBarHorzBtnStyle;
  411. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  412. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  413. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  414. scrollBarHorzBtnStyle.fixedHeight = true;
  415. scrollBarHorzBtnStyle.fixedWidth = true;
  416. scrollBarHorzBtnStyle.height = 6;
  417. scrollBarHorzBtnStyle.width = 4;
  418. mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  419. // Vertical handle
  420. GUIElementStyle scrollBarVertBtnStyle;
  421. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  422. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  423. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  424. scrollBarVertBtnStyle.fixedHeight = true;
  425. scrollBarVertBtnStyle.fixedWidth = true;
  426. scrollBarVertBtnStyle.height = 4;
  427. scrollBarVertBtnStyle.width = 6;
  428. mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  429. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  430. // Vertical scroll bar
  431. GUIElementStyle vertScrollBarStyle;
  432. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  433. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  434. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  435. vertScrollBarStyle.fixedHeight = false;
  436. vertScrollBarStyle.fixedWidth = true;
  437. vertScrollBarStyle.minHeight = 16;
  438. vertScrollBarStyle.width = 8;
  439. mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
  440. // Horizontal scroll bar
  441. GUIElementStyle horzScrollBarStyle;
  442. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  443. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  444. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  445. horzScrollBarStyle.fixedHeight = true;
  446. horzScrollBarStyle.fixedWidth = false;
  447. horzScrollBarStyle.minWidth = 16;
  448. horzScrollBarStyle.height = 8;
  449. mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
  450. /************************************************************************/
  451. /* DROP DOWN BOX */
  452. /************************************************************************/
  453. // ListBox button
  454. GUIElementStyle dropDownListStyle;
  455. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  456. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  457. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  458. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  459. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  460. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  461. dropDownListStyle.fixedHeight = true;
  462. dropDownListStyle.fixedWidth = false;
  463. dropDownListStyle.height = 13;
  464. dropDownListStyle.width = 30;
  465. dropDownListStyle.contentOffset.left = 3;
  466. dropDownListStyle.contentOffset.right = 11;
  467. dropDownListStyle.contentOffset.top = 1;
  468. dropDownListStyle.contentOffset.bottom = 1;
  469. dropDownListStyle.border.left = 1;
  470. dropDownListStyle.border.right = 10;
  471. dropDownListStyle.border.top = 1;
  472. dropDownListStyle.border.bottom = 1;
  473. dropDownListStyle.font = font;
  474. dropDownListStyle.fontSize = DefaultFontSize;
  475. dropDownListStyle.textHorzAlign = THA_Left;
  476. dropDownListStyle.textVertAlign = TVA_Top;
  477. mSkin.setStyle("ListBox", dropDownListStyle);
  478. // DropDown scroll up button arrow
  479. HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  480. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  481. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  482. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  483. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  484. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  485. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  486. dropDownScrollUpBtnArrowStyle.height = 7;
  487. dropDownScrollUpBtnArrowStyle.width = 30;
  488. dropDownScrollUpBtnArrowStyle.border.left = 1;
  489. dropDownScrollUpBtnArrowStyle.border.right = 1;
  490. dropDownScrollUpBtnArrowStyle.border.top = 1;
  491. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  492. mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  493. mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  494. mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  495. // DropDown scroll up button
  496. GUIElementStyle dropDownScrollUpBtnStyle;
  497. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  498. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  499. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  500. dropDownScrollUpBtnStyle.fixedHeight = true;
  501. dropDownScrollUpBtnStyle.fixedWidth = false;
  502. dropDownScrollUpBtnStyle.height = 7;
  503. dropDownScrollUpBtnStyle.width = 30;
  504. dropDownScrollUpBtnStyle.border.left = 1;
  505. dropDownScrollUpBtnStyle.border.right = 1;
  506. dropDownScrollUpBtnStyle.border.top = 1;
  507. dropDownScrollUpBtnStyle.border.bottom = 1;
  508. mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  509. mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  510. mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  511. // DropDown scroll down button arrow
  512. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  513. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  514. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  515. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  516. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  517. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  518. dropDownScrollDownBtnArrowStyle.height = 7;
  519. dropDownScrollDownBtnArrowStyle.width = 30;
  520. dropDownScrollDownBtnArrowStyle.border.left = 1;
  521. dropDownScrollDownBtnArrowStyle.border.right = 1;
  522. dropDownScrollDownBtnArrowStyle.border.top = 1;
  523. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  524. mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  525. mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  526. mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  527. // DropDown scroll down button
  528. GUIElementStyle dropDownScrollDownBtnStyle;
  529. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  530. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  531. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  532. dropDownScrollDownBtnStyle.fixedHeight = true;
  533. dropDownScrollDownBtnStyle.fixedWidth = false;
  534. dropDownScrollDownBtnStyle.height = 7;
  535. dropDownScrollDownBtnStyle.width = 30;
  536. dropDownScrollDownBtnStyle.border.left = 1;
  537. dropDownScrollDownBtnStyle.border.right = 1;
  538. dropDownScrollDownBtnStyle.border.top = 1;
  539. dropDownScrollDownBtnStyle.border.bottom = 1;
  540. mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  541. mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  542. mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  543. // DropDown entry button
  544. GUIElementStyle dropDownEntryBtnStyle;
  545. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  546. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  547. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  548. dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  549. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  550. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  551. dropDownEntryBtnStyle.fixedHeight = true;
  552. dropDownEntryBtnStyle.fixedWidth = false;
  553. dropDownEntryBtnStyle.height = 14;
  554. dropDownEntryBtnStyle.width = 30;
  555. dropDownEntryBtnStyle.border.left = 1;
  556. dropDownEntryBtnStyle.border.right = 1;
  557. dropDownEntryBtnStyle.border.top = 1;
  558. dropDownEntryBtnStyle.border.bottom = 1;
  559. dropDownEntryBtnStyle.font = font;
  560. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  561. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  562. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  563. mSkin.setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  564. // DropDown entry button with expand
  565. GUIElementStyle dropDownEntryExpBtnStyle;
  566. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  567. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  568. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  569. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  570. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  571. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  572. dropDownEntryExpBtnStyle.fixedHeight = true;
  573. dropDownEntryExpBtnStyle.fixedWidth = false;
  574. dropDownEntryExpBtnStyle.height = 14;
  575. dropDownEntryExpBtnStyle.width = 30;
  576. dropDownEntryExpBtnStyle.border.left = 1;
  577. dropDownEntryExpBtnStyle.border.right = 6;
  578. dropDownEntryExpBtnStyle.border.top = 1;
  579. dropDownEntryExpBtnStyle.border.bottom = 1;
  580. dropDownEntryExpBtnStyle.font = font;
  581. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  582. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  583. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  584. mSkin.setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  585. // Drop down separator
  586. GUIElementStyle dropDownSeparatorStyle;
  587. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  588. dropDownSeparatorStyle.fixedHeight = true;
  589. dropDownSeparatorStyle.fixedWidth = false;
  590. dropDownSeparatorStyle.height = 3;
  591. dropDownSeparatorStyle.width = 30;
  592. dropDownSeparatorStyle.border.left = 1;
  593. dropDownSeparatorStyle.border.right = 1;
  594. dropDownSeparatorStyle.border.top = 1;
  595. dropDownSeparatorStyle.border.bottom = 1;
  596. mSkin.setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  597. // Drop down content
  598. GUIElementStyle dropDownContentStyle;
  599. dropDownContentStyle.minWidth = 50;
  600. dropDownContentStyle.minHeight = 20;
  601. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  602. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  603. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  604. mSkin.setStyle("ListBoxContent", dropDownContentStyle);
  605. mSkin.setStyle("MenuBarContent", dropDownContentStyle);
  606. mSkin.setStyle("ContextMenuContent", dropDownContentStyle);
  607. // DropDown box frame
  608. GUIElementStyle dropDownBoxStyle;
  609. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  610. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  611. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  612. dropDownBoxStyle.fixedHeight = false;
  613. dropDownBoxStyle.fixedWidth = false;
  614. dropDownBoxStyle.border.left = 1;
  615. dropDownBoxStyle.border.right = 1;
  616. dropDownBoxStyle.border.top = 1;
  617. dropDownBoxStyle.border.bottom = 1;
  618. dropDownBoxStyle.margins.left = 1;
  619. dropDownBoxStyle.margins.right = 1;
  620. dropDownBoxStyle.margins.top = 1;
  621. dropDownBoxStyle.margins.bottom = 1;
  622. mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
  623. mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
  624. mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
  625. /************************************************************************/
  626. /* MENU BAR */
  627. /************************************************************************/
  628. // MenuBar background
  629. GUIElementStyle menuBarBgStyle;
  630. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  631. menuBarBgStyle.fixedHeight = false;
  632. menuBarBgStyle.fixedWidth = false;
  633. menuBarBgStyle.height = 4;
  634. menuBarBgStyle.width = 4;
  635. mSkin.setStyle("MenuBarBg", menuBarBgStyle);
  636. // MenuBar Banshee logo
  637. GUIElementStyle menuBarBansheeLogoStyle;
  638. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  639. menuBarBansheeLogoStyle.fixedHeight = true;
  640. menuBarBansheeLogoStyle.fixedWidth = true;
  641. menuBarBansheeLogoStyle.height = 7;
  642. menuBarBansheeLogoStyle.width = 51;
  643. mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  644. // MenuBar button
  645. GUIElementStyle menuBarBtnStyle;
  646. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  647. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  648. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  649. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  650. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  651. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  652. menuBarBtnStyle.fixedHeight = true;
  653. menuBarBtnStyle.fixedWidth = false;
  654. menuBarBtnStyle.height = 15;
  655. menuBarBtnStyle.width = 4;
  656. menuBarBtnStyle.margins.left = 2;
  657. menuBarBtnStyle.margins.right = 2;
  658. menuBarBtnStyle.margins.top = 2;
  659. menuBarBtnStyle.margins.bottom = 2;
  660. menuBarBtnStyle.font = font;
  661. menuBarBtnStyle.fontSize = DefaultFontSize;
  662. menuBarBtnStyle.textHorzAlign = THA_Left;
  663. menuBarBtnStyle.textVertAlign = TVA_Top;
  664. mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
  665. /************************************************************************/
  666. /* DOCK SLIDER */
  667. /************************************************************************/
  668. GUIElementStyle dockSliderBtnStyle;
  669. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  670. dockSliderBtnStyle.fixedHeight = false;
  671. dockSliderBtnStyle.fixedWidth = false;
  672. dockSliderBtnStyle.height = 2;
  673. dockSliderBtnStyle.width = 2;
  674. mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
  675. /************************************************************************/
  676. /* TREE VIEW */
  677. /************************************************************************/
  678. // Expand button
  679. GUIElementStyle treeViewExpandButtonStyle;
  680. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  681. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  682. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  683. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  684. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  685. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  686. treeViewExpandButtonStyle.margins.left = 4;
  687. treeViewExpandButtonStyle.margins.right = 4;
  688. treeViewExpandButtonStyle.margins.top = 5;
  689. treeViewExpandButtonStyle.margins.bottom = 4;
  690. treeViewExpandButtonStyle.fixedHeight = true;
  691. treeViewExpandButtonStyle.fixedWidth = true;
  692. treeViewExpandButtonStyle.height = 16;
  693. treeViewExpandButtonStyle.width = 16;
  694. mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  695. // Entry
  696. GUIElementStyle treeViewEntryStyle;
  697. treeViewEntryStyle.font = font;
  698. treeViewEntryStyle.fontSize = DefaultFontSize;
  699. treeViewEntryStyle.fixedWidth = false;
  700. treeViewEntryStyle.fixedHeight = true;
  701. treeViewEntryStyle.height = 16;
  702. treeViewEntryStyle.minWidth = 10;
  703. mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
  704. // Selection background
  705. GUIElementStyle treeViewSelBackgroundStyle;
  706. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  707. treeViewSelBackgroundStyle.fixedHeight = false;
  708. treeViewSelBackgroundStyle.fixedWidth = false;
  709. treeViewSelBackgroundStyle.height = 2;
  710. treeViewSelBackgroundStyle.width = 2;
  711. mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  712. // Edit box
  713. GUIElementStyle treeViewEditBox;
  714. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  715. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  716. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  717. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  718. treeViewEditBox.border.left = 1;
  719. treeViewEditBox.border.right = 1;
  720. treeViewEditBox.border.top = 1;
  721. treeViewEditBox.border.bottom = 1;
  722. treeViewEditBox.margins.left = 1;
  723. treeViewEditBox.margins.right = 1;
  724. treeViewEditBox.margins.top = 1;
  725. treeViewEditBox.margins.bottom = 1;
  726. treeViewEditBox.fixedHeight = true;
  727. treeViewEditBox.height = 13;
  728. treeViewEditBox.minWidth = 10;
  729. treeViewEditBox.font = font;
  730. treeViewEditBox.fontSize = DefaultFontSize;
  731. treeViewEditBox.textHorzAlign = THA_Left;
  732. treeViewEditBox.textVertAlign = TVA_Top;
  733. mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  734. // Element highlight
  735. GUIElementStyle treeViewElementHighlight;
  736. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  737. treeViewElementHighlight.border.left = 1;
  738. treeViewElementHighlight.border.right = 1;
  739. treeViewElementHighlight.border.top = 1;
  740. treeViewElementHighlight.border.bottom = 1;
  741. mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  742. // Element separator highlight
  743. GUIElementStyle treeViewElementSepHighlight;
  744. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  745. treeViewElementSepHighlight.border.left = 1;
  746. treeViewElementSepHighlight.border.right = 1;
  747. treeViewElementSepHighlight.border.top = 1;
  748. treeViewElementSepHighlight.border.bottom = 1;
  749. mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  750. /************************************************************************/
  751. /* OBJECT DROP FIELD */
  752. /************************************************************************/
  753. GUIElementStyle objectDropStyle;
  754. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  755. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  756. objectDropStyle.fixedHeight = true;
  757. objectDropStyle.height = 15;
  758. objectDropStyle.minWidth = 50;
  759. objectDropStyle.font = font;
  760. objectDropStyle.fontSize = DefaultFontSize;
  761. objectDropStyle.textHorzAlign = THA_Center;
  762. objectDropStyle.textVertAlign = TVA_Center;
  763. mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  764. GUIElementStyle objectClearBtnStyle;
  765. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  766. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  767. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  768. objectClearBtnStyle.fixedHeight = true;
  769. objectClearBtnStyle.fixedWidth = true;
  770. objectClearBtnStyle.height = 15;
  771. objectClearBtnStyle.width = 13;
  772. mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  773. GUIElementStyle editorObjectFieldStyle;
  774. editorObjectFieldStyle.fixedHeight = true;
  775. editorObjectFieldStyle.height = 15;
  776. editorObjectFieldStyle.minWidth = 30;
  777. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  778. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  779. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  780. mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  781. /************************************************************************/
  782. /* EDITOR FIELDS */
  783. /************************************************************************/
  784. GUIElementStyle editorFieldLabelStyle;
  785. editorFieldLabelStyle.font = font;
  786. editorFieldLabelStyle.fontSize = DefaultFontSize;
  787. editorFieldLabelStyle.fixedWidth = false;
  788. editorFieldLabelStyle.fixedHeight = true;
  789. editorFieldLabelStyle.height = 11;
  790. editorFieldLabelStyle.minWidth = 10;
  791. editorFieldLabelStyle.textHorzAlign = THA_Left;
  792. mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  793. GUIElementStyle editorIntFieldStyle;
  794. editorIntFieldStyle.fixedHeight = true;
  795. editorIntFieldStyle.height = 15;
  796. editorIntFieldStyle.minWidth = 30;
  797. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  798. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  799. mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  800. GUIElementStyle editorFloatFieldStyle;
  801. editorFloatFieldStyle.fixedHeight = true;
  802. editorFloatFieldStyle.height = 15;
  803. editorFloatFieldStyle.minWidth = 30;
  804. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  805. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  806. mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  807. GUIElementStyle editorTextFieldStyle;
  808. editorTextFieldStyle.fixedHeight = true;
  809. editorTextFieldStyle.height = 15;
  810. editorTextFieldStyle.minWidth = 30;
  811. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  812. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  813. mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  814. GUIElementStyle editorColorFieldStyle;
  815. editorColorFieldStyle.fixedHeight = true;
  816. editorColorFieldStyle.height = 15;
  817. editorColorFieldStyle.minWidth = 30;
  818. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  819. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  820. mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  821. GUIElementStyle editorToggleFieldStyle;
  822. editorToggleFieldStyle.fixedHeight = true;
  823. editorToggleFieldStyle.height = 15;
  824. editorToggleFieldStyle.minWidth = 30;
  825. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  826. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  827. mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  828. GUIElementStyle editorVector2FieldStyle;
  829. editorVector2FieldStyle.fixedHeight = true;
  830. editorVector2FieldStyle.height = 30;
  831. editorVector2FieldStyle.minWidth = 30;
  832. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  833. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  834. mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  835. GUIElementStyle editorVector3FieldStyle;
  836. editorVector3FieldStyle.fixedHeight = true;
  837. editorVector3FieldStyle.height = 30;
  838. editorVector3FieldStyle.minWidth = 30;
  839. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  840. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  841. mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  842. GUIElementStyle editorVector4FieldStyle;
  843. editorVector4FieldStyle.fixedHeight = true;
  844. editorVector4FieldStyle.height = 30;
  845. editorVector4FieldStyle.minWidth = 30;
  846. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  847. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  848. mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  849. /************************************************************************/
  850. /* COMPONENT FOLDOUT */
  851. /************************************************************************/
  852. GUIElementStyle cmpFoldoutBtnStyle;
  853. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  854. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  855. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  856. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  857. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  858. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  859. cmpFoldoutBtnStyle.fixedHeight = true;
  860. cmpFoldoutBtnStyle.fixedWidth = false;
  861. cmpFoldoutBtnStyle.height = 10;
  862. cmpFoldoutBtnStyle.minWidth = 10;
  863. cmpFoldoutBtnStyle.font = font;
  864. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  865. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  866. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  867. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  868. cmpFoldoutBtnStyle.border.left = 8;
  869. mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  870. GUIElementStyle cmpFoldoutStyle;
  871. cmpFoldoutStyle.fixedHeight = true;
  872. cmpFoldoutStyle.height = 12;
  873. cmpFoldoutStyle.minWidth = 30;
  874. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  875. mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  876. /************************************************************************/
  877. /* FOLDOUT */
  878. /************************************************************************/
  879. GUIElementStyle foldoutBtnStyle;
  880. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  881. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  882. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  883. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  884. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  885. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  886. foldoutBtnStyle.fixedHeight = true;
  887. foldoutBtnStyle.fixedWidth = true;
  888. foldoutBtnStyle.height = 10;
  889. foldoutBtnStyle.width = 8;
  890. mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  891. GUIElementStyle foldoutStyle;
  892. foldoutStyle.fixedHeight = true;
  893. foldoutStyle.height = 12;
  894. foldoutStyle.minWidth = 30;
  895. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  896. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  897. mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  898. /************************************************************************/
  899. /* PROGRESS BAR */
  900. /************************************************************************/
  901. GUIElementStyle progressBarBgStyle;
  902. progressBarBgStyle.fixedHeight = true;
  903. progressBarBgStyle.height = 18;
  904. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  905. mSkin.setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  906. GUIElementStyle progressBarFillStyle;
  907. progressBarFillStyle.fixedHeight = true;
  908. progressBarFillStyle.height = 12;
  909. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  910. mSkin.setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  911. GUIElementStyle progressBarStyle;
  912. progressBarStyle.fixedHeight = true;
  913. progressBarStyle.height = 18;
  914. progressBarStyle.minWidth = 100;
  915. progressBarStyle.margins.top = 3;
  916. progressBarStyle.margins.bottom = 3;
  917. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  918. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  919. mSkin.setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  920. /************************************************************************/
  921. /* COLOR PICKER SLIDER */
  922. /************************************************************************/
  923. GUIElementStyle colorPickerSliderHorzHandleStyle;
  924. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  925. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  926. colorPickerSliderHorzHandleStyle.height = 20;
  927. colorPickerSliderHorzHandleStyle.width = 7;
  928. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  929. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  930. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  931. mSkin.setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  932. GUIElementStyle colorPickerSliderHorzStyle;
  933. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  934. colorPickerSliderHorzHandleStyle.height = 32;
  935. colorPickerSliderHorzHandleStyle.minWidth = 20;
  936. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  937. mSkin.setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  938. GUIElementStyle colorPickerSliderVertHandleStyle;
  939. colorPickerSliderVertHandleStyle.fixedHeight = true;
  940. colorPickerSliderVertHandleStyle.fixedWidth = true;
  941. colorPickerSliderVertHandleStyle.height = 7;
  942. colorPickerSliderVertHandleStyle.width = 45;
  943. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  944. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  945. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  946. mSkin.setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  947. GUIElementStyle colorPickerSliderVertStyle;
  948. colorPickerSliderVertStyle.fixedWidth = true;
  949. colorPickerSliderVertStyle.width = 30;
  950. colorPickerSliderVertStyle.minHeight = 20;
  951. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  952. mSkin.setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  953. GUIElementStyle colorPickerSlider2DHandleStyle;
  954. colorPickerSlider2DHandleStyle.fixedHeight = true;
  955. colorPickerSlider2DHandleStyle.fixedWidth = true;
  956. colorPickerSlider2DHandleStyle.height = 8;
  957. colorPickerSlider2DHandleStyle.width = 8;
  958. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  959. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  960. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  961. mSkin.setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  962. /************************************************************************/
  963. /* OTHER */
  964. /************************************************************************/
  965. // Right-aligned label
  966. GUIElementStyle rightAlignedLabelStyle;
  967. rightAlignedLabelStyle.font = font;
  968. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  969. rightAlignedLabelStyle.fixedWidth = false;
  970. rightAlignedLabelStyle.fixedHeight = true;
  971. rightAlignedLabelStyle.height = 11;
  972. rightAlignedLabelStyle.minWidth = 10;
  973. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  974. mSkin.setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  975. }
  976. void BuiltinEditorResources::preprocess()
  977. {
  978. static const WString GUI_TEXTURES[] =
  979. { WindowBackgroundTexture, ButtonNormalTex, ButtonHoverTex, ButtonActiveTex, ToggleNormalTex,
  980. ToggleHoverTex, ToggleActiveTex, ToggleNormalOnTex, ToggleHoverOnTex, ToggleActiveOnTex,
  981. ObjectDropBtnNormalTex, ObjectDropBtnNormalOnTex, ObjectClearBtnNormalTex, ObjectClearBtnHoverTex,
  982. ObjectClearBtnActiveTex, FoldoutOpenNormalTex, FoldoutOpenHoverTex, FoldoutClosedNormalTex,
  983. FoldoutClosedHoverTex, CmpFoldoutOpenNormalTex, CmpFoldoutOpenHoverTex, CmpFoldoutOpenActiveTex,
  984. CmpFoldoutClosedNormalTex, CmpFoldoutClosedHoverTex, CmpFoldoutClosedActiveTex, WindowFrameNormal,
  985. WindowFrameFocused, WindowTitleBarBg, WindowCloseButtonNormal, WindowCloseButtonHover, WindowMinButtonNormal,
  986. WindowMinButtonHover, WindowMaxButtonNormal, WindowMaxButtonHover, TabbedBarBtnNormal, TabbedBarBtnActive,
  987. InputBoxNormalTex, InputBoxHoverTex, InputBoxFocusedTex, ScrollBarUpNormalTex, ScrollBarUpHoverTex,
  988. ScrollBarUpActiveTex, ScrollBarDownNormalTex, ScrollBarDownHoverTex, ScrollBarDownActiveTex, ScrollBarLeftNormalTex,
  989. ScrollBarLeftHoverTex, ScrollBarLeftActiveTex, ScrollBarRightNormalTex, ScrollBarRightHoverTex, ScrollBarRightActiveTex,
  990. ScrollBarHandleHorzNormalTex, ScrollBarHandleHorzHoverTex, ScrollBarHandleHorzActiveTex, ScrollBarHandleVertNormalTex,
  991. ScrollBarHandleVertHoverTex, ScrollBarHandleVertActiveTex, DropDownBtnNormalTex, DropDownBtnHoverTex,
  992. DropDownBoxBgTex, DropDownBoxEntryNormalTex, DropDownBoxEntryHoverTex, DropDownBoxBtnUpNormalTex,
  993. DropDownBoxBtnUpHoverTex, DropDownBoxBtnDownNormalTex, DropDownBoxBtnDownHoverTex, DropDownBoxEntryExpNormalTex,
  994. DropDownBoxEntryExpHoverTex, DropDownSeparatorTex, DropDownBoxBtnUpArrowTex, DropDownBoxBtnDownArrowTex,
  995. ScrollBarBgTex, MenuBarBgTex, MenuBarBtnNormalTex, MenuBarBtnHoverTex, MenuBarBansheeLogoTex, DockSliderNormalTex,
  996. TreeViewExpandButtonOffNormal, TreeViewExpandButtonOffHover, TreeViewExpandButtonOnNormal, TreeViewExpandButtonOnHover,
  997. TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight, ProgressBarBgTex,
  998. ProgressBarFillTex, ColorPickerSliderHorzHandleTex, ColorPickerSliderVertHandleTex, ColorPickerSlider2DHandleTex };
  999. static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] =
  1000. {
  1001. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1002. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1003. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1004. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1005. { PickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1006. { PickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1007. { PickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1008. { PickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1009. { ShaderWireGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1010. { ShaderWireGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1011. { ShaderSolidGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1012. { ShaderSolidGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1013. { ShaderIconGizmo0VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1014. { ShaderIconGizmo0PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1015. { ShaderIconGizmo1VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1016. { ShaderIconGizmo1PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1017. { GizmoPickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1018. { GizmoPickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1019. { GizmoPickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1020. { GizmoPickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1021. { SelectionVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1022. { SelectionPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1023. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1024. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1025. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1026. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1027. { PickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1028. { PickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1029. { PickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1030. { PickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1031. { ShaderWireGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1032. { ShaderWireGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1033. { ShaderSolidGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1034. { ShaderSolidGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1035. { ShaderIconGizmo0VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1036. { ShaderIconGizmo0PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1037. { ShaderIconGizmo1VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1038. { ShaderIconGizmo1PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1039. { GizmoPickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1040. { GizmoPickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1041. { GizmoPickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1042. { GizmoPickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1043. { SelectionVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1044. { SelectionPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1045. { SceneGridVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "glsl", GLSLShaderSubFolder },
  1046. { SceneGridPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "glsl", GLSLShaderSubFolder },
  1047. { ShaderDockOverlayVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1048. { ShaderDockOverlayPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1049. { PickingVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1050. { PickingPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1051. { PickingAlphaVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1052. { PickingAlphaPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1053. { ShaderWireGizmoVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1054. { ShaderWireGizmoPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1055. { ShaderSolidGizmoVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1056. { ShaderSolidGizmoPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1057. { ShaderIconGizmo0VSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1058. { ShaderIconGizmo0PSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1059. { ShaderIconGizmo1VSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1060. { ShaderIconGizmo1PSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1061. { GizmoPickingVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1062. { GizmoPickingPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1063. { GizmoPickingAlphaVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1064. { GizmoPickingAlphaPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1065. { SelectionVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1066. { SelectionPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1067. };
  1068. if (FileSystem::exists(DefaultSkinFolderRaw))
  1069. {
  1070. FileSystem::remove(DefaultSkinFolder);
  1071. for (auto& tex : GUI_TEXTURES)
  1072. importGUITexture(tex);
  1073. {
  1074. Path fontPath = FileSystem::getWorkingDirectoryPath();
  1075. fontPath.append(DefaultSkinFolderRaw);
  1076. fontPath.append(DefaultFontFilename);
  1077. ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
  1078. if (rtti_is_of_type<FontImportOptions>(fontImportOptions))
  1079. {
  1080. FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
  1081. Vector<UINT32> fontSizes;
  1082. fontSizes.push_back(DefaultFontSize);
  1083. importOptions->setFontSizes(fontSizes);
  1084. importOptions->setAntialiasing(false);
  1085. }
  1086. HFont font = Importer::instance().import<Font>(fontPath, fontImportOptions);
  1087. Path outputPath = FileSystem::getWorkingDirectoryPath();
  1088. outputPath.append(DefaultSkinFolder);
  1089. outputPath.append(DefaultFontFilename + L".asset");
  1090. Resources::instance().save(font, outputPath, true);
  1091. // Save font texture pages as well. TODO - Later maybe figure out a more automatic way to do this
  1092. const FontData* fontData = font->getFontDataForSize(DefaultFontSize);
  1093. Path texPageOutputPath = FileSystem::getWorkingDirectoryPath();
  1094. texPageOutputPath.append(DefaultSkinFolder);
  1095. UINT32 pageIdx = 0;
  1096. for (auto tex : fontData->texturePages)
  1097. {
  1098. texPageOutputPath.setFilename(DefaultFontFilename + L"_texpage_" + toWString(pageIdx) + L".asset");
  1099. Resources::instance().save(tex, texPageOutputPath, true);
  1100. }
  1101. }
  1102. }
  1103. if (FileSystem::exists(DefaultShaderFolderRaw))
  1104. {
  1105. Path shaderFolder = DefaultShaderFolder;
  1106. shaderFolder.append(mActiveShaderSubFolder);
  1107. FileSystem::remove(shaderFolder);
  1108. for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
  1109. {
  1110. if (importData.folder != mActiveShaderSubFolder)
  1111. continue;
  1112. Path gpuProgInputLoc = DefaultShaderFolderRaw;
  1113. gpuProgInputLoc.append(importData.folder);
  1114. gpuProgInputLoc.append(importData.filename);
  1115. Path gpuProgOutputLoc = DefaultShaderFolder;
  1116. gpuProgOutputLoc.append(importData.folder);
  1117. gpuProgOutputLoc.append(importData.filename + L".asset");
  1118. ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
  1119. if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
  1120. {
  1121. GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
  1122. importOptions->setEntryPoint(importData.entryPoint);
  1123. importOptions->setLanguage(importData.language);
  1124. importOptions->setProfile(importData.profile);
  1125. importOptions->setType(importData.type);
  1126. }
  1127. HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
  1128. Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
  1129. }
  1130. }
  1131. Resources::instance().unloadAllUnused();
  1132. }
  1133. void BuiltinEditorResources::importGUITexture(const WString& name)
  1134. {
  1135. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1136. texturePath.append(DefaultSkinFolderRaw);
  1137. texturePath.append(name);
  1138. Path texOutputPath = FileSystem::getWorkingDirectoryPath();
  1139. texOutputPath.append(DefaultSkinFolder);
  1140. Path spriteTexOutputPath = texOutputPath;
  1141. texOutputPath.append(name + L".asset");
  1142. spriteTexOutputPath.append(L"sprite_" + name + L".asset");
  1143. HTexture tex = Importer::instance().import<Texture>(texturePath);
  1144. Resources::instance().save(tex, texOutputPath, true);
  1145. HSpriteTexture spriteTex = SpriteTexture::create(tex);
  1146. Resources::instance().save(spriteTex, spriteTexOutputPath, true);
  1147. }
  1148. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1149. {
  1150. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1151. texturePath.append(DefaultSkinFolder);
  1152. texturePath.append(L"sprite_" + name + L".asset");
  1153. return Resources::instance().load<SpriteTexture>(texturePath);
  1154. }
  1155. HGpuProgram BuiltinEditorResources::getGpuProgram(const WString& name)
  1156. {
  1157. Path programPath = DefaultShaderFolder;
  1158. programPath.append(mActiveShaderSubFolder);
  1159. programPath.append(name + L".asset");
  1160. return gResources().load<GpuProgram>(programPath);
  1161. }
  1162. void BuiltinEditorResources::initDockDropOverlayShader()
  1163. {
  1164. HGpuProgram vsProgram = getGpuProgram(ShaderDockOverlayVSFile);
  1165. HGpuProgram psProgram = getGpuProgram(ShaderDockOverlayPSFile);
  1166. BLEND_STATE_DESC desc;
  1167. desc.renderTargetDesc[0].blendEnable = true;
  1168. desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1169. desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1170. desc.renderTargetDesc[0].blendOp = BO_ADD;
  1171. HBlendState blendState = BlendState::create(desc);
  1172. DEPTH_STENCIL_STATE_DESC depthStateDesc;
  1173. depthStateDesc.depthReadEnable = false;
  1174. depthStateDesc.depthWriteEnable = false;
  1175. HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
  1176. PASS_DESC passDesc;
  1177. passDesc.vertexProgram = vsProgram;
  1178. passDesc.fragmentProgram = psProgram;
  1179. passDesc.blendState = blendState;
  1180. passDesc.depthStencilState = depthState;
  1181. PassPtr newPass = Pass::create(passDesc);
  1182. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1183. SHADER_DESC shaderDesc;
  1184. shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
  1185. shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
  1186. shaderDesc.addParameter("tintColor", "tintColor", GPDT_FLOAT4);
  1187. shaderDesc.addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
  1188. shaderDesc.addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
  1189. mShaderDockOverlay = Shader::create("DockDropOverlayShader", shaderDesc, { newTechnique });
  1190. }
  1191. void BuiltinEditorResources::initSceneGridShader()
  1192. {
  1193. HGpuProgram vsProgram = getGpuProgram(SceneGridVSFile);
  1194. HGpuProgram psProgram = getGpuProgram(SceneGridPSFile);
  1195. BLEND_STATE_DESC blendDesc;
  1196. blendDesc.renderTargetDesc[0].blendEnable = true;
  1197. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1198. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1199. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1200. blendDesc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
  1201. HBlendState blendState = BlendState::create(blendDesc);
  1202. RASTERIZER_STATE_DESC rasterizerDesc;
  1203. rasterizerDesc.cullMode = CULL_NONE;
  1204. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1205. DEPTH_STENCIL_STATE_DESC depthStencilDesc;
  1206. depthStencilDesc.depthWriteEnable = false;
  1207. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilDesc);
  1208. PASS_DESC passDesc;
  1209. passDesc.vertexProgram = vsProgram;
  1210. passDesc.fragmentProgram = psProgram;
  1211. passDesc.blendState = blendState;
  1212. passDesc.rasterizerState = rasterizerState;
  1213. passDesc.depthStencilState = depthStencilState;
  1214. PassPtr newPass = Pass::create(passDesc);
  1215. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1216. SHADER_DESC shaderDesc;
  1217. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1218. shaderDesc.addParameter("worldCameraPos", "worldCameraPos", GPDT_FLOAT4);
  1219. shaderDesc.addParameter("gridColor", "gridColor", GPDT_FLOAT4);
  1220. shaderDesc.addParameter("gridSpacing", "gridSpacing", GPDT_FLOAT1);
  1221. shaderDesc.addParameter("gridBorderWidth", "gridBorderWidth", GPDT_FLOAT1);
  1222. shaderDesc.addParameter("gridFadeOutStart", "gridFadeOutStart", GPDT_FLOAT1);
  1223. shaderDesc.addParameter("gridFadeOutEnd", "gridFadeOutEnd", GPDT_FLOAT1);
  1224. mShaderSceneGrid = Shader::create("SceneGridShader", shaderDesc, { newTechnique });
  1225. }
  1226. void BuiltinEditorResources::initPickingShader(CullingMode cullMode)
  1227. {
  1228. UINT32 modeIdx = (UINT32)cullMode;
  1229. HGpuProgram vsProgram = getGpuProgram(PickingVSFile);
  1230. HGpuProgram psProgram = getGpuProgram(PickingPSFile);
  1231. RASTERIZER_STATE_DESC rasterizerDesc;
  1232. rasterizerDesc.scissorEnable = true;
  1233. rasterizerDesc.cullMode = cullMode;
  1234. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1235. PASS_DESC passDesc;
  1236. passDesc.vertexProgram = vsProgram;
  1237. passDesc.fragmentProgram = psProgram;
  1238. passDesc.rasterizerState = rasterizerState;
  1239. PassPtr newPass = Pass::create(passDesc);
  1240. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1241. SHADER_DESC shaderDesc;
  1242. shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
  1243. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1244. mShaderPicking[modeIdx] = Shader::create("PickingShader", shaderDesc, { newTechnique });
  1245. }
  1246. void BuiltinEditorResources::initPickingAlphaShader(CullingMode cullMode)
  1247. {
  1248. UINT32 modeIdx = (UINT32)cullMode;
  1249. HGpuProgram vsProgram = getGpuProgram(PickingAlphaVSFile);
  1250. HGpuProgram psProgram = getGpuProgram(PickingAlphaPSFile);
  1251. RASTERIZER_STATE_DESC rasterizerDesc;
  1252. rasterizerDesc.scissorEnable = true;
  1253. rasterizerDesc.cullMode = cullMode;
  1254. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1255. PASS_DESC passDesc;
  1256. passDesc.vertexProgram = vsProgram;
  1257. passDesc.fragmentProgram = psProgram;
  1258. passDesc.rasterizerState = rasterizerState;
  1259. PassPtr newPass = Pass::create(passDesc);
  1260. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1261. SHADER_DESC shaderDesc;
  1262. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1263. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1264. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1265. shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
  1266. shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
  1267. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1268. mShaderPickingAlpha[modeIdx] = Shader::create("PickingAlphaShader", shaderDesc, { newTechnique });
  1269. }
  1270. void BuiltinEditorResources::initWireGizmoShader()
  1271. {
  1272. HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
  1273. HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
  1274. PASS_DESC passDesc;
  1275. passDesc.vertexProgram = vsProgram;
  1276. passDesc.fragmentProgram = psProgram;
  1277. PassPtr newPass = Pass::create(passDesc);
  1278. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1279. SHADER_DESC shaderDesc;
  1280. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1281. mShaderGizmoWire = Shader::create("GizmoWire", shaderDesc, { newTechnique });
  1282. }
  1283. void BuiltinEditorResources::initSolidGizmoShader()
  1284. {
  1285. HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
  1286. HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
  1287. PASS_DESC passDesc;
  1288. passDesc.vertexProgram = vsProgram;
  1289. passDesc.fragmentProgram = psProgram;
  1290. PassPtr newPass = Pass::create(passDesc);
  1291. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1292. SHADER_DESC shaderDesc;
  1293. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1294. mShaderGizmoSolid = Shader::create("GizmoSolid", shaderDesc, { newTechnique });
  1295. }
  1296. void BuiltinEditorResources::initWireHandleShader()
  1297. {
  1298. HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
  1299. HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
  1300. DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
  1301. depthStencilStateDesc.depthWriteEnable = false;
  1302. depthStencilStateDesc.depthReadEnable = false;
  1303. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
  1304. BLEND_STATE_DESC blendDesc;
  1305. blendDesc.renderTargetDesc[0].blendEnable = true;
  1306. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1307. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1308. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1309. HBlendState blendState = BlendState::create(blendDesc);
  1310. PASS_DESC passDesc;
  1311. passDesc.vertexProgram = vsProgram;
  1312. passDesc.fragmentProgram = psProgram;
  1313. passDesc.depthStencilState = depthStencilState;
  1314. passDesc.blendState = blendState;
  1315. PassPtr newPass = Pass::create(passDesc);
  1316. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1317. SHADER_DESC shaderDesc;
  1318. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1319. mShaderHandleWire = Shader::create("HandleWire", shaderDesc, { newTechnique });
  1320. }
  1321. void BuiltinEditorResources::initSolidHandleShader()
  1322. {
  1323. HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
  1324. HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
  1325. DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
  1326. depthStencilStateDesc.depthWriteEnable = false;
  1327. depthStencilStateDesc.depthReadEnable = false;
  1328. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
  1329. BLEND_STATE_DESC blendDesc;
  1330. blendDesc.renderTargetDesc[0].blendEnable = true;
  1331. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1332. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1333. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1334. HBlendState blendState = BlendState::create(blendDesc);
  1335. PASS_DESC passDesc;
  1336. passDesc.vertexProgram = vsProgram;
  1337. passDesc.fragmentProgram = psProgram;
  1338. passDesc.depthStencilState = depthStencilState;
  1339. passDesc.blendState = blendState;
  1340. PassPtr newPass = Pass::create(passDesc);
  1341. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1342. SHADER_DESC shaderDesc;
  1343. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1344. mShaderHandleSolid = Shader::create("HandleSolid", shaderDesc, { newTechnique });
  1345. }
  1346. void BuiltinEditorResources::initIconGizmoShader()
  1347. {
  1348. HGpuProgram vsProgram0 = getGpuProgram(ShaderIconGizmo0VSFile);
  1349. HGpuProgram psProgram0 = getGpuProgram(ShaderIconGizmo0PSFile);
  1350. HGpuProgram vsProgram1 = getGpuProgram(ShaderIconGizmo1VSFile);
  1351. HGpuProgram psProgram1 = getGpuProgram(ShaderIconGizmo1PSFile);
  1352. BLEND_STATE_DESC blendDesc;
  1353. blendDesc.renderTargetDesc[0].blendEnable = true;
  1354. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1355. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1356. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1357. HBlendState blendState = BlendState::create(blendDesc);
  1358. DEPTH_STENCIL_STATE_DESC depthStencilState0Desc;
  1359. depthStencilState0Desc.depthWriteEnable = false;
  1360. depthStencilState0Desc.depthComparisonFunc = CMPF_LESS_EQUAL;
  1361. HDepthStencilState depthStencilState0 = DepthStencilState::create(depthStencilState0Desc);
  1362. DEPTH_STENCIL_STATE_DESC depthStencilState1Desc;
  1363. depthStencilState1Desc.depthWriteEnable = false;
  1364. depthStencilState1Desc.depthComparisonFunc = CMPF_GREATER;
  1365. HDepthStencilState depthStencilState1 = DepthStencilState::create(depthStencilState1Desc);
  1366. PASS_DESC pass0Desc;
  1367. pass0Desc.vertexProgram = vsProgram0;
  1368. pass0Desc.fragmentProgram = psProgram0;
  1369. pass0Desc.blendState = blendState;
  1370. pass0Desc.depthStencilState = depthStencilState0;
  1371. PassPtr newPass0 = Pass::create(pass0Desc);
  1372. PASS_DESC pass1Desc;
  1373. pass1Desc.vertexProgram = vsProgram1;
  1374. pass1Desc.fragmentProgram = psProgram1;
  1375. pass1Desc.blendState = blendState;
  1376. pass1Desc.depthStencilState = depthStencilState1;
  1377. PassPtr newPass1 = Pass::create(pass1Desc);
  1378. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass0, newPass1 });
  1379. SHADER_DESC shaderDesc;
  1380. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1381. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1382. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1383. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1384. mShaderGizmoIcon = Shader::create("GizmoIcon", shaderDesc, { newTechnique });
  1385. }
  1386. void BuiltinEditorResources::initGizmoPickingShader()
  1387. {
  1388. HGpuProgram vsProgram = getGpuProgram(GizmoPickingVSFile);
  1389. HGpuProgram psProgram = getGpuProgram(GizmoPickingPSFile);
  1390. RASTERIZER_STATE_DESC rasterizerDesc;
  1391. rasterizerDesc.scissorEnable = true;
  1392. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1393. PASS_DESC passDesc;
  1394. passDesc.vertexProgram = vsProgram;
  1395. passDesc.fragmentProgram = psProgram;
  1396. passDesc.rasterizerState = rasterizerState;
  1397. PassPtr newPass = Pass::create(passDesc);
  1398. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1399. SHADER_DESC shaderDesc;
  1400. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1401. mShaderGizmoPicking = Shader::create("GizmoPickingShader", shaderDesc, { newTechnique });
  1402. }
  1403. void BuiltinEditorResources::initGizmoPickingAlphaShader()
  1404. {
  1405. HGpuProgram vsProgram = getGpuProgram(GizmoPickingAlphaVSFile);
  1406. HGpuProgram psProgram = getGpuProgram(GizmoPickingAlphaPSFile);
  1407. RASTERIZER_STATE_DESC rasterizerDesc;
  1408. rasterizerDesc.scissorEnable = true;
  1409. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1410. PASS_DESC passDesc;
  1411. passDesc.vertexProgram = vsProgram;
  1412. passDesc.fragmentProgram = psProgram;
  1413. passDesc.rasterizerState = rasterizerState;
  1414. PassPtr newPass = Pass::create(passDesc);
  1415. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1416. SHADER_DESC shaderDesc;
  1417. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1418. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1419. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1420. shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
  1421. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1422. mShaderGizmoAlphaPicking = Shader::create("GizmoPickingAlphaShader", shaderDesc, { newTechnique });
  1423. }
  1424. void BuiltinEditorResources::initSelectionShader()
  1425. {
  1426. HGpuProgram vsProgram = getGpuProgram(SelectionVSFile);
  1427. HGpuProgram psProgram = getGpuProgram(SelectionPSFile);
  1428. RASTERIZER_STATE_DESC rasterizerDesc;
  1429. rasterizerDesc.polygonMode = PM_WIREFRAME;
  1430. rasterizerDesc.depthBias = 0.00001f;
  1431. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1432. BLEND_STATE_DESC blendDesc;
  1433. blendDesc.renderTargetDesc[0].blendEnable = true;
  1434. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1435. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1436. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1437. HBlendState blendState = BlendState::create(blendDesc);
  1438. PASS_DESC passDesc;
  1439. passDesc.vertexProgram = vsProgram;
  1440. passDesc.fragmentProgram = psProgram;
  1441. passDesc.rasterizerState = rasterizerState;
  1442. passDesc.blendState = blendState;
  1443. PassPtr newPass = Pass::create(passDesc);
  1444. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1445. SHADER_DESC shaderDesc;
  1446. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1447. shaderDesc.addParameter("color", "color", GPDT_FLOAT4);
  1448. mShaderSelection = Shader::create("Selection", shaderDesc, { newTechnique });
  1449. }
  1450. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1451. {
  1452. return Material::create(mShaderDockOverlay);
  1453. }
  1454. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1455. {
  1456. return Material::create(mShaderSceneGrid);
  1457. }
  1458. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1459. {
  1460. UINT32 modeIdx = (UINT32)cullMode;
  1461. return Material::create(mShaderPicking[modeIdx]);
  1462. }
  1463. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1464. {
  1465. UINT32 modeIdx = (UINT32)cullMode;
  1466. return Material::create(mShaderPickingAlpha[modeIdx]);
  1467. }
  1468. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1469. {
  1470. return Material::create(mShaderGizmoWire);
  1471. }
  1472. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1473. {
  1474. return Material::create(mShaderGizmoSolid);
  1475. }
  1476. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1477. {
  1478. return Material::create(mShaderGizmoIcon);
  1479. }
  1480. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1481. {
  1482. return Material::create(mShaderGizmoPicking);
  1483. }
  1484. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1485. {
  1486. return Material::create(mShaderGizmoAlphaPicking);
  1487. }
  1488. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1489. {
  1490. return Material::create(mShaderHandleWire);
  1491. }
  1492. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1493. {
  1494. return Material::create(mShaderHandleSolid);
  1495. }
  1496. HMaterial BuiltinEditorResources::createSelectionMat() const
  1497. {
  1498. return Material::create(mShaderSelection);
  1499. }
  1500. }