BsBuiltinEditorResources.cpp 76 KB

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