BsBuiltinEditorResources.cpp 70 KB

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