BsBuiltinEditorResources.cpp 82 KB

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