BsBuiltinEditorResources.cpp 78 KB

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