BsBuiltinEditorResources.cpp 77 KB

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